Rule 'on chanse'

BasGoodboyBasGoodboy Member, PRO Posts: 310
Hey all,

I need a rule like 'when pressed this button, do: 50% chanse on this action or 50% chanse on this action.

Is this possible?

Goodboi Gamestudios | Monster Jumper now on the App Store

Comments

  • FajlajpFajlajp Member Posts: 666
    You need to create three different rules and one different attribute(we call it RandomAction)

    In the first rule you do
    When touch is pressed
    Change attribute RandomAction to random(1,2)

    And then in the second rule you do
    When RandomAction=1
    "Do your first action"

    Then in the third rule you do
    When RandomAction=2"
    "Do your second action"

  • BasGoodboyBasGoodboy Member, PRO Posts: 310
    Superb man, gonna try it out! Thanks.

    Goodboi Gamestudios | Monster Jumper now on the App Store

  • BasGoodboyBasGoodboy Member, PRO Posts: 310
    Fajlajp.. i reckon the Attribute is an Integer which is by default on 0..

    Then just the rules you say right?

    I made this:
    when RandomAction=1, change attribute game.Money to game.Money+5
    when RandomAction=2, change attribute game.Money to game.Money-5

    I did that, but somehow if i click the button, the first time it always gives +5,
    But at the second and third click nothing changes..
    The nothing change part is not what im aiming for, since there's only 2 opportunities: +5, or -5, not change nothing.

    Something is not working right. Is the aimed Attribut 'RandomAction' an Integer with default 0?

    Goodboi Gamestudios | Monster Jumper now on the App Store

  • BasGoodboyBasGoodboy Member, PRO Posts: 310
    My bad man, i just typed in random(1,2), but I had to choose the specifics in the rules to make it work. Thanks!

    Goodboi Gamestudios | Monster Jumper now on the App Store

  • FajlajpFajlajp Member Posts: 666
    Good it worked for you :)
Sign In or Register to comment.