• 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] [Trinity] Title NPC Bug/add gossip?

Status
Not open for further replies.

Synth

Exalted Member
Hello Emudevs,well as title say i have a problem with a gossip called "How does this npc work" when i click on it learn me a title and it send me a message i don't want to learn a tilte when i click on just message i check the script why it add me this title but i didn't find a solution also i want to add a new gossip that i can put my own titles i make it in patch,i just want a simple example for it,and also i want it for both faction horde and ally,so if someone tell me the code of this or update the script for me please?

Check here the script:
Titile NPC

Thank you!
Best regards,
Synth !
 

Tommy

Founder
That's because on the bottom:

Code:
        for (int i = 0; i < sizeof(Titles) / sizeof(uint32); i++)
        {
            if (actions == Titles[i].menu_id)
            {
                if (player->HasTitle(Titles[i].titleID))
                {
                    player->GetSession()->SendNotification("You already have this title!");
                    return false;
                }
               
                if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) < Titles[i].HK)
                {
                    player->GetSession()->SendNotification("You don't have enough kills!");
                    return false;
                }
               
                if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(Titles[i].titleID))
                {
                    player->SetTitle(titleEntry);
                    player->CLOSE_GOSSIP_MENU();
                }
            }
        }

Is calling no matter what option you click. You could add 'return false' in the action so it won't call it:

Code:
       if (actions == 100)
       {
            ChatHandler(player->GetSession()).SendSysMessage("|cffff6060[Information]:|r This npc show you 2 different options,Honorable Kills Titles costed on LifeTime Kills,Devium WoW Titles show you our own titles |cffff0000[Patch Required]|r,and costed on [Devium Title Token].");
            return false;
       }
 

Synth

Exalted Member
That's because on the bottom:
I get this error when i add return false; with } after.

Code:
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(70) : error C2059: syntax error : 'else'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(71) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(81) : error C2059: syntax error : 'else'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(82) : error C2238: unexpected token(s) preceding ';'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(84) : error C2059: syntax error : 'else'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(85) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C2059: syntax error : 'for'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C2143: syntax error : missing ')' before ';'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C2238: unexpected token(s) preceding ';'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C2143: syntax error : missing ';' before '<'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C2238: unexpected token(s) preceding ';'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C2143: syntax error : missing ';' before '++'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(92) : error C2059: syntax error : ')'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(93) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(115) : error C2059: syntax error : 'return'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(115) : error C2238: unexpected token(s) preceding ';'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(117) : error C2143: syntax error : missing ';' before '}'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(117) : error C2059: syntax error : '}'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(117) : error C2143: syntax error : missing ';' before '}'
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(117) : error C2059: syntax error : '}'
2>Build log was saved at "file://\Build\src\server\scripts\scripts.dir\Release\BuildLog.htm"
2>scripts - 22 error(s), 0 warning(s)
========== Build: 1 succeeded, 1 failed, 14 up-to-date, 0 skipped ==========]
 

Tommy

Founder
tc46.png


How can you forget the open bracket "{" under the if statement? :/
 

Synth

Exalted Member
tc46.png


How can you forget the open bracket "{" under the if statement? :/
Oh ya lol fixed this issue now what about how i can create another gossip contains my own titles for both faction horde and ally and its costed with my extendedcost i make,so if you can give me the code for this.
 

Rochet2

Moderator / Eluna Dev
http://pastebin.com/pRS2nF1p

Sizeof was wrong.
Also did some general codestyle changes. Read the NOTE comments.

Untested, might still have some errors.

To add titles, just add a new title in the array at the top. (NOTE, both ally and horde need the title so there are the same amount of titles for both)
Code:
{9, "My Title", 9000, 123123 }, // 123123 is titleID, 9000 is required kills
 
Last edited:

Synth

Exalted Member
http://pastebin.com/pRS2nF1p

Sizeof was wrong.
Also did some general codestyle changes. Read the NOTE comments.

Untested, might still have some errors.

To add titles, just add a new title in the array at the top. (NOTE, both ally and horde need the title so there are the same amount of titles for both)
Code:
{9, "My Title", 9000, 123123 }, // 123123 is titleID, 9000 is required kills

