How do I prevent an actor from infinitely spawning check marks after an attribute is changed?
Zenith_Gameworks
Member Posts: 310
In my game, I have a set of achievements which, when the player completes them, trigger an attribute respective to them to change to a certain, permanent value. After this is complete, I further wrote the rules so that an actor within the "achievements scene" spawns a check mark near the name of the completed achievement. My problem is that once the aforementioned attribute is changed to its new, permanent value, the actor found within the "achievements scene" continues to spawn the check marks infinitely since the attribute remains at that value.
My goal is to only make the actor spawn one check mark after the achievement is completed; after that new check marks for the achievement are obviously not needed. I tried making a rule which says that if the attribute is changed, then the actor which spawns the check mark is destroyed. However this didn't work because every time I entered the "achievements scene," the actor created another check mark before disappearing.
Any help?
Thanks!
My goal is to only make the actor spawn one check mark after the achievement is completed; after that new check marks for the achievement are obviously not needed. I tried making a rule which says that if the attribute is changed, then the actor which spawns the check mark is destroyed. However this didn't work because every time I entered the "achievements scene," the actor created another check mark before disappearing.
Any help?
Thanks!
This discussion has been closed.
Comments
Generally, this would be done by creating a boolean (either attribute or table cell value) and changing the value from false to true once the achievement is completed. Then the spawner actor would have a rule that says When boolean attribute is true --> spawn [check mark actor].
Rules only trigger when their condition changes. So if you have that rule and the boolean attribute changes from false to true, it will spawn one actor. It won't spawn again unless that attribute then changes from true to false and from false to true once more.
Are you using the same attribute for multiple rules or multiple actors? Are you resetting the attribute at some point, which would make the rule trigger again later? Are you using timers or something else that would repeat the spawn behavior?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Zenith_Gameworks