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

[SOLVED] Edit from Player->whisper to show on gossip

Status
Not open for further replies.

katos

Noble Member
Hi all!

Have gotten myself monumentally cocked-up here, seriously confused myself so I do apologize for the potentially simplistic question.
Basically, at the moment I have a script that outputs data to a whisper to the player: (see below) ::

Code:
player->Whisper("|cff4169E1yada yada.|r", LANG_UNIVERSAL, player);

What I want to do, is convert this to show it on the gossip menu instead, so that it will come up showing the data on the gossip to the player, instead of whispering them the data. The reason for this, is that the whisper was being spammed with data, so I would like the gossip menu to show it instead.

Like I say, a simplistic question but I am in a bit of a pickle after confusing myself and being - frankly - rather god-awful at C++ :p

Many thanks in advance,
regards,
Katos.
 

Tommy

Founder
What data? And are you talking about player gossip in general or creature gossip? Player gossip requires a small modification if you're wanting that. Although, if the data doesn't require the player to click a menu you could use Item OnUse hook to just show the "data" too.

Code:
class item_gossip_data : public ItemScript
{
public:
    bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
    {
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "First Menu", GOSSIP_SENDER_MAIN, 1);
        player->SEND_GOSSIP_MENU(1, item->GetGUID());
    }
};

void SetupItemScript()
{
    new item_gossip_data;
}

I'm almost certain you can still do that, but I can't test it.

Creature Gossip:

Code:
class npc_creature_gossip : public CreatureScript
{
public:
    npc_creature_gossip() : CreatureScript("npc_creature_gossip") { }

    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, "First Menu", GOSSIP_SENDER_MAIN, 1); // 1. Once the player clicks this menu,
        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)
    {
        player->PlayerTalkClass->ClearMenus();
        if (actions == 1) // 2. the menu will be sent here to finish the action
            player->CLOSE_GOSSIP_MENU();
        return true;
    }
};

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

katos

Noble Member
My apologies [MENTION=1]Tommy[/MENTION]

The script would be a creaturescript - namely, an arenatop script: ( http://pastebin.com/UwHJaDwZ ) --
The aim, is to hopefully change the player->whisper into displaying the arena team query on the gossip menu itself?

Hope that this makes things a little clearer? :S
 

katos

Noble Member
Edited it in pastebin so it might contain some errors, anyways.. try this : http://pastebin.com/XcZ1PrQp

Error 1 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 31 1 scripts
Error 2 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 39 1 scripts
Error 3 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 51 1 scripts
Error 4 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 59 1 scripts

Tried it on my lunch break and got these, thanks for the help [MENTION=5]Jameyboor[/MENTION] - any suggestions with these? :)
I'll give it more of a look once I get a little more time after work :)
 

Rochet2

Moderator / Eluna Dev
Error 1 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 31 1 scripts
Error 2 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 39 1 scripts
Error 3 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 51 1 scripts
Error 4 error C2039: 'ADD_GOSSIP_MENU' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\arenaladder.cpp 59 1 scripts

Tried it on my lunch break and got these, thanks for the help [MENTION=5]Jameyboor[/MENTION] - any suggestions with these? :)
I'll give it more of a look once I get a little more time after work :)

change all ADD_GOSSIP_MENU to ADD_GOSSIP_ITEM
 

katos

Noble Member
2v2 section works, 3v3 doesnt and the script is buggy. Believe I know why, so I will be working on this and will report back.

Huge thanks to [MENTION=1]Tommy[/MENTION] [MENTION=5]Jameyboor[/MENTION] [MENTION=6]Rochet2[/MENTION]

for your help! Much appreciated.
I'll let you know how it goes ;)
 
Status
Not open for further replies.
Top