• 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.X+ bless lose c++

jo31

New Member
Joined
May 24, 2010
Messages
70
Reaction score
1
Location
Sweden
People lose lvl with blessing
but I want the opposite of it. so players lose like 30% of exp without blessing and with the blessing they don't lose anything level/magic/skills.

in config I use -1

I tried so many diffrent combo in that section it says the line loss, but last time i changed the line where it says bless loss but it becomes fucked up when I tried it so I made everything over again so now I am on square one
with only one change, haven't compiled yet this line you see here

from this

C++:
uint64_t expLoss = static_cast<uint64_t>(experience * deathLossPercent);

to

C++:
uint64_t expLoss = (uint64_t)(experience * deathLossPercent * 1);
 
People lose lvl with blessing
but I want the opposite of it. so players lose like 30% of exp without blessing and with the blessing they don't lose anything level/magic/skills.

in config I use -1

I tried so many diffrent combo in that section it says the line loss, but last time i changed the line where it says bless loss but it becomes fucked up when I tried it so I made everything over again so now I am on square one
with only one change, haven't compiled yet this line you see here

from this

C++:
uint64_t expLoss = static_cast<uint64_t>(experience * deathLossPercent);

to

C++:
uint64_t expLoss = (uint64_t)(experience * deathLossPercent * 1);
data/lib/core/player.lua
Lua:
function Player.getLossPercent(self)
    local blessings = 0
    local lossPercent = {
        [0] = 100,
        [1] = 70,
        [2] = 45,
        [3] = 25,
        [4] = 10,
        [5] = 0
    }

    for i = 1, 5 do
        if self:hasBlessing(i) then
            blessings = blessings + 1
        end
    end
    return lossPercent[blessings]
end
 
data/lib/core/player.lua
Lua:
function Player.getLossPercent(self)

That's not what he wants. And that function ignores premium.
Post automatically merged:

Diff:
diff --git a/src/player.cpp b/src/player.cpp
index 13acfcca..afb86b25 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -1931,6 +1931,9 @@ void Player::death(Creature* lastHitCreature)
                        lostMana -= manaSpent;
                        manaSpent = vocation->getReqMana(magLevel);
                        magLevel--;
+                       // By setting remaining mana to take away to 0 at end of first loop
+                       //     The maximum magLevel lost is 1
+                       lostMana = 0;
                }
 
                manaSpent -= lostMana;
@@ -1964,6 +1967,9 @@ void Player::death(Creature* lastHitCreature)
 
                                skills[i].tries = vocation->getReqSkillTries(i, skills[i].level);
                                skills[i].level--;
+                               // Just like magic, setting remaining to take away to 0 at end of first loop
+                               //     The maximum levels lost is 1
+                               lostSkillTries = 0;
                        }
 
                        skills[i].tries = std::max<int32_t>(0, skills[i].tries - lostSkillTries);
@@ -1972,6 +1978,7 @@ void Player::death(Creature* lastHitCreature)
 
                //Level loss
                uint64_t expLoss = static_cast<uint64_t>(experience * deathLossPercent);
+               expLoss = std::min<uint64_t>(expLoss, experience - Player::getExpForLevel(level) - 1);
                g_events->eventPlayerOnLoseExperience(this, expLoss);
 
                if (expLoss != 0) {

This patch would eliminate player level loss, and limit magic level and skill level loss to just 1.
 
Last edited:
I want People to not lose anything at all (not exp, not skills, items Or ml) with !bless/blessings

And without blessings i want them to only lose 30% exp (depends on level)

Like level 100 loses 1-2 levels while level 500 lose 30%


And also fix/reduce experience from players..
Killing a player within 50 levels up Or down Will give you 15-30% exp depends on level differences.

It cant be that Hard to solve it!? I really need help fixing this
 
Ok. I believe paying for people's time is allowed here. 🤭
Post automatically merged:

This should do Magic level the way you described.

Diff:
diff --git a/src/player.cpp b/src/player.cpp
index 280eb111..25b6dc3c 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -1913,27 +1913,39 @@ void Player::death(Creature* lastHitCreature)
                }
 
                //Magic level loss
-               uint64_t sumMana = 0;
-               uint64_t lostMana = 0;
+               //uint64_t sumMana = 0;
+               //uint64_t lostMana = 0;
 
                //sum up all the mana
-               for (uint32_t i = 1; i <= magLevel; ++i) {
-                       sumMana += vocation->getReqMana(i);
-               }
+               //for (uint32_t i = 1; i <= magLevel; ++i) {
+               //      sumMana += vocation->getReqMana(i);
+               //}
 
-               sumMana += manaSpent;
+               //sumMana += manaSpent;
 
-               double deathLossPercent = getLostPercent() * (unfairFightReduction / 100.);
 
-               lostMana = static_cast<uint64_t>(sumMana * deathLossPercent);
+               double deathLossPercent = getLostPercent() * (unfairFightReduction / 100.);
 
-               while (lostMana > manaSpent && magLevel > 0) {
-                       lostMana -= manaSpent;
-                       manaSpent = vocation->getReqMana(magLevel);
-                       magLevel--;
+               //lostMana = static_cast<uint64_t>(sumMana * deathLossPercent);
+               //lostMana = static_cast<uint64_t>(sumMana * deathLossPercent);
+
+               //while (lostMana > manaSpent && magLevel > 0) {
+               //      lostMana -= manaSpent;
+               //      manaSpent = vocation->getReqMana(magLevel);
+               //      magLevel--;
+               //}
+               uint64_t bottom = vocation->getReqMana(magLevel);
+               uint64_t range = vocation->getReqMana(magLevel + 1) - bottom;
+               range = range * 0.30;
+
+               if(manaSpent - range > bottom)
+               {
+                       manaSpent -= range;
+               } else {
+                       manaSpent = bottom + 1;
                }
 
-               manaSpent -= lostMana;
+               //manaSpent -= lostMana;
 
                uint64_t nextReqMana = vocation->getReqMana(magLevel + 1);
                if (nextReqMana > vocation->getReqMana(magLevel)) {
 
Last edited:
Back
Top