Hmmm,but i want to make another gossip with new array and i won't costed on lifetimekills i want example "My title" added on another gossip and if the player want to buy it,the code check if player have the itemcount and get it.
 

Tommy

Founder
Hmmm,but i want to make another gossip with new array and i won't costed on lifetimekills i want example "My title" added on another gossip and if the player want to buy it,the code check if player have the itemcount and get it.

Can you be more specific or explain better? I'm not quite following what you wrote.
 

Synth

Exalted Member
Can you be more specific or explain better? I'm not quite following what you wrote.
Alright,i want to create another gossip called "Tommy Titles",on this gossip i want to add some titles but i want to just add 1 title not cosed on lifetimekills,i want this title costed on an item and his id is 99921 if the player have x20 of this item id can buy the titles if no it will say "You don't have enough items to purchase this".So if i get how to do this i can add the other titles.
 

Tommy

Founder
Just make it a second menu, not hard to do considering it doesn't pertain to the 'honorable kill' array.

Code:
struct HonorGossip
{
    uint8 icon;
    std::string name;
    uint32 HK, titleID;
};

// {icon, "title name", honored_kills, titleID}
HonorGossip Titles [] =
{
    {9, "Private", 1, 1 },
    {9, "Corporal", 100, 2 },
    {9, "Sergeant", 250, 3 },
    {9, "Master Sergeant", 500, 4 },
    {9, "Sergeant Major", 750, 5 },
    {9, "Knight", 1000, 6 },
    {9, "Knight-Lieutenant", 1500, 7 },
    {9, "Knight-Captain", 2000, 8 },
    {9, "Knight-Champion", 2500, 9 },
    {9, "Lieutenant Commander", 3000, 10 },
    {9, "Commander", 3500, 11 },
    {9, "Marshal", 4000, 12 },
    {9, "Field Marshal", 4500, 13 },
    {9, "Grand Marshal", 5000, 14 },

    {9, "Scout", 1, 15 },
    {9, "Grunt", 100, 16 },
    {9, "Sergeant", 250, 17 },
    {9, "Senior Sergeant", 500, 18 },
    {9, "First Sergeant", 750, 19 },
    {9, "Stone Guard", 1000, 20 },
    {9, "Blood Guard", 1500, 21 },
    {9, "Legionnaire", 2000, 22 },
    {9, "Centurion", 2500, 23 },
    {9, "Champion", 3000, 24 },
    {9, "Lieutenant General", 3500, 25 },
    {9, "General", 4000, 26 },
    {9, "Warlord", 4500, 27 },
    {9, "High Warlord", 5000, 28 },
};
static const uint32 TITLES_SIZE = (sizeof(Titles) / sizeof(*Titles)); // NOTE, this was wrong. it was uint32 instead of *Titles or HonorGossip in the sizeof.

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

    bool OnGossipHello(Player* player, Creature* creature)
    {
        player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\INV_Misc_QuestionMark:30|tHow does this npc work?|r", GOSSIP_SENDER_MAIN, 100);
        player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|tHonorable Kills Titles|r", GOSSIP_SENDER_MAIN, 101);
	[COLOR="#00FF00"]player->ADD_GOSSIP_ITEM(4, "Item Cost Titles", GOSSIP_SENDER_MAIN, 200);[/COLOR]
        player->ADD_GOSSIP_ITEM(7, "|TInterface\\icons\\Ability_Spy:30|tNevermind|r", GOSSIP_SENDER_MAIN, 102);
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        return true;
    }

    bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
    {
        player->PlayerTalkClass->ClearMenus();
        if (actions == 100)
        {
            ChatHandler(player->GetSession()).SendSysMessage("|cffff6060[Information]:|r This npc show you 2 different options,Honorable Kills Titles costed on LifeTime Kills,Devium WoW Titles show you our own titles |cffff0000[Patch Required]|r,and costed on [Devium Title Token].");
            OnGossipHello(player, creature);
        }
        else if(actions == 101)
        {
            if (player->GetTeamId() == ALLIANCE)
                for (int i = 0; i < TITLES_SIZE/2; ++i)
                    player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i);
            else
                for (int i = TITLES_SIZE/2; i < TITLES_SIZE; ++i)
                    player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i);
            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "<- Back", GOSSIP_SENDER_MAIN, 999);
            player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        }
        else if (actions == 102)
            player->CLOSE_GOSSIP_MENU();
        else if (actions == 999) // NOTE main menu, no need to write the options twice, use the function like this.
            OnGossipHello(player, creature);
