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

Lua COMBAT_FORMULA (How?)

Taurus

Texass
Joined
Jan 11, 2009
Messages
616
Solutions
2
Reaction score
30
Location
United States
I need to know how this works so that I can get the spell editing thing down.

Code:
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, [COLOR="red"]5[/COLOR], [COLOR="lime"]5[/COLOR], [COLOR="yellow"]7[/COLOR], [COLOR="darkorange"]14[/COLOR])

(Color coded so posters can say "red number does this")

I need to know which numbers do what.

And maybe the best advice for editing them lol (If you know a trick)

Thanks so much for your help in understanding this.

rep+ for solid responses.
 
red = level divisor for the minimum damage formula
green = level divisor for the maximum damage formula
yellow = magic level multiplier for the minimum damage formula
orange = magic level multiplier for the maximum damage formula

That was fast, aha? :3

This is how it looks in the end:
Code:
min = level / 5 + maglevel * 7
max = level / 5 + maglevel * 14
The final number will be a number between min and max.

If you want a custom formula; it is, of course, possible to add something like this in your script, instead of the usual setAttackFormula:
LUA:
function onGetFormulaValues(cid, level, maglevel)
	local min = level / 5 + maglevel * 1.4
	local max = level / 5 + maglevel * 2.8
	return -math.max(40, min), -math.max(70, max)
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, 'onGetFormulaValues')
 
Last edited:
THANK YOU

How did I know it would be Cyko that answered :P

Now I can actually edit spells, It is a really important thing to know before altering those scripts :P

Thanks Cyko.
 
Back
Top