• 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] PvE Titles script errors

Status
Not open for further replies.

katos

Noble Member
Hey all,

having a few issues with a script of ours that has stumped both me and my colleague.
Working on a title NPC but having a few errors:

(errors):
Error 1 error C1075: end of file found before the left brace '{' at 'C:\Users\DPCoder\Desktop\TrinityCore\src\server\scripts\Custom\PveTitles.cpp(354)' was matched C:\Users\DPCoder\Desktop\TrinityCore\src\server\scripts\Custom\PveTitles.cpp 688 1 scripts
Error 2 error LNK2019: unresolved external symbol "void __cdecl AddSC_PveTitleNpc(void)" (?AddSC_PveTitleNpc@@YAXXZ) referenced in function "void __cdecl AddCustomScripts(void)" (?AddCustomScripts@@YAXXZ) C:\Users\DPCoder\Desktop\Build\src\server\worldserver\game.lib(ScriptLoader.obj) worldserver
Error 3 error LNK1120: 1 unresolved externals C:\Users\DPCoder\Desktop\Build\bin\Release\worldserver.exe worldserver
4 IntelliSense: expected a '}' c:\Users\DPCoder\Desktop\TrinityCore\src\server\scripts\Custom\PveTitles.cpp 687 1 scripts

Sadly, we can't seem to find what's up with it - maybe all it needs is a fresh pair of eyes!

The script:
http://pastebin.com/rBkgkKgR

Hopefully someone can help.
Thanks in advance.
Katos.
 

slp13at420

