• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

I cant understand spell dmg, heal formulas and one more question

Lopaskurwa

Well-Known Member
Joined
Oct 6, 2017
Messages
936
Solutions
2
Reaction score
57
Hi
so i have a problem with understanding heal dmg formulas how can i count how much do i get healed or how much do i hit from that spell
So first one is heal
LUA:
function onGetFormulaValues(cid, level, maglevel)
    min = (level * 8 + maglevel * 18) * 4.5 - 25
    max = (level * 9 + maglevel * 22) * 4.5
   
    if min < 250 then
        min = 250
    end

    return min, max
end
and these two are spell dmg with two different styles made
LUA:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -20.0, 0, -20.1, 0)
LUA:
function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 1.8) + 11)
    max = -((level / 5) + (maglevel * 3) + 19)
    return min, max
end

And why there is no such think as spellDamage="xx" in vocation.xml that would increase spell dmg so its like
meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"
 
Basically, you'll heal random amount between min and max value.
Assuming min = 500 and max = 1000,
you'll have a random chance between 500-1000.
But if min is, for example, 10, to prevent heals for "10", you set min =250.
So overall, minimum is 250.
For example, if we have 20 sorcerer with 30 magic level, it will heal you
min = (level * 8 + maglevel * 18) * 4.5 - 25
max = (level * 9 + maglevel * 22) * 4.5

min = (20* 8 + 30* 18) * 4.5 - 25
max = (20* 9 + 30* 22) * 4.5

min = 3125
max = 3780

so something between those numbers.
This is a lot, but I'm assuming you didn't meant
maglevel *18
maglevel *22
but rather
maglevel *1.8
maglevel*2.2
?

Anyways that's pretty simple, I guess?

There is no such thing as spellDamage, because basically "magic" prefessions tend to have higher magic level than paladins or knights.
Therefore, by per-se, their magic damage will increase both min and max damage/heal
min = (level * 8 + maglevel * 18) * 4.5 - 25


Also note how "attack" spells have "-" sign at the start. Because you're "adding" hp to monster; you want to add negative value.
i.e not monster_hp + spell_damage, but rather monster_hp + (-spell_damage).


Please ask direct question what's wrong, so I can elaborate more
 
Basically, you'll heal random amount between min and max value.
Assuming min = 500 and max = 1000,
you'll have a random chance between 500-1000.
But if min is, for example, 10, to prevent heals for "10", you set min =250.
So overall, minimum is 250.
For example, if we have 20 sorcerer with 30 magic level, it will heal you
min = (level * 8 + maglevel * 18) * 4.5 - 25
max = (level * 9 + maglevel * 22) * 4.5

min = (20* 8 + 30* 18) * 4.5 - 25
max = (20* 9 + 30* 22) * 4.5

min = 3125
max = 3780

so something between those numbers.
This is a lot, but I'm assuming you didn't meant
maglevel *18
maglevel *22
but rather
maglevel *1.8
maglevel*2.2
?

Anyways that's pretty simple, I guess?

There is no such thing as spellDamage, because basically "magic" prefessions tend to have higher magic level than paladins or knights.
Therefore, by per-se, their magic damage will increase both min and max damage/heal
min = (level * 8 + maglevel * 18) * 4.5 - 25


Also note how "attack" spells have "-" sign at the start. Because you're "adding" hp to monster; you want to add negative value.
i.e not monster_hp + spell_damage, but rather monster_hp + (-spell_damage).


Please ask direct question what's wrong, so I can elaborate more
Hmm so that heal spell is not what i needed, maybe you know how to achieve heal spell that heals with % like? It heals 45% of your health? Because using random stuff on heal is such a stupid think. So i kinda understand now how to count dmg but this one spell is different, you didnt said anything about it
LUA:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -20.0, 0, -20.1, 0)
 
Code:
function doPlayerAddManaPercent(cid, percent)       doPlayerAddMana(cid, (percent*getPlayerMaxMana(cid))/100)           end
function doPlayerAddHealthPercent(cid, percent)     doCreatureAddHealth(cid, (percent*getCreatureMaxHealth(cid))/100)   end
function doPlayerRemoveManaPercent(cid, percent)    doPlayerAddManaPercent(cid, -percent)                               end
function doPlayerRemoveHealthPercent(cid, percent)  doPlayerAddHealthPercent(cid, -percent)                             end
Add this in global.lua and use it.
 
Hmm so that heal spell is not what i needed, maybe you know how to achieve heal spell that heals with % like? It heals 45% of your health? Because using random stuff on heal is such a stupid think. So i kinda understand now how to count dmg but this one spell is different, you didnt said anything about it
LUA:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -20.0, 0, -20.1, 0)
Basically, it uses pre-defined setCombatFormula function, which is, shortly:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -20.0, 0, -20.1, 0)

Has defined something like
setCombatFormula(combat, type, mina, minb, maxa, maxb)
and is used to calculate it this way (formula might differ in your tfs version, but it's working the same way)

min = (int32_t)((player->getLevel() + player->getMagicLevel() * 4) * 1. * mina + minb);
max = (int32_t)((player->getLevel() + player->getMagicLevel() * 4) * 1. * maxa + maxb);

And, once again, it's number between those min and max
 
Code:
function doPlayerAddManaPercent(cid, percent)       doPlayerAddMana(cid, (percent*getPlayerMaxMana(cid))/100)           end
function doPlayerAddHealthPercent(cid, percent)     doCreatureAddHealth(cid, (percent*getCreatureMaxHealth(cid))/100)   end
function doPlayerRemoveManaPercent(cid, percent)    doPlayerAddManaPercent(cid, -percent)                               end
function doPlayerRemoveHealthPercent(cid, percent)  doPlayerAddHealthPercent(cid, -percent)                             end
Add this in global.lua and use it.
hmm?
 
Back
Top