Skip to main content

Event Trigger System

The Schema-Aware Trigger System in SkyrimNet allows you to define custom reactions to in-game events. This system makes NPCs, the player character, and the world itself more dynamic, offering immersive responses that feel tailored to what's happening in real time.

Triggers are event-driven rules that check for specific gameplay conditions, such as casting a spell or using an item. When conditions are met, a templated response is generated โ€” from a whispered thought to a loud reaction from nearby NPCs.


How Triggers Workโ€‹

Each trigger consists of:

  • Event Type: The in-game action that activates the trigger (e.g., spell_cast)
  • Conditions: Fields like spell name, editor ID, or actor type that filter the trigger
  • Response Content: A written message, using variables and templates
  • Response Type: Defines how the line is delivered (thought, speech, narration)
  • Audience: Who hears or sees the response (player, NPCs, etc.)
  • Optional Metadata: Priority, probability, and cooldown timers

Triggers can be created manually or automatically based on spell/item customizations.


๐ŸŽญ Response Typesโ€‹

TypeDescription
Player DialogueSpoken aloud by the player character
Player ThoughtSilent internal monologue (immersive introspection)
Direct NarrationDescriptive text, often from an NPC or narrator

Each response style sets a different narrative tone and use case.


๐Ÿ‘ฅ Audience Optionsโ€‹

You can target who receives the trigger response:

AudienceDescription
playerOnly the player sees/hears the response
originatorThe actor who caused the event (e.g. spell caster)
targetThe actor the event is aimed at (e.g. spell recipient)
nearbyAll nearby actors (within a set distance)
npcsAll nearby NPCs (excludes the player)
everyonePlayer and all nearby NPCs

This allows you to control perspective and immersion for every response.


๐ŸŽฏ Conditions and Eventsโ€‹

Each trigger uses schema-aware conditions tailored to its event type. For example, a spell_cast event includes:

  • spell: The display name of the spell (e.g., Ironflesh)
  • spell_editor_id: The internal ID of the spell
  • actor: The caster of the spell

These fields can be matched using operators like equals, contains, or starts_with.


๐Ÿงพ Response Templatingโ€‹

Response text is written using a flexible template language with variable support. You can insert values dynamically:

{{ actor.name }} begins to glow with magical energy.
I cast {{ event_json.spell }} and feel my skin tingle.

Templates allow you to reuse trigger logic across characters and situations without hardcoding dialogue.


๐Ÿงช Example: Ironflesh Spell Reactionโ€‹

Trigger Name: Ironflesh Trigger
Event: spell_cast
Conditions:

  • spell equals Ironflesh
  • spell_editor_id equals Ironflesh

Response Type: Player Thought
Audience: Player
Cooldown: 30 seconds

Response:
I feel my skin tingle as it hardens while I cast {{ event_json.spell }}.


๐Ÿ”ง Managing Triggersโ€‹

Triggers are created and edited via the Trigger Management UI. Each trigger supports:

  • Setting priority (used when multiple triggers match)
  • Configuring chance (e.g., 100% reliable or random 25% chance)
  • Defining cooldown to prevent repeated responses
  • Live enabling/disabling without restarting the game

You can also search, filter, and reload triggers instantly. The UI is schema-driven and adapts to the selected event type for easier configuration.


๐Ÿ”„ Integration with Other Systemsโ€‹

Triggers integrate seamlessly with:

  • Item and Spell Customizations: Auto-generating responses based on renamed spells or items
  • Memory and Emotion Systems: Feeding into emotional state and memory entries
  • NPC Dialogue and Ambient Behavior: Creating realistic chatter or commentary in response to events

This makes the trigger system a bridge between world simulation and narrative design โ€” powerful for both modders and storytellers.