• 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+ tfs 1.3 (how change formula HIT damage?)

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Iam using tfs 1.3
where do I change the formula of HIT damage?
for example, a player with skill Axe (100) + Fire Axe hit Y value.
I want to change the formula, for people hit 2Y for exemple.
How can i do it?
 
Solution
E
defense formula (player.cpp):
return (defenseSkill / 4. + 2.23) * defenseValue * 0.15 * getDefenseFactor() * vocation->defenseMultiplier;

weapon formula (weapons.cpp):
return static_cast<int32_t>(std::round((level / 5) + (((((attackSkill / 4.) + 1) * (attackValue / 3.)) * 1.03) / attackFactor)));

and hit chance is calculated here onward
You may not know that damage can also be controlled through the vocations.xml file:
XML:
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />

It is not the only way, but it is the most direct and easy
 
You may not know that damage can also be controlled through the vocations.xml file:
XML:
<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />

It is not the only way, but it is the most direct and easy
thanks, and how can i make 1 skill hit more than the current formula?
for exemple, if i need to change the spells formula damage, i edit here in combat.cpp
Lua:
else if (formulaType == COMBAT_FORMULA_LEVELMAGIC) {
                int32_t levelFormula = player->getLevel() * 2 + player->getMagicLevel() * 3;

but i want to change the skill formula (hit with sword, axe, etc etc etc), do u know how?
 
defense formula (player.cpp):
return (defenseSkill / 4. + 2.23) * defenseValue * 0.15 * getDefenseFactor() * vocation->defenseMultiplier;

weapon formula (weapons.cpp):
return static_cast<int32_t>(std::round((level / 5) + (((((attackSkill / 4.) + 1) * (attackValue / 3.)) * 1.03) / attackFactor)));

and hit chance is calculated here onward
 
Solution
do u know what
Code:
4.
in formula means?
C++:
defenseSkill / 4.
what is this 4.? equal a 4? is same if i put 4?
 
do u know what
Code:
4.
in formula means?
C++:
defenseSkill / 4.
what is this 4.? equal a 4? is same if i put 4?
It's so that it becomes floating point division, the dot makes the 4 into a double, so the result of the division will be a double instead of an integer. Otherwise, integer division will not give the same result because c++ is strict when it comes to that, the result will be truncated to an integer and all decimals are thrown away. If you're expecting a decimal result from any division, at least one of the operands must be a float or double.
 
where to edit so the player is likely to hit 800-1000 instead of 100-1000 ??

defense formula (player.cpp):
return (defenseSkill / 4. + 2.23) * defenseValue * 0.15 * getDefenseFactor() * vocation->defenseMultiplier;

weapon formula (weapons.cpp):
return static_cast<int32_t>(std::round((level / 5) + (((((attackSkill / 4.) + 1) * (attackValue / 3.)) * 1.03) / attackFactor)));

and hit chance is calculated here onward
 
Back
Top