Likes: 0
Results 1 to 5 of 5
Thread: Problem with a Lua Script
-
20-02-10, 04:34 AM #1
Problem with a Lua Script
Register to remove this adHey guys!
made my first lua script today, iam not able to find errors in it but i cant get the phases working :/ could someone take a look at the script and tell me whats wrong? the npc casts the spells like i wanted, but the phases wont be registered
Code:function Saurfang_OnCombat(Unit, Event) Unit:SendChatMessage(14, 0, "YOU CANNOT ESCAPE MY ANGER!!!") Unit:RegisterEvent("Saurfang_Berserk", 1, 1) Unit:RegisterEvent("Saurfang_Boilingblood", 60000, 20) Unit:RegisterEvent("Saurfang_Bloodlink", 60000, 10) Unit:RegisterEvent("Saurfang_Phase1", 5000, 1) Unit:RegisterEvent("Saurfang_Phase2", 5000, 1) end function Saurfang_Phase1(Unit, Event) if Unit:GetHealthPct() <= 75 then Unit:SendChatMessage(14, 0, "You are stronger than i thought you are!") Unit:CastSpell(72173) Unit:CastSpell(15578) end end function Saurfang_Phase2(Unit, Event) if Unit:GetHealthPct() <= 33 then Unit:SendChatMessage(14, 0, "That was nothing, take this!!!") Unit:CastSpell(46008) Unit:CastSpell(41185) Unit:SetScale(2) end end function Saurfang_Berserk(Unit, Event) Unit:CastSpell(26662) Unit:SendChatMessage(14, 0, "Feel the pain!!") end function Saurfang_Boilingblood(Unit, Event) Unit:FullCastSpellOnTarget(72178, Unit:GetClosestPlayer()) end function Saurfang_Bloodlink(Unit, Event) Unit:CastSpell(72371) Unit:SendChatMessage(14, 0, "Your Hate makes me even STRONGER!!") end function Saurfang_OnLeaveCombat(Unit, Event) Unit:RemoveEvents() end function Saurfang_OnKilledTarget(Unit, Event) Unit:SendChatMessage(14, 0, "Who expected this? hahaha!") Unit:CastSpell(72356) end function Saurfang_OnDied(Unit, Event) Unit:SendChatMessage(14, 0, "You...cannot...win against...the...Lich...King!") Unit:RemoveEvents() end RegisterUnitEvent(37813, 1, "Saurfang_OnCombat") RegisterUnitEvent(37813, 2, "Saurfang_OnLeaveCombat") RegisterUnitEvent(37813, 3, "Saurfang_OnKilledTarget") RegisterUnitEvent(37813, 4, "Saurfang_OnDied")
› See More: Problem with a Lua Script
-
20-02-10, 04:38 AM #2Code:
function Saurfang_Phase1(Unit, Event) if Unit:GetHealthPct() <= 75 then Unit:SendChatMessage(14, 0, "You are stronger than i thought you are!") Unit:CastSpell(72173) Unit:CastSpell(15578) end end function Saurfang_Phase2(Unit, Event) if Unit:GetHealthPct() <= 33 then Unit:SendChatMessage(14, 0, "That was nothing, take this!!!") Unit:CastSpell(46008) Unit:CastSpell(41185) Unit:SetScale(2) end end
-
20-02-10, 06:18 AM #3
-
20-02-10, 06:23 AM #4
nope its 1 function so u only need 1 end
-
29-07-10, 01:48 PM #5
Register to remove this adMag is right, the reduction of those two ends should make the phases register!