• 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!

C++ increase hp and mana for storage

Izaack

Member
Joined
Jun 18, 2012
Messages
70
Solutions
1
Reaction score
17
Location
México
Hello otland i have a question, I need to do that when a xxxx storage = 10 it increases the player's base mana and hp by 10% example
a sorcerer gains 40 mana per level, if xxxx storage = 10 then the sorcerer will gain 10% more base mana, meaning he would win
mana = 44 mana points per level because 10% of 40 would be 4 so if the player has storage xxxx = 100, he would gain 80 mana points per level and so on, I was moving him to players.cpp but I couldn't get him to respect this operation.

Here I leave the code that I was using, I hope you can help me.

C++:
double Player::gethealthbouns() const
{
float healthbouns = 0;
std::string value;
getStorage("40000", value);
if (value != "-1")
{
healthbouns = atof(value.c_str());
}

    return healthbouns*0.01;
}


        float bouns = health*gethealthbouns();       
        healthMax += vocation->getGain(GAIN_HEALTH);
        health += vocation->getGain(GAIN_HEALTH);
        manaMax += vocation->getGain(GAIN_MANA);
        mana += vocation->getGain(GAIN_MANA)+bouns;
        capacity += voc->getGainCap();
Post automatically merged:

any?
Post automatically merged:

any?
 
Last edited:
Back
Top