Teleporter Issues

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
sirK2005
Posts: 14
Joined: Wed Oct 10, 2012 3:26 pm

Teleporter Issues

Post by sirK2005 »

Hi,

I have crossed upon yet another problem. I have created an item that, on use, leads to the spawning of a teleporter at exactly the point where the party is standing.

Not always, but sometimes, the game crashes on me. This is my code for teleporter creation:

Code: Select all

		spawn("teleporter", party.level, party.x, party.y, 0, "returnTeleporter")
		returnTeleporter:setTriggeredByMonster(false)
		returnTeleporter:setTriggeredByItem(false)
		returnTeleporter:setTeleportTarget(15,15,0,1)
and at level 1 position 15,15 there is a plate that immidiatley destroys the teleporter again.

When testing I found out that when spawning the teleporter at a different location (everywhere but where the party is standing) and the party goes through everything works smoothely.
So I suspect that the fact that I first spawn the teleporter and then define where it is teleporting to sometimes leads to the teleporter porting the party to a not yet specified location and that crashes the game.

So, my Question: Is there a way to "set up" the teleporter (or any other object) first and then spawn it?
Best
Chris
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

Re: Teleporter Issues

Post by Shroom »

Create the object first

Then activate it.

Code: Select all

Teleporter = spawn("teleporter", party.level, party.x, party.y, party.facing, "teleporter_1")
Teleporter:setInvisible(true)
Teleporter:setTriggeredByParty(true)
Teleporter:setTeleportTarget(15, 15, 0, 1)      
Teleporter:activate()
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Teleporter Issues

Post by Komag »

you also might need to delay destroying the teleporter - have the plate link to a timer set to 0.1sec which then destroys the teleporter
Finished Dungeons - complete mods to play
sirK2005
Posts: 14
Joined: Wed Oct 10, 2012 3:26 pm

Re: Teleporter Issues

Post by sirK2005 »

@Shroom:
Yeah, I tried something like that already, but sadly

Code: Select all

Teleporter = spawn("teleporter", party.level, party.x, party.y, party.facing, "teleporter_1")
already spawns the actual telelporter for me within the level, since the teleporter does not start in a deactivated state.

@Komag:
Good hint, I've done that know. My prblem has indeed not accured anymore sonce I uncluded a timer to delay the destruction of the teleporter. But further testing is needed if this solution is stable.

So, maybe the problem was not the setup of the teleporter after all? I will simply test further.
Best
Chris
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

Re: Teleporter Issues

Post by Shroom »

I have used this in a dungeon and it works - however, what i didn't write is that at the 'landing' site is a hidden pressure plate which i used to destroy the teleporter after its work is done. (I also had a teleport counter that made sure each was unique, just to be sure)

You are probably running into a problem with the order in which things are run - ie it finishes your script before engaging the code that would make the party interact with the teleporter and hence it appears deactivated to you.
Post Reply