PDA

View Full Version : [LUA] Outdoor Encounter


helock
04-22-2009, 06:33 PM
Got bored so I made an outdoor event script for you guys! :D
I'm too lazy to find a good location, so I'll let you guys decide what your npc is like and where you want to spawn him. I haven't tested this either, so some feedback on how it works would be nice :)

Change the comments at the end please.
----------Credits----------
-- Level80 outdoor event --
-- Credits to helock --

function Fury_OnCombat(Unit, Event)
Unit:SendChatMessage(14, 0, "It's about time I had a proper fight!")
Unit:RegisterEvent("Fury_special1", 1000, 0)
Unit:RegisterEvent("Fury_special2", 1000, 0)
Unit:RegisterEvent("Fury_special3", 1000, 0)
Unit:RegisterEvent("Fury_special4", 1000, 0)
Unit:RegisterEvent("Fury_special5", 1000, 0)
Unit:RegisterEvent("Fury_thunderclap", 10000, 0)
end

function Fury_thunderclap(pUnit, Event)
pUnit:CastSpell(60019, pUnit:GetMainTank())
end

function Fury_special1(pUnit, Event)
if pUnit:GetHealthPct() < 81 then
if pUnit:GetHealthPct() > 79 then
pUnit:CastSpell(48292, pUnit:GetMainTank())
pUnit:CastSpell(59835)
end
end
end

function Fury_special2(pUnit, Event)
if pUnit:GetHealthPct() < 61 then
if pUnit:GetHealthPct() > 59 then
pUnit:SendChatMessage(14, 0, "Now it's getting good...")
pUnit:CastSpell(48292, pUnit:GetMainTank())
pUnit:CastSpell(59835)
end
end
end

function Fury_special3(pUnit, Event)
if pUnit:GetHealthPct() < 41 then
if pUnit:GetHealthPct() > 39 then
pUnit:SendChatMessage(14, 0, "Hmm, I should end this soon...")
pUnit:CastSpell(48292, pUnit:GetMainTank())
pUnit:CastSpell(59835)
end
end
end

function Fury_special4(pUnit, Event)
if pUnit:GetHealthPct() < 21 then
if pUnit:GetHealthPct() > 19 then
pUnit:CastSpell(48292, pUnit:GetMainTank())
pUnit:CastSpell(59835)
end
end
end

function Fury_special5(pUnit, Event)
if pUnit:GetHealthPct() < 11 then
if pUnit:GetHealthPct() > 9 then
pUnit:SendChatMessage(14, 0, "NO! I will NOT die!")
pUnit:CastSpell(39031)
pUnit:CastSpell(8599)
pUnit:CastSpell(48292, pUnit:GetMainTank())
pUnit:CastSpell(59835)
end
end
end

function Fury_OnLeaveCombat
Unit:RemoveEvents()
end

function Fury_OnDied
Unit:RemoveEvents()
end

function Fury_OnKilledTarget
Unit:SendChatMessage(14, 0, "And another falls.")
end

-- README:
-- Add your own npc into the database please! And replace the following lines with the correct info and remove the --'s

-- RegisterUnitEvent(Replace this with your npcid, 1, "Fury_OnCombat")
-- RegisterUnitEvent(Replace this with your npcid, 2, "Fury_OnLeaveCombat")
-- RegisterUnitEvent(Replace this with your npcid, 3, "Fury_OnKilledTarget")
-- RegisterUnitEvent(Replace this with your npcid, 4, "Fury_OnDied")