Lock isn't working.

CowuniverseCowuniverse Member, PRO Posts: 97

I have an attribute called "lock" and it is a boolean set to true. I have it so when "lock" is true and "coins" is >/= 10 when touch is released change attribute game.lock to false. This works while I am in the scene and only takes the 10 coins once, but when I go out of the scene and back into the same scene it is locked again. I tried putting save attribute and load attribute in it to see if it made a difference, but it did the same thing. Thank you for the help.

Best Answer

  • AlchimiaStudiosAlchimiaStudios Posts: 1,069
    Accepted Answer

    @Cowuniverse said:

    Ignore the attribute named can.

    The problem is that your changing coins, a condition needed to run the rule in first place; to a value no longer at the required amount for the rule to run, so it stops. the change lock will do the same if you switch order.

    A fix would be to put both in a timer of 0 seconds with run to completion checked. This way it will complete the actions regardless of the rule conditions no longer being valid.

    Follow us: Twitter - Website

Answers

  • CowuniverseCowuniverse Member, PRO Posts: 97


    Ignore the attribute named can.

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    Also, not sure if this makes any difference or not in terms of performance, but you can put multiple conditions into a single rule set by hitting the plus button on right side of the conditions line at the top of a rule.

    Follow us: Twitter - Website

  • CowuniverseCowuniverse Member, PRO Posts: 97

    I put the timers in coins and lock1 at 0 seconds set to after and run to complation is chaecked, but nothing changed.

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    @Cowuniverse said:
    I put the timers in coins and lock1 at 0 seconds set to after and run to complation is chaecked, but nothing changed.

    upload another screenshot of how it looks now.

    Follow us: Twitter - Website

  • CowuniverseCowuniverse Member, PRO Posts: 97

  • CowuniverseCowuniverse Member, PRO Posts: 97

    @AlchimiaStudios said:
    upload another screenshot of how it looks now.

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    @Cowuniverse said:

    Check if the rule is actually changing it then, that will eliminate one possible factor.

    Do a display text of the Game.Lock attribute, that should give you the information of wether it is changing properly to false when coins are >/= 10. If it is changing properly then some other rule or behavior is interfering with your logic upon scene start. If not then it is the rule itself.

    Follow us: Twitter - Website

  • CowuniverseCowuniverse Member, PRO Posts: 97

    Thank for the help. What I did to make it work was in the same scene I made a new attribute to update lock1 to false if it equals 1.

Sign In or Register to comment.