Page 1 of 1

Entities destroy crash the editor

Posted: Tue Nov 20, 2012 10:31 pm
by montagneyaya
I have some problems.
I have on the same square twelve entities :

door_floor_1
dungeon_floor_drainage_1
teleporter_door_1
pressure_plate_door_1
blockage_door_1
timer_open_door_1
timer_close_door_1
timer_damage_party_door_1
timer_destroy_blockage_door_1
timer_blockage_door_1
timer_teleporter_door_1
timer_verify_monster_door_1

if I use this function

Code: Select all

function DamageDoor()
	door_number = 1
	door_break = findEntity("door_floor_"..door_number)
	for i in entitiesAt(door_break.level,door_break.x,door_break.y) do
		entity_destroy = findEntity(i.id)
		print(entity_destroy.id)
	end
end
It return the same list with sometimes a number.
Why a number, I don't know.

And if I use this function

Code: Select all

function DamageDoor()
	door_number = 1
	door_break = findEntity("door_floor_"..door_number)
	for i in entitiesAt(door_break.level,door_break.x,door_break.y) do
		entity_destroy = findEntity(i.id)
		entity_destroy:destroy()
	end
end
The editor closed, with no message.

Any idea for why the destroy() method crash the editor ?

Re: Entities destroy crash the editor

Posted: Tue Nov 20, 2012 11:13 pm
by montagneyaya
OK, I find why.
It's because the function is call by blockage_door_1 with hook onDamage, and the function destroy() blockage_door_1, the editor like not that.