Register NPCs in Blueprint
You can list an NPC in the Awaken views without writing C++. Add the Awaken Npc component to the actor for the common case, or call the Awaken Debug Subsystem nodes for an NPC that has no actor.
The project still has to be a C++ project, because the plugin is built from source with it. See Install into a project.
With the Awaken Npc component
This is the shortest route. The component registers its actor when play begins and removes it when play ends.
Add the component
Open the actor’s Blueprint. Choose Add, then Awaken Npc.
Set the first state
Select the component. In the Details panel, under Awaken, set:
| Property | Use |
|---|---|
| Npc Id | A stable id. Empty: the actor’s object name. |
| Display Name | The name shown in the views. Empty: the actor’s label. |
| Status | A short state, such as Idle. |
| Goal | The goal the NPC is working on now. |
| Goals | The goal list, most important first. |
| Blackboard | Keys and text values. |
| Tree Json | A behaviour tree snapshot: any JSON object. |
Update it as the NPC changes
In the event graph, drag from the component and call its nodes:
| Node | Use |
|---|---|
| Set Status | Change the status. |
| Set Goal | Change the current goal. |
| Set Goals | Replace the goal list. |
| Set Blackboard Value | Set a key to a text value. |
| Set Blackboard Number | Set a key to a number. It is published as a number, not as text. |
| Remove Blackboard Key | Remove a key. |
| Set Tree Json | Replace the tree snapshot. Returns false and keeps the previous snapshot when the text is not a JSON object. |
| Push All | Send every property to the subsystem again. |
| Get Registered Id | The id the component registered under. Empty before play begins. |
With the subsystem nodes
Use the subsystem for something that has no actor, such as a squad or an encounter director, or when you want to register an actor without adding a component.
Get the subsystem
In a graph, add the Awaken Debug Subsystem node.
Register
Call Register Npc with an id and a display name. Or call Register Actor with the actor; it returns the id.
Report state
Call the setters with that id. They are the same functions as in C++:
| Group | Nodes |
|---|---|
| Who and what | Set Npc Name, Set Npc Status, Set Npc Goal, Set Npc Goals, Set Npc Position |
| Blackboard | Set Blackboard Value, Set Blackboard Number, Set Blackboard Bool, Remove Blackboard Key, Clear Blackboard |
| Tree | Set Npc Tree Json |
| Reading | Get Npc Ids, Get Npc Count, Is Registered, Get Actor Npc Id, Get Npc, Describe Npcs |
| HUD selection | Select Npc, Get Selected Npc Id |
Every setter returns false when the id is not registered.
Remove
Call Unregister Npc or Unregister Actor. An actor’s NPC is also removed when the actor is destroyed.
The subsystem exists only in game and Play In Editor worlds.
Next steps
- The parameters of each node are in the C++ function reference.
- The Awaken Npc component in detail.
- See the NPCs in the HUD.