Quest integration (PulseAIQuestBridge)

The bridge PulseAIQuestBridge brings agents into the quests of Pulse Quest. Enable it next to PulseAI and PulseQuest. Quests can then spawn agents, change their profile, send them AI events and raise alarms, and two objectives count defeated groups and escorted agents. Everything runs on the server.

Quest tasks

Four tasks for quest StateTrees (schema Pulse Quest, category Pulse Quest AI):
Task What it does
Spawn AI Spawns agents of a pawn class with a profile, an AI group, an actor tag and a difficulty
Set AI Profile Gives agents another profile (bRestart starts their new StateTree): the bandits give up, the guard becomes a companion
Send AI Event Sends an AI event to agents, with the payload FPulseAIQuestEventPayload (the quest and its first player avatar), so their trees can follow, attack or flee from the player
Raise AI Alarm The agents raise an alarm: they, the friendly agents nearby and their groups become alert of the closest player of the quest (bTargetQuestPlayer) or of AlarmTarget

The tasks succeed at once and fail when they find no agent. Put them in a state of their own, before the state with the objective: a task that succeeds completes its state.

Spawn AI

Parameter Default Description
PawnClass none Pawn with a Pulse AI Agent and an AI controller class such as Pulse AI Controller
Profile none Profile of the agents; empty keeps the profile of the pawn class
Count 1 Number of agents
SpawnPoints   Actor, or all actors with ActorTag (spawn points placed in the level), or Location
Spacing 150 Agents at the same point stand side by side, this far apart
Group none AI group of the agents (alarms, roles, Defeat AI Group)
ActorTag none Actor tag the agents get, to find them later
Difficulty none Difficulty of the agents; empty uses the default of the settings
bDespawnOnExit false Keep running while the state is active and remove the agents that are left when it ends

The output SpawnedActors holds the spawned agents for the tasks of child states. With bDespawnOnExit the task belongs next to the objective: the camp disappears when the quest moves on or fails.

Choosing agents

Set Profile, Send Event and Raise Alarm choose their agents the same way (FPulseAIQuestAgents): Actors (bind them to SpawnedActors of a Spawn AI in a parent state), every actor with ActorTag and every agent of Group. Every agent counts once.

Objectives

Objective Completes Fails
Defeat AI Group when every agent of Group is gone: removed, or dead by Pulse.Message.Combat.Died of Pulse Gameplay never
Escort AI when the escorted agents are at a target when one of them is removed or dies, or nobody is there to escort at the start

Create them in the Pulse window (Create, entries Defeat AI Group Objective and Escort AI Objective) as Blueprint objectives, set their fields and use them in a Quest Objective task.

  • Defeat AI Group counts the defeated agents as progress ({Progress}/{Target} in the display text). Agents that join the group while it runs count as well. Agents that are dead already (Pulse::AI::IsAlive: their health is depleted, as after a load that restored a death) do not count. A group without living agents at the start counts as defeated: start the objective after Spawn AI. Removed agents count as defeated, so a load during an encounter fight (the encounter removes its agents and loads its saved state) and a reset of the encounter complete the objective as well.
  • Escort AI escorts the actors with EscortActorTag and the agents of EscortGroup. Its targets come from the Quest Objective task, TargetActorTag or DefaultTargets, as for Reach Location, and the player sees them as markers. bRequireAllAvatars (on) means every escorted agent must arrive. Making the agent follow the player is the job of its StateTree, for example on an event that Send AI Event sends.

The death message comes from Pulse Gameplay; the bridge reads it by name and needs no Pulse Gameplay. Without Pulse Gameplay only removed agents count.

Example: free the prisoner

Root
├─ Ambush    Spawn AI (3 x BP_Bandit, group Bandits), Raise AI Alarm (group Bandits)    → on succeeded: Fight
├─ Fight     Quest Objective (BP_Objective_DefeatBandits: Defeat AI Group, group Bandits) → on succeeded: Rescue
├─ Rescue    Spawn AI (BP_Prisoner, tag Prisoner), Send AI Event (follow, tag Prisoner)  → on succeeded: Escort
└─ Escort    Quest Objective (BP_Objective_EscortPrisoner: Escort AI, tag Prisoner, target the village)

Quests in AI trees

The StateTree condition Pulse Conditions of Pulse AI checks Pulse conditions about the agent’s current target (or TargetActor). When the target is a player, the quest conditions of Pulse Quest work there without this bridge: Quest Active, Quest Finished and Story Flags. A guard that lets the player pass while a quest runs:

Root
├─ Let Pass    enter condition Pulse Conditions: Quest Active (Quest.PassTheGate)    Focus Target
└─ Combat      ...

Agents think on the server, so a condition that cannot be checked there (Unknown) does not pass.

Multiplayer and debugging

The tasks act on the server only (quest managers with authority); clients see the agents as usual. The log category LogPulseAIQuestBridge logs spawned and removed agents, alarms and objectives that complete or fail at once.


This site uses Just the Docs, a documentation theme for Jekyll.