• 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_LEVELMAGIC whats the one based on skills?

Nevalopo

Demigod
Joined
Jul 21, 2008
Messages
5,165
Reaction score
68
Location
Sweden, Landskrona
Hi! I have now read about COMBAT_FORMULA_LEVELMAGIC which i understand is only based on minmax and level and magiclevel, What do i use if i want it to be based on a single skill like fist fighting?

COMBAT_FORMULA_SKILL ??

Is there any explanation of how i use this to either get max skill or a specific skill based on ?
 
Yes, it's COMBAT_FORMULA_SKILL, you can find constant names in data/lib/000-constant.lua

You can also use a callback, like this it's more easy to calculate and you can add other things aswell.
Example default TFS 0.3.6 berserk spell
Code:
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
 
Yes, it's COMBAT_FORMULA_SKILL, you can find constant names in data/lib/000-constant.lua

You can also use a callback, like this it's more easy to calculate and you can add other things aswell.
Example default TFS 0.3.6 berserk spell
Code:
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

Ahh i see if i use this formula how does it work?

local skillTotal, levelTotal = skill + attack * 2, level / 5
return -(skillTotal * 2.1 + levelTotal), -(skillTotal * 3 + levelTotal)

what does skill + attack * 2, level / 5 mean? If one have 100 skill and 100 attack on weapon it would do and are level 100 it would deal 420 damage with that formula there? Its so weird that i have to set the fomula twice :eek: Why wouldnt
return -(skillTotal + levelTotal) work?
 
It's the minimum and maximum attack, first one is minimum, second max.
With skill, attack and level all 100 it will deal 420 damage if you do it like this: (skill + attack) * 2 + level / 5
 
Back
Top Bottom