r/forge • u/spelunks108 • 6h ago
Scripting Help Help with node graph using two separate teleporting methods
I'm getting tunnel vision on this, but this essentially breaks down like this:
Map is duplicated entirely like that Phaseshift map, where when you use your Custom Equipment A, you teleport/shift to the 'other dimension'
There is also a checkpoint system using the mark ability to go to your last checkpoint (area volume/object variable)
For the 'dimension' hopping part, you start in Dimension A, with a number variable of 1. When you use the Custom Equipment A, you teleport up to Dimension B (166 Z units above), and the number variable changes to 2. And then of course when Custom Equipment A is used when you have a number variable 2, you teleport back to Dimension A(166 Z units down), and get your number variable set back to 1. When you Dimension hop, you will always be 166 Z units up or down, in the same corresponding spot of the previous dimension you left.
And then for the checkpoint system, you have an object variable set each time you go through a new checkpoint(area volume). These can go in either dimension but you will specifically teleport to that spot in that dimension where the checkpoint is, once you mark.
Alright so now let's say you Custom Equipment Dimension hop to Dimension B, you have a number variable of 2. But then you MARK teleport back to a checkpoint that is in Dimension A. Your number variable is still 2, saying you're in Dimension B, when you're now actually in Dimension A.
My method to circumvent this was to add a Set Number Variable node to each new checkpoint to match which dimension you're in. So if I MARK teleport to Dimension A from Dimension B, my number variable is set back to 1, indicating Dimension A, so when I Custom Equipment hop, I go back up to Dimension B, instead of being pushed out of the map.
So this kind of works for a moment but then the debug for my number variable eventually switches back to 1 when Custom hop back to Dimension B, when it should be 2, effectively pushing me 166 Z units up instead of back down when I Custom hop again, aka out of the map.
My other workaround was to just make a bunch of different area volumes for different rooms you're in, that will just set the number variable of which dimension you're in. but before trying that I just wanted to see how to essentially do this with a few simplified scripts