I have not released anything in awhile so I decided to release this guide on a teleport npc.
----------------------------
What I'm teaching on this thread is a Teleport NPC. Please read and hopefully learn how to make your own Teleport NPC.
-----------------------------------------------------------------
Red = What needs to be edited Yellow = Information
local npcid = npcid here!
function Gossip_OnTalk(pUnit, event, player)
TeleporterMenu(pUnit, player)
end This section as you can read is when the player talks to the npc.
This next part ill break down to make it more simple. This section is creating the main menu.
function TeleporterMenu(pUnit, player)
pUnit:GossipCreateMenu(3544, player, 0)
This number must be changed with every menu!
Making general menu.
pUnit:GossipSendMenu(player)
end Item Name = Name of the menu item that players click on.
1 = this number must change with the if statement witch will explained later.
Adding items to the menu. And sending the menu
function Teleporter_OnSelect(pUnit, event, player, id, intid, code, pMisc)
Everything goes here when the player click an item on the menu.
if (intid == 1) then
end
if (intid == 2) then
end
1, 2 = These are the numbers that I was talking about. These numbers repersent what happends what a player clicks an item on the menu with the number.
This piece does not need to be edited if your copying this layout otherwise you need to change the names in the " " with the names on the Functions.
ex: Teleporter_OnTalk, TeleporterMenu, Teleporter_OnSelect
If your to lazy to make your own send me an email and ill make you one. Or add me to msn. [Only registered and activated users can see links. ]
All it put together.
Code:
local npcid = npcid here!!
function Teleporter_OnTalk(pUnit, event, player)
TeleporterMenu(pUnit, player)
end
function TeleporterMenu(pUnit, player)
pUnit:GossipCreateMenu(3544, player, 0)
pUnit:GossipMenuAddItem(2, "Item Name", 1, 0)
pUnit:GossipMenuAddItem(2, "Item Name", 2, 0)
pUnit:GossipSendMenu(player)
end
function Teleporter_OnSelect(pUnit, event, player, id, intid, code, pMisc)
if (intid == 1) then
end
if (intid == 2) then
end
end
RegisterUnitGossipEvent(npcid, 1, "Teleporter_OnTalk")
RegisterUnitGossipEvent(npcid, 2, "Teleporter_OnSelect")
__________________
Last edited by DarkFever; 08-20-2009 at 11:41 AM.
Donate to remove ads, get your "DONATOR title, and get access to the MMOwned community's elite Shoutbawx.