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

Compiling [TFS 1.1] Constant health/mana regeneration

Cornwallis

Member
Joined
Jan 3, 2010
Messages
480
Reaction score
16
Hello, all I'm trying to accomplish is constant regeneration. I've previously had something similar, but if I remember right I used level and it wouldn't update whenever I advanced levels, which I imagine if this would have worked, which it won't, it would've done the same thing but I'm just trying it out. So I started at players.cpp:
HTML:
bool Player::setVocation(const Creature* creature)
{

    Condition* condition = getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT);
    condition->setParam(CONDITION_PARAM_HEALTHGAIN, !creature->getMaxHealth() * 0.05);
    condition->setParam(CONDITION_PARAM_HEALTHTICKS, 2000);
    condition->setParam(CONDITION_PARAM_MANAGAIN, !creature->getMaxMana() * 0.1);
    condition->setParam(CONDITION_PARAM_MANATICKS, 2000);
    return true;
}
It was originally:
HTML:
bool Player::setVocation(uint16_t vocId)
{
    Vocation* voc = g_vocations.getVocation(vocId);
    if (!voc) {
        return false;
    }
    vocation = voc;

    Condition* condition = getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT);
    if (condition) {
        condition->setParam(CONDITION_PARAM_HEALTHGAIN, vocation->getHealthGainAmount());
        condition->setParam(CONDITION_PARAM_HEALTHTICKS, vocation->getHealthGainTicks() * 1000);
        condition->setParam(CONDITION_PARAM_MANAGAIN, vocation->getManaGainAmount());
        condition->setParam(CONDITION_PARAM_MANATICKS, vocation->getManaGainTicks() * 1000);
    }
    return true;
}
and in players.h i changed it to:
HTML:
        bool setVocation(const Creature* creature) const;
from:
HTML:
        bool setVocation(uint16_t vocId);
        uint16_t getVocationId() const {
            return vocation->getId();
        }
Any questions please ask.
 
wouldn't do it in globalevents, either in an onAdvance creaturescript or implement updating it in onThink (but sources)
 
Back
Top