View Full Version : [SOLVED] [Need help with a custom boss]

04-03-2015, 11:26 PM
Hello guys, I've a public server, but my dev goes out, he's travelling and the players are claiming for something new, so I tough to create a custom boss, I did it several times and I didn't work (I never did it before, so please, don't blame me) I am running a simples creature example that I found on [Github lua scripts - example_creature.lua I think it belongs to Rochet2, so, the credits goes to him by the way.] I just changed the spell name cast..

local npcId = 70009

local function CastArcaneBarrage(eventId, dely, calls, creature)
creature:CastSpell(creature:GetVictim(), 67996, true)

local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastArcaneBarrage, 5000, 0)

local function OnLeaveCombat(event, creature)
creature:SendUnitYell("Haha, I'm out of combat!", 0)

local function OnDied(event, creature, killer)
if(killer:GetObjectType() == "Player") then
killer:SendBroadcastMessage("You killed " ..creature:GetName().."!")

RegisterCreatureEvent(npcId, 1, OnEnterCombat)
RegisterCreatureEvent(npcId, 2, OnLeaveCombat)
RegisterCreatureEvent(npcId, 4, OnDied)

I tried to put more spells, and I failed, can someone please, teach me how to put more spells on it? also, can someone teach me how to set spells per phase? if possible, help me to create my first boss, instead of a creature, I want to learn it, but I need help, someone to teach me, because I read lots of tuto and they are all different, most of them is for mangos, I'm running a public server on TC, and I need to improve, because I am losing players.

04-04-2015, 12:40 AM
You could go to ElunaLuaEngine/Scripts/Blizzlike (https://github.com/ElunaLuaEngine/Scripts/tree/master/Blizzlike) folder and look at the boss, quest & npc trash code. Foereaper and I made some Blizzlike scripts for people to use and/or learn off of.

04-04-2015, 06:30 AM
https://github.com/ElunaLuaEngine/Scripts/blob/master/Blizzlike/EasternKingdoms/boss_kruul.lua I have some questions, why at the begin it wrote "local Kruul = {}" instead of Local_npcID, what is the different? and the {}? excuse-me to be noob, but If I don't ask i'll not understand, other question, " function Kruul.EnterCombat " why that " . " between the fuction and the action? and the final question, if I modify that one i've liked here, things gonna works fine? if I try to re-write it, can you help me to improve it? I'm not asking to anyone give it to be already done, I want to learn xD

04-04-2015, 09:25 AM
Try read this:

local Kruul = {}
means that Kruul is set to be a new table.
Table is like an array or a vector or a map... hmm. General purpose scaling data structure where you can put anything.

function Kruul.EnterCombat()
As usual, this means creating a function.
However the Kruul. notation means that this function will be saved to the Kruul table defined earlier.
In code it doesnt matter much. Instead of EnterCombat you use Kruul.EnterCombat to access/use the function.
This is used to allow one to freely choose the order of functions and variables while keeping them local (inside the local table Kruul) and identifying the table with boss name, so all variables and functions are thus also named with boss name.

04-06-2015, 06:55 AM
Thank you guys for the support, and a special thanks for you rochet2, for the patience, take care guys, cya!