Illidan1 made this previous guide found here: http://www.mmowned.com/forums/emulat...-updating.html and I am continuing it.
This will be updated as I learn more.
-={Make it play a sound when you attack an NPC}=-
Below is the basic template for this type of script:
Code:function Name_Event (pUnit, Event) pUnit:PlaySoundToSet (Sound ID) end RegisterUnitEvent (NPC ID,When, "Name_Event")
Everything that is red will be changed
Step 1: Open up textpad, notepad, wordpad, whatever and copy and paste the above template
Step 2: function Name_Event (pUnit, Event) = The name of your npc (Doesnt really matter what you put there as long as there are no spaces)
Step 3: function Name_Event (pUnit, Event) = When it happend i.e. OnCombat(it also doesnt matter what you put here like above)
Step 4: pUnit:PlaySoundToSet (Sound ID) = Put in here the sound ID you want it to play
Step 5: RegisterUnitEvent (NPC ID,When, "Name_Event") = Put in the ID of the NPC you want to play the sound
Step 6: RegisterUnitEvent (NPC ID,When, "Name_Event") = When it will play the sound, use the codes from below \/
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
Step 7: RegisterUnitEvent (NPC ID,When, "Name_Event") = Make sure its exactly the same as from step 2 and 3
Step 8: You can save the file name as anything you want just make file type a .lua file i.e. yourface.lua
-={Make an NPC spawn when the other dies}=-
Use this as the template for your lua script
Code:function Name_Event(pUnit, Event) x = pUnit:GetX(); y = pUnit:GetY(); z = pUnit:GetZ(); o = pUnit:GetO(); pUnit:SpawnCreature(NPC ID that will be spawned, x, y, z, o,Faction,Time in milliseconds the npc will remain spawned for); end RegisterUnitEvent(NPC ID that spawns the other,When, "Name_Event")
Everything that is red will be changed
Step 1: Open up textpad, notepad, wordpad, whatever and copy and paste the above template
Step 2: function Name_Event(pUnit, Event) = The name of the mob (there must be no spaces)
Step 3: function Name_Event(pUnit, Event) = when it happens, it doesnt really matter but i.e. OnCombat
Step 4: pUnit:SpawnCreature(NPC ID that will be spawned, x, y, z, o,Time in milliseconds the npc will remain spawned for); = The id of the NPC you want to be spawned
Step 5: pUnit:SpawnCreature(NPC ID that will be spawned, x, y, z, o,Time in milliseconds the npc will remain spawned for); = How much time (in milliseconds) you want the npc to be spawned for (1000 = one second)
Step 6: RegisterUnitEvent(NPC ID that spawns the other,When, "Name_Event") = The ID of the NPC that spawns the other
Step 7: RegisterUnitEvent(NPC ID that spawns the other,When, "Name_Event") = When the npc will be spawned. Use the code from above in the thread
Step 8: RegisterUnitEvent(NPC ID that spawns the other,When, "Name_Event") = Same thing from step 2 and 3
Step 9: You can save the file name as anything you want just make file type a .lua file i.e. yourface.lua make it something youll remember
For Greatdrak:
Heres an example script of what you wanted the npc to do:
p.s. his flags should be set to 7 or 2 in creature_proto
Code:function npc_Sigh(pUnit) x = pUnit:GetX() y = pUnit:GetY() z = pUnit:GetZ() o = pUnit:GetO() x = x + 5 pUnit:Emote(sigh emote ID) pUnit:MoveTo(x,y,z,o) end function npc_Guy(pUnit) pUnit:SendChatMessage(11,0,"Your chat message here.") pUnit:Emote(1) pUnit:RegisterEvent("npc_Sigh",16000,1) --this Waits 16 seconds then activates the function above a maximum of 1 times end RegisterUnitEvent(npc ID,7,"npc_Guy")