[Lua Guide] Teleport NPC menu

User Tag List

Results 1 to 3 of 3
  1. #1
    DarkFever's Avatar Contributor
    Reputation
    84
    Join Date
    Aug 2007
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua Guide] Teleport NPC

    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:GossipMenuAddItem(2, "Item Name", 1, 0)

    pUnit:GossipMenuAddItem(2, "Item Name", 2, 0)

    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.

    end


    Ending the function.

    This is the last piece of the lua script.


    RegisterUnitGossipEvent(npcid, 1, "
    Teleporter_OnTalk")
    RegisterUnitGossipEvent(npcid, 2, "Teleporter_OnSelect")

    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. [email protected]

    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
    player:Teleport(mapid, x,y,z,o)
    end
    
    if (intid == 2) then
    Code:
    player:Teleport(mapid, x,y,z,o)
     end
    
    end
    
    
    RegisterUnitGossipEvent(npcid, 1, "Teleporter_OnTalk")
    RegisterUnitGossipEvent(npcid, 2, "Teleporter_OnSelect")
    


    Last edited by DarkFever; 03-11-2010 at 03:58 PM.


    [Lua Guide] Teleport NPC
  2. #2
    DarkFever's Avatar Contributor
    Reputation
    84
    Join Date
    Aug 2007
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Was this not useful? I thought this could help. :S If anyone has any ideas for a lua project for me that would be great


  3. #3
    shadowstep0705's Avatar Member
    Reputation
    9
    Join Date
    Aug 2009
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where can i modify the teleport locations?

Similar Threads

  1. [GUIDE] Teleporter NPC for MaNGOS (using C++)
    By grayfm in forum WoW EMU Guides & Tutorials
    Replies: 33
    Last Post: 03-17-2010, 12:41 PM
  2. [Lua] My Teleporter NPC...
    By davidknag in forum WoW EMU Questions & Requests
    Replies: 11
    Last Post: 02-27-2010, 06:22 PM
  3. [Lua Guide] Level NPC
    By DarkFever in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 09-10-2009, 03:30 PM
  4. [Lua Guide] Morpher NPC
    By DarkFever in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 09-10-2009, 03:27 PM
  5. [Guide] Teleporter NPC
    By Aldaus in forum WoW EMU Guides & Tutorials
    Replies: 19
    Last Post: 12-25-2007, 02:10 AM
All times are GMT -5. The time now is 06:46 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search