dynamite does not set off nearby dynamite
Posted: Sat May 25, 2013 4:06 am
I can not seem to figure this problem out lol Anyone care to take a look and see what's going on?
I currently have I would simply let the damage 'kill' the nearby dynamite expect that I get an error (and if I try to use die() instead of reducing the tick it just turns into an infinite error two message).
Also I noticed that the explosion is not what I expected.... edit: fixed, silly errors lol. had table.remove in two places (moved to only being in onentitydied), the explosions issue (which came from using a landmine type for the dynamite initially) was due to the createentity not being inside of the if name==dynamite block.
I currently have
Code: Select all
for k,nearbyentity in pairs(game.findentities{{event.entity.position.x-5, event.entity.position.y-5}, {event.entity.position.x+5, event.entity.position.y+5}}) do
if nearbyentity.name == "dynamite" then for k,v in pairs(glob.dynamite) do if nearbyentity.equals(v.entity) then glob.dynamite[k].tick=glob.dynamite[k].tick-100 end end
elseif nearbyentity.health then nearbyentity.damage(20, game.player.force)
end
end
Also I noticed that the explosion is not what I expected.... edit: fixed, silly errors lol. had table.remove in two places (moved to only being in onentitydied), the explosions issue (which came from using a landmine type for the dynamite initially) was due to the createentity not being inside of the if name==dynamite block.