Page 1 of 2

Holding Cells (level 2) teleporters

Posted: Mon Oct 15, 2012 8:43 pm
by Goodygumdrops
Hi all, sorry if this has been discussed, but I can't find it.

I'm trying to re-create the original Grimrock dungeon, but I'm having trouble with a "puzzle" (not really a puzzle) from level 2.

There is a room that has two buttons which each spawn 7 different teleporters in cells around a room. One set of teleporters teleports objects clockwise around the room, and the other counter-clockwise.

So for now I'm trying to get the 7 teleporters which move things around clockwise. I made the 7 teleporters, started them as deactivated, then put a button and connected it to each of them with toggle -> activiate. I also connected the button to a timer (interval 1, initial state stopped). The button activates the timer, also, and the timer is set to deactivate all 7 teleporters. The problem is that in the 1 second the teleporters are active, any object that is located on any of the relevant squares quickly cycles through every single teleporter in the sequence. This problem persists even when setting the timer interval to 0.1.

My next idea was to have the teleporters activate only in light and sound (ie uncheck the three 'triggered by' boxes) and use a script to move items when pressing the button. However, I have no idea how to do this.
SpoilerShow

Code: Select all

function moveStuff()
   for i in entitiesAt(2, 3, 3) do
      i.x = 3
      i.y = 1
   end
end
This gives an error "attempt to modify a read only value" so I guess this type of scripting isn't allowed? Furthermore, even if I got this script to work, I suspect it would move other stuff (like dungeon_wall_dirt, dungeon_ivy, etc.) that I don't want it to move.

Any ideas?

Re: Holding Cells (level 2) teleporters

Posted: Mon Oct 15, 2012 10:13 pm
by Komag
I have re-created that puzzle, but I have to apologize, it's a secret until I release the full mod. Good luck with it though, I really would be interested to see how you tackle and solve that one, as it is indeed quite a difficult one

Re: Holding Cells (level 2) teleporters

Posted: Mon Oct 15, 2012 10:56 pm
by Stevedog
Maybe try a "behind the scenes" set of teleporters. When you press the button the visible teleporters transfer the items to an unaccessible location and after the visible teleporters are done another teleporter hits the unassessible location and puts the obect where it should be. It's kind of a round about way of doing it but it should work.

Re: Holding Cells (level 2) teleporters

Posted: Mon Oct 15, 2012 11:05 pm
by Goodygumdrops
Stevedog wrote:Maybe try a "behind the scenes" set of teleporters. When you press the button the visible teleporters transfer the items to an unaccessible location and after the visible teleporters are done another teleporter hits the unassessible location and puts the obect where it should be. It's kind of a round about way of doing it but it should work.
That definitely sounds like it will work, and I'll keep it in mind if I can't figure this out. But this solution wouldn't give the exact behavior we see in the original game, because when the buttons are pressed, you can see the sack and skeleton warrior teleport immediately to their next square.

edit: better wording

Re: Holding Cells (level 2) teleporters

Posted: Mon Oct 15, 2012 11:38 pm
by Komag
Yes, it should replicate exactly what we see in the original :)

Re: Holding Cells (level 2) teleporters

Posted: Tue Oct 16, 2012 12:34 am
by Stevedog
Oops! Did I just give away your big secret?

On a quasi related note, is it possible to have a teleporter send you to the exact same spot you are in so that essentially you are held where you are until the teleporter is turned off?

Re: Holding Cells (level 2) teleporters

Posted: Tue Oct 16, 2012 12:42 am
by Goodygumdrops
Okay, new idea, and this one almost works.

One button connected to a script and a timer. 7 "real" teleporters and 7 "fake" (just lights and sound, 'triggered by' boxes unchecked) and 7 hidden pressure plates. All the teleporters start out deactivated, and the timer deactivates them as before. When the button is pressed, the script activates 7 of the teleporters, and it deciedes whether to activate the real one or the fake one for each location based on the state of the hidden pressure plate:
SpoilerShow

Code: Select all

function activatecwTeleporters()
	if teleportertester1:isDown() then
		teleportercw1:activate()
	else teleporterfake1:activate()
	end
	if teleportertester2:isDown() then
		teleportercw2:activate()
	else teleporterfake2:activate()
	end
	if teleportertester3:isDown() then
		teleportercw3:activate()
	else teleporterfake3:activate()
	end
	if teleportertester4:isDown() then
		teleportercw4:activate()
	else teleporterfake4:activate()
	end
	if teleportertester5:isDown() then
		teleportercw5:activate()
	else teleporterfake5:activate()
	end
	if teleportertester6:isDown() then
		teleportercw6:activate()
	else teleporterfake6:activate()
	end
	if teleportertester7:isDown() then
		teleportercw7:activate()
	else teleporterfake7:activate()
	end
end
	end
First off I'm sure there's a more elegant way to write this script, but I'm new to this sort of thing. Secondly, this still doesn't give me quite what I want. If there are two objects that are "next to" each other in the sequence of teleporters, then when I press the button, the one that's "behind" will teleport two spots and catch up to the other. I tested this in the original game, and all the items can stay separate even if I put one in all 7 spots. So, I suppose this solution is fine as long as the player doesn't do anything "silly" like just stick an item in a cell for no reason. But I'm still not getting the behavior that exists in the original game, so I'm not satisfied.

Re: Holding Cells (level 2) teleporters

Posted: Tue Oct 16, 2012 12:56 am
by Stevedog
How about "walking" the real transporter thrugh the cells? Have the fake transporters show the whole time but the real transporter just hits one cell at a time in sequence 0.1 seconds apart.

Re: Holding Cells (level 2) teleporters

Posted: Tue Oct 16, 2012 5:07 pm
by Komag
you got it - that's basically how my approach works, I set it to go through as fast as possible, and it's pretty convincing to be instant.

Re: Holding Cells (level 2) teleporters

Posted: Tue Oct 16, 2012 5:53 pm
by Stevedog
Well, there goes "Original Idea" number 27.

I have come up with lots of good ideas about fun things to try in the editor and then I came here and found most of them already in the Useful Scripts Repository. You guys are just too fast!