Arcane University: World Interactions

The Beyond Skyrim Wiki — Hosted by UESP
Revision as of 05:17, 23 November 2020 by Km816 (Talk | contribs) (World Interaction Default Scripts)

Jump to: navigation, search
< Arcane University:Quest Implementation

This guide covers how to set up World Interactions in the Creation Kit. In Skyrim, these "quests" use the "WI" prefix, and include things like NPCs reacting when you cast a spell on them; when you walk around with a weapon drawn; when you when you swing a weapon near an NPC; or when you craft an item.

Introduction

Prerequisites

Implementing world interactions will require knowledge of dialogue implementation and basic scripting, and more complex reactions will require knowledge of the Story Manager, quest aliases, and scenes. You will also need to know how to generate and SEQ file for the quests you create.

Types of World Interactions

World Interactions can be grouped into four categories.

  1. Hellos: Hello reactions are essentially standard out-of-dialogue hellos, conditioned to only happen under special conditions. These are some of the easiest to set up, and include things NPCs reacting to you walking around with a fire spell equipped, or commenting on you sneaking past them.
  2. Scripted Reactions: These are events where an NPC is directly told to say a line using the Papyrus "Say" command. The most common use for this is NPCs reacting to spells being cast on them. These are relatively easy to set up, and can mostly be completed with default scripts.
  3. Engine Events: This covers events with a substype on the Misc Tab of quests, such as NPC reactions to the player bumping into them, watching a fight, or noticing the player about to steal something.
  4. Story Manager Events: The story manager allows you to create world interactions for more complex events. This includes NPC reactions to things like the player crafting an item, dropping something, or having a unique "Hello" if the player previously attacked them.

Each of these types will be covered separately below.

Initial Setup

NPC Preparation

In Skyrim, World Interactions are (broadly speaking) limited to generic NPCs using a default voice type. When you make your own, you will need to condition them in some way so that they are limited to only the NPCs you want. This is best done with one of three methods (or some combination of them):

  • A custom faction, for instance something like "<Mod Prefix>AllowWorldInteractions". (Remember, factions aren't just in-game factions like the Companions or the Mages Guild, they are used for plenty of behind-the-scenes game mechanic things as well.)
  • A formlist of valid NPCs.
  • A formlist of valid voice types.

Pick which method (or methods) you want to use. Depending on your choice, fill out the formlist or add your faction to NPCs. You will use this faction or formlist as a quest dialogue condition, and possibly also as an alias fill condition or a story manager event node condition.

GetAllowWorldInteractions Condition

You may notice that the Creation Kit has a "GetAllowWorldInteractions" condition function. This function checks if the NPC's current package has the "World Interactions" flag checked. If it does, then the GetAllowWorldInteractions function will return TRUE. If not, it will return FALSE. In this way, you can dynamically change whether an NPC will have world interactions or not. For instance, if an NPC is fighting with you in a dungeon, you probably don't want them to complain that you have your weapon drawn. So, you should remember to include this condition for quest dialogue and when filling an alias.

Limiting World Interaction Occurrences

Generally, you want to limit how often world interactions play, lest they become stale after a long playthrough. Skyrim uses three methods to limit how frequently World Interactions play.

  1. Comment Chances: These are global variables set to some value between 0 and 100 and are used to give types of comments a percent chance to occur. There usage is typically a
    GetRandomPercent quest dialogue condition, compared to the Comment chance global variable. For example, vanilla Skyrim has world interaction where NPCs comment if the player has a flame spell equipped (quest <pre>WICommentMagicFlames
    ). There is a corresponding global variable
    WICommentChanceMagicFlames
    , and a quest dialogue condition
    GetRandomPercent() <= WICommentChanceMagicFlames
    .
  2. Comment Timers: In vanilla Skyrim, this is a single global variable
    WICommentNextAllowed
    used alongside a default script
    WICommentScript
    to limit how frequently world interaction comments occur. When a world interaction comment happens, this script gets the current game time and sets
    WICommentNextAllowed
    to one hour in the future. Then, a quest dialogue condition requires that the current game time be greater than
    WICommentNextAllowed
    (specifically, the condition is
    GetGlobalValue(GameDaysPassed) >= WICommentNextAllowed
    ). This blocks world interaction comments from happening until one hour has passed since the last comment. This script can be used as-is for new world interactions; you could make your own timer global variables and use those instead; or you could use some combination (for instance, you could make a new timer just for Magic Flames comments, then condition those comments to be one hour since the last world interaction comment of any kind and two hours since the last Magic Flames comment).
  3. Story Manager Timers: This is simply a setting on quests in the Story Manager.


Note: Remember that Quest Dialogue Conditions (on the Quest Data tab) apply to ```all``` topic infos in their quest. So, they are an easy way to apply a condition to a large set of dialogue lines.

Hello Reactions

Scripted Reactions

Engine Events

Story Manager Events