LUA: Understanding Gossip Menus menu

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 15 of 47
  1. #1
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA: Understanding Gossip Menus

    In this guide, you will learn to use Gossip Menus correctly. I will be using the WarpNPC LUA script as my example. You will need to read my guide on Basic LUA before you move on to this guide, as I call it, my LUA 1.5 guide before the advanced guide is released.
    Prerisque: http://www.mmowned.com/forums/ascent-guides/96215-scripting-lua-101-a.html

    This guide is currently being revamped - meaning its being rewritten in a better format. I will be doing guards in LUA as my example.

    Ok, lets get started!

    First, your going to need the patch for this. I recommend that you do not use it as it does not work with the latest OpenAscent or Ascent revisions. I would simply recommend that you use LUA++'s LUA folder, which has all these cool LUA patches applied. For those of you who can compile, here is their SVN address: http://mmoforge.org/svn/luaplusplus. For those of you who can't, here is it in .ZIP format: http://filebeam.com/e955415d274d74d7bcadec8344299506. Simply replace this LUAScripting folder with the current one.

    Second, we need to look at the commands that are included that we will need to create our Gossip Menu.
    Here they are:
    :GossipCreateMenu
    :GossipMenuAddItem
    :GossipSendMenu
    :GossipComplete
    :GossipSendPOI


    Second, it is time to start our script off with the usual "function" line.
    Example:
    function On_Gossip (pUnit, event, player)
    Third, we must create our Gossip Menu.
    pUnit:GossipCreateMenu(100, player)
    Next, it is time to add the actual menus and lines.
    pUnit:GossipMenuAddItem(player, 0, "Horde Cities", 1, 0)
    pUnit:GossipMenuAddItem(player, 0, "Alliance Cities", 2, 0)
    Third, Make sure that you are labeling the "" part with the Menu's name and then the number following that, the number of the menu.

    Fourth, we need to send the menu with the function :GossipSendMenu.
    Code:
    pUnit::GossipSendMenu(player)

    Fifth, we need to end that function. So it should look something like this:
    function On_Gossip (pUnit, event, player)
    pUnit:GossipCreateMenu(100, player)
    pUnit:GossipMenuAddItem(player, 0, "Horde Cities", 1, 0)
    pUnit:GossipMenuAddItem(player, 0, "Alliance Cities", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    Now to start on the submenus! Start it off with function line:
    function Gossip_Submenus (pUnit, event, player, id, intid, code)
    Sixth, we need to declare that we are using the menu 1, or "Horde Cities". We will do this by using this statement:
    if(intid == 1) then
    This says that if the menu number is 1, then we will recall the following until we hit the "end" statement.

    Now, we need to add our submenus for "Horde Cities". We also need to add the :GossipSendMenu to the bottom.
    pUnit:GossipGossipMenuAddItem(99, player)
    pUnit:GossipMenuAddItem(player, 5, "Orgrimmar", 10, 0)
    pUnit:GossipMenuAddItem(player, 5, "Undercity", 11, 0)
    pUnit:GossipMenuAddItem(player, 5, "Thunder Bluff", 12, 0)
    pUnit:GossipMenuAddItem(player, 5, "Silvermoon", 13, 0)
    pUnit:GossipMenuAddItem(player, 5, "[Back]", 50, 0)
    pUnit:GossipSendMenu
    Take note that the 99 is 1 number less than the 100 we used in the first function. This is consistant for all submenus. Now add the "end" statement to the end of that group of Menus and you should have something like this:
    function On_Gossip (pUnit, event, player)
    pUnit:GossipCreateMenu(100, player)
    pUnit:GossipGossipMenuAddItem(player, 0, "Horde Cities", 1, 0)
    pUnit:GossipGossipMenuAddItem(player, 0, "Alliance Cities", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    function Gossip_Submenus (pUnit, event, player, id, intid, code)
    if(intid == 1) then
    pUnit:GossipGossipMenuAddItem(99, player)
    pUnit:GossipMenuAddItem(player, 5, "Orgrimmar", 10, 0)
    pUnit:GossipMenuAddItem(player, 5, "Undercity", 11, 0)
    pUnit:GossipMenuAddItem(player, 5, "Thunder Bluff", 12, 0)
    pUnit:GossipMenuAddItem(player, 5, "Silvermoon", 13, 0)
    pUnit:GossipMenuAddItem(player, 5, "[Back]", 50, 0)
    pUnit:GossipSendMenu(player)
    end

    Seventh, its time to do the submenu for the number 2, or "Alliance Cities". We have to use the "if" statement again to recall this menu.
    if(intid == 2) then
    Now guess what? Thats right, we have to add the submenus.
    So repeat the steps from step six, exept this time we need to change the numbers after the Menu name because they will be recalled later. It should look something like this:
    pUnit:GossipCreateMenu(99, player)
    pUnit:GossipMenuAddItem(player, 5, "Stormwind", 14, 0)
    pUnit:GossipMenuAddItem(player, 5, "Ironforge", 15, 0)
    pUnit:GossipMenuAddItem(player, 5, "Darnassus", 16, 0)
    pUnit:GossipMenuAddItem(player, 5, "Exodar", 17, 0)
    pUnit:GossipMenuAddItem(player, 5, "[Back]", 50, 0)
    pUnit:MenuSendToPlayer(player)
    end
    Eighth, we need to add the locations for the teleporting. Use this format and simply repeat. After the == signs, add the number after the submenu name for the teleportion. Of course the format is (Map, X, Y, Z).
    if(intid == 10) then
    player:Teleport(1, 1371.068970, -4370.801758, 26.052483)
    end
    Now just repeat this until your done adding all the submenu's teleport locations.

    Then you should add this line at the end of all your teleports:
    intid = 0
    end
    Finally, register the events:
    RegisterGossipEvent(32000 , 1, "On_Gossip")(32000 , 2,"Gossip_Submenus")
    For 32000, you simply put the NPC ID. You will then need to create an NPC with the flags set to gossip flags, or 1.

    Here is my TeleportNPC:
    http://s7guide.pastebin.com/f2137e665

    If your having trouble see this guide: Getting NPC Gossip Stuff Working[Mini-tut] - General discussion - Temp - Lua++ Forums

    I hope this guide helped you and will keep you busy until my LUA: For Advanced Users guide is released. I will, in the meantime, be doing some XML and LUA tutorials related to WoW addons. So if you wanna check those out feel free.

    -SectorSeven

    Credits: To whoever has the time to find the coords. for these places...
    Last edited by SectorSeven; 05-31-2008 at 02:21 PM.

    LUA: Understanding Gossip Menus
  2. #2
    Exona's Avatar Member
    Reputation
    1
    Join Date
    Jan 2007
    Posts
    11
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would you mind going into detail about what each part does, like in your first tut, and have lists of available options etc. Otherwise, great guide +Rep

  3. #3
    Creepfold's Avatar Contributor
    Reputation
    176
    Join Date
    Jul 2007
    Posts
    536
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SectorSeven, you are realy good in LUA it seems like this script, can i talk to you through MSN? you need to learn me some stuff and i want to ask you some stuff to
    I wish to get more advanced with LUA's
    add me : [email protected]


    EDIT : i made a small version of this myself, i dont know if it works or not but :

    Code:
     function WarpNPC_On_Gossip (pUnit, event, player)
    pUnit:GossipCreateMenu(100, player)
    pUnit:GossipMenuAddItem(player, 0, "Horde Locations", 1, 0)
    pUnit:GossipMenuAddItem(player, 0, "Alliance Locations", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    
    function WarpNPC_Submenus (pUnit, event, player, id, intid, code)
    if(intid == 1) then
    pUnit:GossipGossipMenuAddItem(99, player)
    pUnit:GossipMenuAddItem(player, 5, "Mall", 10, 0)
    pUnit:GossipMenuAddItem(player, 5, "Leveling Road", 11, 0)
    pUnit:GossipMenuAddItem(player, 5, "Custom Instances", 12, 0)
    pUnit:GossipMenuAddItem(player, 5, "[Back]", 50, 0)
    pUnit:GossipSendMenu(player)
    end
    
    if(intid == 2) then
    pUnit:GossipCreateMenu(99, player)
    pUnit:GossipMenuAddItem(player, 5, "Mall", 10, 0)
    pUnit:GossipMenuAddItem(player, 5, "Leveling Road", 11, 0)
    pUnit:GossipMenuAddItem(player, 5, "Custom Instances", 12, 0)
    pUnit:GossipMenuAddItem(player, 5, "[Back]", 50, 0)
    pUnit:MenuSendToPlayer(player)
    end
    
    if(intid == 10) then
    player:Teleport(1, -1657.646973, 3096.333008, 32.558029)
    end
    
    if(intid == 11) then
    player:Teleport(580, 1713.559937, 600.632690, 29.677027)
    end
    
    function WarpNPC_Submenus2 (pUnit, event, player, id, intid, code)
    if(intid == 12) then
    pUnit:GossipCreateMenu(99, player)
    pUnit:GossipMenuAddItem(player, 5, "Malygos' Lair(10-15Man)", 13, 0)
    pUnit:GossipMenuAddItem(player, 5, "Scarlet Monastery(5-10Man)", 14, 0)
    pUnit:GossipMenuAddItem(player, 5, "The Deadmines(10Man)", 15, 0)
    pUnit:GossipMenuAddItem(player, 5, "[Back]", 50, 0)
    pUnit:GossipSendMenu(player)
    end
    
    if(intid == 13) then
    player:Teleport(530, 3099.646729, 1513.975342, 192.195267)
    end
    
    if(intid == 14) then
    player:Teleport(0, 2888.867188, -810.674438, 162.649765)
    end
    
    if(intid == 15) then
    player:Teleport(0, -11211.107422, 1661.814087, 26.746098)
    end
    
    RegisterGossipEvent(32000 , 1, "WarpNPC_On_Gossip")(32000 , 2,"WarpNPC_Submenus")(32000 , 2,"WarpNPC_Submenus2")
    Should this work or? and also is there any way to test the LUA's on if they work or not without hosting an actual server?
    Last edited by Creepfold; 05-19-2008 at 01:38 PM.
    RickAstley LUA Boss! (Rickroll)
    mmowned.com/forums/emulator-server-releases/171755-epic-release-rick-astley-rickroll-boss-lua.html#post1119442

  4. #4
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll look at it later.
    Added to MSN.
    Sorry its exam week so im studying alot!

  5. #5
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey SectorSeven i'd love to speak to you a bit to help me learn a bit more LUA im pretty advanced at it but theres alot you can teach me i believe (also i wanna ask something about ABD)

    my msn is

    [email protected]

    i dont have MSN messenger on this comp and my other one is broke ok dude but i'll get on this one soon : )

    +rep btw nice guide
    Lunar Gaming - Reaching For The Stars

  6. #6
    pachuco55's Avatar Member
    Reputation
    12
    Join Date
    Mar 2008
    Posts
    75
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right before you begin your if statements, you have a function. Wouldn't you need two end's in order to close both the last if statement and then the function?

    btw +rep

  7. #7
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    True that. My mistake...it was 3 in the morning

  8. #8
    degoscar's Avatar Member
    Reputation
    1
    Join Date
    Apr 2008
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    These are the codes to the cities

    Orgrimmar 1 1484 -4417 25

    Undercity 0 1831 238 60

    Thunder Bluff 1 -1277 118 131

    Silvermoon 530 9413 -7277 14



    Stormwind 0 -8951 524 96

    Ironforge 0 -4981 -881 501

    Exodar 530 -3826 -11686 -107

    Darnassus 1 9948 2413 1327


    In case anyone cares to have the loc's here they are.


    Joe

  9. #9
    controlsx2's Avatar Member
    Reputation
    16
    Join Date
    Jun 2007
    Posts
    223
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Filebeam - Free Fast File Hosting. Simply replace this LUAScripting folder with the current one.

    I cant find a folder called LUAScripting. how do i do it?

  10. #10
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to compile your own ascent.

  11. #11
    pachuco55's Avatar Member
    Reputation
    12
    Join Date
    Mar 2008
    Posts
    75
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Third, we must create our Gossip Menu.
    Code:
    pUnit:GossipCreateMenu(100, player)
    Will the first number always be 100? What does it represent?

  12. #12
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, but the numbers after it (99 in this case) has to be 1 lower

  13. #13
    pachuco55's Avatar Member
    Reputation
    12
    Join Date
    Mar 2008
    Posts
    75
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since I am only having one menu button in my menu, then I wouldn't need to worry about that, correct?

    Also, does there need to be an OnGossipTalk function? I don't remember where I learned that but I think it was from another warp npc code.

  14. #14
    imsosorrygms's Avatar Member
    Reputation
    2
    Join Date
    Apr 2008
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sector... When i try to replace the luascripting folder and then compile the scripts i get alot of errors... could u help me?

  15. #15
    imsosorrygms's Avatar Member
    Reputation
    2
    Join Date
    Apr 2008
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    3>SpellHandlers - 0 error(s), 1 warning(s)
    5>------ Build started: Project: LUAScripting, Configuration: Release Win32 ------
    5>Compiling...
    5>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
    5>LUAEngine.cpp
    4>Setup.cpp
    5>..srcluascriptingLUAEngine.cpp(4) : fatal error C1083: Cannot open include file: 'ScriptSetup.h': No such file or directory
    5>Build log was saved at "file://c:UsersChrilleDesktopNy mappsrcscriptsprojects2008_int_release_LUAScriptingBuildLog.htm"
    5>LUAScripting - 1 error(s), 1 warning(s)

Page 1 of 4 1234 LastLast

Similar Threads

  1. [Lua Script] Lua NPC Gossip Checklist
    By iindigo in forum WoW EMU Questions & Requests
    Replies: 5
    Last Post: 06-18-2010, 09:04 PM
  2. [Lua Script] LUA item gossip help
    By naturaunglosar in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 05-26-2010, 02:14 AM
  3. [Lua] Gossip Dropdown Menus
    By Dynashock in forum WoW EMU Guides & Tutorials
    Replies: 9
    Last Post: 03-23-2010, 05:09 PM
  4. [ArcEmu 3.3.2][lua] Vendor gossip question and going beyond 80?
    By xyrusazabi in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 03-13-2010, 02:43 PM
  5. Unit Event Lua Question (Gossip Talk)
    By moongo in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 05-22-2008, 07:49 PM
All times are GMT -5. The time now is 04:09 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