Reply To: Dynamic Selector and Failing ActionTask

NodeCanvas Forums Support Dynamic Selector and Failing ActionTask Reply To: Dynamic Selector and Failing ActionTask

#10487
yoziva
Participant

As I understand it, a ConditionTask should only execute a test. It shouldn’t modify the game state (readonly). The two tasks I need (“Attack” and “Move”) are modifying the game state.

In my “Attack” task, the Execute method is checking if the agent is in range of his target. If not in range, the task fails. If in range the agent start shooting and therefore it modifies the game state.

In a way the “Attack” could be split in two task sub tasks:

  • A ConditionTask (“IsInRange”)
  • An ActionTask (“Attack”)

It would work, but it makes the tree more complicated and more error prone:

  • In my example there are only 2 nodes. But it’s easy to imagine that every time I will need to use a Dynamic Selector, I will need to have 2 nodes (condition+action) instead of one (action).
  • Also, one cannot use the “Attack” task by itself. We need to be careful that the “Attack” node always comes after an “IsInRange” task.

Would it fundamentally break existing behaviors if the ActionNode::OnExecute method was calling ExecuteAction not only when the action is Resting or Running but also when the action has Failed? Could it be a setting of the Selector?