Hello people, i am learning how to make some .lua Scripts, here is some
-== How to make a Npc Cast a spell ==-
Ok first here is a Template to use for it \/
Everything in red u need to change
How to use template look below
Code:
function NpcName_Event (pUnit, Event)
pUnit:CastSpell (Spell ID)
end
RegisterUnitEvent (Npc Spawn ID, 1, "NpcName_Event")
Step 1 : All the things in red is the things u need to put in your self
Step 2 : Open a note Pad or Txt Document and Copy and Paste that Template into it and then start modifying it with Steps below
Step 3 : function NpcName_Event (pUnit, Event) = The Name of your Npc
Step 4 : function NpcName_Event (pUnit, Event) = The event, meaning like the name of the spell Etc
Step 5 : pUnit:CastSpell (Spell ID) = The Id of the Spell that you wont your Npc To cast
Step 6 : RegisterUnitEvent (Npc Spawn ID, 4, "NpcName_Event") = The Spawn ID of your Npc that you wont to cast the Spell
Step 7 : RegisterUnitEvent (Npc Spawn ID, 4, "NpcName_Event") = The same ass "Step 3" and "Step 4"
And now Naming it
Naming it is the hard part well kinda not really. Now when your done Modifying it go to File > Save as > and put it as all Files and call it like (If you are doing it for a mob called Slayer i would call it Slayer.lua) So like in "Step 3" The Name of your Npc just name it That and put a .lua at the end of it so it will be like " Slayer.lua "
Saving It : save it to your Desktop or some were u know were it is
Step 10 : Now were u Have to put it u must put it in your Server's Ascent scripts Folder i am using Ac web so it would be in the folder \/
C:\AC Web Ultimate Repack\Ascent\scripts
If u don't have a scripts folder make 1 and just put that Notepad in that Folder and then in your Ascent cmd box type
reloadscripts or in game type .reloadscripts or restart your server
And then your Done
-== Make a npc Talk when in Enter Combat Etc ==-
Ok first here is a Template to use for it \/
Everything in red u need to change
How to use template look below
Code:
function NpcName_Event (pUnit, Event)
pUnit:SendChatMessage (Type, Language, "What you wont your Npc to say")
end
RegisterUnitEvent (Npc Spawn ID, When, "Name_Event")
Step 1 : All the things in red is the things u need to put in your self
Step 2 : Open a note Pad or Txt Document and Copy and Paste that Template into it and then start modifying it with Steps below
Step 3 : function NpcName_Event (pUnit, Event) = the Name of the Npc that you wont to talk on the Event
Step 4 : function NpcName_Event (pUnit, Event) = the event of when the Npc will say what you wont it to say (Like Entercombat, Leavecombat, die, Etc)
Step 5 : pUnit:SendChatMessage (Type, Language, "What you wont your Npc to say") = the Type of text \/
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
Step 6 : pUnit:SendChatMessage (Type, Language, "What you wont your Npc to say") = the Type of Language \/
Code:
0 = UNIVERSAL
1 = ORCISH
2 = DARNASSIAN
3 = TAURAHE
6 = DWARVISH
7 = COMMON
8 = DEMONIC
9 = TITAN
10 = THELASSIAN
11 = DRACONIC
12 = KALIMAG
13 = GNOMISH
14 = TROLL
33 = GUTTERSPEAK
35 = DRAENEI
Step 7 : pUnit:SendChatMessage (Type, Language, "What you wont your Npc to say") = The words that you wont your Npc to say when it enter combat Leaves combat Dies Etc
Step 8 : RegisterUnitEvent (Npc Spawn ID, When, "Name_Event") = The Spawn id of the Npc that you wont these words to come otu of
Step 9 : RegisterUnitEvent (Npc Spawn ID, When, "Name_Event") = When the Npc will say this Text \/
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 10 : RegisterUnitEvent (Npc Spawn ID, When, "Name_Event") = The name of the Npc like in "Step 3"
Step 11 : RegisterUnitEvent (Npc Spawn ID, When, "Name_Event") = the Event of the Npc when it talks, it must be the same as "Step 4"
And now Naming it
Naming it is the hard part well kinda not really. Now when your done Modifying it go to File > Save as > and put it as all Files and call it like (If you are doing it for a mob called Slayer i would call it Slayer.lua) So like in "Step 3" The Name of your Npc just name it That and put a .lua at the end of it so it will be like " Slayer.lua "
Saving It : save it to your Desktop or some were u know were it is
Step 12 : Now were u Have to put it u must put it in your Server's Ascent scripts Folder i am using Ac web so it would be in the folder \/
C:\AC Web Ultimate Repack\Ascent\scripts
If u don't have a scripts folder make 1 and just put that Notepad in that Folder and then in your Ascent cmd box type
reloadscripts or in game type .reloadscripts or restart your server
And then your Done
-==Make a npc change size when every==--
Ok first here is a Template to use for it \/
Everything in red u need to change
How to use template look below
Code:
function WhenScale(pUnit, Event)
pUnit:SetScale(Size);
end
RegisterUnitEvent(Npc Spawn ID,When,"WhenScale")
Step 1 : All the things in red is the things u need to put in your self
Step 2 : Open a note Pad or Txt Document and Copy and Paste that Template into it and then start modifying it with Steps below
Step 3 : function WhenScale(pUnit, Event) = When the Npc will Change Size (So if it was oncombat, i would put there "OnCombatScale" Etc
Step 4 : pUnit:SetScale(Size); = The Size of your Npc will be
When he gets to the Stage ( Chose from 0.1 - 200, any high might crash Server)
Step 5 : RegisterUnitEvent(Npc Spawn ID,When,"WhenScale") = The Spawn Id of the Npc that you wont to grow
Step 6 : RegisterUnitEvent(Npc Spawn ID,When,"WhenScale") = When they Npc will grow chose one 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 Spawn ID,When,"WhenScale") = When the Npc will Change Size (So if it was oncombat, i would put there "OnCombatScale" Etc The same ass what you put in "Step 3"
And now Naming it
Naming it is the hard part well kinda not really. Now when your done Modifying it go to File > Save as > and put it as all Files and call it like (If you are doing it for a mob called Slayer i would call it Slayer.lua) So like in "Step 3" The Name of your Npc just name it That and put a .lua at the end of it so it will be like " Slayer.lua "
Saving It : save it to your Desktop or some were u know were it is
Step 8 : Now were u Have to put it u must put it in your Server's Ascent scripts Folder i am using Ac web so it would be in the folder \/
C:\AC Web Ultimate Repack\Ascent\scripts
If u don't have a scripts folder make 1 and just put that Notepad in that Folder and then in your Ascent cmd box type
reloadscripts or in game type .reloadscripts or restart your server
And then your Done
This was all done by me don't take it any Were else unless you ask
Also this guide will be updata sooner or later, when i get more info