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

[SPELLS] Damage

Maxens

Member
Joined
Apr 9, 2009
Messages
479
Reaction score
7
Location
Germany
Hello everyone! :)

Im bored of trying out which numbers i have to put into my spell scripts to get the right damage...could anyone explain me what each number means and so on? and is there a way to make that the spell hits for example between 300 and 600?

I mean this numbers:

PHP:
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -12, -12, -12, -12)

Thanks ;)
 
not tested

PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(cid, level, maglevel)
	min = (level * maglevel) / 10
	max = (level * maglevel) / 8
	return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") 
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, mina, minb, maxa, maxb)

how to determine your minmum damage and maximum damage :

Minimum = (lvl/mina)+(ml*maxa)
Maximum = (lvl/minb)+(ml*maxb)

i think u got it right ?

rep+ if it helps
 
You can also do it like this. here you can use with more mlvl or lvl effect. This should give attack 40-50k on lvl 8000 with ml 50. I did holydamage as example.

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
min = -(maglevel*750) -level/5 -900
max = -(maglevel*940) -level/5 -1400

return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 
Last edited:
Could you explain me the numbers? cuz for me it doesnt make sense xDD
if u mean your main formula so here its

setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, mina, minb, maxa, maxb)

how to determine your minmum damage and maximum damage :

Minimum = (lvl/mina)+(ml*maxa)
Maximum = (lvl/minb)+(ml*maxb)

i think u got it right ?

rep+ if it helps


if u mean Limos's script u have to edit this
Lua:
min = -(maglevel*750) -level/5 -760
max = -(maglevel*1030) -level/5 -1080

edit number so u get the damage as u want
its depends on calculation

for example player lvl = 8000 and ml 50

min = -(50*750) -8000/5 -760 = 35140
max = -(50*1030) -8000/5 -1080 = 48820

so your hit's damage gonna be from 35140 to 48820
 
I didn't made the damage precisely, already corrected it in my post, but you have to do it like this.
(maglvl*750) + (lvl/5) + 900 = 40000.
 
Last edited:
Well I am going to explain.

Code :

HTML:
1.0, -900, 3.2, -1100)


The first number is the multiplier of your skill (If it's set to COMBAT_FORMULAT_LEVELMAGIC, then it will be based of magic level, if set to SKILL then your main melee skill will take over the others)

The second number is the minimum damage (If you want to make a healing spell, remove the - (negative) symbol of the second and fourth numbers)

The third number is the multiplier of your character level.

The fourth number is the maximum damage (Read the parenthesis of the second set of number)

Now, there is a difference between SKILL and LEVELMAGIC formulas.

If you want them to deal damage and not heal each one has a different setup.

Code :

HTML:
COMBAT_FORMULA_SKILL, 1.0, -100, 1.0, -200)

Will deal damage

Code :

HTML:
COMBAT_FORMULA_SKILL, -1.0, -100, -1.0, -200)

WILL HEAL THE ENEMY IF YOU ARE HIGH LEVEL OR HAVE A HIGH SKILL LEVEL

Code :
HTML:
COMBAT_FORMULA_SKILL, -1.0, 100, -1.0, 200)
Will heal the enemy

Code :

HTML:
COMBAT_FORMULA_LEVELMAGIC, 1.0, -100, 1.0, -200)

WILL HEAL THE ENEMY IF YOU ARE HIGH LEVEL OR HAVE A HIGH MAGIC LEVEL
Note: Will deal damage if you are low level and have a low magic level since minimum and maximum damage are negative

Code :

HTML:
COMBAT_FORMULA_LEVELMAGIC, -1.0, -100, -1.0, -200)

Will completely deal damage to the enemy

Code :

HTML:
COMBAT_FORMULA_LEVELMAGIC, 1.0, 100, 1.0, 200)

Will heal the enemy.


So yeah, I think you get it how SKILL and LEVELMAGIC works now.

Now let's make some calculations on how the multipliers add up to the minimum and maximum damage.

Suppose you have this:
Code :

HTML:
COMBAT_FORMULA_LEVELMAGIC, -1.0, -100, -1.0, -200)


And you are a level 100 character with 100 Magic level

first off at level 0 you would deal 100~200 damage.
Now at level 100 with 100 Magic level you would add up the first and third value (100+100) which is 200, and then add it up to both minimum and maximum damage

Which will be 300~400 damage at level 100 with 100 magic level.

So always sum up the first and third value, and them add it to both minimum and maximum values (The second and fourth).
I wish you understand :)
This tutorial was by Teclis in Otfans I saw that it suits what you want :)
 
Lua:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -8, -1, -14, 5, 5, 1.4, 2.2)
minimum damage multiplier, minimum damage constant, maximum damage modifier, maximum damage constant, level / this value for min damage, level/ this value for max dmg, magic * this min, magic * this max.

In this example, the formula translates to
min = -1*(level/5+mlvl*1.4 - -8)
max = -1*(level/5+mlvl*2.2 - -14)

this is the ONLY formula you should use for every spell, if it is a healing spell you will need to use
Lua:
function onGetFormulaValues(cid, level, maglevel)
	local min = (0.2*level+4*maglevel+24)
	local max = (0.2*level+8*maglevel+50)
	return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
which is self explanatory.


Dont forget that every single spell in tibia uses level/5, so you shouldnt change that variable. Rep+
 
Last edited:
Back
Top