Npc Lua Teleport Script menu

Shout-Out

User Tag List

Results 1 to 12 of 12
  1. #1
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Npc Lua Teleport Script

    Ok guys this is my 1st tutorial on the matter at hand: Lua Npc Teleporter Script,
    I will only be covering the actual script not the npc itself.

    Okay 1st you need to start off with this:
    Code:
    local npcid = 0
    function WarpNPC_OnGossipTalk(pUnit, event, player, pMisc)
    This code is telling how the whole parts following are going to work.
    pUnit = I dont really get this one so...
    Event = This will be the Name of the text that you select
    player = By going off the code i thin the Player is the Menu.
    pMisc = I don't really know this one so i always left it 0 and it worked

    To make it fair for Gankers or PVP we will add this snipet of code in
    Code:
    if (player:IsInCombat() == true) then
    player:SendAreaTriggerMessage("You are in combat!")
    else
    This is making sure the player isnt in combat, and if the player is it will display the message "You are in Combat!"

    Now we are on to the part i Like... Actualy making the freakin menus
    Code:
    pUnit:GossipCreateMenu(3544, player, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)
    This is kinda self Explanitory, but if you dont get it... pUnit:GossipCreateMenu will create the menu and pUnit:GossipMenuAddItem will make the text to click

    now for pUnit:GossipMenuAddItem(3, "Name of Menu", #, 0) # will go up with each time you make another Menuadditem like this
    Code:
    pUnit:GossipCreateMenu(3544, player, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 2, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 3, 0)
    pUnit:GossipSendMenu(player)
    end
    end
    the # going up will define a new menu

    now heres the next snipet of code
    Code:
    function WarpNPC_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
    if(intid == 999) then
    pUnit:GossipCreateMenu(99, player, 0)
    the 1st line is saying when you actualy select one of those menus
    2nd line is defining what happens when you soon to be Back button (in submenus) will take you back here

    now under that put
    Code:
    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 2, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 3, 0)
    pUnit:GossipSendMenu(player)
    end
    This is just saying whats gonna happen when you select it

    so far we have:
    Code:
    local npcid = 0
    function WarpNPC_OnGossipTalk(pUnit, event, player, pMisc)
    if (player:IsInCombat() == true) then
    player:SendAreaTriggerMessage("You are in combat!")
    else
    pUnit:GossipCreateMenu(3544, player, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 2, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 3, 0)
    pUnit:GossipSendMenu(player)
    end
    end
    
    function WarpNPC_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
    if(intid == 999) then
    pUnit:GossipCreateMenu(99, player, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 2, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 3, 0)
    pUnit:GossipSendMenu(player)
    end
    This will define the basic menu; like when you go and talk to a NPC it will show 3 choices and when u click nothing will happen. so to make something happen or to add submenus do this
    Code:
    if(intid == 1) then
    pUnit:GossipCreateMenu(99, player, 0)
    pUnit:GossipMenuAddItem(3, "Sub Menu", 4, 0)
    pUnit:GossipMenuAddItem(3, "Sub Menu", 5, 0)
    This is saying if you click on the "Name of Menu", 1 then it will open up a sub menu with 2 items but notice the "player" slot changed and went up 1 from the previous menu.

    Now to make one of the "Sub Menu" be a teleport set it up like so
    Code:
    if(intid == 4) then
    player:Teleport(Map, X, Y, Z)
    pUnit:GossipComplete(player)
    end
    This will teleport you to the provided location.

    Notice the Intid changed from a 1 to a 4, that is because it is determining whether Menu item 1 was pressed or 4, 1 will open up the sub menu so you can get to 4 to teleport

    At the end of the script have this:
    Code:
    intid = 0
    end
    
    RegisterUnitGossipEvent(Npc ID, 1, "WarpNPC_OnGossipTalk")
    RegisterUnitGossipEvent(Npc ID, 2, "WarpNPC_OnGossipSelect")
    This will finish the script when everythings is pressed and done with, the NPC Id will be the Id of the NPC you make for your script.

    The script now is
    Code:
    local npcid = 0
    function WarpNPC_OnGossipTalk(pUnit, event, player, pMisc)
    if (player:IsInCombat() == true) then
    player:SendAreaTriggerMessage("You are in combat!")
    else
    pUnit:GossipCreateMenu(3544, player, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 2, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 3, 0)
    pUnit:GossipSendMenu(player)
    end
    end
    
    function WarpNPC_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
    if(intid == 999) then
    pUnit:GossipCreateMenu(99, player, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 2, 0)
    pUnit:GossipMenuAddItem(3, "Name of Menu", 3, 0)
    pUnit:GossipSendMenu(player)
    end
    
    if(intid == 1) then
    pUnit:GossipCreateMenu(99, player, 0)
    pUnit:GossipMenuAddItem(3, "Sub Menu", 4, 0)
    pUnit:GossipMenuAddItem(3, "Sub Menu", 5, 0)
    pUnit:GossipMenuAddItem(0, "[Back]", 999, 0)
    
    if(intid == 4) then
    player:Teleport(Map, X, Y, Z)
    pUnit:GossipComplete(player)
    end
    
    intid = 0
    end
    
    RegisterUnitGossipEvent(Npc ID, 1, "WarpNPC_OnGossipTalk")
    RegisterUnitGossipEvent(Npc ID, 2, "WarpNPC_OnGossipSelect")
    Well this is what I know and I hope you guys have learned something from this, I learned all of this from looking at other scripts and realizing what they did. So have fun guys

    Npc Lua Teleport Script
  2. #2
    Claiver's Avatar Member
    Reputation
    138
    Join Date
    Mar 2009
    Posts
    217
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think there are plenty of guides like this, but non the less, a great contribution, and also gives users the ability to choose and learn from multiple guides.

    +Rep from my side!
    (if not on cooldown)

    Claiver

  3. #3
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Claiver that means alot coming from you.

  4. #4
    gimmeurlife's Avatar Member
    Reputation
    12
    Join Date
    Aug 2008
    Posts
    99
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good job man and thnx for the contribution +Rep

  5. #5
    Rayuski's Avatar Member
    Reputation
    3
    Join Date
    May 2009
    Posts
    32
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    guide

    Thanks, i really needed help with this.

  6. #6
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Np. I learned so i might aswell teach other people the way i learned right?? Dude it took me a few hours just reading the code... I have NO IDEA what the fuctions do or anything i just read the code and figured out what does what so pretty much i copy and paste lines over and over again cause i dont know the fuctions

  7. #7
    Lytle69's Avatar Member
    Reputation
    13
    Join Date
    Aug 2008
    Posts
    66
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey sweet deal, i was wondering how to make it so they can't port in combat. Cause I wanna put Teleporters in PvP Locations etc. Thanks for this =]

  8. #8
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Np, this is actually one of the 1st things i put up here that is +repable

  9. #9
    Hellami1's Avatar Member
    Reputation
    3
    Join Date
    May 2009
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I really needed help with this!!!!!

  10. #10
    austin070's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol gimmeurlife, i love that upload speed.

  11. #11
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pretty sick guide. If you want I can explain what the parameters mean in each of the functions. :P

    +rep x2

    I live in a shoe

  12. #12
    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)
    Nice but

    pUnit:GossipMenuAddItem(3, "Name of Menu", 1, 0)

    The 3 can be changed between 0 - 10 to make different symbols on the menu items. Heres a picture




Similar Threads

  1. Plz help me with my Lua Teleporter Script
    By alfen95 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 07-26-2009, 03:37 PM
  2. [Release] Fun Teleporter npc [Lua++]
    By stoneharry in forum WoW EMU General Releases
    Replies: 24
    Last Post: 02-23-2009, 06:48 PM
  3. [Release] Teleporter NPC (LUA++)
    By Vaudville in forum WoW EMU General Releases
    Replies: 9
    Last Post: 09-23-2008, 09:55 AM
  4. Teleporter NPC LUA
    By Performer in forum WoW EMU Questions & Requests
    Replies: 7
    Last Post: 08-21-2008, 08:04 AM
  5. Will this teleporter npc lua script work?
    By Bapes in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 05-22-2008, 11:50 AM
All times are GMT -5. The time now is 07:55 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search