Is there a way to read an Array backwards or reverse it (First Index becomes last index, last index becomes first index and so on)? I have a working Blueprint that Generates a random Dungeon. To avoid placing a Tile on another Tile, i safe the position of the Tile in an Array and everytime i create a new tile, i check if the position is already taken. However, this is very inefficient, because the position I am looking for is often at the End of the Array. For example, when i generate 600 Tiles my Blueprint has to check 1+2+3+4+5…+600 Positions (that´s the optimal case. Normally i have to do this 3 times). If I could read the Array backwards, the Blueprint would find the position much faster. The 600. Tile has to check about 580-599 Tiles until it finds the Position. When reading backwards, it would find the position after 1-20 checks.
Maybe a For Loop with reversed values (from last index to 0)? Never tried that one
Use a for loop and feed this to a “Get” node:
(Array lenght -1) - loop index]
All one loop. No breaks involved.
3 Likes
“Reverse for each loop” nod for this. Yes, I see date af this topic, but its first url in google search.
1 Like
It will never work. Never has been.
THIS is the solution, thank you:
1 Like
There’s “Reverse” node
3 Likes
There is also Reverse For Each Loop
2 Likes
This Works ! Thank you <3