Entities destroy crash the editor

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Entities destroy crash the editor

Post 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 ?
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: Entities destroy crash the editor

Post 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.
Post Reply