Rule that responds to attribute value change
Hi, I'm new to GameSalad and I hope this issue I've found is just a newbie-type error, but I'm very stumped at the moment. I have a blank actor with a rule in it that responds to changes in a game attribute value, screen_num. The value is changed by hotspots that the user clicks. The rule has a behavior that moves the camera origin.x so that the proper "screen" is shown, based on the value of screen_num. (I have six screens, side by side, in my scene. The first one is the master shot and the others are all close-ups of individual objects.)
All this works fine until the camera moves to one of these other screens. The problem occurs when one of these other screens also has a hotspot on it (to zoom even further in to the object, say). The hotspot on this new screen changes the screen_num value (I'm confirming this with the debugger) but the blank actor with the rule that "listens" for that change doesn't respond to the change. Even stranger, it does respond in one case: if that hotspot changes the value back to zero, then it responds (which takes you back to screen zero, the master shot.)
All the hotspots are the same -- they are all using the prototype actor. There is one integer attribute in the prototype, screen_id, that each hotspot overrides with a unique value.
I'm going nuts trying to figure this out. Any help or ideas or suggestions would be extremely welcome.
All this works fine until the camera moves to one of these other screens. The problem occurs when one of these other screens also has a hotspot on it (to zoom even further in to the object, say). The hotspot on this new screen changes the screen_num value (I'm confirming this with the debugger) but the blank actor with the rule that "listens" for that change doesn't respond to the change. Even stranger, it does respond in one case: if that hotspot changes the value back to zero, then it responds (which takes you back to screen zero, the master shot.)
All the hotspots are the same -- they are all using the prototype actor. There is one integer attribute in the prototype, screen_id, that each hotspot overrides with a unique value.
I'm going nuts trying to figure this out. Any help or ideas or suggestions would be extremely welcome.
Comments
Attribute starts at zero. Rule checks when attribute != 0.
Attribute gets changed to 1. Rule fires.
Attribute changes to 2. The rule is still true, but it won't activate.
Attribute changes back to 0, rule is now false.
Attribute changes to 3, rule is true and fires.
Basically, in between true calculations, the rule needs to go back to false.
Have the invisible actor track screen_num locally.
Change Attribute->local_screen_num ->screen_num
Then underneath that:
Rule When Attribute local_screen_num does not equal screen_num
(Stuff that happens in rule)
Then at the bottom of the rule-
Change attribute->local_screen_num->screen_num
Sorry if that's a little confusing, haven't had my coffee yet.
It's like you have to "reset" that rule to get it to fire again. Thanks so much for your help!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User