Announcement

Collapse
No announcement yet.

Generate random pattern of pressure plates

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Generate random pattern of pressure plates

    Hello everyone,

    I'm working on a simple puzzle game with pressure plates: when you press the right pattern it unlock a door.
    So I have 6 ''Good plates'' BP and 1 ''Bad plates'' BP, I'd like to set randomly the position of the 6 good plates on a 6*6 surface and fill the empty spots with the 30 bad plates at the start of the game.

    Everything work for now except for the random generation, if anyone can explain me how he would do that, it will help a lot, because everything ^^


    #2
    Originally posted by Arakismo View Post
    I'm working on a simple puzzle game with pressure plates: when you press the right pattern it unlock a door.
    So I have 6 ''Good plates'' BP and 1 ''Bad plates'' BP, I'd like to set randomly the position of the 6 good plates on a 6*6 surface and fill the empty spots with the 30 bad plates at the start of the game. Everything work for now except for the random generation, if anyone can explain me how he would do that, it will help a lot, because everything ^^
    Which part of the random is stopping you? Assuming each plate is its own Blueprint...
    If it isn't at the moment, and its just 36 static meshes etc, make these their own BP's.

    Add variable Bad to each BP set to true. Setup / spawn the 36 grid map tiles visually.
    Then add all 36 BP's to an array 'Plates'.... Do this using Get All-Actors-of-Class etc...
    Or in your Gamemode when all 36 spawn.. Add variable 'Bad' to each BP, set to true.

    Drag array Plates to graph. Drag off a Get & use Random-Int-In-Range Min0 Max 35.
    Use Remove to delete the BP so that it cannot be chosen a subsequent time etc etc.

    Set its Bad variable to false. Repeat 5 more times in total to set all 6 good Plate BP's.
    Remember to decrement Random-Int-In-Range Max 34, 33, 32, 31, 30 each time etc.

    Hope I understood the problem and that it helped. If not maybe it gave you new ideas...

    Comment


      #3
      Thank you for the answer, it gave me an idea on how to setup it, I'll try it ^^

      Comment

      Working...
      X