Need to communicate player overlap with trigger volume to AI Bot Blueprint

I need to get the AI bot to ignore the player if they are overlapping with a trigger volume. I cannot figure out how to get a reference to the trigger volume into the AI blueprint. Any suggestions would be of great help.

Hello ,

I have set up a few images that should get you all ready. I did change a couple things so make sure you look over them well.

This is the player BP and it holds the variable PlayerDetected. In the event graph i have EventBeginPlay and sets PlayerDetected to false so that the game cannot start bugged (just a safety) if this is not how u want to start then just change the starting variable value.

This is the WorldTriggerVolume BP it casts to Player_BP to set PlayerDetected to false as well as cast to AI_Character_BP and sets ThisAIDetectedPlayer to false.

Last is the AI_Character_BP. The Trigger casts to Player_BP to set PlayerDetected to true, then sets its own ThisAIDetectedPlayer to true. (this is to help make it so that not every AI will follow the player. Just the one that detected the player. to change this just get rid of ThisAIDetectedPlayer and the AND Boolean in the branch at EventTick.) AI_Character_BP uses EventBeginPlay to set EhisAIDetectedPlayer to false for Safety. In the EventTick AI_Character_BP casts to Player_BP to see if PlayerDetected equals true as well as checks if ThisAIDetectedPlayer is true. If both variables are true then branch will do your SimpleMoveToActor i just didnt add that in for room sake.

This should get you goin if not just let me know and i will see if i can assist you further!

Thanks,
I have tried this a few different ways and it doesn’t seem to work. The context is this- Basicly I have a collision box on the AI character. When the player overlaps with it, the AI character goes to the player. This works fine. But I want the trigger box/player overlap in the level to cancel it out.

I tried the set up you suggested (1). I have the AI character’s Blueprint to branch and check the ‘PlayerDetected’ variable (2)

I tried getting the variable for a few different things, like the AI character go to two different locations depending on the variable. It just won’t change.
No mater what, the variable always stays its default setting ‘true’.

Any suggestions you may have would be appreciated.

,

Actually both of those should work fine just you need the first one to be for the trigger volume that the player can hide in and the second should be in the AI character.

In (1) if the player is detected and the player overlaps the level trigger then player detected gets set to false.

In (2) if the player over laps the detection box you need to set Player Detected to true and thin in a Event Tick node you need to do the check if player detected and if so do Simple Move to Actor. If False you can have your AI Character move back to another location.

In your second example you are not setting Player Detected to true when the player overlaps the Trigger you are just checking if it is true or not and the default should be set to false unless you want the AI to move to player at start.

If this helps explain everything let me know if not i will do my best to help you figure this out.

Good job on getting the AI part by yourself!

Make sure you are adding comments to my answer instead of adding an answer so the Unreal Team knows that there isnt multiple answers and this will help them track what the problem is and if it actually gets resolved. You should be able to change it from an answer to a comment to an answer under the drop tab.

Hmmm. Yeah I think I’m a bit lost on this. I tried this setup on the AI BP-

But the AI still goes to player location even if the player gets into the triggerbox (safe trigger) in the level.
I wonder if as long as the player is overlapping with the detection box, PLayerDetected will always be set to true.
Is there a way to have it meet two conditions? Is the player detected and Is the player in the trigger box.

Any ideas?

So just in case I didn’t get anything correctly:

You have a volume inside your level which is some kind of other blueprint.

You have an AI which moves towards the player but it should stop doing so once it hits that volume.

If this is true it should be fairly straight forward using the “on begin Overlap” node, casting the result to your volume blueprint and if this is true, not moving anymore.

Does this help? :slight_smile:

I edited my original answer with the new one to save space and not flood the forum post.

Actually what is doing is he has a trigger in his level, a player and AI pawn.

The AI Pawn has a trigger volume on it and when the player overlaps that volume the AI Pawn is soposed to move to/follow the player.

The Trigger volume in his level is a safe zone and when the player overlaps that trigger the AI Pawn is soposed to stop following the player (Player is Hiding).

If you follow my answer it should explain what he is trying to do.

I really want this to work. I set up the three blue prints as you showed, triple check the instructions. Even started with a brand new project. I thought that it was a problem with the AI BP variable “This AIDetected Player” So I removed that.
Still not working :frowning:

In the player BP, I set up a tick with a branch checking the Player Detected variable to print either “Detected!” or “NOT Detected” to see if the variable is getting set properly.

1- I start the game and it starts printing “NOT Detected”.

2- I run into the AI’s detection box and it starts printing “Detected!” and the AI starts moving at me.

3- Then I run over to the safe trigger box and it starts printing “NOT Detected” (So I know the safe trigger is setting the variable)
-but the AI keeps coming at me.

This is what is going on as I am standing in the safe trigger box-

I really do appreciate all the help I have gotten on this so far. It seems so simple, I just cannot figure out what I’m doing wrong :frowning:

Any suggestions would be very much appreciated :slight_smile:

try making an actor in your world and placing it at or near your AI start point. and have your AI move to that actor if PlayerDetected is false.

One More thing… The problem now might be that your AI might continue to move to the player until it has met his destination. you might have to find another method of moving your AI to the player. but first try moving your AI to another actor if PlayerDetected is == False.

Also is the player Overlaping the the AI Trigger Volume at the same time that you are inside the Safe zone?

Good idea. One thing, I can’t figure out how to reference a target point in the AI blueprint. This is related to a different question I had asked.

Any info would be awesome.
Thanks

First let make sure we have the first problem solved. have you got the original issue resolved?

Since the time has gone by I’m assuming that this problem was resolved.