How to script a npc so that it casts spells. And yells out stuff.
First were gonna start out with a basic variable. Note that "99999" can be changed to what ever the mob's id is.
This says that npcid is the same thing as the id. So if we later on write npcid it will think its 99999.Code:local npcid = 99999
Next up.
Note that NPCName_SpellName is changeable, NPCName SpellName too. Put the Spell ID in SpellID. And put a message which you want him to say in; You shall die slowly..
Note that you can repeat this command over and over again. As long as the NPCName_SpellName is different every time.Code:function NPCName_SpellName(Unit, event, miscunit, misc) print "NPCName SpellName" Unit:FullCastSpellOnTarget(SpellID,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "You shall die slowly..") end
And at the end, put this.
And then its done. Now save the document as a .lua, and then your done.Code:RegisterUnitEvent(npcid,1,"NPC Name")
Hope this helped.
The final script should look like this:
Please report any buggs or questions.Code:local npcid = 99999 function NPCName_SpellName(Unit, event, miscunit, misc) print "NPCName SpellName" Unit:FullCastSpellOnTarget(SpellID,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "You shall die slowly..") end RegisterUnitEvent(npcid,1,"NPC Name")
Over and out, P1raten.