AI Perception

Hi,

i use Behavior Tree to control my enemies
works fine they see me engage me when i hide and
step out they re-engage me
but when i die they dont
pls help

Hey @Chronoknight! Could we possibly get some more details? Screenshots, a more in-depth description of your issue? Because what it’s sounding like is they engage you when appropriate, and when you die they leave you alone… which is typically what someone wants… So I’m thinking if you get us some more details and some screenshots of your behavior tree we might be more able to help you. :slight_smile:

I think he’s referring to on respawn they no longer engage.

1 Like

yea on respawn


this is what i use for sensing

the behavior tree just has blackboard decorator for switching on the
SeeingPlayer bool

1 Like

On death you need to unregister the AI Perception Stimuli Source. These are the ones in the character class. Pawn is dead, hence no longer a valid target.

On respawn (using same pawn) you register the AI Perception Stim source.

Scroll down to the functions list.

1 Like

sorry dont fully understand
so best way is to unregister from the dying/died player?

so i wonder again why is this all working without
having the ai stimuli source bp component?

i cant unregister without having it
is there some default behavior?

When your pawn dies Call UnReg AI Sense on the dead pawn.
This is done from the controller PRE-Unpossess.

When you respawn it, Call Reg AI Sense on the pawn.
This is done from the controller POST-Possess.

thank you

but still how could a pawn or actor be hidden from seeing sense
or how can the ai sensing be configured to just sense
actors with stimuli

i just tested on begin play to unregister but they see me
so unregistering at death also doesnt work :frowning:

Add the unregister for Sense (hearing, Sight) to your Unreg event.

The code I posted previously works on my builds.

i did this they just always see me

is auto register set to true?

tried both

this freaks me out :frowning:

when i hide behind a wall it works oO

and my respawn has a delay of 2 seconds

What net mode are you testing in?

If in Client mode you need to Unregister on the server. Bots interact with authoritative proxies (servers sim). Their actions are only simulated on your end (remote client).

standalone

After lots of testing i realized
The real problem is the behavior tree doesnt get the negative bool from sensing
i would love to do the sensing as bt service but dont know how

yay i did it
i managed to make blackboard services
for checking up line of sight and if any player pawn is available

blackboard keys are kinda like confusing