LOCAL GUIDE!
This is another little guide im making to describe a more advanced yet commonly needed command. The local command. The local command lets you use multiple NPCs in one script.
Ok lets go!!
to start a local value you use the command
Quote:
|
local npcname -- this means nothing it is just recognizing the name in the script you can change npcname into anything you want
|
Now when you start your script you want to name the local value so it means something, for example
Quote:
function npclolz(pUnit, Event)
npcname = pUnit -- this tells the script that this npc is named that! you can use as many npcs as you want using this!
npcname:SendChatMessage(12, 0, "lol") -- npcname replaces pUnit and does its same function
end
|
you
need to bind each function to an npc id, for example
Quote:
local npcname
local npcname2
function npcname(pUnit, Event)
npcname = pUnit
end
RegisterUnitEvent(NPC ID, 1, "npcname")
npcname2 = pUnit
function npcname2(pUnit, Event)
end
RegisterUnitEvent(NPC ID, 1, "npcname2")
|
Thats all i hoped you learned something! have fun!