View Full Version : [ElunaEngine]Help with Boss Script!

07-05-2013, 05:13 AM
I am having trouble with the boss/creature scripts and was wanting some help. Here is the Pastebin please post what you found that I didn't. will rep for the help!


07-05-2013, 05:41 AM
I do see where you aren't using the same variable name when you declared it. You have 'unit' when it is suppose to be 'Unit' and there's 'Unit' where 'unit' is suppose to be. Stop being a copy/paster! You also have a method name not capitalized in a couple of places. All I see right now, someone else could do the rest if it is needed. Also, besides that, could you actually tell us what errors you received? Would be helpful other than, "I need help, fix this!"

local function highwarlord_needlespine1(Unit, Event)

local function highwarlord_needlespine(Unit, Event)
Unit:RegisterEvent("highwarlord_needlespine1",0, 0)

local function highwarlord_impalingspine(unit)
local plr = unit:GetClosestPlayer()
if (plr ~= nil) then
unit:CastSpellOnTarget(39837, plr)
local spruch = math.random(1,2)
if (spruch == 1) then
unit:SendChatMessage(12,0, "Stick around!")
elseif (spruch == 2) then
unit:SendChatMessage(12,0, "I'll deal with you later!")

local function highwarlord_tidalshield(unit)
unit:SendChatMessage(12,0, "Blood will flow! ")

local function highwarlord_enrage(unit)
unit:SendChatMessage(12,0, "My patience has run out! Die, die!")

local function highwarlord_OnKilledTarget(unit, Event)
local spruch = math.random(1,2)
if (spruch == 1) then
unit:SendChatMessage(12,0, "Your success was short lived!")
elseif (spruch == 2) then
unit:SendChatMessage(12,0, "Time for you... to go!")

local function highwarlord_OnCombat(Unit, Event)
Unit:SendChatMessage(12,0, "You will die, in the name of Lady Vashj!")
Unit:RegisterEvent("highwarlord_needlespine",7500, 0)
Unit:RegisterEvent("highwarlord_enrage",480000, 0)
Unit:RegisterEvent("highwarlord_tidalshield",60000, 0)
Unit:RegisterEvent("highwarlord_impalingspine",20000, 0)

local function highwarlord_OnDied(Unit, Event)
Unit:SendChatMessage(12,0, "Lord Illidan will... crush you.")

RegisterCreatureEvent(22887, 1, "highwarlord_OnCombat")
RegisterCreatureEvent(22887, 3, "highwarlord_OnKilledTarget")
RegisterCreatureEvent(22887, 4, "highwarlord_OnDied")

07-05-2013, 08:35 AM
I already posted a rather detailed list of things wrong for you :)

RegisterCreatureGossipEvent(22887, 1, "highwarlord_OnCombat")
RegisterCreatureGossipEvent(22887, 3, "highwarlord_OnKilledTarget")
RegisterCreatureGossipEvent(22887, 4, "highwarlord_OnDied")
Dont use strings.
Use like this:
RegisterCreatureGossipEvent(22887, 1, highwarlord_OnCombat)
RegisterCreatureGossipEvent(22887, 3, highwarlord_OnKilledTarget)
RegisterCreatureGossipEvent(22887, 4, highwarlord_OnDied)
This way you provide the function as the argument.

:CastSpell(target, spellID[, triggered]) - Casts spell on target (player/npc/object/item), if triggered is false has mana cost and cast time
So to cast spell on self you do unit:CastSpell(unit, 123123)

See the event argument order:
CREATURE_EVENT_ON_ENTER_COMBAT = 1, // (event, creature, target)

local spruch = math.random(1,2) this should be outside of the IF statement.

if (plr ~= nil) then you can just check if (plr) then

unit:CastSpellOnTarget(39837, plr) There is no such method, use :CastSpell(target, spellID[, triggered]) (this is for almost all spellcasting)
unit:CastSpell(plr, 39837)

Unit:SendChatMessage(12,0, "Stick around!")
Try using Unit:SendUnitSay("Stick around!", 0) .. or yell or whatever you need.

Unit:RegisterEvent("highwarlord_impalingspine",20000, 0)
This is wrong, again you need to provide the function, not the name as a string:
Unit:RegisterEvent(highwarlord_impalingspine, 20000, 0)
Also note that the arguments are: eventID, delay, pCall, unit
So it should be local highwarlord_impalingspine(eventID, delay, pCall, Unit)

You seem to have some case sensitivity problems (Using Unit and unit mixed).
Did not test, might have more errors.

ALL Eluna functions and methods: https://raw.github.com/ElunaLuaEngine/Source/master/src/server/LuaEngine/LuaFunctions.h
All hooks and their arguments: https://github.com/ElunaLuaEngine/Source/blob/master/src/server/LuaEngine/LuaEngine.h#L46

Basic debug steps:
use .reload eluna
see console errors, fix them (repeat until no errors)
use script
see console errors, fix them (repeat until no errors)
add prints
see what prints work and what they print
read the code through while you write it to make sure the logic is good

If you still have problems, post the errors you get from the console like Tommy said.

When making your first scripts it would be good to not write the whole script and then go testing, but test the script as you go.
You will learn more this way as you make the script one step at a time. Later as you understand how everything basically works, it is easier to skip testing and just write code.

07-05-2013, 07:41 PM
thank you Rochet XD