Improve This Simple AI Loop?

xjjon

New member
I have this simple AI loop that seems a bit more verbose than it needs to be.

Repeating behavior:

  1. Wait random time
  2. Seek player with random timeout (i.e. if target not reached after X seconds, abort)
  3. Perform radial damage (custom task)
  4. Repeat
I think the repeater could be removed if I set behavior tree to repeat on completion.

How about the seek with random timeout? Is there a better way than to return failure from wait - and then always return success from parallel? (Otherwise radial damage won't execute)

Thanks


1605678408625.png
 
Seems like if either seek or wait returns a value then it will continue on.
A timeout situation is very common so thanks for sharing this.
I see you kept the repeater, "repeat on completion" didn't give the behavior you were looking for?
 
A timeout situation is very common so thanks for sharing this.
I see you kept the repeater, "repeat on completion" didn't give the behavior you were looking for?

It does, but this was a external behavior (shared between enemies), so being able to set the repeat on the asset was more convenient than on the component.
 
Top