I got a crash when breaking a breakable object and wonder if someone can help about that:
I was holding an item on the mouse which use a special script while tryin to break the object, here is the screen error:
SpoilerShow

this is the script used by the item:
SpoilerShow
Code: Select all
onAttack = function(self, champion, slot, chainIndex)
----
local ammo1 = champion:getItem(1)
local ammo2 = champion:getItem(2)
if ammo1 and ammo2 then
if ammo1.go.name == "ion_gun" and ammo2.go.name == "power_recharge"
or ammo2.go.name == "ion_gun" and ammo1.go.name == "power_recharge" then
----
local ion = spawn("ion_object",party.level,party.x,party.y,party.facing,party.elevation)
ion.projectile:setIgnoreEntity(party)
-- Set cast by champion so that experience is awarded for kills.
local ord = champion:getOrdinal()
ion.projectile:setCastByChampion(ord)
-- Simulate the position of a player-cast spell.
local left = nil
for i = 1,4 do
if party.party:getChampion(i):getOrdinal() == ord then
left = i == 1 or i == 3
break
end
end
local wpos = party:getWorldPosition()
local dx = nil
local dz = nil
if party.facing == 0 then
dx = left and -0.1 or 0.1
dz = -1
elseif party.facing == 1 then
dz = left and 0.1 or -0.1
dx = -1
elseif party.facing == 2 then
dx = left and 0.1 or -0.1
dz = 1
else -- party.facing == 3
dz = left and -0.1 or 0.1
dx = 1
end
ion:setWorldPosition(vec(wpos[1]+dx,wpos[2]+1.35,wpos[3]+dz))
end
end
end