πŸš‰NPC Stations

circle-exclamation

Using the NPCssystem, we have a specific type of spawner: BP_ODK_NPCSpawner_StationUser.

NPCs spawned from this spawner run the BT_ODK_UseStations behavior: They look around for available BP_ODK_NPCStation actors, move to them, and perform the associated action.

Configuring your station spawner

Each station spawner is a basic NPC spawner, with a few additions:

  • SpecificStations: If entries are provided in this list, NPCs spawned from this spawner will only consider the stations in this list as viable stations to navigate to.

  • StationSearchRange: If there are no specific stations, stations will be found using this. Any stations within the range will be viable stations to navigate to.

Advanced: Station filter

An example station filter: The stations' NPCs will be considered TypeA, and search only for stations that are Restricted or Restricted2

When searching for smart object slots, using either of the above approaches, it is possible to add SmartObjectRequestFilter details to it. With this you can e.g.

  • Provide UserTags to represent NPCs in this station. In your stations' Smart Object Definitions, you can add a UserTagFilter to only accept NPCs that have the required tags.

  • Provide ActivityRequirements. These are effectively the inverse of the above - the NPCs will only accept stations/slots that have the required ActivityTags

    Example details within a Smart Object Definition. This smart object is a Restricted type, and only accepts users (NPCs from a station) that has TypeB as one of its UserTags.

Configuring your stations

Each station extends BP_ODK_NPCStation, and can be placed in the world. This will be the target that NPCs will move to.

  • SmartObjectDefinition controls the behavior that NPCs will perform upon reaching the target, along with other properties. By default we have the SOD_ODK_NPCStation_Blank definition, which means the NPC will not do anything upon reaching the target - they will immediately move on to the next target (for randomly walking)

  • RequiresMatchingRotation is a tickbox that can be used to control whether NPCs need to match the rotation of the station's slot before running the action, or not

  • MoveToSpeed lets you control whether NPCs will walk, jog or run to the target.

(If you use a smart object definition with multiple slots, each slot is a viable "target" for NPCs to move to and interact with)

Smart Object Behaviors

Each station is a Smart Object, with a Smart Object Definition. The behavior definition within a smart object definition controls what behavior runs when interacting with the object.

The most common usage is to add an entry to your DefaultBehaviorDefinitions: Add a GameplayBehaviorSmartObjectBehaviorDefinition, and a GameplayBehaviorConfig within that. You can make and provide your own BehaviorClass, where you can add your custom logic.

  • As an example, see GameplayBehavior_ODK_PlayMontage: This handles playing a montage, getting some additional relevant information from the station.

    • The event to implement is Event OnTriggeredCharacter. When finished, pass or fail, call EndBehavior to move on.

circle-info

NOTE: One of the existing gameplay behavior config classes is GameplayBehaviorConfigBehaviorTree (instead of a regular GameplayBehaviorConfig). This has not been verified to work with our current setup, so is not recommended.

circle-info

NOTE: Each Smart Object Definition must have at least one slot. This can be the blank "None" slot created if you click the + button:

Montage Stations

These are a specialised form of station, pre-made for convenience. They are set to use the SOD_ODK_NPCStation_PlayMontage smart object definition, which will play the configured MontageName upon interacting with the station.

(If a MaxPlayDuration is provided, then the montage will only play for at most that duration. This avoids NPCs looping forever if they play a looping montage)

Last updated