Friendly AI

Hello all! While looking through the code of shooter game, I noticed that the bot’s enemy class is a Pawn. Doesn’t that mean if creating friendly AI they’ll attack the player as well? Or did i read it wrong? Because I am trying to make friendly AI, and plus how do I exclude players and only attack enemy pawns?

A Pawn is anything that can have a controller, regardless of whether it’s friendly or enemy.

See the docs here:

Oh, well how do I specify what it attacks?

Instead of just saying the base class Pawn?

If you’re using Blueprints, you can create a variable called ‘BadGuy’ that is True for the enemies and False for the allies. You can check in the blueprint that the target is flagged as a BadGuy or not before the bot decides to shoot.

thanks for the help!

No problem!

I’m sort of really late and also new to blueprints, Could you explain how such a system would be layed out? Like, where would this variable be placed? In the BotShootEnemy blueprint? or the pawn blueprint

Can you show an image?

Can you show an image?

I’m really confused how to do this; I made a variable in the bot blueprint called Bad_Guy but now I don’t know what to do.