Page 1 of 1

[BUG] Weird teleporter/healing crystal crashes

Posted: Tue Oct 23, 2012 12:32 am
by BeNNyBiLL
Hello,

I have this bug in my level which crashes the editor 100% of the time. I can't seem to recreate it with normal placeable teleporters so I will share my scripts here for reproduction. Hopefully I havn't done anything noddy here and there genuinely is a bug. Here are the repro steps

1. The respawnPoint is set to a position in an adjacent tile to a healing_crystal, facing towards the healing crystal
2. recall is invoked and the party is teleported to the respawn point facing the crystal
3. press forward (i.e. move towards the crystal)
4. CRASH

respawner code:

Code: Select all

respawnPoint = {}
respawnPoint.x = 0
respawnPoint.y = 0
respawnPoint.facing = 1
respawnPoint.level = 1

function setRespawnPoint(object)
	respawnPoint.x = object.x
	respawnPoint.y = object.y
	respawnPoint.facing = object.facing
	respawnPoint.level = object.level
end

function recall()
	spawn("teleporter", party.level, party.x, party.y, party.facing, "recall_teleporter")
	recall_teleporter:setTriggeredByMonster(false)	
	recall_teleporter:setTriggeredByItem(false)
	recall_teleporter:setInvisible(true)
	recall_teleporter:setTeleportTarget(respawnPoint.x, respawnPoint.y, respawnPoint.facing, respawnPoint.level)
	recall_teleporter:activate()
	
	spawn("timer", party.level, party.x, party.y, party.facing, "recall_timer")
	recall_timer:activate()
	recall_timer:setTimerInterval(1)
	recall_timer:addConnector("activate", "garbage_script", "destroy_recall_teleporter")
	recall_timer:addConnector("activate", "garbage_script", "destroy_recall_timer")
end
garbage_script code

Code: Select all

function destroy_recall_teleporter()
	recall_teleporter:destroy()
	recall_teleporter = nil
end

function destroy_recall_timer()
	recall_timer:destroy()
	recall_timer = nil
end