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

TFS 0.X Healing formula by vocation

leonmagmo

New Member
Joined
Mar 17, 2009
Messages
82
Reaction score
3
Hello guys,
I would like that my Healing spell use a different formula depending on the vocation who is casting(I have many vocations in my custom server). Something like that:

if getPlayerVocation(cid) == 5 or getPlayerVocation(cid) == 10 then
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValue2")
else
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
end
But I had no success doing that

The script that I'm trying to edit is this one:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 20, -1, 40, 5, 5, 3.19, 5.39)
function onGetFormulaValues(cid, level, maglevel)
local min = ((level/5)+(maglevel*3.19)+20)
local max = ((level/5)+(maglevel*5.39)+40)
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

Does someone know how to do make this verification?

Thanks in advance!
 
Solution
Lua:
function onGetFormulaValues(cid, level, maglevel) 
    local min = 0
    local max = 0
    local vocation = getPlayerVocation(cid) 
    if vocation == 1 then
        min = 5
        max = 10
    elseif vocation == 2 then
        min = 20
        max = 40
    end
    return min, max
end
Lua:
function onGetFormulaValues(cid, level, maglevel) 
    local min = 0
    local max = 0
    local vocation = getPlayerVocation(cid) 
    if vocation == 1 then
        min = 5
        max = 10
    elseif vocation == 2 then
        min = 20
        max = 40
    end
    return min, max
end
 
Solution
Back
Top