[COLOR="#00FF00"]	else if (actions == 200)
	{
	    if (player->HasItemCount(99921, 20, false))
	    {
	        player->GetSession()->SendNotification("You don't have enough tokens!");
		player->CLOSE_GOSSIP_MENU();
		return false;
	    }
            if (!player->HasTitle(30000))
                player->SetTitle(30000);
	}[/COLOR]
        else if (actions < TITLES_SIZE) // must check so we wont accidently go overboard
        {
            if (player->HasTitle(Titles[actions].titleID))
                player->GetSession()->SendNotification("You already have this title!");
            else if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) < Titles[actions].HK)
                player->GetSession()->SendNotification("You don't have enough kills!");
            else if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(Titles[actions].titleID))
            {
                player->SetTitle(titleEntry);
                player->GetSession()->SendAreaTriggerMessage("Title granted!");
            }
            OnGossipHello(player, creature);
        }
        return true; // NOTE always return true, unless you want to send the default gossip menu from DB
    }
};

void AddSC_honor_gossip()
{
    new npc_honor_gossip;
}
 

Synth

Exalted Member
Just make it a second menu, not hard to do considering it doesn't pertain to the 'honorable kill' array.
I got an error:
Code:
2>..\..\..\..\Source\src\server\scripts\Custom\npc_honor_gossip.cpp(90) : error C2664: 'Player::SetTitle' : cannot convert parameter 1 from 'int' to 'const CharTitlesEntry *'
2>        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Also the code check if player x20 of this item and can buy it and if not it say the error you add in script right ?
 

Tommy

Founder
Also the code check if player x20 of this item and can buy it and if not it say the error you add in script right ?

If you look at what I changed it is in the script. I fixed the error. I wasn't using Visual Studio, so that explains why you received an error or might receive some.

Code:
struct HonorGossip
{
    uint8 icon;
    std::string name;
    uint32 HK, titleID;
};

// {icon, "title name", honored_kills, titleID}
HonorGossip Titles [] =
{
    {9, "Private", 1, 1 },
    {9, "Corporal", 100, 2 },
    {9, "Sergeant", 250, 3 },
    {9, "Master Sergeant", 500, 4 },
    {9, "Sergeant Major", 750, 5 },
    {9, "Knight", 1000, 6 },
    {9, "Knight-Lieutenant", 1500, 7 },
    {9, "Knight-Captain", 2000, 8 },
    {9, "Knight-Champion", 2500, 9 },
    {9, "Lieutenant Commander", 3000, 10 },
    {9, "Commander", 3500, 11 },
    {9, "Marshal", 4000, 12 },
    {9, "Field Marshal", 4500, 13 },
    {9, "Grand Marshal", 5000, 14 },

    {9, "Scout", 1, 15 },
    {9, "Grunt", 100, 16 },
    {9, "Sergeant", 250, 17 },
    {9, "Senior Sergeant", 500, 18 },
    {9, "First Sergeant", 750, 19 },
    {9, "Stone Guard", 1000, 20 },
    {9, "Blood Guard", 1500, 21 },
    {9, "Legionnaire", 2000, 22 },
    {9, "Centurion", 2500, 23 },
    {9, "Champion", 3000, 24 },
    {9, "Lieutenant General", 3500, 25 },
    {9, "General", 4000, 26 },
    {9, "Warlord", 4500, 27 },
    {9, "High Warlord", 5000, 28 },
};
static const uint32 TITLES_SIZE = (sizeof(Titles) / sizeof(*Titles)); // NOTE, this was wrong. it was uint32 instead of *Titles or HonorGossip in the sizeof.

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

    bool OnGossipHello(Player* player, Creature* creature)
    {
        player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\INV_Misc_QuestionMark:30|tHow does this npc work?|r", GOSSIP_SENDER_MAIN, 100);
        player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|tHonorable Kills Titles|r", GOSSIP_SENDER_MAIN, 101);
[COLOR="#00FF00"]	player->ADD_GOSSIP_ITEM(4, "Item Cost Titles", GOSSIP_SENDER_MAIN, 200);[/COLOR]
        player->ADD_GOSSIP_ITEM(7, "|TInterface\\icons\\Ability_Spy:30|tNevermind|r", GOSSIP_SENDER_MAIN, 102);
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        return true;
    }

    bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
    {
        player->PlayerTalkClass->ClearMenus();
        if (actions == 100)
        {
            ChatHandler(player->GetSession()).SendSysMessage("|cffff6060[Information]:|r This npc show you 2 different options,Honorable Kills Titles costed on LifeTime Kills,Devium WoW Titles show you our own titles |cffff0000[Patch Required]|r,and costed on [Devium Title Token].");
            OnGossipHello(player, creature);
        }
        else if(actions == 101)
        {
            if (player->GetTeamId() == ALLIANCE)
                for (int i = 0; i < TITLES_SIZE/2; ++i)
                    player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i);
            else
                for (int i = TITLES_SIZE/2; i < TITLES_SIZE; ++i)
                    player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i);
            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "<- Back", GOSSIP_SENDER_MAIN, 999);
            player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        }
        else if (actions == 102)
            player->CLOSE_GOSSIP_MENU();
        else if (actions == 999) // NOTE main menu, no need to write the options twice, use the function like this.
            OnGossipHello(player, creature);
