Difference between revisions of "Arcane University:World Interactions"
(→Types of World Interactions) |
(→Examples) |
||
(28 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
===Prerequisites=== | ===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. | + | 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, and will want Fuz Ro D'oh for testing before you get voiced lines. |
* [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Dialogue Basic Dialogue Implementation] | * [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Dialogue Basic Dialogue Implementation] | ||
Line 14: | Line 14: | ||
* [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Scenes Scenes] | * [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Scenes Scenes] | ||
* [[AU:Seq Guide|Seq Guide]] | * [[AU:Seq Guide|Seq Guide]] | ||
+ | * [https://www.nexusmods.com/skyrim/mods/14884 Fuz Ro D'oh (LE)] | ||
+ | * [https://www.nexusmods.com/skyrimspecialedition/mods/15109 Fuz Ro D'oh (SE)] | ||
+ | |||
+ | Regarding dialogue, you will not have to know how to set up any complex branching conversations. Typically world interactions will only be a single line. However, you should be familiar with making non-Player Dialogue topics (such as Combat topics, Detection topics, and so on). | ||
===Types of World Interactions=== | ===Types of World Interactions=== | ||
Line 19: | Line 23: | ||
# 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. | # 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. | ||
− | # | + | # Spell Reactions: These are events where an NPC is directly told to say a line using the Papyrus "Say" command when a spell is cast on them. These are relatively easy to set up, and can mostly be completed with default scripts. |
− | # Engine Events: This covers events with a | + | # Engine Events: This covers events with a subtype on the [https://www.creationkit.com/index.php?title=Misc_Tab 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. |
# 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. | # 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. | ||
Line 26: | Line 30: | ||
==Initial Setup== | ==Initial Setup== | ||
− | ===NPC Preparation=== | + | ===<span id="NPC Preparation"></span>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 "<code><Mod Prefix>AllowWorldInteractions</code>". | ||
+ | *:- (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. | ||
+ | |||
+ | Or, you could use the reverse: a "DisallowWorldInteractions" faction, a formlist of invalid NPCs, and so on. | ||
+ | |||
+ | Pick which method (or methods) you want to use. Depending on your choice, fill out the formlist(s) or add your faction(s) to NPCs. You will use these factions or formlists for quest dialogue conditions, and possibly also as alias fill conditions or story manager event node conditions. | ||
+ | |||
+ | ===GetAllowWorldInteractions Condition=== | ||
+ | You may notice that the Creation Kit has a "<code>GetAllowWorldInteractions()</code>" 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 <code>TRUE</code>. If not, it will return <code>FALSE</code>. 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. | ||
+ | |||
+ | ===<span id="Timers"></span>Limiting World Interaction Occurrences=== | ||
+ | Generally, you want to limit how often world interactions play, lest they become stale after a long playthrough. Skyrim uses four methods to limit how frequently World Interactions play. | ||
+ | |||
+ | # 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 <code>GetRandomPercent</code> 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 <code>WICommentMagicFlames</code>). There is a corresponding global variable <code>WICommentChanceMagicFlames</code>, and a quest dialogue condition <code>GetRandomPercent() <= WICommentChanceMagicFlames</code>. | ||
+ | # Comment Timers: In vanilla Skyrim, this is usually global variable <code>WICommentNextAllowed</code> used alongside a default script <code>WICommentScript</code> to limit how frequently world interaction comments occur, however there are a few cases of separate times, such as for spell reactions. For <code>WICommentNextAllowed</code>, when a world interaction comment happens, <code>WICommentScript</code> the current game time and sets <code>WICommentNextAllowed</code> to one hour in the future. Then, a quest dialogue condition requires that the current game time be greater than <code>WICommentNextAllowed</code> (specifically, the condition is <code>GetGlobalValue(GameDaysPassed) >= WICommentNextAllowed</code>). 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). | ||
+ | # Story Manager Timers: This is simply a setting on quest entries in the Story Manager. When quests in the story manager have a value for "Hours until reset", the story manager will not attempt to start that quest again until that much time has passed since the last occurrence. | ||
+ | # Event Timers: These are timers used to block whole categories of events in the Story Manager. For instance, Skyrim has seven CastMagic world interaction quests in the story manager—the "Hours until reset" setting would block a ''single'' quest for some amount of time, but an event timer would be used to block ''all seven''. Functionally these are similar to comment timers. The code for them exists on <code>WorldInteractionsScript</code>, and are typically used through a custom script that extends <code>WorldInteractionsScript</code>, where the timer functions are called in quest fragments. | ||
+ | |||
+ | ===WI Quest=== | ||
+ | Skyrim has a World Interaction parent quest <code>WI</code>, which holds a script <code>WIFunctionScript</code> for some common WI functions and properties. In truth, you probably won't use this much. The functions primarily concern an unused "Mourner" world interaction and dragon attacks. The two functions you might find useful are <code>AllowComplexInteractions</code>/<code>DisallowComplexInteractions</code>, which enables you to enable/disable certain world interactions for whole locations at once (. Also, <code>ShowPlayerRoom</code> is used for some Skyrim tavern scenes. I've personally never needed any of the functions in this script, so I won't cover it in any more depth in this guide. | ||
+ | |||
+ | ==<span id="Hello Reactions"></span>Hello Reactions== | ||
+ | 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. These are the steps to create "Hello" world interactions: | ||
− | + | # Create a new quest. Give the quest a readable ID like "<code><ModPrefix>WIComment<Description></code>". Click "OK" then reopen the quest. | |
+ | #::- Because quests can only have one "Hello" topic, you will generally need one quest per type of interaction. | ||
+ | # Set the quest to Start Game Enabled. At some point before you start testing it, create a new SEQ file for your plugin. | ||
+ | # Set the quest data conditions for the world interaction. These are conditions that will apply to ''all'' topicinfos. | ||
+ | #* Check for valid NPCs, such as per [[Arcane University:World Interactions#NPC Preparation]]. | ||
+ | #::- This can include other broad conditions, for example you could exclude NPCs in the Mages Guild from commenting on equipped spells. | ||
+ | #* GetAllowWorldInteractions returns TRUE | ||
+ | #* If desired, a random percent condition | ||
+ | #* If desired, a timer condition | ||
+ | #* If desired, IsInDialogueWithPlayer returns FALSE. This will make it so the line only happens when the player brushes past the NPC, not when the NPC actually greets them to start a conversation. | ||
+ | #* The condition for your specific interaction type. Some examples: | ||
+ | #::- <code>IsSneaking</code>: React to the player sneaking | ||
+ | #::- <code>SpellHasKeyword</code>: React to an equipped spell | ||
+ | #::- <code>HasMagicEffectKeyword</code>: React to a spell active on the player | ||
+ | #::- <code>WornHasKeyword</code>: React to some thing the player is (or isn't!) wearing | ||
+ | #::- <code>IsWeaponOut</code>: React to the player having a weapon drawn | ||
+ | # Set the quest priority to something above totally generic greetings but below actually important quests. Skyrim uses a priority of 40 for world interactions; your mod or project might need something different. | ||
+ | # ''If'' you are using a timer: | ||
+ | ## Check the "Allow Repeated Stages" box on the Quest Data Tab. | ||
+ | ## Go to the Scripts tab and add <code>WICommentScript</code>. If you are using the generic <code>WICommentNextAllowed</code>, you can auto-fill all properties. Otherwise, autofill <code>GameDaysPassed</code> and fill <code>WICommentNextAllowed</code> with your own global variable. | ||
+ | ##:- If you are using multiple timers, you will need a custom script. | ||
+ | ## Go to the Quest Stages tab and create a new stage. The stage number is not important. '''DO NOT''' enter anything for the log. | ||
+ | ## Call <code>WICommentScript</code>'s <code>Commented()</code> function in the stage's quest fragment. | ||
+ | # Go to the Misc tab and create a new topic with subtype "Hello". | ||
+ | # Create the individual topicinfos for this world interaction. The exact conditions here will depend on what you've written for the lines or what your writing team has given you. For instance, conditioned on voice type, class, race, faction, and so on. | ||
+ | # If you're using a timer, then update the timer by setting the quest stage. In a Begin fragment, call: <code>GetOwningQuest().SetStage(<the stage you made earlier>)</code>. | ||
− | + | Your world interaction should now work in-game! | |
+ | ==Spell Reactions== | ||
+ | "Spell Reactions" are where an NPC is directly told to say a when a spell is cast on them. These work by using a script attached to the magic effect to force the NPC to say a line using Papyrus's [https://www.creationkit.com/index.php?title=Say_-_ObjectReference Say] command. | ||
+ | First, we'll cover setting up the quest and dialogue: | ||
+ | # Create a new quest. Give the quest a readable ID like "<code><ModPrefix>WICastMagic<Description></code>". Click "OK" then reopen the quest. | ||
+ | #* It is possible to have multiple reaction topics in the same quest, so you could make one quest that holds all your spell reaction topics. | ||
+ | # Set the quest to Start Game Enabled. At some point before you start testing it, create a new SEQ file for your plugin. | ||
+ | # Set the quest data conditions for the world interaction. These are conditions that will apply to ''all'' topicinfos. | ||
+ | #* Check for valid NPCs, such as per [[Arcane University:World Interactions#NPC Preparation]] | ||
+ | #* If desired, a random percent condition. | ||
+ | #: Note 1: We can handle the timer in our MagicEffect script (discussed later), so we don't need that here. | ||
+ | #: Note 2: <code>GetAllowWorldInteractions</code> is optional here, depending on your specific lines. | ||
+ | # Go to the Player Dialogue tab and create a new branch and topic, and '''set the branch type to "Normal"'''. | ||
+ | #* If you want reactions in combat to be different from reactions outside of combat, create a second topic that is just for in-combat lines. Although it is technically possible to put these all in the same topic, the default script we will be using allows for separate combat and noncombat topics, so it will be easier and more organized to use two topics here. | ||
+ | # Create the individual topicinfos for this world interaction. The exact conditions here will depend on what you've written for the lines or what your writing team has given you. For instance, conditioned on voice type, class, race, faction, and so on. | ||
− | + | Next, we need to add a script to the magic effects we are interested in. | |
+ | # Open up the magic effect. | ||
+ | # In the "Scripts" section, add the script <code>SayOnHitByMagicEffectScript</code>, then open up the Script Properties window. | ||
+ | # Auto-fill the <code>GameDaysPassed</code> property. | ||
+ | # You can auto-fill <code>WICastNonHostileTimer</code> or use your own timer global variable. | ||
+ | # Fill <code>TopicToSay</code> and <code>CombatTopicToSay</code> with your newly-created topics. | ||
+ | # Optionally, set <code>AllowForTeammate</code> to 1 to allow your teammates to comment as well when you cast a spell with this magic effect on them. | ||
− | + | NPCs should now comment when you cast your spell on them! | |
==Engine Events== | ==Engine Events== | ||
+ | The [https://www.creationkit.com/index.php?title=Misc_Tab Misc Tab] of on quests allows for NPC reactions to a number of events: | ||
+ | * ActorCollidewithActor: Said when the player bumps into the actor. | ||
+ | * KnockOverObject: Said when the player collides with a physics object. | ||
+ | * LockedObject: Said when the player looks at a locked object and it would be a crime to open it. | ||
+ | * NoticeCorpse: Said when the actor notices a corpse. | ||
+ | * ObserveCombat: Said when the actor sees combat and is not taking part in it. | ||
+ | * PickpocketTopic: Said when the player seems to be trying to pickpocket. | ||
+ | * PlayerIronSights: Said when the player aims at someone with a drawn bow. | ||
+ | * PlayerShout: Said when the player uses a shout nearby. | ||
+ | * ShootBow: Said when the player shoots with a bow outside combat. | ||
+ | * SwingMeleeWeapon: Said when the player swings a melee weapon outside combat. | ||
+ | * ZKeyObject: Said when the player is holding an object with physics. | ||
+ | |||
+ | Setting these up is relatively straightforward. | ||
+ | # Create a new quest. Give the quest a readable ID like "<code><ModPrefix>WICastMagic<Description></code>". Click "OK" then reopen the quest. | ||
+ | #:- Each event listed above can be it's own topic, so realistically you only need one quest for all of them. | ||
+ | # Set the quest to Start Game Enabled. At some point before you start testing it, create a new SEQ file for your plugin. | ||
+ | # Set the quest data conditions for the world interaction. These are conditions that will apply to ''all'' topicinfos. | ||
+ | #* Check for valid NPCs, such as per [[Arcane University:World Interactions#NPC Preparation]] | ||
+ | #* If desired, a random percent condition. | ||
+ | #* If desired, a timer condition. | ||
+ | #*:- Remember that Quest Dialogue Conditions apply to ''all'' topicinfos. If you have multiple events in the same quest, (e.g. "ShootBow" and "KnockOverObject"), they will be on the same timer. | ||
+ | #*:- If you do use a timer, see the steps in [[Arcane University:World Interactions#Hello Reactions]] for how to set it up. | ||
+ | #: Note: <code>GetAllowWorldInteractions</code> is optional here, depending on your specific lines. | ||
+ | # Go to the Misc tab and create a topic for each subtype you want to have a reaction for. | ||
+ | # Create the individual topicinfos for this world interaction. The exact conditions here will depend on what you've written for the lines or what your writing team has given you. | ||
+ | |||
+ | Close, save your plugin, and test. NPCs should now be more responsive to the chaos you cause in the world. :) | ||
==Story Manager Events== | ==Story Manager Events== | ||
+ | The [https://www.creationkit.com/index.php?title=Story_Manager Story Manager] allows us to make some more complex events, regarding what events NPCs react to, picking which NPCs will react to the event, and controlling how NPCs react. | ||
+ | |||
+ | Consider the "Cast Magic" event, for instance. We have already looked at ways make NPCs comment on spells you have equipped, spells that are active on you, and spells that you cast directly on NPCs. What does the Story Manager do differently? First, it can work for spells of any kind—spells cast on you, on an NPC, off into the distance, etc... It does not need to be an effect active on you (like "Hello" interactions) or cast directly on an NPC ("Spell" reactions). Second, the NPC that reactions will be picked randomly from NPCs nearby by filling a quest alias (unlike "Hello" interactions where you must talk to the NPC or at least be close to them, or "Spell" interactions where you must cast the spell on the directly). Third, you have more control over how the NPC reacts. In previous interaction types, we could only make NPCs say a certain line. Now, we could make them do other things, like run away from you, run to start conversation with you, start a fight with another NPC... You can get much more creative with how NPCs respond. | ||
+ | |||
+ | This section will cover the basic setup of a Story Manager based world interaction, followed by some specific examples for different event types. | ||
+ | |||
+ | ===General Setup=== | ||
+ | |||
+ | ====Create The Quest==== | ||
+ | The first step for a story-manager based world interaction is to create a new quest. Unlike previous quests we've made, this quest will ''not'' be start-game enabled and therefore will ''not'' require an SEQ file. instead, select the event you want to use from the "Event" dropdown menu. | ||
+ | |||
+ | Once you've created your quest, navigate to the "Aliases" tab. Depending on what exactly you want to happen, you may need several aliases here. Generally, you should create an aliases for: | ||
+ | |||
+ | # Every bystander that you want to react to the event. These use a fill type "Find Matching Reference", with "In Loaded Area" checked. You ''probably'' also want the "Nearest" box checked, but this depends on your preference and what exactly the world interaction is. Then, you should add conditions so that: | ||
+ | #* The selected NPC is valid, as per [[Arcane University:World Interactions#NPC Preparation]]. | ||
+ | #* The selected NPC's package allows world interactions. | ||
+ | #* Any other conditions specific to this world interaction. For instance, if you only want alchemists to react to the player crafting a potion, that would need it's own condition (such as checking class, or another faction, or a list of NPCs or voicetypes, etc...). | ||
+ | # Any reference that will be passed in by the event. These also use a fill type "Find Matching Reference", but should come from the event. Make an alias for everything available in "Event Data". | ||
+ | # The player. This can be a forced reference. You can attached the script <code>WIPlayerScript</code> for the option to end the interaction early if the player travels too far from where it started. | ||
+ | |||
+ | If you want to use an event timer for this world interaction (as mentioned here [[Arcane University:World Interactions#Timers]]): navigate to the "Scripts" tab, then create and attach a new script that extends <code>WorldInteractionsScript</code>. You do not need to add anything else to the script. Then, auto-fill the <code>GameDaysPassed</code> property and fill the remaining two global variable properties with the global variables you are using for your timer. Once the script is attached, go to the "Quest Stages" tab. Create a new quest stage that runs on quest start, and call the timer function <code>SetNextEventGlobals()</code> on the stage's fragment. | ||
+ | |||
+ | Remember to include some way for the quest to end. For world interactions that use a scene, this is a flag you can check there. As mentioned earlier, the <code>WIPlayerScript</code> on the player alias will stop the interaction if the player changes [https://www.creationkit.com/index.php?title=Location location]. Otherwise, create a quest stage that has a fragment to stop the quest. You can then call this stage, for instance through dialogue/a topicinfo fragment, whenever the interaction is over. | ||
+ | |||
+ | ====Implementing the Reaction==== | ||
+ | This is a pretty open-ended section, and really depends on what exactly your world interaction is. I'll cover three basic cases, and for anything more complex you'll want to refer to the CK Wiki guides on [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Packages Packages], [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Scenes Scenes], and [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Dialogue Dialogue] as appropriate. | ||
+ | |||
+ | # '''Saying a Single Line''': To make an NPC idly comment on a player action (think: reactions to smithing an item, mixing a potion, picking something up off the ground), all we need is a simple scene. | ||
+ | ## Navigate to the "Scenes" tab of your quest, and create a new scene. | ||
+ | ## Check the flags for "Begin on Quest Start" and "Stop Quest on End". | ||
+ | ## Add a new actor with the alias that will do the talking. Set the actor behavior so that combat ends the scene (the default will be that it pauses the scene). | ||
+ | ## Add a new phase, and add a Dialogue action to your actor for that phase. You do not need to check anything for looping, headtracking, etc... | ||
+ | ## Create TopicInfos for the lines you want your NPC to say. | ||
+ | ##* This will work like a normal TopicInfo stack, so the first line that has all of its conditions met will be the line that is spoken. | ||
+ | ##* You can use <code>GetEventData</code> conditions and run normal conditions on Event Data to make responses reactive to the player's specific actions. For instance, you can check for keywords on a crafted item, or check the value of an item the player dropped. | ||
+ | ## (Optional) If your dialogue topic has a very large number of topicinfos and you want to organize it a more nicely, you can split the one phase into multiple, and use phase conditions to make conditioning dialogue lines simpler. | ||
+ | ##* Look at <code>WICraftItem01</code> as an example of this. Rather than have one phase and dialogue action with 72 topicinfos, it uses 8 phases with 9 topicinfos each. Conditions on each phase make it so that only voicetype conditions are needed on the topicinfos. | ||
+ | ##* If you go this route, you will want to add a script fragment on phase end to stop the scene, otherwise your NPC may end up saying multiple lines in succession. | ||
+ | ##* The Creation Kit will not parse phase conditions when filtering dialogue for an Actor or Voice Type, so you should avoid using condition functions that affect dialogue filtering in phase conditions. These are condition functions like <code>GetIsID</code>, <code>GetIsVoiceType</code>, <code>GetInFaction</code>, and so on ([https://www.creationkit.com/index.php?title=VoiceType conditions that affect default dialogue]). | ||
+ | # '''Start a Conversation''': To make an NPC start a conversation with the player when an event happens (think: player drops a weapon and a guard chastises them), we will want to use a ForceGreet package to start ordinary dialogue. | ||
+ | ## Navigate to the "Player Dialogue" tab of your quest, and create a new blocking branch and a starting topic. | ||
+ | ## Implement the dialogue like normal ([https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Dialogue Basic Dialogue Tutorial]). There's nothing special that needs to be done. | ||
+ | ##* Remember that you can use <code>GetEventData</code> conditions and run normal conditions on Event Data to make dialogue more responsive to the player's specific actions. | ||
+ | ## Create a quest stage to stop the quest. The stage number is your choice but "10" is common. Include a quest fragment with the command <code>stop()</code>. Set the quest to this stage on any topicinfos that end the world interaction. | ||
+ | ## Create a new package using the ForceGreet template. | ||
+ | ##* Set the package's topic to the starting topic you created earlier. | ||
+ | ##* Set the wait location to near package start. | ||
+ | ##* Set the Trigger Location and ForceGreet distance to both within some radius of the player. The ForceGreet distance should be smaller than the Trigger Location distance. | ||
+ | ##* Uncheck all flags on the package (even the Allow World Interactions flag!). | ||
+ | ## Add this package to the NPC's quest alias. The NPC will automatically start using this package, unless they are occupying another alias with higher priority. | ||
+ | # '''Delayed Reactions''': It's possible to use the story manager to set up NPC world interactions to play later (think: NPCs that have special dialogue when you talk to them some time after assaulting them). | ||
+ | ## Create a new faction named similar to your quest. It does not need any faction relationships, crime/vendor/etc... information. | ||
+ | ## On the quest, create a startup stage (typically stage 0). | ||
+ | ## Create a quest fragment, and add your faction as a script property. | ||
+ | ## In the fragment, add the faction to the NPC alias(es), then stop the quest. For example: | ||
+ | ##: <code>(BystanderAlias.GetReference() as Actor).AddToFaction(MyFaction)</code> | ||
+ | ##: <code>Stop()</code> | ||
+ | #: This will record that the NPCs took part in this original event. Then, later, we can check if an NPC is in this faction for future world interactions. For instance: | ||
+ | #::* Create a new quest (start-game enabled) with a Hello topic for special greetings for NPCs in the faction you created. | ||
+ | #::* Give NPCs a unique reaction to having a spell cast on them after they've seen you cast it once before. | ||
+ | #::* Make guards ''actually'' respond differently if they catch you dropping a weapon more than once. | ||
+ | |||
+ | Remember, it is absolutely possible to make world interactions that are more complex that what's above. Look at <code>WIRemoveItem03</code> for instance—two NPCs fight over a dropped object, up to three bystanders arrive to watch, and a guard may intervene. However it's not really possible to write a tutorial for these, as the way to implement them is going to be unique. Still, you should be able to the above steps like building blocks for more complex world interactions. | ||
+ | |||
+ | ====Updating the Story Manager==== | ||
+ | The final step will be to add your quest to the Story Manager with appropriate conditions. The CK Wiki already has a good [https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Story_Manager tutorial on the Story Manager], so this section will only cover the few specifics needed for world interactions. | ||
+ | # Navigate to the SM Event Node section of the Object Window, and open the node for your particular event. | ||
+ | # Create a new branch node for your world interaction or set of world interactions. | ||
+ | #* This should be pretty low in the stack—below any nodes that are for actual quests. | ||
+ | # Add any broad world interaction conditions, such as: | ||
+ | #* Timer conditions (compare your timer global variable to the <code>GameDaysPassed</code> global variable) | ||
+ | #* Check if globals like <code>WIEventsEnabled</code> and/or <code>WIComplexEventsEnabled</code> are set to 1 (true) | ||
+ | #* Check that you aren't in a location that prohibits world interactions (e.g. Sovngarde) | ||
+ | #* Optionally, apply a random chance that the event doesn't occur | ||
+ | # Create a new quest node. Generally you want "Random", "Do all before repeating," and "Shares Event" flagged. | ||
+ | # Add your world interaction quest(s) to this node. Add any quest-specific conditions here. For instance: | ||
+ | #* For Add/Remove item events, you check item type (weapon, armor, etc...) | ||
+ | #* For Cast Magic events, you can check the type of spell being cast (shout, destruction spell, etc... usually using formlists) | ||
+ | #* For Change Location events, check new location keywords | ||
+ | #* For Craft Item events, check what type of workbench the player is using (keyword check) | ||
+ | #* etc... | ||
+ | # (Optional) Set a value for "Hours to Reset" on the specific quest(s). | ||
+ | |||
+ | ===Examples=== | ||
+ | These are how several Story Manager events are used for World Interactions in vanilla Skyrim. | ||
+ | |||
+ | ====Assault Actor Event==== | ||
+ | * A quest is used to add a faction to NPCs when you assault them. Then, a separate quest has unique greetings for NPCs when they are in this faction. | ||
+ | |||
+ | ====Cast Magic Event==== | ||
+ | * If you cast a colorful spell, a child may initiate conversation and ask you to make them invisible. | ||
+ | * If you cast a dangerous spell, a crowd will gather to chastise the you. | ||
+ | * If a guard hears you shout, they will approach you and tell you to stop. | ||
+ | |||
+ | ====Change Location Event==== | ||
+ | * NPCs will comment on you entering their home, shop, or tavern. | ||
+ | ** Some quests cover special cases like having a weapon drawn or being naked. | ||
+ | * Kids may start a game of tag. | ||
+ | |||
+ | ====Craft Item Event==== | ||
+ | * NPCs will comment on crafting weapons and armor, brewing potions, and enchanting objects. | ||
+ | * Comments cover generic skill lavel (looking at player skills) as well as crafting material, type of enchantment, and so on. | ||
+ | |||
+ | ====Dead Body Event==== | ||
+ | * Crowds will gather around a found body, and a guard may question you about your involvement. | ||
+ | |||
+ | ====Player Add Item Event==== | ||
+ | * NPCs will comment on you picking up an item ("Nice find!", "...Are you digging through the trash?", etc...) | ||
+ | * Hired thugs will attack you some time after stealing an item (this is moderately complex so be sure to check it out in the CK). | ||
+ | |||
+ | ====Player Remove Item Event==== | ||
+ | * A guard will chastise you for dropping a weapon. | ||
+ | * NPCs will fight over an item you dropped and attract a crowd. | ||
+ | * NPCs will chastise you for littering. | ||
+ | * An NPC will pick up the item and tell you you dropped it accidentally. | ||
+ | * An NPC will pick up dropped armor and ask if its okay to keep. | ||
[[Category:Arcane University-Implementation]] | [[Category:Arcane University-Implementation]] |
Latest revision as of 10:57, 25 May 2021
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.
Contents
Introduction[edit]
Prerequisites[edit]
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, and will want Fuz Ro D'oh for testing before you get voiced lines.
- Basic Dialogue Implementation
- Advanced Dialogue Implementation
- Basic Scripting
- Story Manager
- Aliases
- Scenes
- Seq Guide
- Fuz Ro D'oh (LE)
- Fuz Ro D'oh (SE)
Regarding dialogue, you will not have to know how to set up any complex branching conversations. Typically world interactions will only be a single line. However, you should be familiar with making non-Player Dialogue topics (such as Combat topics, Detection topics, and so on).
Types of World Interactions[edit]
World Interactions can be grouped into four categories.
- 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.
- Spell Reactions: These are events where an NPC is directly told to say a line using the Papyrus "Say" command when a spell is cast on them. These are relatively easy to set up, and can mostly be completed with default scripts.
- Engine Events: This covers events with a subtype 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.
- 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[edit]
NPC Preparation[edit]
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.
Or, you could use the reverse: a "DisallowWorldInteractions" faction, a formlist of invalid NPCs, and so on.
Pick which method (or methods) you want to use. Depending on your choice, fill out the formlist(s) or add your faction(s) to NPCs. You will use these factions or formlists for quest dialogue conditions, and possibly also as alias fill conditions or story manager event node conditions.
GetAllowWorldInteractions Condition[edit]
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[edit]
Generally, you want to limit how often world interactions play, lest they become stale after a long playthrough. Skyrim uses four methods to limit how frequently World Interactions play.
- 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 (questWICommentMagicFlames
). There is a corresponding global variableWICommentChanceMagicFlames
, and a quest dialogue conditionGetRandomPercent() <= WICommentChanceMagicFlames
. - Comment Timers: In vanilla Skyrim, this is usually global variable
WICommentNextAllowed
used alongside a default scriptWICommentScript
to limit how frequently world interaction comments occur, however there are a few cases of separate times, such as for spell reactions. ForWICommentNextAllowed
, when a world interaction comment happens,WICommentScript
the current game time and setsWICommentNextAllowed
to one hour in the future. Then, a quest dialogue condition requires that the current game time be greater thanWICommentNextAllowed
(specifically, the condition isGetGlobalValue(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). - Story Manager Timers: This is simply a setting on quest entries in the Story Manager. When quests in the story manager have a value for "Hours until reset", the story manager will not attempt to start that quest again until that much time has passed since the last occurrence.
- Event Timers: These are timers used to block whole categories of events in the Story Manager. For instance, Skyrim has seven CastMagic world interaction quests in the story manager—the "Hours until reset" setting would block a single quest for some amount of time, but an event timer would be used to block all seven. Functionally these are similar to comment timers. The code for them exists on
WorldInteractionsScript
, and are typically used through a custom script that extendsWorldInteractionsScript
, where the timer functions are called in quest fragments.
WI Quest[edit]
Skyrim has a World Interaction parent quest WI
, which holds a script WIFunctionScript
for some common WI functions and properties. In truth, you probably won't use this much. The functions primarily concern an unused "Mourner" world interaction and dragon attacks. The two functions you might find useful are AllowComplexInteractions
/DisallowComplexInteractions
, which enables you to enable/disable certain world interactions for whole locations at once (. Also, ShowPlayerRoom
is used for some Skyrim tavern scenes. I've personally never needed any of the functions in this script, so I won't cover it in any more depth in this guide.
Hello Reactions[edit]
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. These are the steps to create "Hello" world interactions:
- Create a new quest. Give the quest a readable ID like "
<ModPrefix>WIComment<Description>
". Click "OK" then reopen the quest.- - Because quests can only have one "Hello" topic, you will generally need one quest per type of interaction.
- Set the quest to Start Game Enabled. At some point before you start testing it, create a new SEQ file for your plugin.
- Set the quest data conditions for the world interaction. These are conditions that will apply to all topicinfos.
- Check for valid NPCs, such as per Arcane University:World Interactions#NPC Preparation.
- - This can include other broad conditions, for example you could exclude NPCs in the Mages Guild from commenting on equipped spells.
- GetAllowWorldInteractions returns TRUE
- If desired, a random percent condition
- If desired, a timer condition
- If desired, IsInDialogueWithPlayer returns FALSE. This will make it so the line only happens when the player brushes past the NPC, not when the NPC actually greets them to start a conversation.
- The condition for your specific interaction type. Some examples:
- -
IsSneaking
: React to the player sneaking - -
SpellHasKeyword
: React to an equipped spell - -
HasMagicEffectKeyword
: React to a spell active on the player - -
WornHasKeyword
: React to some thing the player is (or isn't!) wearing - -
IsWeaponOut
: React to the player having a weapon drawn
- -
- Set the quest priority to something above totally generic greetings but below actually important quests. Skyrim uses a priority of 40 for world interactions; your mod or project might need something different.
- If you are using a timer:
- Check the "Allow Repeated Stages" box on the Quest Data Tab.
- Go to the Scripts tab and add
WICommentScript
. If you are using the genericWICommentNextAllowed
, you can auto-fill all properties. Otherwise, autofillGameDaysPassed
and fillWICommentNextAllowed
with your own global variable.- - If you are using multiple timers, you will need a custom script.
- Go to the Quest Stages tab and create a new stage. The stage number is not important. DO NOT enter anything for the log.
- Call
WICommentScript
'sCommented()
function in the stage's quest fragment.
- Go to the Misc tab and create a new topic with subtype "Hello".
- Create the individual topicinfos for this world interaction. The exact conditions here will depend on what you've written for the lines or what your writing team has given you. For instance, conditioned on voice type, class, race, faction, and so on.
- If you're using a timer, then update the timer by setting the quest stage. In a Begin fragment, call:
GetOwningQuest().SetStage(<the stage you made earlier>)
.
Your world interaction should now work in-game!
Spell Reactions[edit]
"Spell Reactions" are where an NPC is directly told to say a when a spell is cast on them. These work by using a script attached to the magic effect to force the NPC to say a line using Papyrus's Say command.
First, we'll cover setting up the quest and dialogue:
- Create a new quest. Give the quest a readable ID like "
<ModPrefix>WICastMagic<Description>
". Click "OK" then reopen the quest.- It is possible to have multiple reaction topics in the same quest, so you could make one quest that holds all your spell reaction topics.
- Set the quest to Start Game Enabled. At some point before you start testing it, create a new SEQ file for your plugin.
- Set the quest data conditions for the world interaction. These are conditions that will apply to all topicinfos.
- Check for valid NPCs, such as per Arcane University:World Interactions#NPC Preparation
- If desired, a random percent condition.
- Note 1: We can handle the timer in our MagicEffect script (discussed later), so we don't need that here.
- Note 2:
GetAllowWorldInteractions
is optional here, depending on your specific lines.
- Go to the Player Dialogue tab and create a new branch and topic, and set the branch type to "Normal".
- If you want reactions in combat to be different from reactions outside of combat, create a second topic that is just for in-combat lines. Although it is technically possible to put these all in the same topic, the default script we will be using allows for separate combat and noncombat topics, so it will be easier and more organized to use two topics here.
- Create the individual topicinfos for this world interaction. The exact conditions here will depend on what you've written for the lines or what your writing team has given you. For instance, conditioned on voice type, class, race, faction, and so on.
Next, we need to add a script to the magic effects we are interested in.
- Open up the magic effect.
- In the "Scripts" section, add the script
SayOnHitByMagicEffectScript
, then open up the Script Properties window. - Auto-fill the
GameDaysPassed
property. - You can auto-fill
WICastNonHostileTimer
or use your own timer global variable. - Fill
TopicToSay
andCombatTopicToSay
with your newly-created topics. - Optionally, set
AllowForTeammate
to 1 to allow your teammates to comment as well when you cast a spell with this magic effect on them.
NPCs should now comment when you cast your spell on them!
Engine Events[edit]
The Misc Tab of on quests allows for NPC reactions to a number of events:
- ActorCollidewithActor: Said when the player bumps into the actor.
- KnockOverObject: Said when the player collides with a physics object.
- LockedObject: Said when the player looks at a locked object and it would be a crime to open it.
- NoticeCorpse: Said when the actor notices a corpse.
- ObserveCombat: Said when the actor sees combat and is not taking part in it.
- PickpocketTopic: Said when the player seems to be trying to pickpocket.
- PlayerIronSights: Said when the player aims at someone with a drawn bow.
- PlayerShout: Said when the player uses a shout nearby.
- ShootBow: Said when the player shoots with a bow outside combat.
- SwingMeleeWeapon: Said when the player swings a melee weapon outside combat.
- ZKeyObject: Said when the player is holding an object with physics.
Setting these up is relatively straightforward.
- Create a new quest. Give the quest a readable ID like "
<ModPrefix>WICastMagic<Description>
". Click "OK" then reopen the quest.- - Each event listed above can be it's own topic, so realistically you only need one quest for all of them.
- Set the quest to Start Game Enabled. At some point before you start testing it, create a new SEQ file for your plugin.
- Set the quest data conditions for the world interaction. These are conditions that will apply to all topicinfos.
- Check for valid NPCs, such as per Arcane University:World Interactions#NPC Preparation
- If desired, a random percent condition.
- If desired, a timer condition.
- - Remember that Quest Dialogue Conditions apply to all topicinfos. If you have multiple events in the same quest, (e.g. "ShootBow" and "KnockOverObject"), they will be on the same timer.
- - If you do use a timer, see the steps in Arcane University:World Interactions#Hello Reactions for how to set it up.
- Note:
GetAllowWorldInteractions
is optional here, depending on your specific lines.
- Go to the Misc tab and create a topic for each subtype you want to have a reaction for.
- Create the individual topicinfos for this world interaction. The exact conditions here will depend on what you've written for the lines or what your writing team has given you.
Close, save your plugin, and test. NPCs should now be more responsive to the chaos you cause in the world. :)
Story Manager Events[edit]
The Story Manager allows us to make some more complex events, regarding what events NPCs react to, picking which NPCs will react to the event, and controlling how NPCs react.
Consider the "Cast Magic" event, for instance. We have already looked at ways make NPCs comment on spells you have equipped, spells that are active on you, and spells that you cast directly on NPCs. What does the Story Manager do differently? First, it can work for spells of any kind—spells cast on you, on an NPC, off into the distance, etc... It does not need to be an effect active on you (like "Hello" interactions) or cast directly on an NPC ("Spell" reactions). Second, the NPC that reactions will be picked randomly from NPCs nearby by filling a quest alias (unlike "Hello" interactions where you must talk to the NPC or at least be close to them, or "Spell" interactions where you must cast the spell on the directly). Third, you have more control over how the NPC reacts. In previous interaction types, we could only make NPCs say a certain line. Now, we could make them do other things, like run away from you, run to start conversation with you, start a fight with another NPC... You can get much more creative with how NPCs respond.
This section will cover the basic setup of a Story Manager based world interaction, followed by some specific examples for different event types.
General Setup[edit]
Create The Quest[edit]
The first step for a story-manager based world interaction is to create a new quest. Unlike previous quests we've made, this quest will not be start-game enabled and therefore will not require an SEQ file. instead, select the event you want to use from the "Event" dropdown menu.
Once you've created your quest, navigate to the "Aliases" tab. Depending on what exactly you want to happen, you may need several aliases here. Generally, you should create an aliases for:
- Every bystander that you want to react to the event. These use a fill type "Find Matching Reference", with "In Loaded Area" checked. You probably also want the "Nearest" box checked, but this depends on your preference and what exactly the world interaction is. Then, you should add conditions so that:
- The selected NPC is valid, as per Arcane University:World Interactions#NPC Preparation.
- The selected NPC's package allows world interactions.
- Any other conditions specific to this world interaction. For instance, if you only want alchemists to react to the player crafting a potion, that would need it's own condition (such as checking class, or another faction, or a list of NPCs or voicetypes, etc...).
- Any reference that will be passed in by the event. These also use a fill type "Find Matching Reference", but should come from the event. Make an alias for everything available in "Event Data".
- The player. This can be a forced reference. You can attached the script
WIPlayerScript
for the option to end the interaction early if the player travels too far from where it started.
If you want to use an event timer for this world interaction (as mentioned here Arcane University:World Interactions#Timers): navigate to the "Scripts" tab, then create and attach a new script that extends WorldInteractionsScript
. You do not need to add anything else to the script. Then, auto-fill the GameDaysPassed
property and fill the remaining two global variable properties with the global variables you are using for your timer. Once the script is attached, go to the "Quest Stages" tab. Create a new quest stage that runs on quest start, and call the timer function SetNextEventGlobals()
on the stage's fragment.
Remember to include some way for the quest to end. For world interactions that use a scene, this is a flag you can check there. As mentioned earlier, the WIPlayerScript
on the player alias will stop the interaction if the player changes location. Otherwise, create a quest stage that has a fragment to stop the quest. You can then call this stage, for instance through dialogue/a topicinfo fragment, whenever the interaction is over.
Implementing the Reaction[edit]
This is a pretty open-ended section, and really depends on what exactly your world interaction is. I'll cover three basic cases, and for anything more complex you'll want to refer to the CK Wiki guides on Packages, Scenes, and Dialogue as appropriate.
- Saying a Single Line: To make an NPC idly comment on a player action (think: reactions to smithing an item, mixing a potion, picking something up off the ground), all we need is a simple scene.
- Navigate to the "Scenes" tab of your quest, and create a new scene.
- Check the flags for "Begin on Quest Start" and "Stop Quest on End".
- Add a new actor with the alias that will do the talking. Set the actor behavior so that combat ends the scene (the default will be that it pauses the scene).
- Add a new phase, and add a Dialogue action to your actor for that phase. You do not need to check anything for looping, headtracking, etc...
- Create TopicInfos for the lines you want your NPC to say.
- This will work like a normal TopicInfo stack, so the first line that has all of its conditions met will be the line that is spoken.
- You can use
GetEventData
conditions and run normal conditions on Event Data to make responses reactive to the player's specific actions. For instance, you can check for keywords on a crafted item, or check the value of an item the player dropped.
- (Optional) If your dialogue topic has a very large number of topicinfos and you want to organize it a more nicely, you can split the one phase into multiple, and use phase conditions to make conditioning dialogue lines simpler.
- Look at
WICraftItem01
as an example of this. Rather than have one phase and dialogue action with 72 topicinfos, it uses 8 phases with 9 topicinfos each. Conditions on each phase make it so that only voicetype conditions are needed on the topicinfos. - If you go this route, you will want to add a script fragment on phase end to stop the scene, otherwise your NPC may end up saying multiple lines in succession.
- The Creation Kit will not parse phase conditions when filtering dialogue for an Actor or Voice Type, so you should avoid using condition functions that affect dialogue filtering in phase conditions. These are condition functions like
GetIsID
,GetIsVoiceType
,GetInFaction
, and so on (conditions that affect default dialogue).
- Look at
- Start a Conversation: To make an NPC start a conversation with the player when an event happens (think: player drops a weapon and a guard chastises them), we will want to use a ForceGreet package to start ordinary dialogue.
- Navigate to the "Player Dialogue" tab of your quest, and create a new blocking branch and a starting topic.
- Implement the dialogue like normal (Basic Dialogue Tutorial). There's nothing special that needs to be done.
- Remember that you can use
GetEventData
conditions and run normal conditions on Event Data to make dialogue more responsive to the player's specific actions.
- Remember that you can use
- Create a quest stage to stop the quest. The stage number is your choice but "10" is common. Include a quest fragment with the command
stop()
. Set the quest to this stage on any topicinfos that end the world interaction. - Create a new package using the ForceGreet template.
- Set the package's topic to the starting topic you created earlier.
- Set the wait location to near package start.
- Set the Trigger Location and ForceGreet distance to both within some radius of the player. The ForceGreet distance should be smaller than the Trigger Location distance.
- Uncheck all flags on the package (even the Allow World Interactions flag!).
- Add this package to the NPC's quest alias. The NPC will automatically start using this package, unless they are occupying another alias with higher priority.
- Delayed Reactions: It's possible to use the story manager to set up NPC world interactions to play later (think: NPCs that have special dialogue when you talk to them some time after assaulting them).
- Create a new faction named similar to your quest. It does not need any faction relationships, crime/vendor/etc... information.
- On the quest, create a startup stage (typically stage 0).
- Create a quest fragment, and add your faction as a script property.
- In the fragment, add the faction to the NPC alias(es), then stop the quest. For example:
-
(BystanderAlias.GetReference() as Actor).AddToFaction(MyFaction)
-
Stop()
-
- This will record that the NPCs took part in this original event. Then, later, we can check if an NPC is in this faction for future world interactions. For instance:
- Create a new quest (start-game enabled) with a Hello topic for special greetings for NPCs in the faction you created.
- Give NPCs a unique reaction to having a spell cast on them after they've seen you cast it once before.
- Make guards actually respond differently if they catch you dropping a weapon more than once.
Remember, it is absolutely possible to make world interactions that are more complex that what's above. Look at WIRemoveItem03
for instance—two NPCs fight over a dropped object, up to three bystanders arrive to watch, and a guard may intervene. However it's not really possible to write a tutorial for these, as the way to implement them is going to be unique. Still, you should be able to the above steps like building blocks for more complex world interactions.
Updating the Story Manager[edit]
The final step will be to add your quest to the Story Manager with appropriate conditions. The CK Wiki already has a good tutorial on the Story Manager, so this section will only cover the few specifics needed for world interactions.
- Navigate to the SM Event Node section of the Object Window, and open the node for your particular event.
- Create a new branch node for your world interaction or set of world interactions.
- This should be pretty low in the stack—below any nodes that are for actual quests.
- Add any broad world interaction conditions, such as:
- Timer conditions (compare your timer global variable to the
GameDaysPassed
global variable) - Check if globals like
WIEventsEnabled
and/orWIComplexEventsEnabled
are set to 1 (true) - Check that you aren't in a location that prohibits world interactions (e.g. Sovngarde)
- Optionally, apply a random chance that the event doesn't occur
- Timer conditions (compare your timer global variable to the
- Create a new quest node. Generally you want "Random", "Do all before repeating," and "Shares Event" flagged.
- Add your world interaction quest(s) to this node. Add any quest-specific conditions here. For instance:
- For Add/Remove item events, you check item type (weapon, armor, etc...)
- For Cast Magic events, you can check the type of spell being cast (shout, destruction spell, etc... usually using formlists)
- For Change Location events, check new location keywords
- For Craft Item events, check what type of workbench the player is using (keyword check)
- etc...
- (Optional) Set a value for "Hours to Reset" on the specific quest(s).
Examples[edit]
These are how several Story Manager events are used for World Interactions in vanilla Skyrim.
Assault Actor Event[edit]
- A quest is used to add a faction to NPCs when you assault them. Then, a separate quest has unique greetings for NPCs when they are in this faction.
Cast Magic Event[edit]
- If you cast a colorful spell, a child may initiate conversation and ask you to make them invisible.
- If you cast a dangerous spell, a crowd will gather to chastise the you.
- If a guard hears you shout, they will approach you and tell you to stop.
Change Location Event[edit]
- NPCs will comment on you entering their home, shop, or tavern.
- Some quests cover special cases like having a weapon drawn or being naked.
- Kids may start a game of tag.
Craft Item Event[edit]
- NPCs will comment on crafting weapons and armor, brewing potions, and enchanting objects.
- Comments cover generic skill lavel (looking at player skills) as well as crafting material, type of enchantment, and so on.
Dead Body Event[edit]
- Crowds will gather around a found body, and a guard may question you about your involvement.
Player Add Item Event[edit]
- NPCs will comment on you picking up an item ("Nice find!", "...Are you digging through the trash?", etc...)
- Hired thugs will attack you some time after stealing an item (this is moderately complex so be sure to check it out in the CK).
Player Remove Item Event[edit]
- A guard will chastise you for dropping a weapon.
- NPCs will fight over an item you dropped and attract a crowd.
- NPCs will chastise you for littering.
- An NPC will pick up the item and tell you you dropped it accidentally.
- An NPC will pick up dropped armor and ask if its okay to keep.