• 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] Exchange NPC C++ Errors - Help updating please.

Status
Not open for further replies.

katos

Noble Member
Hi all (again)

Having issues updating / adding to an old exchange NPC.
I've added a few functions but frankly, am failing rather monumentally.

Errors occurring:
Error 1 error C2039: 'isInCombat' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 19 1 scripts
Error 2 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [19]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 22 1 scripts
Error 3 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 76 1 scripts
Error 4 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 81 1 scripts
Error 5 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 90 1 scripts
Error 6 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 95 1 scripts
Error 7 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 104 1 scripts
Error 8 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 109 1 scripts
Error 9 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 118 1 scripts
Error 10 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 123 1 scripts
Error 11 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 132 1 scripts
Error 12 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 137 1 scripts
Error 13 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 146 1 scripts
Error 14 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 151 1 scripts
Error 15 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 161 1 scripts
Error 16 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 166 1 scripts
Error 17 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 175 1 scripts
Error 18 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 180 1 scripts
Error 19 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 189 1 scripts
Error 20 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 194 1 scripts
Error 21 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 203 1 scripts
Error 22 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 208 1 scripts
Error 23 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 217 1 scripts
Error 24 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 222 1 scripts
Error 25 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 231 1 scripts
Error 26 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 236 1 scripts
Error 27 error C2061: syntax error : identifier 'pPlayer' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 241 1 scripts
Error 28 error C2143: syntax error : missing ';' before '{' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 242 1 scripts
Error 29 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [27]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 246 1 scripts
Error 30 error C2181: illegal else without matching if D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 248 1 scripts
Error 31 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [73]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 251 1 scripts
Error 32 error C1075: end of file found before the left brace '{' at 'D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp(261)' was matched D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 263 1 scripts
Error 33 error LNK2019: unresolved external symbol "void __cdecl AddSC_npc_exchanger(void)" (?AddSC_npc_exchanger@@YAXXZ) referenced in function "void __cdecl AddCustomScripts(void)" (?AddCustomScripts@@YAXXZ) D:\katos\test core\buildtest\src\server\worldserver\game.lib(ScriptLoader.obj) worldserver
Error 34 error LNK1120: 1 unresolved externals D:\katos\test core\buildtest\bin\Debug\worldserver.exe worldserver

Script:
http://pastebin.com/PxsaMKAS


Any help much appreciated.
Thanks in advance! :)
 

Tommy

Founder
The older Whisper arguments are being supplied. View: Unit::Whisper

And then change your whispers to:

Code:
->Whisper("...", LANG_UNIVERSAL, player);

Error 27 error C2061: syntax error : identifier 'pPlayer' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 241 1 scripts

On line 241 you're missing an open parenthesis for the if statement, which causes the error for line 242 & 248 to error too. Fix the missing parenthesis and you'll be fine on that.

That's all I see. :D
 

katos

Noble Member
The older Whisper arguments are being supplied. View: Unit::Whisper

And then change your whispers to:

Code:
->Whisper("...", LANG_UNIVERSAL, player);



On line 241 you're missing an open parenthesis for the if statement, which causes the error for line 242 & 248 to error too. Fix the missing parenthesis and you'll be fine on that.

That's all I see. :D

Christ, can't believe I missed that bloody whisper LAND_UNIVERSAL ... (again) ...
Thanks for that, [MENTION=1]Tommy[/MENTION]

As for the missing parenthesis I am not sure how / where?
if pPlayer->HasItem(24245,1)
{

Is that not the open parenthesis there?

- - - Updated - - -

Christ, can't believe I missed that bloody whisper LAND_UNIVERSAL ... (again) ...
Thanks for that, [MENTION=1]Tommy[/MENTION]

As for the missing parenthesis I am not sure how / where?


Is that not the open parenthesis there?

Scrap that, think I found it.
 

Tommy

Founder
Missing parenthesis are super easy to spot. Actually, you're missing an end parenthesis too. Didn't see that.

Code:
if [COLOR="#FF0000"]SHOULDBEHERE[/COLOR]pPlayer->HasItem(24245,1)[COLOR="#FF0000"]SHOULDBEHERE[/COLOR]

Correct:

Code:
if [COLOR="lime"]([/COLOR]pPlayer->HasItem(24245,1)[COLOR="lime"])[/COLOR]
 

katos

Noble Member
Missing parenthesis are super easy to spot. Actually, you're missing an end parenthesis too. Didn't see that.

Code:
if [COLOR="#FF0000"]SHOULDBEHERE[/COLOR]pPlayer->HasItem(24245,1)[COLOR="#FF0000"]SHOULDBEHERE[/COLOR]

Correct:

Code:
if [COLOR="lime"]([/COLOR]pPlayer->HasItem(24245,1)[COLOR="lime"])[/COLOR]

Yep, corrected this then. Can't actually believe I missed that ...
Many thanks for your help there good sir, I will attempt a recompile now! :)
 

katos

Noble Member
Error 1 error C2039: 'isInCombat' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 19 1 scripts
Error 2 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 1 from 'const char [19]' to 'uint32' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 22 1 scripts
Error 3 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 76 1 scripts
Error 4 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 81 1 scripts
Error 5 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 90 1 scripts
Error 6 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 95 1 scripts
Error 7 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 104 1 scripts
Error 8 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 109 1 scripts
Error 9 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 118 1 scripts
Error 10 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 123 1 scripts
Error 11 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 132 1 scripts
Error 12 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 137 1 scripts
Error 13 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 146 1 scripts
Error 14 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 151 1 scripts
Error 15 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 161 1 scripts
Error 16 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 166 1 scripts
Error 17 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 175 1 scripts
Error 18 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 180 1 scripts
Error 19 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 189 1 scripts
Error 20 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 194 1 scripts
Error 21 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 203 1 scripts
Error 22 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 208 1 scripts
Error 23 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 217 1 scripts
Error 24 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 222 1 scripts
Error 25 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 231 1 scripts
Error 26 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 236 1 scripts
Error 27 error C2039: 'HasItem' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 241 1 scripts
Error 28 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 246 1 scripts
Error 29 error C2065: 'player' : undeclared identifier D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 251 1 scripts
Error 30 error C1075: end of file found before the left brace '{' at 'D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp(261)' was matched D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 263 1 scripts
Error 31 error LNK2019: unresolved external symbol "void __cdecl AddSC_npc_exchanger(void)" (?AddSC_npc_exchanger@@YAXXZ) referenced in function "void __cdecl AddCustomScripts(void)" (?AddCustomScripts@@YAXXZ) D:\katos\test core\buildtest\src\server\worldserver\game.lib(ScriptLoader.obj) worldserver
Error 32 error LNK1120: 1 unresolved externals D:\katos\test core\buildtest\bin\Debug\worldserver.exe worldserver

Strange, not a clue why I am having these ...
Script : http://pastebin.com/y7iAKa5e

I am very tired atm, and not thinking straight due to real life stresses, so I might be missing simple things. I will look over it and see what I can find, appreciate any and all help though.
Thanks to [MENTION=1]Tommy[/MENTION] for your help so far buddy. :)

- - - Updated - - -

'isInCombat

Needs capital - fixed this one. :)
 

Tommy

Founder
Well, that's because you used my 'player' variable example in your script when you should go by your own parameter names. OnGossipHello is fine but you need to change the "player" variable name in the Whisper argument to "pPlayer" since "pPlayer" is the correct name in the OnGossipSelect parameters in that script.
 

katos

Noble Member
Well, that's because you used my 'player' variable example in your script when you should go by your own parameter names. OnGossipHello is fine but you need to change the "player" variable name in the Whisper argument to "pPlayer" since "pPlayer" is the correct name in the OnGossipSelect parameters in that script.

My apologies, I got confused and thought they had changed it so that it was "player" no matter of the preceding "pPlayer" - So thanks for pointing that out.
Guess I am slowly getting the hang of this ... (slowly ...)

Thanks again [MENTION=1]Tommy[/MENTION].
 

katos

Noble Member
Error 1 error C2039: 'HasItem' : is not a member of 'Player' D:\katos\test core\dev\src\server\scripts\Custom\exchange.cpp 241 1 scripts

Any ideas on this one please [MENTION=1]Tommy[/MENTION]? This actually is the first time I've used HasItem.

Code:
case 17: //1DP -> 5VP
                if (pPlayer->HasItem(24245,1))
                {
                    pPlayer->CLOSE_GOSSIP_MENU();
                    pPlayer->DestroyItemCount(24245,1,true,false);
                    pPlayer->AddItem(44791,5);
                    pCreature->Whisper("You exchanged succesfully!", LANG_UNIVERSAL, pPlayer);
                }
 

Tommy

Founder
As the error pointed out, "HasItem" is not a member of Player which means it doesn't exist, so no, it can't have the same parameters.

bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) : Only requires the item entry since the other parameters are optional.

EXAMPLE of HasItemCount usage:

itemId
Code:
if (player->HasItemCount(30000))
{
    // Player has the item
}
else
{
    // No item in the player's inventory
}

Using the optional args:

itemId, count
Code:
if (player->HasItemCount(30000, 5))
{
    // Player has 5 of the item
}
else
{
    // No item in the player's inventory
}

itemId, count, inBankAlso
Code:
if (player->HasItemCount(30000, 1, true))
{
    // Player has 1 of the item, checking the player's bank as well
}
else
{
    // No item in the player's inventory or in the bank
}
 

katos

Noble Member
Super informative, many thanks [MENTION=1]Tommy[/MENTION], starting to slowly wrap my head around parts of this now. :)
 

katos

Noble Member
Fully working now, many thanks to everyone who helped! :)
Huge shout-out to [MENTION=1]Tommy[/MENTION] and [MENTION=6]Rochet2[/MENTION] - Thanks! :)

/Solved.
 
Status
Not open for further replies.
Top