Lua Script Error: [Spell Interface]
in callback: data/spells/scripts/attack/sudden_death_rune.luanGetFormulaValues
(Unknown scriptfile)
data/spells/scripts/attack/sudden_death_rune.lua:37: attempt to index global 'vocation' (a nil value)
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
local function removerExaustao(playerID)
local player = Player(playerID)
if player:isPlayer() then
player:setStorageValue(CAST_EXHAUST, 0)
end
return true
end
function onGetFormulaValues(player, level, maglevel)
local max = -((level / 5) + (maglevel * 7.4) + 48)
local min = -(max*0.7)
if getConfigInfo(danoDiferentePorClasse) == true then
if vocation:getName() == "Feiticeiro" then
max = (max*1.1)
min = (min*1.0)
end
if vocation:getName() == ("Arqueiro" or "Bruxo") then
max = (max*0.9)
min = (min*0.8)
end
if vocation:getName() == ("Barbaro" or "Paladino") then
max = (max*0.7)
min = (min*0.6)
end
if vocation:getName() == ("Clerigo" or "Atirador" or "Conjurador" or "Druida") then
max = (max*0.5)
min = (min*0.4)
end
end
if player:getStorageValue(CAST_EXHAUST) <= 0 then
if vocation:getName() == ("Clerigo" or "Bruxo") then
addEvent(removerExaustao, CAST_ATAQUE_3, player:getid())
end
if vocation:getName() == "Arqueiro" then
addEvent(removerExaustao, CAST_ATAQUE_2, player:getid())
end
if vocation:getName() == ("Barbaro" or "Paladino" or "Atirador" or "Feiticeiro" or "Conjurador" or "Druida") then
addEvent(removerExaustao, CAST_ATAQUE_1, player:getid())
end
player:setStorageValue(CAST_EXHAUST, 1)
return min, max
else
player.sendCancelMessage(player, "Esta exausto.")
player:sendMagicEffect(CONST_ME_POFF)
end
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, var, isHotkey)
return combat:execute(creature, var)
end