Menu That When Clicked Displays Text? menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    Convicted's Avatar Member
    Reputation
    1
    Join Date
    Aug 2009
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Menu That When Clicked Displays Text?

    If I wanted to create an NPC that when spoken to pops up with a menu (similar to that of a teleporter) that when the player clicks on one of the menu selections, brings up a whole different page with text and a go back feature, how would that be done and what function would I have to use? I'm still trying to adjust to LUA. Any help is appreciated.

    Menu That When Clicked Displays Text?
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    You need at least 2 options at all times otherwise it can become buggy. Here is some pseudocode on how it is done:

    pUnit:GossipCreateMenu(565, player, 0)

    The 565 here links to the npc_text table and is the text ID displayed.

    When the npc is clicked it calls a different function to show the default gossip menu. When a item is clicked it opens another gossip menu in the on click function. The on click function calls its self when another button is pressed, which calls the default gossip menu again or closes the menu.

    Code:
    function Proffesion_ONClick(pUnit, event, player)
    	proffesionmenu(pUnit, player)
    end
    
    
    function proffesionmenu(pUnit, player)
    
      pUnit:GossipCreateMenu(565, player, 0)
      pUnit:GossipMenuAddItem(7, "How does being a miner work?", 9, 0)
      pUnit:GossipMenuAddItem(3, "Unlearn current proffesion.", 6, 0)
      pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
      pUnit:GossipSendMenu(player)
    
    end
    
    function ProffesionOnGossip(pUnit, event, player, id, intid, code)
    	if (intid == 1) then
    		player:GossipComplete()
    	elseif intid == 4 then
    		proffesionmenu(pUnit, player)
    	elseif intid == 5 then
    		pUnit:GossipCreateMenu(7363, player, 0)
    		if pUnit == nil then
    			pUnit:GossipMenuAddItem(0, "debug.", 4, 0)
    		end
    		pUnit:GossipMenuAddItem(0, "Alright.", 4, 0)
    		pUnit:GossipSendMenu(player)
    	elseif intid == 6 then
    		pUnit:GossipCreateMenu(3802, player, 0)
    		pUnit:GossipMenuAddItem(4, "Are you sure you wish to unlearn your current proffesion? (You will loose your skill level and it cannot be recovered!)", 6, 0)
    		pUnit:GossipMenuAddItem(0, "Yes.", 7, 0)
    		pUnit:GossipMenuAddItem(0, "No.", 4, 0)
    		pUnit:GossipSendMenu(player)
            end
    end

  3. #3
    Convicted's Avatar Member
    Reputation
    1
    Join Date
    Aug 2009
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    You need at least 2 options at all times otherwise it can become buggy. Here is some pseudocode on how it is done:

    pUnit:GossipCreateMenu(565, player, 0)

    The 565 here links to the npc_text table and is the text ID displayed.

    When the npc is clicked it calls a different function to show the default gossip menu. When a item is clicked it opens another gossip menu in the on click function. The on click function calls its self when another button is pressed, which calls the default gossip menu again or closes the menu.

    Code:
    function Proffesion_ONClick(pUnit, event, player)
    	proffesionmenu(pUnit, player)
    end
    
    
    function proffesionmenu(pUnit, player)
    
      pUnit:GossipCreateMenu(565, player, 0)
      pUnit:GossipMenuAddItem(7, "How does being a miner work?", 9, 0)
      pUnit:GossipMenuAddItem(3, "Unlearn current proffesion.", 6, 0)
      pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
      pUnit:GossipSendMenu(player)
    
    end
    
    function ProffesionOnGossip(pUnit, event, player, id, intid, code)
    	if (intid == 1) then
    		player:GossipComplete()
    	elseif intid == 4 then
    		proffesionmenu(pUnit, player)
    	elseif intid == 5 then
    		pUnit:GossipCreateMenu(7363, player, 0)
    		if pUnit == nil then
    			pUnit:GossipMenuAddItem(0, "debug.", 4, 0)
    		end
    		pUnit:GossipMenuAddItem(0, "Alright.", 4, 0)
    		pUnit:GossipSendMenu(player)
    	elseif intid == 6 then
    		pUnit:GossipCreateMenu(3802, player, 0)
    		pUnit:GossipMenuAddItem(4, "Are you sure you wish to unlearn your current proffesion? (You will loose your skill level and it cannot be recovered!)", 6, 0)
    		pUnit:GossipMenuAddItem(0, "Yes.", 7, 0)
    		pUnit:GossipMenuAddItem(0, "No.", 4, 0)
    		pUnit:GossipSendMenu(player)
            end
    end
    Thank you so much, I really appreciate it. +rep

Similar Threads

  1. [HELP]Unity3D Menu disappearing,(when finishing match)
    By CowPowers in forum Hearthstone: Heroes of Warcraft
    Replies: 6
    Last Post: 06-17-2014, 02:11 PM
  2. Spawning ads when clicking something
    By mariaaulman in forum Report Bugs
    Replies: 8
    Last Post: 07-31-2012, 04:42 PM
  3. A tool that will Email or Text you when you get a GM whisper
    By odriv3 in forum WoW Bots Questions & Requests
    Replies: 0
    Last Post: 09-30-2010, 09:46 PM
  4. Replies: 10
    Last Post: 10-15-2009, 08:31 PM
  5. Mod that queues u for a BG without u clicking anything?
    By JoKeR` in forum World of Warcraft General
    Replies: 4
    Last Post: 09-05-2006, 11:43 AM
All times are GMT -5. The time now is 01:18 PM. 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