Welcome to this LUA guide, After this guide, you should be able to speak some LUA, you may not be as good as some of the pro's but you should atleast get the point of LUA.
First of all, When you are going to start a LUA script, you must make it a function
I.E
Code:
function mob_phaseone (pUnit, Event)
That would be the function of it.
Then lets say you wanted it to make it say something? well then you put put
Code:
pUnit:SendChatMessage (TYPE , LANGUAGE , "MESSAGE")
end
RegisterUnitEvent (4, 0, "FUNCTION NAME"
Code:
1 = Enter Combat
2 = Leave Combat
3 = Killed Target
4 = Died
5 = AI Tick
6 = Spawn
7 = Gossip Talk
8 = Reach Waypoint
9 = On Leave Limbo
10 = Player Enters Range
Code:
-1 = ADDON
0 = SAY
1 = PARTY
2 = RAID
3 = GUILD
4 = OFFICER
5 = YELL
6 = WHISPER
7 = WHISPER_INFORM
8 = EMOTE
9 = TEXT_EMOTE
10 = SYSTEM
11 = MONSTER_SAY
12 = MONSTER_YELL
13 = MONSTER_WHISPER
14 = CHANNEL
16 = CHANNEL_JOIN
17 = CHANNEL_LEAVE
18 = CHANNEL_LIST
19 = CHANNEL_NOTICE
20 = CHANNEL_NOTICE_USER
21 = AFK
22 = DND
23 = COMBAT_LOG
24 = IGNORED
25 = SKILL
32 = LOOT
83 = BATTLEGROUND_EVENT
87 = RAIDLEADER
88 = RAIDWARNING
Well guys, that's just the basic stuff =]. Once you have mastered that, Please move on to the rest of the guide.
Lets say you wanted to make it cast a spell? well than do this
Code:
function NPCNAME_Spell(pUnit,Event)
pUnit:CastSpell(SELFBUFFSPELL)
end
pUnit:RegisterEvent("NPCNAME_Spell", 25000, 0)
That would make it cast a spell
Okay now, lets get back to some easys stuff, like the chat message?
Code:
This is an example script
function boss_sayoncombat (pUnit, Event)
pUnit:SendChatMessage (1, 0, "How dare you enter my lair! Now you must pay!")
end
RegisterUnitEvent (4, 1, "boss_sayoncombat")
Okay, that would make the boss say that once it enters combat.
Lets say you want your boss to spawn a minion ay?
Well then you would use this:
:SpawnCreature(entryID, x, y, z, o, faction, duration)
Remember to use pUnit: and also, remember that LUA is VERY case-sensitive about things, if you mess up with a letter, or even mis-type something, your going to get some errors. GL with your LUA scripts! You can PM me here, or Message me on MSN if you need any help
[email protected]
Thats my MSN!
GL!