How to make a box that only blocks the enemy that spawns it?

You will need to script the desired behaviour. Simple behaviours can be scripted into an actor or a component, for more complex stuff look into Behaviour Trees.


Here’s a couple of examples demonstrating how basic logic could be set up, they’re pretty crude but hopefully you can make them better:

  • these guys will attempt to keep their distance:


  • these baddies will get to the player but not in a straight line, they must do some weaving first.

Added some debugging to visualise it better.


  • these zombies wander somewhat randomly around the player but will eventually find them as the radius gets tighter with every attempt:

image


Hope this helps a little.