Category:Scenes

From the Fallout4 CreationKit Wiki
Revision as of 11:04, 21 November 2014 by imported>DosBuster (→‎Controlling Random Conversations)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Scenes handle the coordination of multiple NPCs in conversations as well as the various "cut scenes". Scenes include dialogue, timers, and packages. Scenes can range from a simple conversation between 2 random NPCs to an elaborate set-piece for a quest.

A Scene contains a sequential list of Phases. Each Phase is a discrete chunk of the Scene -- when Phase 1 is complete, the Scene moves on to Phase 2, and so on. When the last phase of the scene is complete, the scene ends.

Each Phase contains a set of Actions for each actor assigned to the scene. Actions that occur in the same phase are simultaneous -- what each actor is doing during this part of the Scene. There are three kinds of Actions:

  • Dialogue
  • Package
  • Timer

See Scenes Tab for details on editing Scenes in the Creation Kit.

Actors in Scenes

An actor can only be actively in one scene at the same time. In general, when a scene starts up and one or more of its actors are already in another scene, the new scene will pause until all its actors are available.

However, a scene which is flagged "Interruptible" (see below) will be stopped (not paused) when another scene using the same actors wants to start. This allows important scenes to not have to wait for less important scenes (such as random conversations).

Scene package actions override any other packages the actor may have. But if a scene actor is not currently assigned a package action, that actor will run whatever package they would otherwise be running (the highest valid package on their package stack).

How Scenes Work

Starting a Scene

Scenes can start in two ways:

  • Scenes flagged "Begin on quest start" will start automatically when their quest starts.
  • The Start_-_Scene script command) is called on the scene.

When a scene starts, the "Begin" fragment on the scene runs and then the scene begins by checking the Begin Conditions on Phase 1.

Starting a Phase

The scene checks whether to start the current phase by checking that phase's Start Conditions. If they are true, the phase begins. If the Start Conditions are false, the phase is skipped (neither the Start or Completion script fragments on this phase run).

If the phase starts, the Start script fragment is run, then the actions that start in this phase are assigned to the appropriate actors.

Completing a Phase

The scene remains in this phase until the phase ends, which can happen in two ways:

  • All the actions that end in that phase are completed, OR
  • The "End Conditions" on that phase are true.

Actions are completed as follows:

  • Package actions are completed when the package reaches the "Done" state. Actions with packages that have no "Done" state can never be completed - phases with these kinds of actions need to use Completion Conditions in order to end.
  • Dialogue actions are completed when the actor finishes speaking the line.
  • Timer actions are completed when the timer expires.

Note that any actions on dead or disabled actors are immediately considered completed. (Dead/disabled actors do not speak or run packages.)

When a phase ends, the phase's Completion script fragment is run before the scene moves on to the next phase. Then the scene continues by checking the Start Conditions on the next phase, and so on.

Ending a Scene

Scenes can end in several ways:

  • The final phase of the scene ends.
  • One of the actors in the scene hits a state that is marked to end the scene (see Actor Behavior flags below).
  • The scene is flagged as "Interruptible", and another scene starts that needs one or more of this scene's actors.
  • The scene's quest is stopped.
  • Stop is called on the scene.

No matter how the scene ends, the scene's "End" script fragment is called.

Repeating scenes

If the "Repeat while true" flag is checked on a scene, the "Repeat" conditions are checked when the scene ends - if true, the scene restarts. Note that the scene's Begin and End script fragments run only once each - Begin when the scene first starts, and the End when the scene actually ends. They do NOT run each time the scene loops.

Random Conversations

The game sends two types of events when actors try to initiate conversations with each other: Actor Hello Event and Actor Dialogue Event.

Quests placed in the appropriate node of the Story Manager are used to respond to these events. (This replaces the conversation system used in Fallout and Oblivion.)

As a way to streamline this process, scenes can be marked "Begin on quest start" (which initiates the scene automatically when the quest starts), and "End quest on scene end" (which stops the scene's quest when the scene ends).

Actor Hello Event

This event is sent when a moving actor (when allowed by the "Random Conversations" flag) pass close enough to a non-moving actor.

Once the event is sent, the AI code does nothing to change or control the actors' behavior (unlike the Actor Dialogue Event - see below). Any AI behavior needs to be handled by package actions within the triggered scene.

Actor Dialogue Event

This event is sent when actors (when allowed by the "Random Conversations" flag on their package) find a valid conversation target.

If the event triggers a scene, the AI code controls both actors with "interrupt behavior":

  • The actor that initiated the event walks towards the conversation target actor.
  • The target actor stops moving - but will continue to use an Idle Marker or Furniture.
  • The triggered scene will be paused in "Phase 0" (prior to Phase 1) until the initiating actor reaches fAIMinGreetingDistance (150 units).

Controlling Random Conversations

Random NPC conversations are controlled by the following gamesettings:

Gamesetting Value Description
fAISocialRadiusToTriggerConversation 2000 Actors outside this radius will not try to initiate conversation with each other (exterior)
fAISocialRadiusToTriggerConversationInterior 1000 Actors outside this radius will not try to initiate conversation with each other (interior)
fAISocialchanceForConversation 25 Percent chance that the actor will choose to initiate a random conversation
fAISocialchanceForConversationInterior 25 Percent chance that the actor will choose to initiate a random conversation (interior)
fAItalktosameNPCTimer 120 How long until you can talk to the same actor again (seconds)
fAISocialTimerForConversationsMin 30 Min value for timer for the next time this actor will look to start a random conversation
fAISocialTimerForConversationsMax 60 Max value for timer for the next time this actor will look to start a random conversation
iAISocialDistanceToTriggerEvent 120 How close actors want to get when initiating a random conversation
fAISocialTimerToWaitForEvent 0.5 How long an actor will wait for the Scene Manager to return a random conversation scene after firing the Actor Dialogue Event

How it works:

  • This NPC will not send the event if they are already in a scene, if the player is already engaged in an important conversation, or if the global "complex scene" flag is set.
  • The NPC's package must be flagged to allow "Random Conversations."
  • The NPC will look for valid targets (see below) within the "social radius"
    • The default "social radius" is fAISocialRadiusToTriggerConversation in an exterior or fAISocialRadiusToTriggerConversationInterior in an interior.
    • If the NPC is in a Sandbox package, the "social radius" is replaced by the NPC's Sandbox radius.
  • If there is a valid target, roll for the "social chance" (fAISocialchanceForConversation/fAISocialchanceForConversationInterior)
  • If the roll is successful, the NPC walks over to the target NPC. When within (iAISocialDistanceToTriggerEvent) distance, send an Actor Dialogue Event and wait for (fAISocialTimerToWaitForEvent) seconds to see if a Scene is initiated.
  • When the scene is finished, roll for a timer between (fAISocialTimerForConversationsMin and fAISocialTimerForConversationsMax).
  • When that timer expires, start the process again from the top.

Valid conversation targets:

  • Actors must have the "Random Conversations" package flag checked.
  • Can't talk to the same actor within fAItalktosameNPCTimer seconds.
  • Actors must not be in interrupt behavior.

Controlling who is the Initiator and who is the Target:

  • Actor 1 is always the Initiator and will walk over to the Target.
  • Actor 2 is always the Target and will stay still, remain in furniture, idle markers, etc.

This category currently contains no pages or media.