Action task is never repeated

NodeCanvas Forums Support Action task is never repeated

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16893
    iancmccleary
    Participant

    Hello,

    I am working on a behavior for my AI. I want it to patrol an area for some time, automatically turning around if it collides with another character. This is the current tree I have:

    bt

    The tree works as expected, except for one problem.

    The action “Set Facing to $new_direction” only runs once.

    I expected that if the conditional “If Collided With Character” is true, the following action will always be executed. However, the action is never re-executed if it already ran (successfully or unsuccessfully). If I end the task with EndAction(null), it will not change the status of the action and thus allow it to be re-executed. This is not what I expected and seems incorrect.

    What am I misunderstanding about this BT graph? Is there a better way to structure this?

    Attachments:
    You must be logged in to view attached files.
    #16910
    Gavalakis
    Keymaster

    Hello,

    Please use EndAction(true) or EndAction(false) ( or simply EndAction() ) in your custom action tasks code. An action task has to finish in either Success or Failure so that it gets reset and is able to run again. Does it work if you do?

    Let me know. Thanks.

    Join us on Discord: https://discord.gg/97q2Rjh

    #16921
    iancmccleary
    Participant

    This is the script:

    If I use EndAction(true) or EndAction(false), the action will never run again.
    If I use EndAction(null) it is able to run again

    Worth mentioning that Character, TryFindModule, FlippableModule is all custom and working correctly. No nulls or errors are thrown

    #16922
    iancmccleary
    Participant

    Also worth mentioning, I was able to verify that the condition IS run again and is successful, but the action is never run again

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.