Reply To: Turn-based game – turn-based execution of Actions

NodeCanvas Forums General Discussion Turn-based game – turn-based execution of Actions Reply To: Turn-based game – turn-based execution of Actions

#9147
Gavalakis
Keymaster

Hey,

So, after all I don’t know if it’s actualy more elegant since it requires more source changes but here they are:
In ActionTask.cs make the UpdateAction method public.
Also remove any MonoManager.current.AddMethod and RemoveMethod (found in ExecuteAction, EndAction & PauseAction).
In BTAction.cs, add action.UpdateMethod() in OnExecute right before the return.

That’s it. So you completely bypass the MonoManager and the action is updated every time the action node is ticked.
I haven’t thoroughly tested it but it works. This will only work for BTs of course if thats the only system you are using.

On the other hand, if you don’t want running actions, why don’t you just not use action that need more than a frame to complete?
If you create your own actions and you call EndAction within OnExecute of the action then what you are after will happen already.

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