• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Community effort to improve spell forumlas!

The formulas for strike spells are as follows (compliments of a bit of outside help making it pretty)
A(B*sqrt(X)+Y)-C

X=level, Y=magic
min: A=1.3, B=3, C=5
max: A=1.7, B=4, C=X/20

This formula is true to within 1 at any combination of level and magic levels :). As you can see it was a simple formula as I expected, and easily customizable in spell config files with only 3 variables as predicted.

An example LUA script for energy strike would be as follows:
Lua:
--Spell config, do not edit anything outside of this area!---------------------------
----Editting any values in this LUA will deviate from actual tibia damages-----------
local DamageMultiplierMin = 1.3 --minimum damage multiplier 
local DamageMultiplierMax = 1.7 --maximum damage multiplier 
--------------------------------------------------------------------------------
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onGetFormulaValues(cid, level, maglevel)
        local B = 3
        local C = 5
        local D = 4
        local E = level/20
	local min = DamageMultiplierMin*(B*math.sqrt(level)+maglevel)-C
	local max = DamageMultiplierMax*(D*math.sqrt(level)+maglevel)-E
	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

I would like help making it simpler to view. For example we could have the damage formula and then case min (a=1,b=2,c=3) and case max, or something similar to that. Any suggestions as to what is simplest and easiest to understand are welcomed.
 
Last edited:
If you need some help generating values I have an 100 ED.
Just tell me which spells on which monsters how many times.

Red
 
Like Red I have some characters.
I have a 195 RP, 94 ED, 40 EK, 20 ED.

If that could help in anyway, let me know.
 
Extending the strike formula we got 12 variables. Mina, minb, minc, minxdiv, minydiv(not used but may appear in some spells), minconst and the same for max. We just have to find out if we can get all formulas in that format math.random(mina*(minb*sqrt(lvl)+minc*mlvl)-lvl/minlvldiv-mlvl/minmlvldiv-const, thesameformax). I hope that it is possible. That way it would be easy to just hardcode formula or at least put it in lib.
And I have small question, is just sqrt right one or the lvl/sqrt was right one?
 
Well I was thinking. mina,b,c, and maxa,b,c SHOULD be sufficient.

A acts as the multiplier that affects the spells power.
B acts as a level multiplier to create the ratio between level and mlvl that we want.
C acts as a flat change which is necessary.

Between these variables I think we should be able to replicate any formula. The reason I exclude D is that it is much simpler to create a formula where we have a constant such as the magic level. Excluding D should not have any effect other than simplification.

I consider C, whether it is x, 2x, 2x^2, xy, y, y+7 etc... to be a single variable. It is only to move the spell up and down the Y axis.

I think we should consider it as 3 variables for min, and 3 variables for max.

in reality even
ASqrt(level) + Bmagic - C
A=6.8 B=1.7 C = level/20
would work. In fact I think Ill use it. I had somebody look at it because I knew it could be simplified in some way, they factored the 1.7 in and that was the result.

And I have small question, is just sqrt right one or the lvl/sqrt was right one?

It was a mistake by myself. 3/root3 = root3, I was too silly to realize this in my first formula I made.

The real LUA should look similar to
Code:
--Spell config, do not edit anything outside of this area!---------------------------
----Editting any values in this LUA will deviate from actual tibia damages-----------
local Min = 1 --minimum damage multiplier 
local Max = 1 --maximum damage multiplier 
--------------------------------------------------------------------------------
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
 
function onGetFormulaValues(cid, level, maglevel)
    local A = 3.9
    local B = 1.3
    local C = 5
	
    local D = 6.8
    local E = 1.7
    local F = level/20
    local min = -(Min)*(A*math.sqrt(level) + B*maglevel -C)
    local max = -(Max)*(D*math.sqrt(level) + E*maglevel -F)
    return min, max
end
 
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
If anyone is so inclined, Id like some nice way to lay the variables out in lua so we have less lines of random variables.
 
Last edited:
Woot. Right, you are absolutely right about square root. But about variables in formula: it's better to prepare for more and them just exclude one or two if they won't be used at all in even single spell using that formula type probably. And it would be easier to put only numbers in variables than formulas like x^2-5(if formula is first sent to server and then values are set to variables sending formula as variable would be bit harder if we want to use it in c, in lua anything will work I guess)
 
Well I know what you're implying, but can you explain the problems with C more? Will putting formulas IN variables cause issues? Right now I see this as the simplest way to make the script (while allowing for customization), but I may be wrong. As long as everything is simple I am happy, I feel too many variables complicates it.

I also have an idea. Can I get somebody to test exori mort? If it follows this formula it is a surefire way to get monster armor values.

Aha, fixed another issue. The reason I had level/20 was because I had one variable too high. Every single formula is possible with 3 float variables for min and max. I hope that solves any of your worries.
 
Last edited:
When using current formula levelmagic variables are sent from lua interface to c++ so putting formula as a variable just won't work(variables are defined before spell is called so we don't know level or magic yet)
probably even using formula in spells lib would generate some problems.
Mort for sure user strike formula but it is death spell not physical for quite long time now
 
Well, Ive realized something that makes the whole issue irrelevant. My formula is wrong.

I dont know if wrong is the right word, but even if it works in all cases there is a simpler version. I made a serious mistake.

Tibia uses ridiculously simple formulas, and somehow I was replicating them at 3 points with my silly one. There are only 4 variables. Level*float + magic*float, constmin and constmax. So essentially not only did I overthink the entire issue, I wasted a lot of time :). At least now Ill be able to find all formulas quite fast.
 
Last edited:
Back
Top