• 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] 1.5 Source edit to prevent skill lose when player dies (SOLVED)

Status
Not open for further replies.

Redz

New Member
Joined
Mar 3, 2023
Messages
2
Reaction score
1
Id like to modify this code in order to make the following changes in game:

1. Players don't lose skills or magic level on death

C++:
        //Magic level loss
        uint64_t sumMana = 0;
        for (uint32_t i = 1; i <= magLevel; ++i) {
            sumMana += vocation->getReqMana(i);
        }

        //double deathLossPercent = getLostPercent() * (unfairFightReduction / 100.);
        double deathLossPercent = getLostPercent();
        removeManaSpent(static_cast<uint64_t>((sumMana + manaSpent) * deathLossPercent), false);

        //Skill loss
        for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; ++i) { //for each skill
            uint64_t sumSkillTries = 0;
            for (uint16_t c = MINIMUM_SKILL_LEVEL + 1; c <= skills[i].level; ++c) { //sum up all required tries for all skill levels
                sumSkillTries += vocation->getReqSkillTries(i, c);
            }

2. Player won't downgrade from level 100 when dying

C++:
            while (level > 1 && experience < Player::getExpForLevel(level)) {
                --level;
                healthMax = std::max<int32_t>(0, healthMax - vocation->getHPGain());
                manaMax = std::max<int32_t>(0, manaMax - vocation->getManaGain());
                capacity = std::max<int32_t>(0, capacity - vocation->getCapGain());
            }

Im not sure how exactly to make the changes in order to not bug the src files when compiling, any advice or help implementing the modification will be appretiated
 
config lua does not work ?

Lua:
-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = -1
 
SOLVED PLEASE DELETE
Please, never do that, you asked for public help, u should gave solution in post and keep the post. with this way that i said we are creating a huge knowledge base, because many ppl can appear your problem and here shouldbe a solution.
 
Please, never do that, you asked for public help, u should gave solution in post and keep the post. with this way that i said we are creating a huge knowledge base, because many ppl can appear your problem and here shouldbe a solution.

You are right.
 
Status
Not open for further replies.
Back
Top