NPC Waypoints

Hey guys!
I’m trying to set up a system that allows npc waypoints to be used dynamically and fluidly.

Here’s what I want:
-A system that doesn’t require blueprint editing! I don’t want to open a level blueprint for every npc in the game!!
-A list of targetPoints that is referenced to the npc character

I’m trying to set it up so a UProperty Array holds all the references to the targets you want… is this possible?

I have this, but all this does is lets you choose any asset that is a TargetPoint. I want to make it so you can choose a specific asset on the map.



UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AI)
		TArray<TSubclassOf<class ATargetPoint> > WayPoints;


Any ideas? Thanks!

Use EQS. Make a query with a generator for all actors of class type targetpoint. Run your distance, path, line of sight, dot or whatever tests required. The AI can then move to a given waypoint. If you write a custom generator than you could reserve certain waypoints and lock them out.

I do this actively for my cover system and smart object system.

But how could you make a certain npc pick certain waypoints in the world? Cause one level could have like 20 guards with different paths to go. :slight_smile:

Give the NPC the ability to reserve a certain waypoint so it is no longer included in the original generator. You can also write custom EQS tests if you want more granular control and a less sandboxy selection. Furthermore if you want a fully controlled situation I would handle it on a case by case basis post NPC spawn.

So i’m guessing there is no way to choose specific waypoints for each npc in the editor itself? Would I just use a blueprint?
Basically all I’m wanting to know how to specifically select the waypoints per npc, without opening code or blueprints.
In other words, like this: (But selecting specific objects in map instead of blueprints)
temo.png

Thanks!

It is easy to select waypoints and add them to a list. But I don’t understand what you mean by doing it without a Blueprint or C++, that doesn’t make sense to me.

You have some choices, one is extend the targetmarker and place them in your level, then make a Bluepint that is an NPC spawner. Give the spawner variables such as the NPC type to spawn, also give it the list of points, then after you place the spawner assign the markers to it. The spawner is then responsible for setting the NPC with it’s waypoints after it’s spawned.

This is one way to do it that I did. When the project moved to procedural levels I stopped doing it like this and made the markers components. But it doesn’t matter, because I used both C++ and Blueprints to do it. So, I think the answer is simply NO. You can not do what you want without opening a Blueprint or code. Algorithmic solutions to have NPC’s select their own waypoints will all require needing to either write C++ or do the logic in a Blueprint.

Sorry, I’m really not explaining this at all!
I’m planning of writing code, of course. However after I write the base code, It’d be nice to be able to choose what target points in the map are for each npc - in other words, I just wanna make an array of targetpoints without opening code/blueprints…
To simplify this, is it possible to do something like in the above image, but instead of classes being listed, have individual actors on the map listed?

Ahh! I found it!

For some reason this didn’t work before, but simply having these lines:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AI)
TArray<class ATargetPoint*> WayPoints;

Makes it so you can select actors in the map! Really simple and stupid answer!
Thanks for all your help!

Ok, it’s not stupid, glad you got past the issue.