Random number generation

xotty9999xotty9999 Posts: 9Member, PRO

I am sure there is an easy fix to this, but I can't seem to find it. I want a random number generated each time a player does touch release behavior on an actor. If the random number is above 10, a new cell value of [current cell value]-5 should result in a table.
Here is what I have:
When touch is pressed and,
Numeric expression, random (1,20) is >=10
Change table value, table name, row 1, column 1 to function table cell value (table name, row 1, column 1) -5

This works when I touch the actor, but when I release touch and touch again, the randomly generated number part of this rule does not start over. So if I get a random number result over ten, the number decreases by 5 as it should, but then every time I touch, it keeps reducing by 5 as if a newly generated random number is never being generated.
So how do I get the random number to generate each and every time I do the touch behavior?


  • pHghostpHghost London, UKPosts: 1,755Member
    edited March 17

    Two rules:

    1. When touch is pressed, change attribute: self.number to random (1,20).
    2. When touch is pressed AND attribute: self.number is >=10, change table value, blablabla.

    P.S. Yes, they have to come in this sequence.

  • xotty9999xotty9999 Posts: 9Member, PRO

    Great. That worked. That's two I owe you!

Sign In or Register to comment.