• 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 Spells FORMULA_LEVELMAGIC, FORMULA_SKILL

Joined
Jul 25, 2007
Messages
382
Reaction score
38
Don't understand the spell damage formulas, I posted them from combat.cpp.

COMBAT_FORMULA_SKILL

Code:
					Item* tool = player->getWeapon();
					const Weapon* weapon = g_weapons->getWeapon(tool);

					min = (int32_t)minb;
					if(weapon)
					{
						max = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb);
						if(params.useCharges && tool->hasCharges())
						{
							int32_t newCharge = std::max<int32_t>(0, tool->getCharges() - 1);
							g_game.transformItem(tool, tool->getID(), newCharge);
						}
					}

I thought this was max = wep_damage * max_a + max_b, through testing that is clearly not the case at all. I think it factors in player skill level too? I don't know, there isn't any documentation on this anywhere that I can find and it's kind of important if you plan to change spell damages. Can anyone properly explain the formula?


COMBAT_FORMULA_LEVELMAGIC​
Code:
max = (int32_t)((player->getLevel() * 2 + player->getMagicLevel() * 3) * 1. * mina + minb);
min = (int32_t)((player->getLevel() * 2 + player->getMagicLevel() * 3) * 1. * maxa + maxb);

Don't understand why theirs negative values for min in spells etc, just as confused.
 
Last edited:
you can make ur own formulas with a function. i forgot the name of it but there's many spells released with it. it makes it a lot easier to make spells with rl dmg and to balance it easier.
 
Lua:
function getDmg_combat(cid, level, maglevel)
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getDmg_combat")

You use something similar to this.
 
Code:
function getDmg_combat(cid)
	local min = 20
	local max = 40 
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getDmg_combat")

EDIT --- Got it working changed min, max values to negative and everything is fine. Thanks a lot.
 
Last edited:
Back
Top