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

Solved Monster levels system attack in health more than mana

S

Shadow_

Guest
Hello everyone, i disabled all health and mana change functions, brought 2 characters same level sorcerer and knight, and made a monster to damage of 1k min and max, the knight receive 1k (health) but the sorcerer received 500? I thought it might be something with vocations or creaturescripts health/mana change scripts so i disabled them all and gave knight mana shield and removed mana shield from sorcerer, now the same happens sorcerer received 1k (health)and knight received 500 (mana), also checked all functions responsible for health/mana change in my source i didn’t find something that may cause the damage to be half on mana combat, does anybody have clue why this is happening in tfs ?
 
Does it also happen on most recent 1.3?
just tested when you asked, the answer is nope, it does only in my TFS due to this Feature - [TFS 1.3] Monster Levels (https://otland.net/threads/tfs-1-3-monster-levels.260470/), the monster dmg bonus is added on bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage& damage) correctly but on combatChangeMana, its screwed up, idk how but i even added the same way to multiply in both, but as a try to fix i executed this in health change
C++:
        Monster* monster = attacker ? attacker->getMonster() : nullptr;
        if (monster && monster->getLevel() > 0) {
            float bonusDmg = g_config.getFloat(ConfigManager::MLVL_BONUSDMG) * monster->getLevel();
            if (bonusDmg != 0.0) {
                damage.primary.value += std::round(damage.primary.value * bonusDmg);
                damage.secondary.value += std::round(damage.secondary.value * bonusDmg);
            }
        }

and for manachange made it on manaLoss by moving it down under uint manaLoss and using this
manaLoss += std::round(manaLoss * bonusDmg);
, and it is still the same for HP i receive 1.6M//MP 250k,


PS: sorry for the miss-leading title, i would never discover without his question
 
maybe if you use it in monster.cpp will help you
Lua:
float bonusDmg = g_config.getFloat(ConfigManager::MLVL_BONUSDMG) * getLevel();
                minCombatValue = spellBlock.minCombatValue * bonusDmg;
                maxCombatValue = spellBlock.maxCombatValue *bonusDmg;
doAttacking and onThinkDefense

remove bonusdmg from game.cpp
 
maybe if you use it in monster.cpp will help you
Lua:
float bonusDmg = g_config.getFloat(ConfigManager::MLVL_BONUSDMG) * getLevel();
                minCombatValue = spellBlock.minCombatValue * bonusDmg;
                maxCombatValue = spellBlock.maxCombatValue *bonusDmg;
doAttacking and onThinkDefense

remove bonusdmg from game.cpp
Lua:
        if (canUseSpell(myPos, targetPos, spellBlock, interval, inRange, resetTicks)) {
            if (spellBlock.chance >= static_cast<uint32_t>(uniform_random(1, 100))) {
                if (updateLook) {
                    updateLookDirection();
                    updateLook = false;
                }
                minCombatValue = spellBlock.minCombatValue;
                maxCombatValue = spellBlock.maxCombatValue;
                if (getLevel() > 0) {
                    float bonusDmg = g_config.getFloat(ConfigManager::MLVL_BONUSDMG) * getLevel();
                    if (bonusDmg != 0.0) {
                        minCombatValue += std::round(minCombatValue * bonusDmg);
                        maxCombatValue += std::round(maxCombatValue * bonusDmg);
                    }
                }
                spellBlock.spell->castSpell(this, attackedCreature);

didn't work, bonus isn't added at all
i think i need to change getLevel() with level, doing that now
 
getlevel() = level check this
Code:
    int32_t getLevel() const {
            return level;
        }

but any way ur code must be like this
Lua:
                if (getLevel() > 0)
{
                    float bonusDmg = g_config.getFloat(ConfigManager::MLVL_BONUSDMG) * getLevel();
                    if (bonusDmg != 0.0)
{
                        minCombatValue += std::round(minCombatValue * bonusDmg);
                        maxCombatValue += std::round(maxCombatValue * bonusDmg);
}
else
                minCombatValue = spellBlock.minCombatValue;
                maxCombatValue = spellBlock.maxCombatValue;

}
don't check normal combat at first
 
getlevel() = level check this
Code:
    int32_t getLevel() const {
            return level;
        }

but any way ur code must be like this
Lua:
                if (getLevel() > 0)
{
                    float bonusDmg = g_config.getFloat(ConfigManager::MLVL_BONUSDMG) * getLevel();
                    if (bonusDmg != 0.0)
{
                        minCombatValue += std::round(minCombatValue * bonusDmg);
                        maxCombatValue += std::round(maxCombatValue * bonusDmg);
}
else
                minCombatValue = spellBlock.minCombatValue;
                maxCombatValue = spellBlock.maxCombatValue;

}
don't check normal combat at first
i got this part of spells to work but melee doesn't work, only spells that have chances
 
Back
Top