KimybaWoW


Thursday, 2024-06-20, 8:27 PM


Welcome Peon | RSS


Main | How to make a Teleport NPC with a LUA file ( the easy way ) - Forum | Registration | Login
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
How to make a Teleport NPC with a LUA file ( the easy way )
kimybawowDate: Tuesday, 2008-09-16, 0:07 AM | Message # 1
Server Owner
Group: Administrators
Messages: 26
Reputation: 15
Status: Offline
This guide will show you how to script a simple LUA file and bind it to a NPC on your WoW private server.
1. Open a new Notepad file.
2. Copy this text into it:

Quote
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(100, player, 0)
unit:GossipMenuAddItem(0,"Alliance Locations", 0, 0)
unit:GossipSendMenu(player)
end

function Gossip_Submenus(unit, event, player, id, intid, code)
if(intid == 0) then
unit:GossipCreateMenu(101, player, 0)
unit:GossipMenuAddItem(0,"Darnasuss", 50, 0)
unit:GossipMenuAddItem(0,"Ironforge", 51, 0)
unit:GossipMenuAddItem(0,"Stormwind", 52, 0)
unit:GossipMenuAddItem(0,"Exodar", 53, 0)
unit:GossipSendMenu(player)
end
if(intid == 50) then
player:Teleport(1, 9985.907227, 1971.155640, 1326.815674)
end
if(intid == 51) then
player:Teleport(0, -5028.265137, -825.976563, 495.301575)
end
if(intid == 52) then
player:Teleport(0, -9100.480469, 406.950745, 92.594185)
end
if(intid == 53) then
player:Teleport(530, -4072.202393, -12014.337891, -1.277277)
end
end

RegisterUnitGossipEvent(5, 1, "On_Gossip")
RegisterUnitGossipEvent(5, 2, "Gossip_Submenus")

Alright Everything wrote with this type of text change that to what you want.

Quote
unit:GossipMenuAddItem(0,"Alliance Locations", 0, 0)
thats what the npc says when you right click it and you can click on Alliance Locations and you will get into another menu

Quote
unit:GossipMenuAddItem(0,"Darnasuss", 50, 0)
unit:GossipMenuAddItem(0,"Ironforge", 51, 0)
unit:GossipMenuAddItem(0,"Stormwind", 52, 0)
unit:GossipMenuAddItem(0,"Exodar", 53, 0)

this is when you have clicked on Alliance Locations which locations for alliance locations you can port to you can always add more locations to it just by copy one row

Quote
(unit:GossipMenuAddItem(0,"Stormwind", 52, 0)
and then change Stormwind to which name you want to be shown when you see the buttom change the number 52 to anything you like if you want your new destination to be number one from above set it to 49 because thats the lowest number of all of them or set it to 54 if you want it to be the last from above.

Alright this is the coordinates the links you made from last step will teleport you to if(intid == 50) is darnassus so when you click on "Darnassus" you will get ported to the coordinates below

player:Teleport(this is the map id, X cords, Y cords, Z cords) you can add new rows by copying whats wrote in this text. just change the number 50 to the number you choose earlier the 54 or 49, change the map, x,y and z cords and ensure that when you are done adding new places make to "end" in the end.

Quote
if(intid == 50) then
player:Teleport(1, 9985.907227, 1971.155640, 1326.815674)
end

if(intid == 51) then
player:Teleport(0, -5028.265137, -825.976563, 495.301575)
end
if(intid == 52) then
player:Teleport(0, -9100.480469, 406.950745, 92.594185)
end
if(intid == 53) then
player:Teleport(530, -4072.202393, -12014.337891, -1.277277)
end
end

Now if you didnt add any new locations but just changed the original once then your text file should look like this:

Quote
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(100, player, 0)
unit:GossipMenuAddItem(0,"any name", 0, 0)
unit:GossipSendMenu(player)
end

function Gossip_Submenus(unit, event, player, id, intid, code)
if(intid == 0) then
unit:GossipCreateMenu(101, player, 0)
unit:GossipMenuAddItem(0,"any name", 50, 0)
unit:GossipMenuAddItem(0,"any name", 51, 0)
unit:GossipMenuAddItem(0,"any name", 52, 0)
unit:GossipMenuAddItem(0,"any name", 53, 0)
unit:GossipSendMenu(player)
end
if(intid == 50) then
player:Teleport(map id of your choise, x cords, y cords, z cords)
end
if(intid == 51) then
player:Teleport(map id of your choise, x cords, y cords, z cords)
end
if(intid == 52) then
player:Teleport(map id of your choise, x cords, y cords, z cords)
end
if(intid == 53) then
player:Teleport(map id of your choise, x cords, y cords, z cords)
end
end

RegisterUnitGossipEvent(the entry id of the npc you are adding this to, 1, "On_Gossip")
RegisterUnitGossipEvent(the entry id of the npc you are adding this to, 2, "Gossip_Submenus")

Now its time to save your file click on file in the upper left corner of the notepad
Click save as
Type whatevername.lua
Below it should say something about standard txt file change it to all files
And save it where you like
If you havent made the npc yet, make it !
When you have made it open your server folder, open the folder called scripts and drop the lua file in there
Restart server
This should work but when you point over the npc you cant see your curser i dont know why, but if i find out i'll share.
Thanks i hope this helped you
Kind Regards Kimyba


 
BoxjackedlolDate: Tuesday, 2008-09-16, 0:14 AM | Message # 2
Head Game Master
Group: Game Master
Messages: 13
Reputation: 4
Status: Offline
.... Win.
 
PlutoDate: Tuesday, 2008-09-16, 0:44 AM | Message # 3
Administrator/Database Editor
Group: Administrators
Messages: 44
Reputation: 12
Status: Offline
Its either me being tired and sick or I just didnt understand a thing u said... I think its the first one though happy

*Edit* lol now i understand (Great Guide BTW) i missed a few bits and pieces...

+Rep



KimybaWoW Admin (Forums & Server)
 
aedw984342Date: Monday, 2008-10-13, 10:48 AM | Message # 4
Game Master
Group: Game Master
Messages: 10
Reputation: 1
Status: Offline
Yeah , Success biggrin cry tongue

 
kingjulian21Date: Tuesday, 2008-10-14, 6:04 PM | Message # 5
Private
Group: Users
Messages: 1
Reputation: 0
Status: Offline
hi i dont understand how you can get the sctipt to that npc you made plz tell sad

JULIAN
 
  • Page 1 of 1
  • 1
Search:


Copyright MyCorp © 2024   Powered by uCoz