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

Lua Spell Error [Ice Storm]

Joined
May 23, 2010
Messages
185
Reaction score
23
Error:

[Error - LuaScriptInterface::loadFile] data/spells/scripts/druid/icestorm.lua:98: 'end' expected (to close 'for' at line 88) near '<eof>'
[28/12/2010 22:09:36] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/druid/icestorm.lua)
[28/12/2010 22:09:36] data/spells/scripts/druid/icestorm.lua:98: 'end' expected (to close 'for' at line 88) near '<eof>'

Script:

Code:
local spellConfig = {
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {1, 0, 1},
        {0, 2, 0},
        {0, 1, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 1, 0, 0, 0},
        {1, 0, 0, 1, 0},
        {0, 0, 2, 0, 0},
        {0, 0, 1, 0, 1},
        {1, 0, 0, 1, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 0, 1, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 0, 2, 1, 0},
        {0, 1, 0, 0, 1},
        {1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_ICETORNADO,
     area = createCombatArea({
        {0, 0, 1, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 0, 2, 1, 0},
        {0, 1, 0, 0, 1},
        {1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 0, 0, 0, 0, 1, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 0, 1, 2, 1, 0, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 0, 1, 0, 0, 0, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_ICETORNADO,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 1, 0, 1, 0, 1, 0},
        {1, 0, 1, 0, 0, 0, 1},
        {0, 0, 0, 2, 1, 0, 0},
        {0, 1, 0, 0, 0, 0, 1},
        {1, 0, 0, 1, 0, 1, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 1, 0, 1, 0, 1, 0},
        {1, 0, 1, 0, 0, 0, 1},
        {0, 0, 0, 2, 1, 0, 0},
        {0, 1, 0, 0, 0, 0, 1},
        {1, 0, 0, 1, 0, 1, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    }
}


local combats = {}
for k, config in ipairs(spellConfig) do
    combats[k] = createCombatObject()
        onTargetTile = function(cid, pos)
            local basePos = getThingPosition(cid)
            local fromPos = {x=basePos.x-6, y=basePos.y-8, z=basePos.z}
            doSendDistanceShoot(fromPos, pos, CONST_ANI_ICE)
        end
        setCombatCallback(combats[k], CALLBACK_PARAM_TARGETTILE, "onTargetTile")
        setCombatParam(combats[k], COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
        setCombatParam(combats[k], COMBAT_PARAM_EFFECT, config.effect)
setCombatFormula(combats[k], COMBAT_FORMULA_LEVELMAGIC, 5, 29, 5, 36)
        setCombatArea(combats[k], config.area)
end


local function castingSpellTime(p)
    if(isCreature(p[1]) == TRUE) then
        doCombat(unpack(p))
    end
end

function onCastSpell(cid, var)
    for k, combat in ipairs(combats) do
        addEvent(castingSpellTime, (250*k), {cid, combat, var})
        if exhaustion.check(cid, 23000) == false then
        exhaustion.set(cid, 23000, 2)
        if getPlayerMana(cid) >= 65 then
        doPlayerAddMana(cid, -65)
                doPlayerSendCancel(cid, "Now you have to wait two seconds to use this kind of spell again.")
        else
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) 
        end
    end
 
the same debug message is telling you what and where to fix, missing 'end' at end of script
 
but i already put the end in the end o.0
i will post the bug again

look the same error

[Error - LuaScriptInterface::loadFile] data/spells/scripts/druid/icestorm.lua:99: 'end' expected (to close 'function' at line 87) near '<eof>'
[28/12/2010 22:24:54] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/druid/icestorm.lua)
[28/12/2010 22:24:54] data/spells/scripts/druid/icestorm.lua:99: 'end' expected (to close 'function' at line 87) near '<eof>'
 
try
Lua:
local spellConfig = {
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {1, 0, 1},
        {0, 2, 0},
        {0, 1, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 1, 0, 0, 0},
        {1, 0, 0, 1, 0},
        {0, 0, 2, 0, 0},
        {0, 0, 1, 0, 1},
        {1, 0, 0, 1, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 0, 1, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 0, 2, 1, 0},
        {0, 1, 0, 0, 1},
        {1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_ICETORNADO,
     area = createCombatArea({
        {0, 0, 1, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 0, 2, 1, 0},
        {0, 1, 0, 0, 1},
        {1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 0, 0, 0, 0, 1, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 0, 1, 2, 1, 0, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 0, 1, 0, 0, 0, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_ICETORNADO,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 1, 0, 1, 0, 1, 0},
        {1, 0, 1, 0, 0, 0, 1},
        {0, 0, 0, 2, 1, 0, 0},
        {0, 1, 0, 0, 0, 0, 1},
        {1, 0, 0, 1, 0, 1, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    },
    {effect = CONST_ME_GIANTICE,
     area = createCombatArea({
        {0, 0, 1, 0, 1, 0, 0},
        {0, 1, 0, 1, 0, 1, 0},
        {1, 0, 1, 0, 0, 0, 1},
        {0, 0, 0, 2, 1, 0, 0},
        {0, 1, 0, 0, 0, 0, 1},
        {1, 0, 0, 1, 0, 1, 0},
        {0, 0, 1, 0, 1, 0, 0}})
    }
}


local combats = {}
for k, config in ipairs(spellConfig) do
    combats[k] = createCombatObject()
    onTargetTile = function(cid, pos)
		local basePos = getThingPosition(cid)
		local fromPos = {x=basePos.x-6, y=basePos.y-8, z=basePos.z}
		doSendDistanceShoot(fromPos, pos, CONST_ANI_ICE)
	end
	setCombatCallback(combats[k], CALLBACK_PARAM_TARGETTILE, 'onTargetTile')
	setCombatParam(combats[k], COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
	setCombatParam(combats[k], COMBAT_PARAM_EFFECT, config.effect)
	setCombatFormula(combats[k], COMBAT_FORMULA_LEVELMAGIC, 5, 29, 5, 36)
	setCombatArea(combats[k], config.area)
end


local function castingSpellTime(p)
    if isCreature(p[1]) then
        doCombat(unpack(p))
    end
end

function onCastSpell(cid, var)
    for k, combat in ipairs(combats) do
        addEvent(castingSpellTime, (250*k), {cid, combat, var})
        if not exhaustion.check(cid, 23000) then
			exhaustion.set(cid, 23000, 2)
			if getPlayerMana(cid) >= 65 then
				doTargetCombatMana(0, cid, -65, -65, CONST_ME_NONE)
                doPlayerSendCancel(cid, 'Now you have to wait two seconds to use this kind of spell again.')
			else
				doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) 
			end
		end
	end
	return true
end
 
Back
Top