Before reading this guide please read my first one at:
http://www.mmowned.com/forums/emulat...tml#post639049
||LUA TuT 2||
1.) After reading my first LUA tutorial you should know the basics. Lets start
off with a creature to edit, in this guide I used Illidan.
2.) Now let's start the script:
function Illidan_Phase1(pUnit, Event)
pUnit:SendChatMessage(11, 0, "I am entering phase 1.")
pUnit:CastSpell(SPELL ID)
end
Here is what CastSpell() does:
CastSpell(spellID) : Causes the unit to cast a spell.
3.) Now that we have finished his first phase, let's make him say somthing when
he enters combat:
function Illidan_OnCombat(pUnit, Event)
pUnit:SendChatMessage(11, 0, "I am entering combat.")
pUnit:FullCastSpell(SPELL ID)
end
Here is what FullCastSpell() does:
FullCastSpell(spellID) : Casts a spell with casting time.
4.) Illidan will now enter a phase, and say stuff on combat. Now to finish the script off:
function Illidan_Phase1(pUnit, Event)
pUnit:SendChatMessage(11, 0, "I am entering phase 1.")
pUnit:CastSpell(SPELL ID)
RegisterEvent("Illidan_OnCombat, 1000, 0")
end
function Illidan_OnCombat(pUnit, Event)
pUnit:SendChatMessage(11, 0, "I am entering combat.")
pUnit:FullCastSpell(SPELL ID)
end
RegisterUnitEvent(ILLIDANS ID, 1, "Illidan_Phase1")
RegisterUnitEvent(ILLIDANS ID, 2, "Illidan_OnCombat")