Random Integer not working correctly...

0belisk0belisk PRO Posts: 189
edited November -1 in Working with GS (Mac)
i made made a integer attribute, set at 0.

i have made a actor occasionally appear on screen, when you click it, it changes the value of the attribute to random(1,3)

i have made rules for what it should do, for the value of 1, 2 and 3.

however, sometimes, NOTHING happens. as if a value outside of 1-3 was chosen.

and i have no idea why this is happening, but i cant seem to fix it, i dont personally see anything wrong with what ive made, rather confusing.

any idea?

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Let's say that the value of the attribute is 2
    And you click on this actor and the random number generator happens to give you the value of 2
    This will not cause a change in the value so therefore whatever rules you had in the "when attribute = 2" rule set will not run a second time. So you may want to have a second attribute (boolean) called game.CheckForRandom (or something). Then in the actor that you click on to change the random number have a rule that says change game.CheckForRandom to 1. Then in the actor that has the rules that need to be ran just wrap the current rule set in a rule that says "when game.CheckForRandom is true"

    You will need to change game.CheckForRandom back to false or you will have the same problem. You could have a change attribute behavior to set it back to 0 at the end of the rule set.

    Hope this helps.
  • 0belisk0belisk PRO Posts: 189
    bump. still cant seem to fix this annoying problem.

    i tried what you said scitunes, but it isnt working, sometimes you can get 10 working fine power-ups in a row, then 2 nulls. or a null to start off, seems to have nothing to do with the same power-up running a second time. i had the same power-up work 3 times in a row.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Have you kept the actor on screen with display text power up so you can see if it is changing?

    I have a little time spare so i could take a look.

    toyboxuk[AT]hotmail.com

    Darren.

    image
Sign In or Register to comment.