• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Feature [0.4] All heal / damage in percentage

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,752
Solutions
5
Reaction score
756
Hello,
I was looking around and saw this thread, and the idea for a high exp server seemed pretty wonderful, but I couldn't find it released anywhere, so I got some help, and we made things work! So I'd want to share this with anyone else who would like to have this implemented on their server!

What is this?
This will change every healing (runes, potions, spells etc) and every damage (melee, spells etc) to a percentage looking
Example:
image.png
riL34U1.png


Open your game.cpp

Replace
Code:
sprintf(buffer, "+%d", healthChange);
with
Code:
int percentHealthChange = (int) round(healthChange / (target->getMaxHealth() / 100));
sprintf(buffer, "+%d%%", percentHealthChange);

replace
Code:
sprintf(buffer, "%d", manaDamage);
with
Code:
int percentManaChange = (int) round(manaDamage / (target->getMaxMana() / 100.));
sprintf(buffer, "%d%%", percentManaChange);

replace
Code:
sprintf(buffer, "%d", damage);
with
Code:
int percentHealthChange2 = (int) round(damage / (target->getMaxHealth() / 100.));
sprintf(buffer, "%d%%", percentHealthChange2);

replace
Code:
sprintf(buffer, "+%d", manaChange);
with
Code:
int percentManaChange2 = (int) round(manaChange / (target->getMaxMana() / 100.));
sprintf(buffer, "+%d%%", percentManaChange2);

and replace
Code:
sprintf(buffer, "%d", manaLoss);
with
Code:
int percentManaChange3 = (int) round(manaLoss / (target->getMaxMana() / 100.));
sprintf(buffer, "%d%%", percentManaChange3);

Shoutout to Carcoo & GPedro for making it happen
 

Fanni

Member
Joined
Oct 30, 2015
Messages
19
Reaction score
19
int percentManaChange2 = (int) round(getMaxMana( / (target->manaChangegetMaxMana() / 100.));
 

ArnHD

New Member
Joined
Feb 5, 2020
Messages
2
Reaction score
0
what is this error?

C++:
game.cpp: In member function ‘bool Game::combatChangeHealth(const CombatParams&, Creature*, Creature*, int32_t, bool)’:
game.cpp:4864:81: error: call of overloaded ‘round(int32_t)’ is ambiguous
    int percentHealthChange = round(healthChange / (target->getMaxHealth() / 100));
                                                                                 ^
done.
solution on TFS 0.3.6
C++:
            int32_t percentHealthChange = (int32_t) (healthChange / (target->getMaxHealth() / 100));
            sprintf(buffer, "+%d%%", percentHealthChange);
 
Last edited:
Top