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
Rule only works once because it only runs once, change the rule to a loop and it will keep checking.
@ 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.
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.
it's needs a rule that keeps it going, see my example I added a true/false to yours.
Yes rules only fire once. This would be a good video for my new GS basics series. Going to steal the example @BBEnk
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Oh, just looked at the code I have a more condensed way.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@BBEnk You were right the first time use a loop behavior instead of a rule works great.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@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:
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.
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
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.
@Tiny_Ideas
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.