Hey i decided to make a Lua Guide as im bored and got noting else to do enjoy
1.0 making an NPC Speak
2.0 Making a Custom Teleporter
3.0 Making a Boss Cast Spells
3.1 Making a Phase for a Boss
4.0 Item Scripting
1.0 Make an NPC Speak
Ok First Thing is to Open up Notepad
and Type the Following
Ok this is the Function we use for when we want the NPC to do things when it enters Combat so to make it say Somthing we typefunction NPC_OnCombat(Unit, Event)The Yellow bit is the Language they say it inUnit:SendChatMessage(12, 0, "Type you text Here")
here is a list of Languag Ids
The Red is the channel they say it in0 = 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
Once you have done that you should have somthing that looks like thisSay : 12
Yell : 14
Whisper: 13
now put an End on the end so it looks like thisfunction NPC_OnCombat(Unit, Event)
Unit:SendChatMessage(12, 0, "Type your text Here")
And Finally you need to Register the function you do this by Typingfunction NPC_OnCombat(Unit, Event)
Unit:SendChatMessage(12, 0, "Type your text Here")
end2.0 Making a Custom TeleporterRegisterUnitEvent(NPC Spawn Id, 1, "The Function Name")
Ok so we made our NPC Speak Lets make it so that when you click on him he Teleports you Somwhere Open up Notepad and Type this
Ok so the Yellow bit is the Id of the Menu which can be any high number you wantFunction NPC_OnGossip(Unit, Event, Player)
Unit:GossipCreateMenu(100, Player, 0)
Unit:GossipMenuAddItem(9, "To Ironforge Please Sir", 0, 0)
Unit:GossipSendMenu(player)
end
The Red bit is the Icon it will have next to it here is a list of the diff Icons you can have
The Olive bit is Id of that Item so its id is 0
After you done that make sure there is an End at the end and type this
The "Player:Teleport( Map id, x, y, z)"function Gossip_Submenu(pUnit, Event, Player, Id, Intid, Code)
if (intid == 0) then
Player:Teleport( Map id, x Coordinate, y coordinate, z coordinate)
Player:GossipComplete()
end
end
will teleport the player to the location you want, to find the coordinates you need go to the location, target yourslef and type .gps
The Olive bit is the Item Id so what its saying is If Item 0 is click then do this
The Yellow bit will close the Gossip Menu for the Player
3.0 Make a Custom Boss Cast Spells
Ok Start from Fresh and Open Notepad and type all this out or just copy and Paste
The Functions Are Self Explanatory i think on what they dofunction Boss_OnCombat(pUnit, event)
end
function Boss_LeaveCombat(Unit, Event)
end
function Boss_OnDied(Unit, Event)
end
function Boss_OnKilledTarget(Unit, Event)
end
RegisterUnitEvent(Boss Spawn Id, 1, "Boss_OnCombat")
RegisterUnitEvent(Boss Spawn Id, 2, "Boss_OnLeaveCombat")
RegisterUnitEvent(Boss Spawn Id, 3, "Boss_OnKilledTarget")
RegisterUnitEvent(Boss Spawn Id, 4, "Boss_OnDied")
The Yellow Bits are the Bosses Spawn id
So Lets Say we want the boss to cast Blessing of Kings on himself when he Enters combat so we do
Yes its Really that simplefunction Boss_OnCombat(Unit, event)
Unit:CastSpell(20217)
end
function Boss_OnLeaveCombat(Unit, Event)
end
function Boss_OnDied(Unit, Event)
end
function Boss_OnKilledTarget(Unit, Event)
end
RegisterUnitEvent(Boss Spawn Id, 1, "Boss_OnCombat")
RegisterUnitEvent(Boss Spawn Id, 2, "Boss_OnLeaveCombat")
RegisterUnitEvent(Boss Spawn Id, 3, "Boss_OnKilledTarget")
RegisterUnitEvent(Boss Spawn Id, 4, "Boss_OnDied")
The Yellow Bit is the Spell Id
And now for the Boring bit add this to these fucntions
This is Just to stop and Errors/Bugs happening when he Dies or leaves combatfunction Boss_OnDied(Unit, Event)
Unit:RemoveEvents()
end
Function Boss_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
3.1 Making a Boss with Phases
Ok so So Far We Have This
Which is a bit boring so lets add Some Phasesfunction Boss_OnCombat(Unit, event)
Unit:CastSpell(20217)
end
function Boss_OnLeaveCombat(Unit, Event)
end
function Boss_OnDied(Unit, Event)
end
function Boss_OnKilledTarget(Unit, Event)
end
RegisterUnitEvent(Boss Spawn Id, 1, "Boss_OnCombat")
RegisterUnitEvent(Boss Spawn Id, 2, "Boss_OnLeaveCombat")
RegisterUnitEvent(Boss Spawn Id, 3, "Boss_OnKilledTarget")
RegisterUnitEvent(Boss Spawn Id, 4, "Boss_OnDied")
Create a New Function lets call it Boss_Phase1
Ok so we have made our Phase 1 which will happen when we lower the bosses HP Down to 50% but we have to Register the Function and not like we normally doFunction Boss_Phase1(Unit, Event)
if Unit:GetHealthPct() <= 50 then
Unit:RemoveEvents()
Unit:SendChatMessage(12, 0, "Prepare your Selfs")
Unit:CastSpell(1535)
end
The Yellow Bit is just the Spell Id for Fire Novafunction Boss_OnCombat(pUnit, event)
Unit:CastSpell(20217)
Unit:RegisterEvent("Boss_Phase1", 1000, 0)
end
function Boss_OnLeaveCombat(Unit, Event)
end
function Boss_OnDied(Unit, Event)
end
function Boss_OnKilledTarget(Unit, Event)
end
Function Boss_Phase1(Unit, Event)
if Unit:GetHealthPct() <= 50 then
Unit:RemoveEvents()
Unit:SendChatMessage(12, 0, "Prepare your Selfs")
Unit:CastSpell(1535)
end
RegisterUnitEvent(Boss Spawn Id, 1, "Boss_OnCombat")
RegisterUnitEvent(Boss Spawn Id, 2, "Boss_OnLeaveCombat")
RegisterUnitEvent(Boss Spawn Id, 3, "Boss_OnKilledTarget")
RegisterUnitEvent(Boss Spawn Id, 4, "Boss_OnDied")
The Olive Bit is the name of the Function
So What This is going to do is
1. When he Enters Combat he Will Cast Blessing of Kings
2. When you lower his HP to 50% he will say somthing and cast Fire Nova
4.0 Item Scripting
Remeber the Custom Teleporter we made ??
Well there is not alot of Difference between that one with an NPC and the one were about to make with an Item
Remeber the Function we used for the NPC Teleporter well there is a Difference betwen the Two a Item Gossip Function needs to look like this
See instead of using Unit: we use Item: thats really the only difference for that bit and the submenus look like thisfunction OnGossipTalk(item, event, player, pMisc)
item:GossipCreateMenu(102, player, 0)
item:GossipMenuAddItem(3, "Take me to the Dream", 1, 0)
item:GossipSendMenu(player)
end
Im Sure if you have read the whole guide you should understand what to do with those functions and the Final Thing is the Registration of the Functions which look like thisfunction OnGossipSelect(item, event, player, id, intid, code, pMisc)
The Yellow is the Item IdRegisterItemGossipEvent(6, 1, "OnGossipTalk")
RegisterItemGossipEvent(6, 2, "OnGossipSelect")
Now the MOST Important thing of all is the Actual Item creation itself
when you create it and i would suggest going to WoW-V.com in the On use: Section put in this Spell id 37745 it is what we call a "Dummy" spell it does nothing and is the Most Important part as without that part on your Item the Script will not work
Thanks and Hope you Enjoyed