View Full Version : [SOLVED] how to create submenus on MultiVendor

12-07-2015, 01:34 AM
The title says all, how i can create sub-menus on multivendor?


[GEMS] -> then open a menu with Red,Blue,Blue and BACK <-
[GLYPHS] -> Paladin, Warrior and <-Back


12-07-2015, 04:21 AM
I'll give you an example showing the gist of setting up submenus in general.

class example_submenus_gossip : public CreatureScript
example_submenus_gossip() : CreatureScript("example_submenus_gossip") { }

bool OnGossipHello(Player* player, Creature* creature) override
// Let's create our menus first
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Test1", 0, 1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Nevermind..", 0, 2);
// Send Gossip menus to the player
player->SEND_GOSSIP_MENU(1, creature->GetGUID());
return true;

bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 actions) override

switch (actions)
case 1: // Test1
// Create our submenus
// It is best to create a method for submenus for easy handling and editing, especially for bigger scripts
SendSubMenus(player, creature);
case 2: // Nevermind..
case 3: // SendSubMenus '<- Back <-'. Goes to Home
OnGossipHello(player, creature);
case 4: // Submenu 1
case 5: // Submenu 2
case 6: // Submenu 3
return true;

// SubMenus: Home (OnGossipHello) -> SubMenus
void SendSubMenus(Player* player, Creature* creature)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Submenu 1", 0, 4);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Submenu 2", 0, 5);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Submenu 3", 0, 6);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "<- Back <-", 0, 3);
// Send our submenus to the player
player->SEND_GOSSIP_MENU(1, creature->GetGUID());

Hope this helps you. Note: I didn't use VS or any IDE so beware of potential errors.

12-07-2015, 08:14 AM
Submenu is displayed by simply sending a new menu just like you send the main menu. So simply add the options and call send menu.
The sender and action are both simply numbers that are bound to each gossip option and when clicked are given to the on gossip select function.
They both may be useful in making submenus or simpler code overall. For example in your code you could use sender as the identifier for the options (mainly for identifying what submenu to show next) and if action > 0 then it is assumed to be a vendor to display.

12-07-2015, 02:25 PM
Is there any way to do this without using c++ ? Only on SQL? i tried to send the menu to another id but didnt work

12-07-2015, 03:37 PM
Sure is.
Just see how the stormwind guard gossip is made.
Basically the submenu's menu_id is in the action_menu_id field in gossip_menu_option table.

12-07-2015, 04:04 PM
Rochet look: http://prntscr.com/9bf3k8

Im doing it right? the menu 55.015 its sending to menu 55.016, and the menu 55016 its sending to actoin id 91 (npc vendor)

12-07-2015, 05:45 PM
No, because your option_id is set to 3. It should be .. 1? This is for the option that opens a submenu.
Otherwise looks fine.

.. If I interpreted it correctly. Ppl keep posting only columns so I have no idea what column is what :D

12-07-2015, 06:13 PM
Thank you rochet! I got it working!