This worked in past build - Doesn't work now?

Hi,

All I want to occur is that if a game.attribute is updated - then the actors self.attribute is updated.

This is done by a simple rule,

If self.Attribute is NOT equal to Game.attribute

     Then Change self.attribute to game.attribute.

This only works once. As you can see by the attached demo.
Why doesn't it work? And is there an alternative method of getting the same results?

Thanks

  • Touch the orange actor to change the game.Attribute

Comments

  • BBEnkBBEnk Member Posts: 1,764

    Rule only works once because it only runs once, change the rule to a loop and it will keep checking.

  • Tiny_IdeasTiny_Ideas Member Posts: 326

    @‌ BBEnk

    Not sure I understand. If thats the case - whats the point of having a rule than? A rule use to work if the conditions are met, if not than it runs the otherwise section. Its very frustrating wasting a day breaking into an old game only to find this was the issue. I have never used loops, and this rule has always worked.

    Are you saying that if I have a rule that says - If left arrow is pressed - then move left.

    It will only run that rule once - so no matter how many times I press the arrow afterwards it will not move?

    Just wondering why it has changed.

  • Tiny_IdeasTiny_Ideas Member Posts: 326

    Loops solve the issue if it simple making one attribute the same as the other.

    But I want a rule that when game.attribute is not Equal to Self.Attribute

    Then change a table value
    Then change self.Attribute to game.attribute

    If I use a loop - it constrains the table value rather than simply changing it once.

  • BBEnkBBEnk Member Posts: 1,764

    it's needs a rule that keeps it going, see my example I added a true/false to yours.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Yes rules only fire once. This would be a good video for my new GS basics series. Going to steal the example @BBEnk‌ :#

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Oh, just looked at the code I have a more condensed way.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited September 2014

    @BBEnk‌ You were right the first time use a loop behavior instead of a rule works great.

  • Tiny_IdeasTiny_Ideas Member Posts: 326

    @The_Gamesalad_Guru‌ and @BBEnk‌

    Rules fire more than once - Got it working finally.

    Not sure why loops are being used because loops are fairly new.

    Anyhow now all games run fine as long as there an existing change attribute behaviour.

    Here is all I did:

  • pHghostpHghost London, UKMember Posts: 2,342

    But wasn't it that rules fired once per state change?

    So if you have: If self.Attribute is NOT equal to Game.attribute

    And it changes from NOT equal to EQUAL -- it triggers. If Game.attribute then changes again, but is still not equal, it won't trigger again. But, if in the mean time self.Attribute and Game.attribute become equal, then the rule SHOULD trigger again.

    I'm pretty sure it worked that way at some point.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited September 2014

    Loops are great. You should learn how to use them. plus now you added another behavior. always go for the least amount of code. optimization is key to a great running game. Just because something works doesn't make it the best method.

  • Tiny_IdeasTiny_Ideas Member Posts: 326

    From what I have played with so far, I only want something to fire once if conditions are correct. Loops seem to always change the variables until a match is found. So far it seems they do the opposite. I am sure one day I will find a need to learn them.

  • BBEnkBBEnk Member Posts: 1,764
    edited September 2014

    @Tiny_Ideas‌

    @Tiny_Ideas said:
    The_Gamesalad_Guru‌ and BBEnk‌

    Rules fire more than once - Got it working finally.

    Not sure why loops are being used because loops are fairly new.

    Anyhow now all games run fine as long as there an existing change attribute behaviour.

    Here is all I did:

    Oh I see. if it's ok for both actors to start at number "1" then just remove the change attribute and change actors self level to "1" and you get same effect.

Sign In or Register to comment.