[Guide] How to Advanced Lua. menu

User Tag List

Results 1 to 7 of 7
  1. #1
    ZestyJ's Avatar Contributor
    Reputation
    86
    Join Date
    Mar 2008
    Posts
    169
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Guide] How to Advanced Lua.

    Hello today i will be teaching you the some advanced things with lua like intid and such this is very muched used in almost all servers with teleporters.

    First you have to start it off as if any other lua.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
    Second you are going to create the gossip menu.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
         Unit:GossipCreateMenu(TextID, player, 0)
    TextID = Usually 100 you can find others in your db or just use 100
    player = Means that it sends it to the player you must keep this.
    0 = Unknown (Works if you just leave it)

    Third you need to add a menu item.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
         Unit:GossipCreateMenu(TextID, player, 0)
         Unit:GossipMenuAddItem(Icon, "MenuName", [intid], extra)
    Icon = Usually 0 or 1 it is the icon that is next to the option like a cog or wings.
    MenuName = What you would like the option to say.
    [intid] = In this case it is going to be the intid so id say 1 - infinite depending how many options.
    extra = Usually un-used so just leave it as 0.

    Fourth you need to send the menu to the player and end this part of the script.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
         Unit:GossipCreateMenu(TextID, player, 0)
         Unit:GossipMenuAddItem(Icon, "MenuName", extra)
         Unit:GossipSendMenu(player)
    end
    player = Sends the menu to player must leave it for it to work

    Fifth you need to put the intid to work you will declare that anything beyond the point of declaration and the next "end" will happen when you choose the option.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
         Unit:GossipCreateMenu(TextID, player, 0)
         Unit:GossipMenuAddItem(Icon, "MenuName", extra)
         Unit:GossipSendMenu(player)
    end
    
    if (intid == [intid]) then
    Sixth we are going to make the option do something in this case we are going to make it have a song play.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
         Unit:GossipCreateMenu(TextID, player, 0)
         Unit:GossipMenuAddItem(Icon, "MenuName", extra)
         Unit:GossipSendMenu(player)
    end
    
    if (intid == [intid]) then
         Unit:PlaySoundToSet(SoundID)
    Seventh you must complete the gossip and end the whole script.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
         Unit:GossipCreateMenu(TextID, player, 0)
         Unit:GossipMenuAddItem(Icon, "MenuName", extra)
         Unit:GossipSendMenu(player)
    end
    
    if (intid == [intid]) then
         Unit:PlaySoundToSet(SoundID)
         player:GossipComplete()
    end
    end
    Last but definetly not least we must register the lua event.
    Code:
    function firstname_secondname(Unit, Event, player, id, intid, code, pMisc)
         Unit:GossipCreateMenu(TextID, player, 0)
         Unit:GossipMenuAddItem(Icon, "MenuName", extra)
         Unit:GossipSendMenu(player)
    end
    
    if (intid == [intid]) then
         Unit:PlaySoundToSet(SoundID)
         player:GossipComplete()
    end
    end
    
    RegisterUnitGossipEvent(EntryID, 1, "firstname_secondname")
    EntryID = The id of the npc you wish to talk.
    1 = First Gossip event goes up everytime you register a new event.
    firstname_secondname = Replace with your name.

    Then you must make sure that your npc can be used for gossip the flag id is 1 .

    Then you must save the script as a lua and put it in script_bin for it to work. To add more menu items repeast adding menu item and making options .

    Hope this helps.

    Bai :wave:
    Last edited by ZestyJ; 04-28-2009 at 05:31 PM.
    -Zesty
    Formerly Known as Wickedshadow/KingMitch

    [Guide] How to Advanced Lua.
  2. #2
    ZestyJ's Avatar Contributor
    Reputation
    86
    Join Date
    Mar 2008
    Posts
    169
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does no one think this is useful?
    -Zesty
    Formerly Known as Wickedshadow/KingMitch

  3. #3
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    It's not that advanced and I already knew this, so I did not comment I'm only commenting now because I'm sure some people are leeching this.

  4. #4
    spectre123's Avatar Member
    Reputation
    8
    Join Date
    Sep 2008
    Posts
    130
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice guide man i will use this to add to my collection of guides, if you dont mind i will give you the credit itl just be a compilation

  5. #5
    Scubast3ve's Avatar Member
    Reputation
    55
    Join Date
    Apr 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you know what a metatable is then put that in because this is not an advanced script an advanced script would be something that has more than gossip menus and the such.

    And a few fixes the script you have there. It does not require firstname_secondname the reason people use this is to define which npc is being called and what that npc is doing it could just be one thing like NpcOnGossip but its easier to read the other way.

    and as far as menus go you also need to define which intid is going to be output like this:

    Code:
    Unit:GossipMenuAddItem(Icon, "MenuName", intid, extra)
    Anyway thats just some extra for the readers good luck peepz ^^
    Last edited by Scubast3ve; 04-27-2009 at 01:01 AM.
    Don't Forget To Give Rep To People Who Help You.

  6. #6
    Kaidos's Avatar Contributor
    Reputation
    148
    Join Date
    Jun 2008
    Posts
    324
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Wicked Shadow View Post


    [...]

    Then you must save the script as a lua and put it in script_bin for it to work. To add more menu items repeast adding menu item and making options .

    [...]

    its not the script_bin folder, it only the scripts folder.

    anyway, good guide.

  7. #7
    ZestyJ's Avatar Contributor
    Reputation
    86
    Join Date
    Mar 2008
    Posts
    169
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you.
    -Zesty
    Formerly Known as Wickedshadow/KingMitch

Similar Threads

  1. [Guide] How to make a NPC cast spells. NO LUA!
    By Power of Illuminati in forum WoW EMU Guides & Tutorials
    Replies: 52
    Last Post: 05-06-2011, 07:13 AM
  2. [Guide] How to create Lua Portals [3.3.3a]
    By bulletzaredeadly in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 04-14-2010, 01:11 AM
  3. [Guide] How to make LUA portals easy and noobie too!
    By Ellenor in forum WoW EMU Guides & Tutorials
    Replies: 15
    Last Post: 03-05-2008, 09:10 PM
  4. [GUIDE] How to activate LUA scripts
    By ~SaiLyn~ in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 12-25-2007, 11:52 AM
  5. [GUIDE] How to setup MGT-Web ADVANCED repack!
    By Eepi in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 11-03-2007, 03:50 AM
All times are GMT -5. The time now is 07:07 AM. 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