Download

Enemy AI can't see player when on horse

Hi , just wondering if anyone knows how to make AI see player while on horse ? Enemy AI sees the player fine when he is not on the horse , but when he is on the horse , i can ride right in front of them and they dont see player

Usually depends on how you set up the perception service / whatver you did when you coded the blackboard tree.

The blackboard tree?

If you posses the horse then you need to communicate to the AI that the horse is the player, depending on your game logic. For instance add a player tag to the horse bp, or add the horse bp to the enemy list of the AI.

Then let him see the horse.

I did add the horse to the enemy list , but it didn’t work , must be a component on the player that is not on the horse i figure.

Tried adding tags , but none help, there is no tag on the player now. Is there a tag name that should always be seen by AI , or does that tag logic need to be set up in the AI for them to see it?

It depends on your AI code. It seems the AI code is configured to only specifically seek the player blueprint. Take a look into the enemy AI Controller for a start. Look at the enemy ai blueprint and find references related to components related to player detection, for example AI Perception, Behavior etc.

this is all the code in the AI perception component

Okay, so you need to add the horse, as of now there is only AC Player BP. So on fail at the IsValid nodes, add another IsValid, with the same code as is already in place, but change the class component to the horse bp. Be aware that there are likely many more such code changes for the AI.

Perhaps it is not working, because it is looking for a component. In this case I suggest either add cast to the player and horse blueprint directly, including a setup using on fail, or add a Actor has Tag node, and add the tag you looking for to both blueprints.

Start from scratch and do it right by using a blueprint interface…

Hmmm , thanks for replies , gives me something to look at.

I am unable to change the class component to the horse bp , as the horse bp is not in the list , nor anything related to it.

T

ried adding a horse bp cast in but no change.

Or this dont help either.

So i got this so that the AI sees the horse , then AI of course attacks the horse , so when they attack horse i call an " Exit Horse " event . Which works , except after he exits horse and AI keep shooting fireballs at horse , each time a fireball or other attack hits horse , then player is teleported next to horse again for some reason. Even though he is off the horse.