Cannot get the variable to change...

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hello! I'm stuck. I'm trying to generate a random room, but it isn't working...

    This is what I have, in a nutshell:

    Global.doorVAR = 0

    IF system: doorVAR = 0

    {set doorVAR = random(15)

    THEN: (based on that number, a certain number of doors will appear at north, south, east and west. If I edit the variable directly, this works, but it seems like no matter what I can't get the game to recognize the statement to alter the variable. I've tried EVERYTHING I can think of. I made the condition a given (IF player is visible...), I tried changing it from random to other number (set doorVAR = 4), but even that wouldn't change it.

    The only way to change a variable seems to be by changing it in its declaration: (doorVAR = 13) as opposed to a condition that should do the same thing.

    I've come so far but this is just not working... What am I doing wrong?

  • well, it is impossible to tell without seeing your actual code... it could be just about anything.

    you may have placed the code somewhere that never actually runs.

    Random(15) will return a floating point number between 0 and 14.9999, so the chances of getting an integer are almost zero. If the rest of your code is expecting an integer then use something like Round(Random(15))

    or Int(Random(15))+1 if you don't want it to ever pick zero.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Dude, it worked, and it's amazing. My random dungeon room is all setup thanks to you. Take it easy.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)