Rules based on attribute triggers inconsistently

Hey guys - I'm working on a maths game at the moment, where a lot of different things are triggered by attributes, but I'm running into some problems where the triggering of rules seems to be quite inconsistent.

The game is quite simple, you player is given a target value, and a handful of different numbers to make up the target value using another attribute called current value. If the player gets the target value, then the round is reset and new numbers are displayed by using a rule if current value = target value, then change attribute reset to true.

In the number actors, there is a rule that when reset is true, do somethings like change colour and movement - but this rule doesn't always apply, sometimes it does, sometimes it doesn't, and I can't see any pattern. I've tried adding a timer, so the reset attribute is kept 'on' for a second, rather than instantly changing back, but this still doesn't seem to work.

The number values are drawn from a table, but unless I'm mistaken, this should really impact on the reset function, since they're not part of the rule.

Just wondering if anyone has had any similar experiences and managed to find workarounds?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    It's possible that you have unlocked some of the actors on your scene and created "instances" with their own unique rules. Either double-click on each actor to verify that the lock symbol still appears (if not, click Revert to Prototype) or delete the actors from the scene and re-add them, which will force them to be prototypes. By the way, another way to diagnose this issue without making changes it to add Log Debugging Statements to your number actors and then open the Debugger window and see if the rules are triggering.

    *Make a backup before you do this since I don't know if you can Undo a Revert to Prototype.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • imjustmikeimjustmike Member Posts: 450
    Hey @tatiang - good shout on the instances - I've double checked each of the actors and they are all locked.

    I probably should have mentioned that I'd added a debug to the reset attribute - that's how I know that it's not always firing!

    Essentially there is a self attribute called 'used' to determine if the actor has been used. When it has been used, the colour is swapped to black and touching disabled so that the player doesn't use the same number once. However, once the current value = target value, the self attribute used should change back to off. And actually it should change back for ALL actors since they're all locked, even if it was already off. What seems to be happening is that the 'used' attribute doesn't always reset. Sometimes actors with used already off don't have it reset, but the player doesn't notice because there's no rules to kick in, but occasionally an actor with used 'on' doesn't reset, which means it stays black and unclickable...

    And I just can't figure out why
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Well if you'd like, I can take a look at the project file. If it's a quick fix, I'll let you know. Just .zip it, upload it to a file-sharing service, and then post the link here or send it to me in a private message.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The problem is with the timing in your game_settings actor. The last rule ("Target asteroid count reached") needs to have those three behaviors inside of an After 0.1 seconds timer with Run to Completion checked. Without that, the round is ending at the same moment the next round is beginning and your asteroid actors check their first rule to see if game.asteroid_count = game.target_asteroid_count and find that it's not equal any more so they don't reset (some do, some don't).

    image

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • imjustmikeimjustmike Member Posts: 450
    Thank you thank you. Here I was searching for a complex solution when it was glaring right at me! I would never have spotted that.

    And very very use for future reference, I keep forgetting that rules need a little time to kick in!

    Thank you very much @tatiang
Sign In or Register to comment.