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

TFS 0.X TFS 0.4 remove full health and mana on level up

3688599

Darkness-babek.no-ip.org
Joined
Mar 23, 2013
Messages
92
Reaction score
12
Location
EGYPT
How do I remove full health and mana on level up system?
tfs 0.4

Note: I do not have any advance script for it in creatures folder
 
OP
OP
3688599

3688599

Darkness-babek.no-ip.org
Joined
Mar 23, 2013
Messages
92
Reaction score
12
Location
EGYPT
I believe this line is what heals the player upon level up.
Are you sure mana restores as well?
yeah after level up mana and health get full
Post automatically merged:

C++:
void Player::addExperience(uint64_t exp)
{
    uint32_t prevLevel = level;

    uint64_t nextLevelExp = Player::getExpForLevel(level + 1);
    if(Player::getExpForLevel(level) > nextLevelExp)
    {
        //player has reached max level
        levelPercent = 0;
        sendStats();
        return;
    }

    experience += exp;
    while(experience >= nextLevelExp)
    {
        ++level;
        Vocation* voc = vocation;
        if(voc->getId() > 0 && g_config.getBool(ConfigManager::ROOK_SYSTEM) &&
            level <= (uint32_t)g_config.getNumber(ConfigManager::ROOK_TOLEVEL))
        {
            if(Vocation* tmp = Vocations::getInstance()->getVocation(0))
                voc = tmp;
        }

        healthMax += voc->getGain(GAIN_HEALTH);
        health += voc->getGain(GAIN_HEALTH);
        manaMax += voc->getGain(GAIN_MANA);
        mana += voc->getGain(GAIN_MANA);
        capacity += voc->getGainCap();

        nextLevelExp = Player::getExpForLevel(level + 1);
        if(Player::getExpForLevel(level) > nextLevelExp) //player has reached max level
            break;
    }

    if(prevLevel != level)
    {
        updateBaseSpeed();
        g_game.changeSpeed(this, 0);
        if(party)
            party->updateSharedExperience();

        CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE);
        for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it)
            (*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level);

    std::stringstream s;
    s << "You advanced from Level " << prevLevel << " to Level " << level << ".";

    sendTextMessage(MSG_EVENT_ADVANCE, s.str());
}

    uint64_t currLevelExp = Player::getExpForLevel(level);
    nextLevelExp = Player::getExpForLevel(level + 1);
    levelPercent = 0;
    if(nextLevelExp > currLevelExp)
        levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);

    sendStats();
}
 
Top