[COLOR="#00FF00"]       else if (actions == 200)
	{
	    if (player->HasItemCount(99921, 20, false))
	    {
	        player->GetSession()->SendNotification("You don't have enough tokens!");
		player->CLOSE_GOSSIP_MENU();
                return false;
	    }
            if (!player->HasTitle(30000))
	    {
                if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(30000))
                {
                    player->SetTitle(titleEntry);
                    player->GetSession()->SendAreaTriggerMessage("Title granted!");
                }
	    }
	}[/COLOR]
        else if (actions < TITLES_SIZE) // must check so we wont accidently go overboard
        {
            if (player->HasTitle(Titles[actions].titleID))
                player->GetSession()->SendNotification("You already have this title!");
            else if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) < Titles[actions].HK)
                player->GetSession()->SendNotification("You don't have enough kills!");
            else if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(Titles[actions].titleID))
            {
                player->SetTitle(titleEntry);
                player->GetSession()->SendAreaTriggerMessage("Title granted!");
            }
            OnGossipHello(player, creature);
        }
        return true; // NOTE always return true, unless you want to send the default gossip menu from DB
    }
};

void AddSC_honor_gossip()
{
    new npc_honor_gossip;
}
 

Synth

Exalted Member
If you look at what I changed it is in the script. I fixed the error. I wasn't using Visual Studio, so that explains why you received an error or might receive some.
The errors fixed but i have some errors in-game if i have x20 of this item it say "You don't have enough items to purchase" but me i have x20 item to purchase this so this is the first error also when he buy the title i want to remove from him x20 of this item,and last question please how i can create 2 title on this gossip ?Thank you.
 

Tommy

Founder
Whoops, had the logic wrong.

Code:
struct HonorGossip
{
    uint8 icon;
    std::string name;
    uint32 HK, titleID;
};