Mad Scientist
honestly don't know much about C++ but I did notice something :
Code:
[COLOR="#808080"]
                case 28: //Exhalted
                        if (Player->HasItemCount(Vote_Token, 1, false))
                        {
                               Player->DestroyItemCount(Vote_Token, 1, true, false);
                               Player->SetTitle(sCharTitlesStore.LookupEntry(77));
                        }


                        break;

                case 29: //Ambassador
                [COLOR="#FF0000"]{[/COLOR]
                        if (Player->HasItemCount(Vote_Token, 1, false))
                        {
                                Player->DestroyItemCount(Vote_Token, 1, true, false);
                                Player->SetTitle(sCharTitlesStore.LookupEntry(130));
                        }


                        break;

                case 30: //Diplomat
                [COLOR="#FF0000"]{[/COLOR]
                        if (Player->HasItemCount(Vote_Token, 1, false))

                        {
                                Player->DestroyItemCount(Vote_Token, 1, true, false);
                                Player->SetTitle(sCharTitlesStore.LookupEntry(79));
                        }


                        break;
[/COLOR]
up to case 28 , there are no opening/closing brackets, but from case 29 and on there is an opening bracket but no closing bracket. if I understand it right , `for every opening bracket there must me a closing bracket`.

but then again I may be wrong since my C++ knowledge is minimal...
but its a learning process lol

another thing you could do is use the `if (Player->HasItemCount(Vote_Token, 1, false))` before the case comparisons along with the `Player->DestroyItemCount(Vote_Token, 1, true, false);` within the HasItem if statement so it will help cut down on size. now something I would also try is sync my case so then I ust need 1 `Player->SetTitle(sCharTitlesStore.LookupEntry(172));` with this instead:player->SetTitle(sCharTitlesStore.LookupEntry(case_value));

Code:
        bool OnGossipSelect(Player* Player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)

        {
int32 xcase = uiAction or whatever way you can get the case value

//              WorldSession* ws = Player->GetSession();

                switch (uiAction) maybe not need this line now
	                {
                
                    if (Player->HasItemCount(Vote_Token, 1, false))
               		   {
                           Player->DestroyItemCount(Vote_Token, 1, true, false);
                           Player->SetTitle(sCharTitlesStore.LookupEntry(xcase));
         			   }
         			}
                    break;

Code:
#include "ScriptPCH.h"

enum Tokens

{
        Vote_Token = 44791,
};

class PveTitleNpc : public CreatureScript
{
public:
        PveTitleNpc() : CreatureScript("PveTitleNpc"){}
        bool OnGossipHello(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
        {
                player->ADD_GOSSIP_ITEM(4, "Raiding / Dungeon Titles", GOSSIP_SENDER_MAIN, 2);
                player->ADD_GOSSIP_ITEM(4, "Reputation Titles", GOSSIP_SENDER_MAIN, 3);
                player->ADD_GOSSIP_ITEM(4, "Other Titles", GOSSIP_SENDER_MAIN, 4);
                return true;

                switch (uiAction)

                case 2: //Raiding and Dungeon Titles

                        player->ADD_GOSSIP_ITEM(4, "Champion Of The Naaru", GOSSIP_SENDER_MAIN, 5);
                        player->ADD_GOSSIP_ITEM(4, "Hand Of Adal", GOSSIP_SENDER_MAIN, 6);
                        player->ADD_GOSSIP_ITEM(4, "The Patient", GOSSIP_SENDER_MAIN, 7);
                        player->ADD_GOSSIP_ITEM(4, "The Undying", GOSSIP_SENDER_MAIN, 8);
                        player->ADD_GOSSIP_ITEM(4, "The Immortal", GOSSIP_SENDER_MAIN, 9);
                        player->ADD_GOSSIP_ITEM(4, "Of The Nightfall", GOSSIP_SENDER_MAIN, 10);
                        player->ADD_GOSSIP_ITEM(4, "Twilight Vanquisher", GOSSIP_SENDER_MAIN, 11);
                        player->ADD_GOSSIP_ITEM(4, "Obsidium Slayer", GOSSIP_SENDER_MAIN, 12);
                        player->ADD_GOSSIP_ITEM(4, "Magic Seeker", GOSSIP_SENDER_MAIN, 13);
                        player->ADD_GOSSIP_ITEM(4, "Starcaller", GOSSIP_SENDER_MAIN, 14);
                        player->ADD_GOSSIP_ITEM(4, "The Astral Walker", GOSSIP_SENDER_MAIN, 15);
                        player->ADD_GOSSIP_ITEM(4, "Herald Of Titans", GOSSIP_SENDER_MAIN, 16);
                        player->ADD_GOSSIP_ITEM(4, "The Celestial Defender", GOSSIP_SENDER_MAIN, 17);
                        player->ADD_GOSSIP_ITEM(4, "Conqueror Of Ulduar", GOSSIP_SENDER_MAIN, 18);
                        player->ADD_GOSSIP_ITEM(4, "Champion Of Ulduar", GOSSIP_SENDER_MAIN, 19);
                        player->ADD_GOSSIP_ITEM(4, "Death's Demise", GOSSIP_SENDER_MAIN, 20);
                        player->ADD_GOSSIP_ITEM(4, "Conqueror Of Naxxramas", GOSSIP_SENDER_MAIN, 21);
                        player->ADD_GOSSIP_ITEM(4, "Champion Of The Frozen Wastes", GOSSIP_SENDER_MAIN, 22);
                        player->ADD_GOSSIP_ITEM(4, "The Argent Defender", GOSSIP_SENDER_MAIN, 23);
                        player->ADD_GOSSIP_ITEM(4, "The Kingslayer", GOSSIP_SENDER_MAIN, 24);
                        player->ADD_GOSSIP_ITEM(4, "Bane Of The Fallen King", GOSSIP_SENDER_MAIN, 25);
                        player->ADD_GOSSIP_ITEM(4, "The Light Of Dawn", GOSSIP_SENDER_MAIN, 26);

                        return true;

                        switch (uiAction)

                case 3: // Reputation Titles
                        player->ADD_GOSSIP_ITEM(4, "Of The Shattered Sun", GOSSIP_SENDER_MAIN, 27);
                        player->ADD_GOSSIP_ITEM(4, "The Exhalted", GOSSIP_SENDER_MAIN, 28);
                        player->ADD_GOSSIP_ITEM(4, "Ambassador", GOSSIP_SENDER_MAIN, 29);
                        player->ADD_GOSSIP_ITEM(4, "The Diplomat", GOSSIP_SENDER_MAIN, 30);
                        player->ADD_GOSSIP_ITEM(4, "Bloodsail Admiral", GOSSIP_SENDER_MAIN, 31);
                        player->ADD_GOSSIP_ITEM(4, "Crusader", GOSSIP_SENDER_MAIN, 32);
                        player->ADD_GOSSIP_ITEM(4, "The Insane", GOSSIP_SENDER_MAIN, 33);
                        player->ADD_GOSSIP_ITEM(4, "Guardian Of Cenarius", GOSSIP_SENDER_MAIN, 34);
                        player->ADD_GOSSIP_ITEM(4, "The Argent Champion", GOSSIP_SENDER_MAIN, 35);
                        player->ADD_GOSSIP_ITEM(4, "Of The Ashen Verdict", GOSSIP_SENDER_MAIN, 36);
                        player->ADD_GOSSIP_ITEM(4, "Of Darnassus", GOSSIP_SENDER_MAIN, 37);
                        player->ADD_GOSSIP_ITEM(4, "Of Gnomeregan", GOSSIP_SENDER_MAIN, 38);
                        player->ADD_GOSSIP_ITEM(4, "Of Ironforge", GOSSIP_SENDER_MAIN, 39);
                        player->ADD_GOSSIP_ITEM(4, "Of Stormwind", GOSSIP_SENDER_MAIN, 40);
                        player->ADD_GOSSIP_ITEM(4, "Of The Exodar", GOSSIP_SENDER_MAIN, 41);
                        player->ADD_GOSSIP_ITEM(4, "Of Orgrimmar", GOSSIP_SENDER_MAIN, 42);
                        player->ADD_GOSSIP_ITEM(4, "Of Sen'jin", GOSSIP_SENDER_MAIN, 43);
                        player->ADD_GOSSIP_ITEM(4, "Of Silvermoon", GOSSIP_SENDER_MAIN, 44);
                        player->ADD_GOSSIP_ITEM(4, "Of Thunderbluff", GOSSIP_SENDER_MAIN, 45);
                        player->ADD_GOSSIP_ITEM(4, "Of The Undercity", GOSSIP_SENDER_MAIN, 46);
                        player->ADD_GOSSIP_ITEM(4, "For The Alliance", GOSSIP_SENDER_MAIN, 47);
                        player->ADD_GOSSIP_ITEM(4, "For The Horde", GOSSIP_SENDER_MAIN, 48);
                        return true;

                        switch (uiAction)

                case 4: // Other Titles

                        player->ADD_GOSSIP_ITEM(4, "Scarab Lord", GOSSIP_SENDER_MAIN, 49);
                        player->ADD_GOSSIP_ITEM(4, "Brewmaster", GOSSIP_SENDER_MAIN, 50);
                        player->ADD_GOSSIP_ITEM(4, "The Love Fool", GOSSIP_SENDER_MAIN, 51);
                        player->ADD_GOSSIP_ITEM(4, "Matron", GOSSIP_SENDER_MAIN, 52);
                        player->ADD_GOSSIP_ITEM(4, "Patron", GOSSIP_SENDER_MAIN, 53);
                        player->ADD_GOSSIP_ITEM(4, "The Hallowed", GOSSIP_SENDER_MAIN, 54);
                        player->ADD_GOSSIP_ITEM(4, "Merrymaker", GOSSIP_SENDER_MAIN, 55);
                        player->ADD_GOSSIP_ITEM(4, "The Noble", GOSSIP_SENDER_MAIN, 56);
                        player->ADD_GOSSIP_ITEM(4, "The Pilgram", GOSSIP_SENDER_MAIN, 57);
                        player->ADD_GOSSIP_ITEM(4, "Flame Keeper", GOSSIP_SENDER_MAIN, 58);
                        player->ADD_GOSSIP_ITEM(4, "Flame Warden", GOSSIP_SENDER_MAIN, 59);
                        player->ADD_GOSSIP_ITEM(4, "Elder", GOSSIP_SENDER_MAIN, 60);
                        player->ADD_GOSSIP_ITEM(4, "Loremaster", GOSSIP_SENDER_MAIN, 61);
                        player->ADD_GOSSIP_ITEM(4, "The Seeker", GOSSIP_SENDER_MAIN, 62);
                        player->ADD_GOSSIP_ITEM(4, "Salty", GOSSIP_SENDER_MAIN, 63);
                        player->ADD_GOSSIP_ITEM(4, "Chef", GOSSIP_SENDER_MAIN, 64);
                        player->ADD_GOSSIP_ITEM(4, "Assassin", GOSSIP_SENDER_MAIN, 65);
                        player->ADD_GOSSIP_ITEM(4, "The Explorer", GOSSIP_SENDER_MAIN, 66);
                        player->ADD_GOSSIP_ITEM(4, "Jenkins", GOSSIP_SENDER_MAIN, 67);
                        
                        player->PlayerTalkClass->SendGossipMenu(9000000, creature->GetGUID());

                        return true;

player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());

                return true;
                }

        
        bool OnGossipSelect(Player* Player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)

        {
int32 xcase = uiAction or whatever way you can get the case value

//              WorldSession* ws = Player->GetSession();

                switch (uiAction) maybe not need this line now
	                {
                
                    if (Player->HasItemCount(Vote_Token, 1, false))
               		   {
                           Player->DestroyItemCount(Vote_Token, 1, true, false);
                           Player->SetTitle(sCharTitlesStore.LookupEntry(xcase));
         			   }
         			}
                    break;
 
Last edited:

Tommy

Founder
This script is all kinds of fucked up.

OnGossipHello is being used as OnGossipSelect? It has the same parameters as OnGossipSelect. You have duplicate switch statements and you're missing brackets for those said switch statements. You probably have more brackets missing or too many added as well. Too many redundant 'return true;' as well in every case. Looks like the switch statements were added for every one case.

Missing SEND_GOSSIP_MENU for basically everything as well. Lastly, all the other cases calling "Player" is incorrect because "Player* player" is defined, not "Player* Player"

I'll fix it up because it is very bad at the moment. Who ever put this together should be put into a ball and launched into space.

I fixed everything and simplified what needed to be. Everything could be simplified more but I can't mess with it right now. I'd also have it cleaned up indentation wise, but it will take too long.

http://pastebin.com/b4xbKQqX

P.S: I also noticed that a lot of those titles are duplicates and will not be what they are commented to be.
 

slp13at420

Mad Scientist
yea like what he just did lol :
Code:
   void TitleAction(Player* player, uint32 title)

    {
        if (player->HasItemCount(Vote_Token, 1, false))
        {
            player->DestroyItemCount(Vote_Token, 1, true, false);
            player->SetTitle(sCharTitlesStore.LookupEntry(title));
        }
    }

I was kinda close lol
 

katos

Noble Member
This script is all kinds of fucked up.

OnGossipHello is being used as OnGossipSelect? It has the same parameters as OnGossipSelect. You have duplicate switch statements and you're missing brackets for those said switch statements. You probably have more brackets missing or too many added as well. Too many redundant 'return true;' as well in every case. Looks like the switch statements were added for every one case.

Missing SEND_GOSSIP_MENU for basically everything as well. Lastly, all the other cases calling "Player" is incorrect because "Player* player" is defined, not "Player* Player"

I'll fix it up because it is very bad at the moment. Who ever put this together should be put into a ball and launched into space.

I fixed everything and simplified what needed to be. Everything could be simplified more but I can't mess with it right now. I'd also have it cleaned up indentation wise, but it will take too long.

http://pastebin.com/b4xbKQqX

P.S: I also noticed that a lot of those titles are duplicates and will not be what they are commented to be.

Really appreciate the help, the script is made by my colleague, who fully admits little to no knowledge of C++ and he is trying to pick it up as he goes along.
He is actually monitoring this thread but doesnt have an account yet.

Sadly, we got errors from the script that you have provided Tommy:
http://pastebin.com/C3wvvGSK

Any help would be much appreciated, I am at a bit of a loss here to be honest!
 

Tommy

Founder
I guess I was wrong about "Player* Player" not being defined. However, it is bad practice and not recommended to name your variable the same name as a class (example: Player* Player) because that's the actual classname itself. Better to do "Player* player".

Any who, I edited the variable in the parameter: http://pastebin.com/NArZqW9x

If anymore errors show, read them carefully and try to fix them before asking - it helps in terms of experience with error solving. Besides, I'm not using an IDE, just Notepad++.
 
Status
Not open for further replies.
Top