Hi, just curious if anyone knows how you go about solving this error that comes up in console. I have been working on this script few weeks back but I have forgotten what I meant to fix.
Here is my code
I am guessing that there is something wrong with the area so I decided to change the local combat to
but that just created another console error:
Lua Script Error: [Test Interface]
data/spells/scripts/test.lua
data/spells/scripts/test.lua:39: attempt to get length of global 'area' (a nil value)
stack traceback:
[C]: in function '__len'
data/spells/scripts/test.lua:39: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/test.lua
Here is my code
Lua:
local combat = {
{
{0,0,0},
{0,0,0},
{0,0,0},
{1,3,1},
{1,0,1}
},
{
{0,0,0},
{0,0,0},
{0,0,0},
{1,1,1},
{0,2,0}
},
{
{0,0,0},
{0,0,0},
{1,1,1},
{0,0,0},
{0,2,0}
},
{
{0,0,0},
{1,1,1},
{0,0,0},
{0,0,0},
{0,2,0}
},
{
{1,1,1},
{0,0,0},
{0,0,0},
{0,0,0},
{0,2,0}
}
}
for i = 1, #area do
combat[i] = createCombatObject()
setCombatParam(combat[i], COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat[i], COMBAT_PARAM_EFFECT, 6)
setCombatArea(combat[i], createCombatArea(area[i]))
function onGetFormulaValues(cid, level, maglevel)
min = -((level / 5) + (maglevel * 10) + 25)
max = -((level / 5) + (maglevel * 20) + 50)
return min, max
end
setCombatCallback(combat[i], CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
end
function onCastSpell(cid, var)
-- my script here
return doCombat(cid, combat[1], var)
end
I am guessing that there is something wrong with the area so I decided to change the local combat to
Lua:
local area = {
but that just created another console error:
Lua Script Error: [Test Interface]
data/spells/scripts/test.lua
data/spells/scripts/test.lua:40: attempt to index global 'combat' (a number value)
stack traceback:
[C]: in function '__newindex'
data/spells/scripts/test.lua:40: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/test.lua