Resync0
05-04-09, 04:06 PM
Here is a Very simple LUA Template for Custom Bosses.
What this gives you.
The boss yells somthing on entering combat/90%/75%/50%/35%/15%/7%/KillTarget/Death/
You edit all the things in red :)
Don't be shocked if all you see is a big wall of text, it is very very simple, just edit the things in red for what you created the NPC :) and what you want the npc to yell.
*Note Make sure LUA Scripts are enabled in your World.config file :)*
Enjoy
function NPCNAME_OnCombat(pUnit, Event)
pUnit:SendChatMessage(14, 0, "YELL_ON_COMABAT_TEXT")
pUnit:RegisterEvent("NPCNAME_90", 100, 0)
end
function NPCNAME_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function NPCNAME_OnKillTarget(pUnit, Event)
pUnit:SendChatMessage(14, 0, "YELL_ON_KILL_TARGET_TEXT")
end
function NPCNAME_OnDeath(pUnit, Event)
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "YELL_ON_DEATH_TEXT")
end
RegisterUnitEvent(NPCSPAWNID, 1, "NPCNAME_OnCombat")
RegisterUnitEvent(NPCSPAWNID, 2, "NPCNAME_OnLeaveCombat")
RegisterUnitEvent(NPCSPAWNID, 3, "NPCNAME_OnKillTarget")
RegisterUnitEvent(NPCSPAWNID, 4, "NPCNAME_OnDeath")
function NPCNAME_90(pUnit, Event)
if pUnit:GetHealthPct() <= 90 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_75", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_90%_HP_TEXT")
end
end
function NPCNAME_75(pUnit, Event)
if pUnit:GetHealthPct() <= 75 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_50", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_75%_HP_TEXT")
end
end
function NPCNAME_50(pUnit, Event)
if pUnit:GetHealthPct() <= 50 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_35", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_50%_HP_TEXT")
end
end
function NPCNAME_35(pUnit, Event)
if pUnit:GetHealthPct() <= 35 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_15", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_35%_HP_TEXT")
end
end
function NPCNAME_15(pUnit, Event)
if pUnit:GetHealthPct() <= 15 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_7", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_15%_HP_TEXT")
end
end
function NPCNAME_7(pUnit, Event)
if pUnit:GetHealthPct() <= 7 then
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "YELL_ON_7%_HP_TEXT")
end
end
What this gives you.
The boss yells somthing on entering combat/90%/75%/50%/35%/15%/7%/KillTarget/Death/
You edit all the things in red :)
Don't be shocked if all you see is a big wall of text, it is very very simple, just edit the things in red for what you created the NPC :) and what you want the npc to yell.
*Note Make sure LUA Scripts are enabled in your World.config file :)*
Enjoy
function NPCNAME_OnCombat(pUnit, Event)
pUnit:SendChatMessage(14, 0, "YELL_ON_COMABAT_TEXT")
pUnit:RegisterEvent("NPCNAME_90", 100, 0)
end
function NPCNAME_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function NPCNAME_OnKillTarget(pUnit, Event)
pUnit:SendChatMessage(14, 0, "YELL_ON_KILL_TARGET_TEXT")
end
function NPCNAME_OnDeath(pUnit, Event)
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "YELL_ON_DEATH_TEXT")
end
RegisterUnitEvent(NPCSPAWNID, 1, "NPCNAME_OnCombat")
RegisterUnitEvent(NPCSPAWNID, 2, "NPCNAME_OnLeaveCombat")
RegisterUnitEvent(NPCSPAWNID, 3, "NPCNAME_OnKillTarget")
RegisterUnitEvent(NPCSPAWNID, 4, "NPCNAME_OnDeath")
function NPCNAME_90(pUnit, Event)
if pUnit:GetHealthPct() <= 90 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_75", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_90%_HP_TEXT")
end
end
function NPCNAME_75(pUnit, Event)
if pUnit:GetHealthPct() <= 75 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_50", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_75%_HP_TEXT")
end
end
function NPCNAME_50(pUnit, Event)
if pUnit:GetHealthPct() <= 50 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_35", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_50%_HP_TEXT")
end
end
function NPCNAME_35(pUnit, Event)
if pUnit:GetHealthPct() <= 35 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_15", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_35%_HP_TEXT")
end
end
function NPCNAME_15(pUnit, Event)
if pUnit:GetHealthPct() <= 15 then
pUnit:RemoveEvents()
pUnit:RegisterEvent("NPCNAME_7", 100, 0)
pUnit:SendChatMessage(14, 0, "YELL_ON_15%_HP_TEXT")
end
end
function NPCNAME_7(pUnit, Event)
if pUnit:GetHealthPct() <= 7 then
pUnit:RemoveEvents()
pUnit:SendChatMessage(14, 0, "YELL_ON_7%_HP_TEXT")
end
end