Peguei esse script com o Oneshot, ele me ajudou em outro tópico, porém ao testar percebi que não funciona...
Ele deveria analisar a vocação do player e, de acordo com a vocação, executar uma fórmula.
Porém o que acontece é que ele usa sempre a primeira fórmula, sendo knight, paladin, ou sorcerer.
Aí o script.
Gostaria que alguém me mostrasse aonde está o erro.
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat1, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat1, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(combat1, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) --[[Fórmula dos Sorcerers]]
function onGetFormulaValues(cid, level, maglevel)
local min = 100
local max = 101
return min, max
end
setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat2, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat2, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(combat2, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) --[[Fórmula dos druids]]
function onGetFormulaValues(cid, level, maglevel)
local min = ((level*1)+(maglevel*6))
local max = ((level*1)+(maglevel*7))
return min, max
end
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat3, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat3, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(combat3, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) --[[Fórmula dos paladins]]
function onGetFormulaValues(cid, level, maglevel)
local min = ((level*10)+(maglevel*(25/10)))
local max = ((level*10)+(maglevel*3))
return min, max
end
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat4, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat4, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(combat4, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) --[[Fórmula dos knights]]
function onGetFormulaValues(cid, level, maglevel)
local min = ((level*5)+(maglevel*40))
local max = ((level*5)+(maglevel*50))
return min, max
end
setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
if isInArray({1, 5}, getPlayerVocation(cid)) then
return doCombat(cid, combat1, var)
elseif isInArray({2, 6}, getPlayerVocation(cid)) then
return doCombat(cid, combat2, var)
elseif isInArray({3, 7}, getPlayerVocation(cid)) then
return doCombat(cid, combat3, var)
elseif isInArray({4, 8}, getPlayerVocation(cid)) then
return doCombat(cid, combat4, var)
end
end