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

Solved Error in console

Status
Not open for further replies.

azzkaban

Monster Maker
Joined
Feb 23, 2010
Messages
1,101
Reaction score
194
Location
Iquique Chile
I have this error in console:

Code:
[22/5/2013 10:13:8] [Error - Spell Interface] 
[22/5/2013 10:13:8] data/spells/scripts/Amy Azzkaban Spells/Player Spells/energy strike.lua:onCastSpell
[22/5/2013 10:13:8] Description: 
[22/5/2013 10:13:8] mods/scripts/test.lua:23: attempt to get length of local 'targets' (a nil value)
[22/5/2013 10:13:8] stack traceback:
[22/5/2013 10:13:8] 	mods/scripts/test.lua:23: in function 'chainRoute'
[22/5/2013 10:13:8] 	.../Amy Azzkaban Spells/Player Spells/energy strike.lua:19: in function <.../Amy Azzkaban Spells/Player Spells/energy strike.lua:11>

This Spell script:
Lua:
-- Electrical Discharge Rune
--- Created by Ramza(Ricardo Ianelli) for Zodiac Legacy ATS.
---- For more informations, visit: [url]http://forums.otserv.com.br/forumdisplay.php?493-Zodiac-Legacy[/url]

dofile(getDataDir().."lib/ramzalib.lua")

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, true)


function onCastSpell(cid, var)
  
local inicio = getThingfromPos(var.pos).uid


local maxDmg = - math.ceil(getPlayerMagLevel(cid) * 3)
local minDmg = math.ceil((maxDmg / 2) - 1) 

local targets = chainRoute(inicio, 2)

local i = 0
    for _,v in pairs(targets) do 
    i = i+1
        addEvent(doSendDistanceShoot, i*100, getCreaturePosition(v[1]), getCreaturePosition(v[2]), 32)
        addEvent(doAreaCombatHealth, i*100, cid, 1, getCreaturePosition(v[2]), 0, minDmg, maxDmg, 77)
    end
    return doCombat(cid, combat, var)
      
end

Can you help me?
REP MAS 001.png
 
Last edited:
Bummies_family_by_MenInASuitcase.gif
 
Lua:
-- RamzaLIB - Electrical Discharge Functions
--- Created by Ramza(Ricardo Ianelli) for Zodiac Legacy ATS.
---- For more informations, visit: [url=http://forums.otserv.com.br/forumdisplay.php?493-Zodiac-Legacy]OTServ Brasil[/url]

function isInArray3(array, array2) -- Function by Ramza (Ricardo Ianelli)
local x = array2[1]
local y = array2[2]

  for _,v in pairs(array) do
     if (v[1] == x and v[2] == array2[2]) or (v[2] == x and v[1] == y)  then
       return true    
     end
  end
return false
end                 

function chainRoute(init, r) -- Function by Ramza (Ricardo Ianelli)
 local route, targets, tam = {{init, init}}, {}, 0
 for i = 1,#route do
    repeat
    tam = #route 
       targets = getSpectators(getCreaturePosition(init), r, r, false)      
    if #targets > 1 then
       for _,v in pairs(targets) do
          if not isInArray3(route, {init, v}) and (init ~= v) then
             table.insert(route, {init,v})
          end 
       end
    end
    init = route[#route][2]
   until tam == #route
 end
return route 
end
 
Lua:
-- Electrical Discharge Rune
--- Created by Ramza(Ricardo Ianelli) for Zodiac Legacy ATS.
---- For more informations, visit: <a href="http://forums.otserv.com.br/forumdisplay.php?493-Zodiac-Legacy" target="_blank">http://forums.otserv.com.br/forumdis...-Zodiac-Legacy</a>
 
dofile(getDataDir().."lib/ramzalib.lua")
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, true)
 
 
function onCastSpell(cid, var)

local inicio = getCreatureTarget(cid)

if inicio == 0 then 
	if isPlayer(cid) then
		doPlayerSendCancel(cid, "No tienes ningun target.")
	end
	doSendMagicEffect(getCreaturePosition(cid), 2)
	return false
end
 
 
local maxDmg = - math.ceil(getPlayerMagLevel(cid) * 3)
local minDmg = math.ceil((maxDmg / 2) - 1) 
 
local targets = chainRoute(inicio, 2)
 
local i = 0
    for _,v in pairs(targets) do 
    i = i+1
        addEvent(doSendDistanceShoot, i*100, getCreaturePosition(v[1]), getCreaturePosition(v[2]), 32)
        addEvent(doAreaCombatHealth, i*100, cid, 1, getCreaturePosition(v[2]), 0, minDmg, maxDmg, 77)
    end
    return doCombat(cid, combat, var)
 
end
 
Status
Not open for further replies.
Back
Top