• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Help on C++ Gossip Code

Status
Not open for further replies.

Deewad

Respected Member
Hello, I'm trying to create a sub menu, On GOSSIP_ACTION_INFO_DEF+4
As you can see, I added when it is selected

Code:
		if (actions == GOSSIP_ACTION_INFO_DEF+4)
        {
               
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Level Area 1", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); 
            
         }
To add a Gossip item, But it does nothing at all when I select that option, Wondering, Does anyone know what else needs added to make this work?

Also, Added whole code
Code:
//*
 *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗ 
 *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
 *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
 *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
 *       EmuDevs - (http://emudevs.com)
*/

class Testscript : public CreatureScript // Testscript - Class constructor, name this anything that doesn't conflict with another name
{
public:
    Testscript() : CreatureScript("Testscript") { } // Testscript, should be the same as class Testscript -- CreatureScript("Testscript") - This is your 'ScriptName' that you will assign in your database.

    bool OnGossipHello(Player* player, Creature* creature) // This will show first when a player clicks on a gossip npc
    {
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go To", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); // 1. Once the player clicks this menu,
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,  "Give me Food Mang", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
		player->SEND_GOSSIP_MENU(1, creature->GetGUID()); // This sends the menu to the player
        return true;
    }

    bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 actions)
    {
        if (actions == GOSSIP_ACTION_INFO_DEF+1) // 2. the menu will be sent here to finish the action
        {    //                Map       X             Y             Z          O
            player->TeleportTo(0, -11068.678711f, -1807.715332f, 52.766014f, 1.577324f);
            player->CLOSE_GOSSIP_MENU();
        }
        if (actions == GOSSIP_ACTION_INFO_DEF+2)
        {
                //             item  count
                player->AddItem(21215, 20);
                player->CLOSE_GOSSIP_MENU();
         }
		if (actions == GOSSIP_ACTION_INFO_DEF+4)
        {
               
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Level Area 1", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
			player->SEND_GOSSIP_MENU(2, creature->GetGUID());
            
         }
return true;
    }
};

void AddSC_Testscript() // This is your ScriptLoader.cpp setup function
{
    new Testscript(); // Call any new classes here as 'new classname();'
}

Thanks in advance!
 
Last edited:

Tommy

Founder
Code:
if (actions == GOSSIP_ACTION_INFO_DEF+4)
{
               
    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Level Area 1", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); 
    player->SEND_GOSSIP_MENU(1, creature->GetGUID());
}

That's because you need "player->SEND_GOSSIP_MENU(1, creature->GetGUID());" when you want to send gossip items.
 

Deewad

Respected Member
Great! So I see that now, It does add that gossip item, But can I create a submenu, It adds that gossip menu, Into the rest of them And I want it to go to a new menu With only the Gossip items that are found here
{

player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Level Area 1", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(1, creature->GetGUID());
}


I tried to change
player->SEND_GOSSIP_MENU(1, creature->GetGUID());
To
player->SEND_GOSSIP_MENU(2, creature->GetGUID());
 
Last edited:

Tommy

Founder
Great! So I see that now, It does add that gossip item, But can I create a submenu, It adds that gossip menu, Into the rest of them And I want it to go to a new menu With only the Gossip items that are found here
{

player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Level Area 1", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(1, creature->GetGUID());
}


I tried to change
player->SEND_GOSSIP_MENU(1, creature->GetGUID());
To
player->SEND_GOSSIP_MENU(2, creature->GetGUID());

Could you be more specific? I don't get what you're talking about. Are you referring to the npc_text table argument in "SEND_GOSSIP_MENU"? If so, just go to npc_text table in your world database and find a saying or make your own. :p
 

Deewad

Respected Member
This may be a little more clear
This is before I click, Im trying to get it to go to a new menu

This is After I click, It simply adds the gossip to the rest of them



Im trying to get it to go into a new menu rather than merging the gossip
 
Status
Not open for further replies.
Top