Straight To The Point.
Code:
- GetRandomPlayer(0) this is a Random Player
- GetRandomPlayer(1) this is a Random guy in Short-Range
- GetRandomPlayer(2) this is aRandom guy in Mid-Range
- GetRandomPlayer(3) this is a Random guy in Long-Range
- GetRandomPlayer(4) = Random guy with Mana
- GetRandomPlayer(5) = Random guy with Rage
- GetRandomPlayer(6) = Random guy With Energy
- GetRandomPlayer(7) = Random guy WILL NOT BE Main-Tank
- GetMainTank()
- GetClosestPlayer()
- GetAddTank()
Cast A Spell With Them :
Unit:CastSpellOnTarget(spellid, Unit:GetRandomPlayer(0))
Code:
The Registerd Funtions:
function NPCNAME_OnCombat(Unit, Event)
(Register Youre Starting Event Here)
end
function NPCNAME_OnDied(Unit, Event)
RemoveEvents()
end
function NPCNAME_OnKilledTarget(Unit, Event)
end
function NPCNAME_OnLeaveCombat(Unit, Event)
RemoveEvents()
end
RegisterUnitEvent(npc_entry, 1, "NPCNAME_OnCombat")
RegisterUnitEvent(npc_entry, 2, "NPCNAME_OnLeaveCombat")
RegisterUnitEvent(npc_entry, 3, "NPCNAME_OnKilledTarget")
RegisterUnitEvent(npc_entry, 4, "NPCNAME_OnDied")
Use This if Casts On Self! :-
function Name_Event(pUnit, Event)
local plr = pUnit:GetRandomPlayer(0) <-- Or something else
if (plr ~= nil) then
pUnit:FullCastSpellOnTarget(SpellID, player)
end
end
Regiter A Event :
Unit:RegisterEvent("function_name", timeinms, howManyTimes?)
Code:
Events:
function NPCNAME_Event
(Unit, Event)
Unit:CastSpell(Spellid) ( For AoE )
Unit:FullCastSpell(SPELL ID HERE)
Unit:CastSpellOnTarget(Spellid, Unit:GetRandomPlayer(0)) ( For Players )
Unit:SetScale(1)
Unit:SetModel(Model Id Here!)
Unit:SendChatMessage(11, 0, "What You Want Him To Say")
Unit:SpawnGameObject(entryID, x, y, z, o, duration)
Unit:SpawnCreature(entryID, x, y, z, o, faction, duration)
Unit:Emote(Id)
Unit:SendChatMessage (Type, Language, "What you want mob to say.")
end
SendChatMessage
type:
11 – say
12 – yell
13 – whisper
Languages
0 = UNIVERSAL // Anyone can see this
1 = ORCISH
2 = DARNASSIAN
3 = TAUREN
6 = DWARVISH
7 = COMMON
8 = DEMONIC
9 = TITAN
10 = THELASSIAN
11 = DRAGONIC
12 = KALIMAG
13 = GNOMISH
14 = TROLL
33 = GUTTERSPEAK
35 = DRAENEI
[For Boss Scripts]
RegisterUnitEvents events:
type:
1 = Enter Combat <Needed
2 = Leave Combat <Needed
3 = Killed Target <Needed
4 = Died <Needed
5 = AI Tick
6 = Spawn
7 = Gossip Talk
8 = Reach Waypoint
9 = On Leave Limbo
10 = Player Enters Range
Makeing a Portal ::
function Gameobject_Teleport (pUnit, Event, pMisc)
pMisc:Teleport (MapID, X-Coor, Y-Coor, Z-Coor)
end
RegisterGameObjectEvent (Gameobject_ID, 2, "Gameobject_Teleport")
Aggro Script:
function (Mobs Name Without any Spaces)_onAgro(pUnit, Event)
pUnit:SendChatMessage (11, 0, "What You Want em to say")
end
RegisterUnitEvent (Entry ID, 1, "(Mobs Name Without any Spaces)_onAgro")
Sound Play:
function Name_Event (pUnit, Event)
pUnit:PlaySoundToSet (Sound ID)
end
RegisterUnitEvent (NPC ID,When, "Name_Event")
" When List "
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
Spawning a Nother Creature When 1 Dies :
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")
Note : x, y, z, o, Does not need to be Changed.
Make a Npc Walk Forward Then Sigh :
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")
Advanced Events :
:SpawnGameObject(entryID, x, y, z, o, duration)
This one is also pretty self-explanitory. You MUST have an SQL file for the gameobject you want to spawn.
So put the ID of the gameobject first, then the coordinates for the location you want it to spawn using the .gps command. For duration, remember its in milliseconds.
Example: 10 seconds = 10000.
:SpawnCreature(entryID, x, y, z, o, faction, duration)
This one is the exact same as the one above, exept your spawning a creature. Make sure the SQL is already made for it. Use the faction NUMBER for the faction part. There are too many to list here, so just search for a Faction ID thread.
:Emote(Id)
This command is currently not working in Ascent. I will let you know when it is. Simply put the emote id for the id part. You can search for a thread on this also.
Registering a Event @ A Serten % Of HP :--
function Boss_Phase1(Unit, event)
if Unit:GetHealthPct() < XX then
Unit:RemoveEvents()
end
end
Then Add Events 
Emote ID:
State = Always
OneShot = Once
Code:
0 : ONESHOT_NONE
1 : ONESHOT_TALK(DNR)
2 : ONESHOT_BOW
3 : ONESHOT_WAVE(DNR)
4 : ONESHOT_CHEER(DNR)
5 : ONESHOT_EXCLAMATION(DNR)
6 : ONESHOT_QUESTION
7 : ONESHOT_EAT
10 : STATE_DANCE
11 : ONESHOT_LAUGH
12 : STATE_SLEEP
13 : STATE_SIT
14 : ONESHOT_RUDE(DNR)
15 : ONESHOT_ROAR(DNR)
16 : ONESHOT_KNEEL
17 : ONESHOT_KISS
18 : ONESHOT_CRY
19 : ONESHOT_CHICKEN
20 : ONESHOT_BEG
21 : ONESHOT_APPLAUD
22 : ONESHOT_SHOUT(DNR)
23 : ONESHOT_FLEX
24 : ONESHOT_SHY(DNR)
25 : ONESHOT_POINT(DNR)
26 : STATE_STAND
27 : STATE_READYUNARMED
28 : STATE_WORK
29 : STATE_POINT(DNR)
30 : STATE_NONE
33 : ONESHOT_WOUND
34 : ONESHOT_WOUNDCRITICAL
35 : ONESHOT_ATTACKUNARMED
36 : ONESHOT_ATTACK1H
37 : ONESHOT_ATTACK2HTIGHT
38 : ONESHOT_ATTACK2HLOOSE
39 : ONESHOT_PARRYUNARMED
43 : ONESHOT_PARRYSHIELD
44 : ONESHOT_READYUNARMED
45 : ONESHOT_READY1H
48 : ONESHOT_READYBOW
50 : ONESHOT_SPELLPRECAST
51 : ONESHOT_SPELLCAST
53 : ONESHOT_BATTLEROAR
54 : ONESHOT_SPECIALATTACK1H
60 : ONESHOT_KICK
61 : ONESHOT_ATTACKTHROWN
64 : STATE_STUN
65 : STATE_DEAD
66 : ONESHOT_SALUTE
68 : STATE_KNEEL
69 : STATE_USESTANDING
70 : ONESHOT_WAVE_NOSHEATHE
71 : ONESHOT_CHEER_NOSHEATHE
92 : ONESHOT_EAT_NOSHEATHE
93 : STATE_STUN_NOSHEATHE
94 : ONESHOT_DANCE
113 : ONESHOT_SALUTE_NOSHEATH
133 : STATE_USESTANDING_NOSHEATHE
153 : ONESHOT_LAUGH_NOSHEATHE
173 : STATE_WORK_NOSHEATHE
193 : STATE_SPELLPRECAST
213 : ONESHOT_READYRIFLE
214 : STATE_READYRIFLE
233 : STATE_WORK_NOSHEATHE_MINING
234 : STATE_WORK_NOSHEATHE_CHOPWOOD
253 : STATE_APPLAUD
254 : ONESHOT_LIFTOFF
273 : ONESHOT_YES(DNR)
274 : ONESHOT_NO(DNR)
275 : ONESHOT_TRAIN(DNR)
293 : ONESHOT_LAND
313 : STATE_AT_EASE
333 : STATE_READY1H
353 : STATE_SPELLKNEELSTART
373 : STATE_SUBMERGED
374 : ONESHOT_SUBMERGE
375 : STATE_READY2H
376 : STATE_READYBOW
377 : ONESHOT_MOUNTSPECIAL
378 : STATE_TALK
379 : STATE_FISHING
380 : ONESHOT_FISHING
381 : ONESHOT_LOOT
382 : STATE_WHIRLWIND
383 : STATE_DROWNED
384 : STATE_HOLD_BOW
385 : STATE_HOLD_RIFLE
386 : STATE_HOLD_THROWN
387 : ONESHOT_DROWN
388 : ONESHOT_STOMP
389 : ONESHOT_ATTACKOFF
390 : ONESHOT_ATTACKOFFPIERCE
391 : STATE_ROAR
392 : STATE_LAUGH
393 : ONESHOT_CREATURE_SPECIAL
394 : ONESHOT_JUMP_LAND_RUN
395 : ONESHOT_JUMP_END
396 : ONESHOT_TALK_NOSHEATHE
397 : ONESHOT_POINT_NOSHEATHE
398 : STATE_CANNIBALIZE
399 : ONESHOT_JUMP_START
400 : STATE_DANCE_SPECIAL
401 : ONESHOT_DANCE_SPECIAL
402 : ONESHOT_CUSTOMSPELL01
403 : ONESHOT_CUSTOMSPELL02
404 : ONESHOT_CUSTOMSPELL03
405 : ONESHOT_CUSTOMSPELL04
406 : ONESHOT_CUSTOMSPELL05
407 : ONESHOT_CUSTOMSPELL06
408 : ONESHOT_CUSTOMSPELL07
409 : ONESHOT_CUSTOMSPELL08
410 : ONESHOT_CUSTOMSPELL09
411 : ONESHOT_CUSTOMSPELL10
412 : STATE_EXCLAIM
415 : STATE_SIT_CHAIR_MEDIUM
422 : STATE_SPELLEFFECT_HOLD
This is Gst Basicly My List Copy + Pasted 
If you want Explainations for each 1 say.
Credits:
Me
Gastric
SectorSeven
Walgreve
Varios People @ Ascent Emu