playMaker

Author Topic: How to interrupt a Wait For Completion Action?  (Read 891 times)

Snowfrog

  • Playmaker Newbie
  • *
  • Posts: 1
How to interrupt a Wait For Completion Action?
« on: July 08, 2020, 08:20:11 PM »
My FSM has a 'Following Player' state that is the default state. In a script, I detect when the mouse is clicked and I trigger the 'MoveTo' transition event and set the Vec3 target of the mouse. This triggers a transition to the 'Moving To' state (right in the image) that has an action to Start a Behavior Designer Tree. That tree (left in the image) has a simple behavior, it seeks the target then waits for one second.

I have a bit of a conundrum because in order to make sure that Playmaker lets the behavior tree run it's course completely before going back to the 'Following Player' state, I seem to need to tick the 'Wait For Completion' option. The problem is that I want to be able to interrupt this 'Move To' execution if the player clicks somewhere else, effectively giving another 'Move To' order. How should I handle this situation?

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: How to interrupt a Wait For Completion Action?
« Reply #1 on: July 08, 2020, 08:44:54 PM »
In the state that waits, you can place other actions that can send events thus leaving to any state you want (e.g. also listen for input). Else you could use a second FSM that listens for input and that sends out an event to the first FSM to go to any state you want.