Hi guys, I’m working to a top down shooter and I’m stuck with the AI.
I found this quick-start guide on the Unreal Documentation: https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/index.html
which is perfect for my project, so I builded up all the blueprints and applied the Controller (Follower AI CON) to my enemy character as the default controller.
I also builded up a simple spawn for enemies, which is the following:
I used an Event dispatcher: There is a trigger box (called Spawn Enemies) that calls this on the level blueprint.
It’s very simple: after the Overlap event, “Spawn AI from class” spawns an enemy, and the number of enemy spawned is increased by one. Until this number is less than the spawn limit value, it keeps spawning. The spawn location of each pawn is choosed randomly from a group of target points placed on the map.
I don’t think this could be the reason of the problem, but since I’ve made it on my own and I’m not very experienced, maybe there is something to change, in order to make the IA working correctly.
I’ll briefly explain how the IA should work: When the enemy is spawned, his location is stored in the HomeLocation variable. If he see the HeroCharacter, he moves to his location. If he loose his target, he stops and waits for 2.5 sec and then returns to his HomeLocation.
What actually happens when I hit play is: If an enemy sees me, he runs to my location. If I make him loose the target, he just stays still and does not go back to HomeLocation. If I make him see me again, he correctly follows me.
When I stop the game, I receive this error log:
And the reason is the Get Controlled Pawn node, as you can see here:
I think that when the pawn is spawned, the controller does not immediately take possess of him, so the HomeLocation variable cannot be stored, (this could explain why enemies don’t go back to HomeLocation) but the fact that the enemy runs to me means that at a certain point the controller “appears”.
So… has someone and idea of why this appens? How can I fix it? I’m really desperate, I tried everything.
Hoping I explained clearly the problem, thank you