[=Jordan Walker;39617]
Keep in mind, I know -very little- about AI and i’m probably not doing a lot of things properly! I just bash them together until they work
Having said that, here’s my behavior tree:
SearchForEnemy is just a decorator that grabs the player variable off of the enemy pawn if the enemy aggro is set to true. On my enemy I have a sensing component that sets aggro to true if it detects a player.
Attack decorator just calls an attack function on my enemy that plays an attack anim montage and does damage.
[/]
is pretty similar to what I’ve been working on in functionality, but is rather differently built.
Here’s my advice: You can get rid of all of the sequence nodes except the first one and it would probably work better actually. Just move the SearchForPlayerEnemy to the Selector below it and the “Attacking” decorator onto the MoveTo node below it (You may need to actually get rid of the Selector, but there is one too many composites here). The Sequence leading to the Attack doesn’t seem to be doing anything, so it can be removed flat out.
Here is a similar test zombie I have been working on. The simple parallel makes it so that he attacks while moving simply.
EDIT: I use a Service to find the player as well in case I decide to add NPCs so that the zombie could change victems. Decorators are good for checking before proceeding, but Services are for something that happens everytime a node is activated. If you move the SearchForPlayerEnemy down, you may want to switch it to a Service. I didn’t actually try any of out, but it makes sense from what I’ve in the past. If it starts acting funny, I can drop by and see what is up.

