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

Upgrade spell issue

MadMOOK

Hoo
Joined
Apr 20, 2011
Messages
802
Reaction score
43
data/spells/scripts/attack/berserk.lua:13: attempt to perform ari thmetic on local 'attack' (a nil value)
Code:
local SPELL_LVL_STORAGE = 18479

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, element, factor)
local combat_formulas = {  
[0] = {min = (skill + attack*1) +level/5 -10, max = (skill + attack*2) +level/5 -20},  
[1] = {min = (skill + attack*2) +level/5 +30, max = (skill + attack*2) +level/5 +40},  
[2] = {min = (skill + attack*2) +level/5 +80, max = (skill + attack*3) +level/5 +130},  
[3] = {min = (skill + attack*2) +level/5 +150, max = (skill + attack*3) +level/5 +250} 
} 

local lvl = getPlayerStorageValue(cid, SPELL_LVL_STORAGE) 

lvl = lvl == -1 and 0 or lvl
x = combat_formulas[lvl]
return -x.min, -x.max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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