My question is about an enemy I’m programming. This enemy patrols normally until a player is at the same height level as they are, and if this happens they chase the player quickly.
How can I make so I know when the player is on the same navmesh as this enemy?
I just give reference to certain triggers for each enemy. So when player trips one or many specific triggers, whichever enemies have reference to that trigger know.
In theory you could use find path to actor then check if the returned path is valid.Using triggers to wake up enemies on each floor as suggested above would be more reliable though if there’s any stairs or nav links a nav agent could theoretically use.
My task here initially just got a random location around the npc’s spawn point for them to moveto in their idle sequence. If you have them patrolling a specific route, try tossing the logic up to the branch in front of where the path is assigned.
This is a bit squirrely though as it was sometimesreturning true even when standing on a roof with no nav links leading up to it. When /flying several meters above the ground, however, all the npcs just stood around as expected.
Thanks for the explanation! I feel I’m not familiar enough with those nodes and I’m gonna opt for another blueprint that is a big collider that activates when the players enter it. It’s clunkier but it might work better for my level of dev skills.
unreal has a class of actors for that already called Triggers.
It is a very common technique in games - don’t consider it to be clunky or weird. I doubt you find many games that dont use triggers to control a ton of the games events. Simple is almost always better than sophisticated.
Ok so I found a native Behavior Tree condition that seems to do the work. It’s called “Does Path exist” between two objects.
For now it does exactly what I needed so I’ll keep it that way!
Ok so I update this post just in case it helps people.
the problem with “Does path exist” is that it’s uneditable, and more it cannot be aborted (which means it’s not something that is verified every tick and won’t be updated when a player no longer exist)
So I just created a BT service that does the same thing