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
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
Thanks in advance!
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);
}
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: