• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[C++] (PVP) No damage if same storage value

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
132
Location
Unknown
I've been struggling with some changes I want to make to my server, tbh i'm kinda tired of trying this, that's why I decided to post it here, if someone could help that'd be cool. It takes place in Game::combatChangeHealth function in game.cpp, I want to return false to this function in PvP if both parts have the same storage value.

Is there way to use getStorageValue in game.cpp I mean I know that I have to point it.

For example attackerPlayer->getStorageValue

Example:
Code:
    if (attackerPlayer->getStorageValue(39753) > 0 && target->getStorageValue(39753) > 0) {
                return false;
            }

Error:
getStorageValue function is not pointed or declared to Creature.

Full code:
http://pastebin.com/H3RsbmiW

Engine:
TFS 1.0

Thanks in advance,
Cheers.
 
Last edited:
I've been struggling with some changes I want to make to my server, tbh i'm kinda tired of trying this, that's why I decided to post it here, if someone could help that'd be cool. It takes place in Game::combatChangeHealth function in game.cpp, I want to return false to this function in PvP if both parts have the same storage value.

Is there way to use getStorageValue in game.cpp I mean I know that I have to point it.

For example attackerPlayer->getStorageValue

Example:
Code:
    if (attackerPlayer->getStorageValue(39753) > 0 && target->getStorageValue(39753) > 0) {
                return false;
            }

Error:
getStorageValue function is not pointed or declared to Creature.

Full code:
http://pastebin.com/H3RsbmiW

Engine:
TFS 1.0

Thanks in advance,
Cheers.
Change "target->getStorageValue(39753)" to "targetPlayer->getStorageValue(39753)" you should as well use combatType != COMBAT_HEALING.
 
Code:
    int32_t storageAttacker, storageTarget
    attackerPlayer->getStorageValue(39753, storageAttacker)
    targetPlayer->getStorageValue(39753, storageTarget)
   
    if (storageAttacker == storageTarget && combatType != COMBAT_HEALING) {
                return false;
    }
 

Similar threads

Back
Top