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

C++ [TFS 0x] Life Leech ?

Mokk

New Member
Joined
Jun 2, 2023
Messages
12
Reaction score
4
Hello everyone,

I would like to know if someone could help me add new attributes in TFS 0.4 like Life Leech/Absorb for example.

I appreciate everyone's attention, thank you very much!
 
Solution
in combat.cpp in bool Combat::CombatHealthFunc add

Code:
if(caster->getPlayer()&& params.combatType != COMBAT_HEALING )
        {
            int32_t Lifeleech = caster->getPlayer()->getLifeLeechAmount(); // you can set it empty storage
            int32_t Lifeleechchance = caster->getPlayer()->getLifeLeechChance(); // you can set it empty storage
            if(Lifeleech > 0)
            {
                int32_t amount = std::abs((int32_t)std::floor((change * (Lifeleech / 100.))));
                if(amount > 0 && random_range(1, 100) <= Lifeleechchance)
                {
                        g_game.combatChangeHealth(COMBAT_HEALING, caster->getPlayer(), caster->getPlayer(), amount)...
in combat.cpp in bool Combat::CombatHealthFunc add

Code:
if(caster->getPlayer()&& params.combatType != COMBAT_HEALING )
        {
            int32_t Lifeleech = caster->getPlayer()->getLifeLeechAmount(); // you can set it empty storage
            int32_t Lifeleechchance = caster->getPlayer()->getLifeLeechChance(); // you can set it empty storage
            if(Lifeleech > 0)
            {
                int32_t amount = std::abs((int32_t)std::floor((change * (Lifeleech / 100.))));
                if(amount > 0 && random_range(1, 100) <= Lifeleechchance)
                {
                        g_game.combatChangeHealth(COMBAT_HEALING, caster->getPlayer(), caster->getPlayer(), amount);
                        g_game.addMagicEffect(pCaster->getPosition(), MAGIC_EFFECT_WRAPS_RED); // add effect you want here
                }
            }
        }
that how life leech work u can make same for mana leech
will work for spells and weapons
 
Solution
Why not using tfs 1.x ?
Because my server on TFS 0.4 is almost ready, I tried to use 1x versions but I couldn't add some modifications in the font that for my server is essential, in addition to some scripts that I couldn't adapt to 1x, so I decided to stay on 0.4, what I lack is just that of adding new attributes like Life Leech for example
Post automatically merged:

Issue resolved with @Elgenady support
 
Last edited:
Back
Top