// {icon, "title name", honored_kills, titleID}
HonorGossip Titles [] =
{
    {9, "Private", 1, 1 },
    {9, "Corporal", 100, 2 },
    {9, "Sergeant", 250, 3 },
    {9, "Master Sergeant", 500, 4 },
    {9, "Sergeant Major", 750, 5 },
    {9, "Knight", 1000, 6 },
    {9, "Knight-Lieutenant", 1500, 7 },
    {9, "Knight-Captain", 2000, 8 },
    {9, "Knight-Champion", 2500, 9 },
    {9, "Lieutenant Commander", 3000, 10 },
    {9, "Commander", 3500, 11 },
    {9, "Marshal", 4000, 12 },
    {9, "Field Marshal", 4500, 13 },
    {9, "Grand Marshal", 5000, 14 },

    {9, "Scout", 1, 15 },
    {9, "Grunt", 100, 16 },
    {9, "Sergeant", 250, 17 },
    {9, "Senior Sergeant", 500, 18 },
    {9, "First Sergeant", 750, 19 },
    {9, "Stone Guard", 1000, 20 },
    {9, "Blood Guard", 1500, 21 },
    {9, "Legionnaire", 2000, 22 },
    {9, "Centurion", 2500, 23 },
    {9, "Champion", 3000, 24 },
    {9, "Lieutenant General", 3500, 25 },
    {9, "General", 4000, 26 },
    {9, "Warlord", 4500, 27 },
    {9, "High Warlord", 5000, 28 },
};
static const uint32 TITLES_SIZE = (sizeof(Titles) / sizeof(*Titles)); // NOTE, this was wrong. it was uint32 instead of *Titles or HonorGossip in the sizeof.

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

    bool OnGossipHello(Player* player, Creature* creature)
    {
        player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\INV_Misc_QuestionMark:30|tHow does this npc work?|r", GOSSIP_SENDER_MAIN, 100);
        player->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\Achievement_PVP_H_15:30|tHonorable Kills Titles|r", GOSSIP_SENDER_MAIN, 101);
	player->ADD_GOSSIP_ITEM(4, "Item Cost Titles", GOSSIP_SENDER_MAIN, 200);
        player->ADD_GOSSIP_ITEM(7, "|TInterface\\icons\\Ability_Spy:30|tNevermind|r", GOSSIP_SENDER_MAIN, 102);
        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        return true;
    }

    bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
    {
        player->PlayerTalkClass->ClearMenus();
        if (actions == 100)
        {
            ChatHandler(player->GetSession()).SendSysMessage("|cffff6060[Information]:|r This npc show you 2 different options,Honorable Kills Titles costed on LifeTime Kills,Devium WoW Titles show you our own titles |cffff0000[Patch Required]|r,and costed on [Devium Title Token].");
            OnGossipHello(player, creature);
        }
        else if(actions == 101)
        {
            if (player->GetTeamId() == ALLIANCE)
                for (int i = 0; i < TITLES_SIZE/2; ++i)
                    player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i);
            else
                for (int i = TITLES_SIZE/2; i < TITLES_SIZE; ++i)
                    player->ADD_GOSSIP_ITEM(Titles[i].icon, Titles[i].name.c_str(), GOSSIP_SENDER_MAIN, i);
            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "<- Back", GOSSIP_SENDER_MAIN, 999);
            player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
        }
        else if (actions == 102)
            player->CLOSE_GOSSIP_MENU();
        else if (actions == 999) // NOTE main menu, no need to write the options twice, use the function like this.
            OnGossipHello(player, creature);
       else if (actions == 200)
	{
	    if (!player->HasItemCount(99921, 20, false))
	    {
	        player->GetSession()->SendNotification("You don't have enough tokens!");
		player->CLOSE_GOSSIP_MENU();
                return false;
	    }
            if (!player->HasTitle(30000))
	    {
                if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(30000))
                {
                    player->SetTitle(titleEntry);
                    player->GetSession()->SendAreaTriggerMessage("Title granted!");
                }
	    }
	}
        else if (actions < TITLES_SIZE) // must check so we wont accidently go overboard
        {
            if (player->HasTitle(Titles[actions].titleID))
                player->GetSession()->SendNotification("You already have this title!");
            else if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) < Titles[actions].HK)
                player->GetSession()->SendNotification("You don't have enough kills!");
            else if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(Titles[actions].titleID))
            {
                player->SetTitle(titleEntry);
                player->GetSession()->SendAreaTriggerMessage("Title granted!");
            }
            OnGossipHello(player, creature);
        }
        return true; // NOTE always return true, unless you want to send the default gossip menu from DB
    }
};

void AddSC_honor_gossip()
{
    new npc_honor_gossip;
}
 

Synth

Exalted Member
Whoops, had the logic wrong.
I still get errors in-game if i have x20 of this item it say "You don't have enough items to purchase" also when the player buy the title i want to remove from him x20 of this item,and last question,how i can create 2 title on this gossip?
 
Status
Not open for further replies.
Top