Skip to main content

Conversation Triggers

Conversation triggers control when agents autonomously start conversations with each other.

Rather than scripting every conversation manually, you define trigger conditions and the system evaluates them automatically.

How triggers work

ConversationTriggerEvaluator runs each frame, evaluating registered trigger sources. For each potential initiator, it:

  1. checks the trigger profile conditions
  2. looks for nearby valid conversation targets
  3. verifies requirements and cooldowns
  4. rolls against the configured probability
  5. attempts to start a conversation through the orchestrator

If all checks pass, a headless conversation begins between the initiator and the target.

Trigger sources

A ConversationTriggerSource is a MonoBehaviour attached to an agent that marks it as capable of initiating conversations. It references a ConversationTriggerProfile that defines the rules.

Trigger profiles

A ConversationTriggerProfile is a ScriptableObject that configures:

  • Sense -- a SenseDefinition determining how the initiator perceives targets (sight, proximity, eavesdrop, or group)
  • Initiator Requirements -- blackboard conditions the initiator must meet
  • Target Requirements -- blackboard conditions the target must meet
  • Cooldown Seconds -- minimum time between triggers for this profile
  • Probability -- chance (0-1) that a successful perception results in a conversation
Requires CIVIL-AI-SYSTEM

When CIVIL-AI-SYSTEM is installed, proximity detection uses the CivilAI sense system (ISenseProvider). This provides more sophisticated spatial awareness based on perception profiles rather than simple distance checks. Without CivilAI, a simpler proximity fallback is used.

Global trigger settings

Beyond per-agent profiles, global settings in BardTreeLtd/Dialogue/Module Settings, under the Conversation Triggers section, control system-wide behaviour:

  • Enable Conversation Triggers -- master toggle for the entire trigger system
  • Auto Attach -- automatically adds ConversationTriggerSource to agents at runtime:
    • Disabled -- you must manually add trigger sources to agents
    • DialogueAgents -- auto-attaches to agents that have a dialogue tree assigned
    • AllAgents -- auto-attaches to every agent in the scene
  • Default Sense -- the SenseDefinition used when a trigger source has no profile-specific sense
  • Default Headless Dialogue Tree -- fallback tree used when agents have no headless tree assigned
  • Evaluation Tick Interval -- how often triggers are evaluated in seconds (default: 3)
  • Default Cooldown Seconds -- global cooldown between any two triggers (default: 30)
  • Default Probability -- global probability fallback (default: 0.5)
  • Player Conversation Cooldown -- cooldown after a player conversation before triggers can fire on that agent
  • Exclude Player From Triggers -- whether the player agent is excluded from being a trigger target
  • Max Triggers Per Tick Percent -- caps how many conversations can start in one tick (as a percentage of total sources)

The trigger driver

ConversationTriggerDriver is a MonoBehaviour added to the bootstrap automatically by the dialogue registrar during initialization. It drives periodic evaluation of all registered trigger sources with a configurable tick interval (plus jitter to avoid synchronized bursts).

When Auto Attach is enabled, the driver also listens for new agents spawning and automatically adds trigger sources to them.

You do not need to add this component manually.

Eavesdropping

The trigger system supports an EavesdropSense concept. Nearby agents can detect that a conversation is happening and react to it through their own triggers or event subscriptions. This allows for chains of social interaction where one conversation can influence another.

Practical advice

Start with simple triggers:

  • one trigger source on a single agent
  • a generous cooldown (so conversations are infrequent)
  • a low probability (so they feel natural rather than constant)
  • no requirements initially

Once basic triggering works, add requirements and adjust timing to create the social patterns you want.

Next step

Continue to Blackboard.