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:
It was originally:
and in players.h i changed it to:
from:
Any questions please ask.
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;
}
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;
}
HTML:
bool setVocation(const Creature* creature) const;
HTML:
bool setVocation(uint16_t vocId);
uint16_t getVocationId() const {
return vocation->getId();
}