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

Increase maximum health per storage

felipemko

New Member
Joined
Mar 2, 2010
Messages
173
Reaction score
3
Hi everyone,
Can you guys help me?

I need something like a player gain % of maximum health per value of storage.

Example:
Each value of storage add 5% of maximum health

So a player with value 7 of storage gain 35% more health

Player normal health: 100
Player with 7 of storage: 135 (100+35% above maximum health)

@heba can you help me with this too?
 
Solution
I sent for you in private
in player.cpp add this
Lua:
int32_t Player::gethealthbouns() const
{
int32_t healthbouns = 0;
std::string value;
getStorage("218984", value);
if (value != "-1")
{
healthbouns = atoi(value.c_str());
}

    return healthbouns*5;
}
after getArmor()

and in function addExperience change this
Code:
healthMax += vocation->getGain(GAIN_HEALTH);
        health += vocation->getGain(GAIN_HEALTH);
        manaMax += vocation->getGain(GAIN_MANA);
        mana += vocation->getGain(GAIN_MANA);
to
Code:
uint32_t bouns = healthMax*gethealthbouns()/100;       
 healthMax += vocation->getGain(GAIN_HEALTH)+bouns ;
        health += vocation->getGain(GAIN_HEALTH)+bouns ;
        manaMax +=...
I sent for you in private
in player.cpp add this
Lua:
int32_t Player::gethealthbouns() const
{
int32_t healthbouns = 0;
std::string value;
getStorage("218984", value);
if (value != "-1")
{
healthbouns = atoi(value.c_str());
}

    return healthbouns*5;
}
after getArmor()

and in function addExperience change this
Code:
healthMax += vocation->getGain(GAIN_HEALTH);
        health += vocation->getGain(GAIN_HEALTH);
        manaMax += vocation->getGain(GAIN_MANA);
        mana += vocation->getGain(GAIN_MANA);
to
Code:
uint32_t bouns = healthMax*gethealthbouns()/100;       
 healthMax += vocation->getGain(GAIN_HEALTH)+bouns ;
        health += vocation->getGain(GAIN_HEALTH)+bouns ;
        manaMax += vocation->getGain(GAIN_MANA)+bouns;
        mana += vocation->getGain(GAIN_MANA)+bouns;
and in player.h
add virtual int32_t gethealthbouns() const;
 
Solution
Why do you need to set a storage if its adding the health/mana based on level? Just add it in vocations.xml.
 
Back
Top