Well you can make it as a service in a behavior tree or you can just toss it into the character blueprint. If it was in the behavior tree you’d use a service to check if the character is touching the light and have it set a blackboard key based on that (a bool variable), then use that to tell it to move away before it goes back to its normal tasks.
It’s a bit more involved with the structure setting it up in behavior tree but the basic functionality would be as I showed in the picture higher up.
If what I’m saying now is unclear please ask and I will attempt to clarify. This is an example the behavior tree from the quickstart guide:
What you want is essentially the same thing. That tree checks if the AI has a target, then follows that target. If it doesn’t have a target, it returns to its “home location” (Ie it’s starting point). In your behavior tree you’d have a similar service, except checking if the character is overlapping the light actor. If it is, it performs task “move away”, if it isn’t, it goes about its usual business.
I personally prefer to use blueprints for scripting AI as it makes the setup less cumbersome to me, but to each its own. Behavior trees have performance advantages of course.
https://docs.unrealengine.com/en-us/Engine/AI/BehaviorTrees/QuickStart
