how can I destroy actor based on changing table value

goonergooner Lancaster, PAMember Posts: 135

A "soldier" must have greater than x amount of "credits" when colliding with "checkpoint" to leave (actor destroyed).

Scenario #1 (OK) - "soldier" has enough credits, collides with "checkpoint", actor destroyed, this works.

Scenario #2 (NOT WORKING) - "soldier" does not have enough "credits"(total is in a table cell value), collides with "checkpoint", does not get destroyed (as designed), meanwhile, still touching the "checkpoint" the "soldier" eventually accumulates enough "credits" (table cell value successfully updated), at this point the "soldier" should be destroyed but this isn't happening (not good) . I'm not positive but it seems like it's not checking for the conditions again, only on that initial collide. What must I do to have this constantly being checked? timer?

Also ...

Scenario #3 (NOT WORKING) - I have an actor which checks a game attribute, then based on the game attribute will change it's image. First time through, this works, however when the game attribute changes, the actor's image does not change. I am guessing that this is related to Scenario #2, in that it's not constantly checking the attribute. If different solution than Scenario #2, how can I constantly check this game attribute.

Thanks for any suggestions and advice, always much appreciated.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    We have no idea how your rules are set up so please post a screenshot.

    Rules only trigger when their condition changes from false to true. So if you have something like this:

    When actor collides with checkpoint actor
         When attribute game.credit ≥ 100
              Destroy actor

    Then if the actor collides with the checkpoint, that outer rule is true. But if game.credit is less than 100, the inner rule won't trigger. And since the outer rule is still true, it won't trigger again until it becomes false and true once more. So the inner rule will not evaluate at all even when game.credit is greater than or equal to 100.

    A better setup would be:

    When actor collides with checkpoint actor AND attribute game.credit ≥ 100
         Destroy actor

    That would be a single rule with two conditions set to when ALL conditions apply. And that rule would only trigger when both were true at the same time.

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

  • goonergooner Lancaster, PAMember Posts: 135
    edited September 2015

    @tatiang said:
    ...
    That would be a single rule with two conditions set to when ALL conditions apply. And that rule would only trigger when both were true at the same time.

    OK, thanks, I'll make sure it is one rule and not using an outer rule. Also, could there be any issues with the condition checking TableCellValue(table, row, col) rather than game.credits attribute?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I'm guessing the issue is with your rule conditions but without seeing your actual rules I can't really answer that question. In general, tables work great. But as I'm sure you know, a misplaced parenthesis or typed in (instead of selected from the drop-down menu) attribute can ruin everything.

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

Sign In or Register to comment.