moving portal mechanic?
moving portal mechanic?
You guys probably remember this puzzle from the main game that used this mechanic. So you got a 3X3 square room with a pit in the middle and 2 portals on opposite ends rotating around the room counter clockwise. There are some other elements about the room but that's irrelevant according to what I need to accomplish in my own version of the puzzle. How would I implement this portal rotation? I thought I had a way by putting portals on all squares inside the room and using timers, but the way I had it in my head got too confusing and used too many timers. Any ideas on what to use, be it timers, counters or script? I am definitely interested in multiple way to do it too. Here is a slide show illustration of what I mean if anyone is unable to understand my description. The portals should change every 1 second in a continuous rotation around the room. I want it to be triggered with a hidden pressure plate when entering the room and stopped by another pressure plate on the other end.
Re: moving portal mechanic?
Hint: there are four states, so you need a ticker that goes 0,1,2,3,0,1,2,3,...
Re: moving portal mechanic?
an easy way to code it - not elegant but fairly straight forward, would be to use a single timer connected to a lua script with a setting of 1
the script would have a function
All we are really doing is building a counter into the script and then turning off two and turning on two each tick of the timer.
The pressure pads would activate and deacivate the timer - you would also have them deactivate all the teleports
this would need to be in the same script entity as the first script.
Am unable to test this, but it should work - if the second script cant see step, then link it to a counter instead
the script would have a function
Code: Select all
step = 1
function cycleTeleports()
if step==1 then
telport1:activate()
telport4:deactivate()
telport5:activate()
telport8:deactivate()
step = 2
else if step==2 then
telport1:deactivate()
telport2:activate()
telport5:deactivate()
telport6:activate()
step = 3
else if step==3 then
telport2:deactivate()
telport3:activate()
telport6:deactivate()
telport7:activate()
step = 4
else
telport3:deactivate()
telport4:activate()
telport7:deactivate()
telport8:activate()
step = 1
end
The pressure pads would activate and deacivate the timer - you would also have them deactivate all the teleports
Code: Select all
function resetTeleports()
telport1:deactivate()
telport2:deactivate()
telport3:deactivate()
telport4:deactivate()
telport5:deactivate()
telport6:deactivate()
telport7:deactivate()
telport8:deactivate()
step = 1
end
Am unable to test this, but it should work - if the second script cant see step, then link it to a counter instead
Re: moving portal mechanic?
I tested this and it worked well, although I needed to fix a couple of minor mistakes in the script (easily done when writing untested code). I also changed the names of the teleporters in the script to the convention used by the editor when placing them.
In addition to the script you will need
- a timer with interval 1 second and with action point at the script entity cycleTeleports
- start pressure plate with 2 CONNECTORS
---- one to the script entity resetTeleporters
---- one to the timer with an activate action
- end pressure plate
with 2 CONNECTORS
---- one to the script entity resetTeleporters
---- one to the timer with an deactivate action
Code: Select all
step = 1
function cycleTeleports()
if step==1 then
teleporter_1:activate()
teleporter_4:deactivate()
teleporter_5:activate()
teleporter_8:deactivate()
step = 2
elseif step==2 then
teleporter_1:deactivate()
teleporter_2:activate()
teleporter_5:deactivate()
teleporter_6:activate()
step = 3
elseif step==3 then
teleporter_2:deactivate()
teleporter_3:activate()
teleporter_6:deactivate()
teleporter_7:activate()
step = 4
elseif step==4 then
teleporter_3:deactivate()
teleporter_4:activate()
teleporter_7:deactivate()
teleporter_8:activate()
step = 1
end
end
function resetTeleports()
teleporter_1:deactivate()
teleporter_2:deactivate()
teleporter_3:deactivate()
teleporter_4:deactivate()
teleporter_5:deactivate()
teleporter_6:deactivate()
teleporter_7:deactivate()
teleporter_8:deactivate()
step = 1
end
- a timer with interval 1 second and with action point at the script entity cycleTeleports
- start pressure plate with 2 CONNECTORS
---- one to the script entity resetTeleporters
---- one to the timer with an activate action
- end pressure plate
with 2 CONNECTORS
---- one to the script entity resetTeleporters
---- one to the timer with an deactivate action
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: moving portal mechanic?
Yeah, it's threads like this that really peel back the curtain
and this would probably make a decent addition to the Useful scripts repository
and this would probably make a decent addition to the Useful scripts repository
Finished Dungeons - complete mods to play
Re: moving portal mechanic?
Thanks for all the advice guys. I managed to get this to work. I was also able to adapt it to some other puzzles I made. This dungeon is coming along nicely!
Re: moving portal mechanic?
Thank you guys!! rotating teleporters are now on the menu
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
-
- Posts: 1
- Joined: Mon Jan 21, 2013 12:48 pm
Re: moving portal mechanic?
I think it's just a typo. "Can we play with this?"
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!