Jump to content

Add Titles with Gossip


Recommended Posts

Posted

Hello, I was wondering if it's possible to add titles with a gossip NPC. What I mean is have like NPC with Option High Warlord etc.

So here I tried to do Private however has erros:

        if (pPlayer->GetTeam() == ALLIANCE)
       {
       pPlayer->SetRank(PLAYER_TITLE_PRIVATE);
       if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(1)) // Title id:1 is Private
       pPlayer->SetTitle(titleEntry);
       pPlayer->CLOSE_GOSSIP_MENU();
       }

If anyone has done something like that and is willing to share code or a suggestion on how to implement something like that it would be highly appreciated.

Posted
Why not just change the NPC's name in creature_template? "Sonya" --> "Private Sonya"

i think you miss get it , i think he wants to add a title to a player via an Gossip menu from an NPC

@

Veretos what errors did you get?

pls post full code (pastebin or so )

is the gossipmenu implementet in SD2?

Posted

Alright here is the code:


#include "precompiled.h"


bool GossipHello_titles_npc(Player* pPlayer, Creature* pCreature)
{

   pPlayer->ADD_GOSSIP_ITEM( 5, "Rank 1: 100 HK"    , GOSSIP_SENDER_MAIN, 4010);
   pPlayer->ADD_GOSSIP_ITEM( 5, "Leave"    , GOSSIP_SENDER_MAIN, 4011);
   pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,pCreature->GetGUID());

return true;
}

void SendDefaultMenu_titles_npc(Player* pPlayer, Creature* pCreature, uint32 uiAction)
{
switch(uiAction)
{
case 4010://Advance Professions

   pPlayer->CLOSE_GOSSIP_MENU();
   //Scout first test
   if (pPlayer->GetHonorPoints() >= 100)
   {
       if (pPlayer->GetTeam() == ALLIANCE)
       {
       pPlayer->SetRank(PLAYER_TITLE_PRIVATE);
       if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(1))
       pPlayer->SetTitle(titleEntry);
       pPlayer->CLOSE_GOSSIP_MENU();
       }
       else if (pPlayer->GetTeam() == HORDE)
       {
       pPlayer->SetRank(PLAYER_TITLE_SCOUT);
       pPlayer->SetRank(15);
       pCreature->MonsterWhisper("Your Rank has been advanced to scout!", pPlayer->GetGUID());
       pPlayer->CLOSE_GOSSIP_MENU();
       }
   }
   else
   {
       pPlayer->CLOSE_GOSSIP_MENU();
       pCreature->MonsterWhisper("You need atleast 100 HK to get a rank nub!", pPlayer->GetGUID());
   }

break;

case 4011://Close Menu
   pPlayer->CLOSE_GOSSIP_MENU();
break;


} //end of function
}


bool GossipSelect_titles_npc(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
   // Main menu
   if (uiSender == GOSSIP_SENDER_MAIN)
   SendDefaultMenu_titles_npc(pPlayer, pCreature, uiAction);

return true;
}

void AddSC_titles_npc()
{
   Script *newscript;

   newscript = new Script;
   newscript->Name = "titles_npc";
   newscript->pGossipHello = &GossipHello_titles_npc;
   newscript->pGossipSelect = &GossipSelect_titles_npc;
   newscript->RegisterSelf();
}

Compile error:

Error    1    error LNK2001: unresolved external symbol "class DBCStorage<struct CharTitlesEntry> sCharTitlesStore" (?sCharTitlesStore@@3V?$DBCStorage@UCharTitlesEntry@@@@A)    honor_npc.obj    ScriptDev2
Error    2    fatal error LNK1120: 1 unresolved externals    ..\\..\\..\\..\\bin\\win32_release/MaNGOSScript.dll    ScriptDev2

I will probably need to create a custom function or something for this to work :(

Posted

first i think this should be asked in the scriptdev2 forum not @ mangos

i haven't realy expirience with Mangos/SD2 on Windows , but i think youre script does not know the CharTitlesEntry type maybe not linked or you must include it.

hope i could help

Posted

I did try asking this on Scriptdev2 forums. However no replies. Since most of the people who use mangos have scriptdev2 implementation of some sort, this seems like appropriate forum.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use