This is a guide about the basics of lua scripting for world of warcraft. Today we will be a making script in which somone or something will say something.
First, you need to name the event or declare it. It is usually done like this.
Second, you need to know what you are going to have the Unit or npc do.Code:function firstname_secondname (Unit, Event, player, id, intid, code, pMisc)
For the sake of the tutorial i will be making it talk.
You must add the action and have some ids
Here is the code added on...Code:11=/say 12=/yell etc... | 0= commun (languages)
Third, you must end the command...Code:function firstname_secondname(Unit, Event, player, id, intid, code, pMisc) Unit:SendChatMessage(11 or 12, 0, "Your text here")
Last, you must register the even...Code:function firstname_secondname(Unit, Event, player, id, intid, code, pMisc) Unit:SendChatMessage(11 or 12, 0, "Your text here") end
Replace 0 with the number you like 0 is usually the best...Code:function firstname_secondname(Unit, Event, player, id, intid, code, pMisc) Unit:SendChatMessage(11 or 12, 0, "Your text here") end RegisterUnitEvent(ENTRYID, 0, "firstname_secondname")
CREATURE_EVENT_ON_ENTER_COMBAT = 1,
CREATURE_EVENT_ON_LEAVE_COMBAT = 2,
CREATURE_EVENT_ON_TARGET_DIED = 3,
CREATURE_EVENT_ON_DIED = 4,
CREATURE_EVENT_ON_TARGET_PARRIED = 5,
CREATURE_EVENT_ON_TARGET_DODGED = 6,
CREATURE_EVENT_ON_TARGET_BLOCKED = 7,
CREATURE_EVENT_ON_TARGET_CRIT_HIT = 8,
CREATURE_EVENT_ON_PARRY = 9,
CREATURE_EVENT_ON_DODGED = 10,
CREATURE_EVENT_ON_BLOCKED = 11,
CREATURE_EVENT_ON_CRIT_HIT = 12,
CREATURE_EVENT_ON_HIT = 13,
CREATURE_EVENT_ON_ASSIST_TARGET_DIED = 14,
CREATURE_EVENT_ON_FEAR = 15,
CREATURE_EVENT_ON_FLEE = 16,
CREATURE_EVENT_ON_CALL_FOR_HELP = 17,
CREATURE_EVENT_ON_LOAD = 18,
CREATURE_EVENT_ON_REACH_WP = 19,
CREATURE_EVENT_ON_LOOT_TAKEN = 20,
CREATURE_EVENT_ON_AIUPDATE = 21,
CREATURE_EVENT_ON_EMOTE = 22,
Then save it as a .lua then put it in your script_bin in your server files.
Here is a list of other commands.
http://www.arcemu.info/wiki/index.ph...=Unit_Commands
I will be making a more advanced version of this later.
Bai :wave:
-WickedShadow