Closed lukz closed 7 years ago
In short Yes, parallel task will repeat all tasks (it restarts completed tasks).
For your case, you need an extra task to know when to stop shooting (when not moving). It could be something like this :
root
sequence
parallel policy:"sequence"
sequence
wait seconds:0.3f
log text:"TASK1 (move finished)"
sequence
repeat times:5
log text:"TASK2 (shoot once)"
waitIdleState
log text:"END"
wait seconds:10
where "waitIdleState" is returning :
@mgsx-dev this seems to break whole idea of reusing tasks in BT without additional code. I guess I'll just replace parallel task with my own one ;)
@lukz
What if you wrap the shoot task with a custom decorator alwaysRunning
that always returns STATUS_RUNNING
regardless of child's status?
Actually, I think that this kind of decorator might be part of the framework.
PR welcome :smiley:
@lukz I think that commit f747fbdc5e7c7fa2f3f1ae414c84a0c198414f70 implements exactly what you asked for, see PR https://github.com/libgdx/gdx-ai/pull/93 The wiki should be updated soon. Let me know if it's enough for your needs. Closing this.
Is it intended for parallel task to repeat all tasks until all tasks return success condition or one return fail condition (depending on policy)?
I want to make a monster which starts to move and at the same time shoot 5 times. Movement can take a lot longer than shooting. No matter how I construct this parallel task monster is shooting constantly until movement task is finished or stop moving after finishing shooting.
To demonstrate:
(Log task returns SUCCESS instantly after execution)
This is output: