How to set target variable as null after timeout?

NodeCanvas Forums Custom Nodes & Tasks How to set target variable as null after timeout?

This topic contains 2 replies, has 2 voices, and was last updated by  Gavalakis 2 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13136

    rafinha
    Participant

    Hi guys, I’m new using nodeCanvas and I’m trying to make my unit follow the target, and if the distance is > 6, I would like to stop the unit and set the $target variable as null.

    So far, the target is following the $target etc, but once the timeout happens, how can I reset the $target = NULL?

    I’m not sure if what I did is the best approach, but except for this that I want do, everything else works.

    Any suggestion?

    Thanks
    🙂

    Attachments:
    You must be logged in to view attached files.
    #13138

    rafinha
    Participant

    Sorry wrong forum, can you move to the general question forum please?

    Thanks 🙂

    #13150

    Gavalakis
    Keymaster

    Hello,

    Have you checked the soldiers example scene included in the examples from the downloads section?
    The BT of the soldiers there is doing something similar..

    If you want to force continue with the Sequencer even if a child returns Failure (which is the case of the Timeout when it does time out), then you can use a Remap Decorator above the Timeout Decorator and remap Failure to Success. This way, when the Timeout occurs and returns Failure, it will be remapped to Success and the Sequencer will continue to the next child regardless.
    This of course is just one way to do this and it might or might not be the best way depending on the rest of the tree 🙂

    Let me know if that works for you.
    Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.