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

Solved Spell damage

seleo

Active Member
Joined
Jun 6, 2012
Messages
498
Reaction score
33
Location
Egypt
Hello
would some one explain how this formula working ?

PHP:
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.4, 2.8, 40, 70)

i want to edit my server spells damages

so please someone explain how this formula working

or if there any other formula that explained before and i can use on my server please show me it

im using TFS 0.3.5pl1
 
Best way is to just use combat callback and define the formula exactly how you want it.
Otherwise go and check the sources which paramater is what.

LUA:
function getCombatFormulas(cid, lv, maglv)
	local min = (lv*0.8 + maglv*1.2) - 10
	local max = (lv*0.8 + maglv*1.2) - 30

	return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas")
 
so if u remove this formula

setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.4, 2.8, 40, 70)

and add the other one that you just writed it will work without source editing ?
 
You never need source editing, but by viewing the sources you can see which value is what.
Which server are you using / where did you download?
 
im using TFS 0.3.5pl1
alright thanks for your help :)
but what about the knight and paladin spells
add the forumla please :D

- - - Updated - - -

add a full spell script please as example
 
This is the default berserk script from 0.3.6.
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

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

function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack, level / 5
	return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 1.5 + levelTotal)
end

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

but i want to use the formula that Summ added before with this spell

PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.9, 3.0, 40, 70)

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

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

how it will look like when i added the formula
sorry about that im kinda new
 
You wanted this, but then for skill right?
LUA:
function getCombatFormulas(cid, lv, maglv)
	local min = (lv*0.8 + maglv*1.2) - 10
	local max = (lv*0.8 + maglv*1.2) - 30
 
	return -min, -max
end
 
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas")
That beserk script is using that, it might look a bit different, but it's basicly the same, you can do it with the min and max too.
Or do you mean that spell with CALLBACK_PARAM_SKILLVALUE instead of CALLBACK_PARAM_LEVELMAGICVALUE?
It would be the same way, so like this.
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

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

function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack, level / 5
	return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 1.5 + levelTotal)
end
 
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 
Last edited:

Similar threads

Back
Top