Conversation plots and scripting

From Dragon Age Toolset Wiki

Jump to: navigation, search
Conversation topics

The plots and scripting tab under the conversation editor has many powerful features:

Conversation plots and scripting.png

To make a line dependent on the condition of the world at large, and to allow a line to have an effect on the world at large, plots and scripts are employed.

Since the effect of a script is seldom obvious at a glance, a "scripting comments" text field is available for keeping notes for your reference.

Contents

Conditional display of a line

Conversation plots and scripting condition.png

Using plots

The "condition" section of the plots and scripting tab is used to determine whether this line will be run at all. To make the line depend on the status of a particular plot, select the plot in question from the plot dropdown list (or if it's not already in the dropdown list click on the ellipses button (Ellipsis.png) to select from all available plots). Then pick one of the flags used within that plot, and set whether the condition needs to be true or false for the line to be displayed.

A common example of this sort of conditional conversation would be a quest giver, who has different responses to give the player before and after the quest in question has been accepted. Another example might be a character whose attitude toward the player changes when the player has performed a particular task, for good or for ill. Or if the player has learned some important new piece of information, he may now be able to ask a question that he wouldn't otherwise have known to ask.

Using scripts

To make a line in a conversation depend on a more complex condition, or on some condition that is not easily kept track of using plot resources, you can use a script instead. Using scripts and using plots are mutually exclusive here, so if you want to use information derived from both you'll need to write your script to account for plot flags.

Some examples of scripted conditions that conversations might use are: differing NPC responses depending on the player's race or gender, differing options depending on what skills the player has, or lines that change depending on the time of day.

To use a script, select it from the script dropdown menu (or from the list of all scripts opened by the ellipsis button if it's not already there).

Scripts associated with conversations take the form

int StartingConditional()
{
    return 1;
}

If the script returns true the line will display, otherwise it will not.

The last line in a block of multiple NPC lines should always be non-scripted (and without a comment). This ensures that the dialogue always drops to a default line if the scripts break. For example:

A writer creates two PC lines, one for a male and one for a female. Only the first of the 2 lines needs an "if PC is male/female" script. The other line is assigned the correct result by default without a script.

A script called by a line of the conversation can be passed an integer as a parameter, which is retrieved by the function GetConversationEntryParameter. Note that as of November 18 this function is not currently functional. A patch will be needed for the game executable to repair this.

Generic conditions

Since there are several extremely common conditions that are checked for when writing dialog, a number of "generic" plot flags are available for use. An event script is connected with the generic plots described below that does the work of determining what the state of any given plot flag is.

To check a player's class, race, or gender, use the generic plot "gen00pt_class_race_gend" in the plot conditionon section. The following flags are available:

To select a random chance of picking a line, you can use the "gen00pt_random" plot's flags. This is commonly used for ambient banter, or for providing the player with random tidbits of interesting information that are not strictly necessary to complete the adventure. Important note: ensure that the last line in a group of random selections has no condition.

There are two sets of flags in the gen00pt_random plot. The first and most basic set are:

In addition to these, there are a series of "lines left" flags that make it easier to set up a series of random lines to be spoken with equal probability.

The format of the LINES_LEFT flags is GEN_RAND_RXX Where XX is the total number of random elements left in the series of randoms after the current line. Naturally, GEN_RAND_LINES_LEFT_01 has a 50% chance of being chosen. The very last dialogue line does not need a condition. For the statistically-minded, the probabilities are:

Actions triggered by a line

Conversation plots and scripting action.png

A line can also be set to modify a plot flag when it is reached, or to run a script whose purpose is to modify the state of the world in some way.

Setting and clearing plot flags is very similar to how plots are handled in the condition section, except instead of the condition "is true/false" for a plot flag you select whether the flag is to be set or cleared when this line is reached.

Scripted actions should work as usual, and trigger as follows:

This type of scripting will be used mostly for rewarding the player, taking/giving items and setting plot flags.

When taking or giving items, the script should not play an animation — it should just switch the items. The cinematic layer should take care of the visuals.

Generic actions

For ease of use, several actions that are commonly called in dialog have had generic scripts written to perform them with the script being triggered by setting plot flags on a dummy plot named "gen00pt_generic_actions". To use them, simply set this plot in the "plot" field of the action section and pick the appropriate plot flag to trigger the associated code. The generic actions available are:

!!These two flags are defined for the generic action plot but appear to be conditionals instead, look into what they're for!!

Lines That Only Show Up Once

Conversation plots and scripting line settings.png

At the bottom of this window is the "line settings" section. Visibility determines whether the line is seen only once in a game or once in a conversation.

Once-in-a-conversation lines are useful when a conversation loops back on itself, for example if the conversation is being used to make a clarification hub that provides information to a player and you don't want the player to keep being presented with the option to ask questions that he's already just asked moments ago.

Once-in-a-game lines are useful for presenting information that it wouldn't make sense for a character to repeat a second time if a new conversation is started again with him later, but for which using plot-based conditionals would be unweildy.

This section also has the "ambient" flag. The ambient flag prevents the default conversation cinematics from operating, leaving the camera view where it was and instead putting the text of the spoken line hovering over the head of the object that spoke it. This is intended for use when generating background conversations for the player to "overhear", or that is a quick one-line response to player interaction that doesn't require a full-blown conversation to play out.

Root node plots and scripting

A "Plots and Scripting" tab is also available in the root node of the conversation:

Conversation root plots and scripting.png

This is somewhat simpler than the plots and scripting tabs for child nodes, but functions in a very similar manner. It has no "condition" section, just a section called "Conversation End" that is analogous to an "action" section above. The difference is that this action section will be triggered whenever the conversation ends, by whatever path. This is helpful for preventing errors and saving time when crafting a conversation that is always supposed to have the same effect on the world when it's over but that has many different conversation end nodes scattered throughout it.

Comments and complex logic

Conversations can be documented using comment lines (for example, at the start of each major branch).

Comment lines are coded by entering a scripting comment with no dialogue.

The comment appears in green text when viewing the conversation in the toolset.

Comments aren't spoken in game, but they can be conditional.

This fact can be exploited to implement complex logic such as "if (condition 1) (if (condition 2) say X else say Y)". Condition 1 is placed on a comment line, which is followed by dialogue lines X (condition 2) and Y (unconditional).

See the OC party banter conversation for a good example.


Language: English  • Русский
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox