Difference between revisions of "Plot"

From Dragon Age Toolset Wiki
Jump to: navigation, search
m ({{Resource palette}})
m
Line 1: Line 1:
{{Resource palette}}
+
{| style="float:right;"
 +
|-
 +
| {{Resource palette}}
 +
|}
  
 
A plot is a bundle of boolean (true or false) values that can be used to track the state of the game world. They are most commonly used to control the flow of conversations and to control the contents of the player's journal.
 
A plot is a bundle of boolean (true or false) values that can be used to track the state of the game world. They are most commonly used to control the flow of conversations and to control the contents of the player's journal.

Revision as of 20:44, 3 February 2010

A plot is a bundle of boolean (true or false) values that can be used to track the state of the game world. They are most commonly used to control the flow of conversations and to control the contents of the player's journal.

They can also be used as a convenient way to run scripts.

Journal entries

Journal entries are created in the Plot Manager. When you open a Plot, you'll see a window called "Journal Text" at the bottom of the screen. Creating a journal entry is as simple as writing the text of the entry to that window while you have the appropriate flag selected.

For example, if you wanted to add a journal entry to the flag "JOURNAL_TEST" in the plot test_journal.plo, then you would check out test_journal, select "JOURNAL_TEST", and enter your journal text in the "Journal text" window.

For journal purposes, each plot file is a single journal topic, and so every flag that has an entry for a specific journal topic (say, "The Quest for the Golden Chicken") must be listed under the same plot file (say, "test_chicken"). You name the journal topic in the "Name" field in the Object Inspector when you have a Plot open.

For example, the Quest for the Golden Chicken has four parts:

  • QUEST_GIVEN: Research the last known location of the Golden Chicken.
  • RESEARCH_DONE: You know where the Chicken was last seen: the Museum of Precious Fowl. Talk to the curator of the museum to see if she heard anything about the whereabouts of the Golden Chicken.
  • CURATOR_MET: You spoke to the curator of the Museum of Precious Fowl. She told you many things, of which the current location of the Chicken is one. Go to the Dungeon of Infinite Sorrows and find the Golden Chicken.
  • CHICKEN_FOUND: You found the Golden Chicken. You are awesome.

As long as all relevant flags are in the same plot, each time a new flag is set, that flag's Journal Text will replace that of the previously set flag.

Only the latest Journal Text is displayed, but any previously set flags remain set (unless you explicitly switch them off). For example, when RESEARCH_DONE is set, QUEST_GIVEN will normally be set, too.

If you want to track steps within a subplot (say finding the Golden Chicken's last-known location involved several steps of researching places and visiting them in turn), you'll want to create multiple smaller plots and organize the flags within them, possibly naming them to indicate that they're subplots.

For example, if the Quest for the Golden Chicken had subplots of "Go to the dig site," "Speak with the Professor," and "Find the Tome of Finding Stuff," then you might want to create separate plots for each and begin each plot's name with "Golden Chicken: Go to the dig site" and so on. If you want to preserve the text of a journal entry when the next entry is given, you have to paste the original entry's text into the new entry or organize the new entry into a separate plot.

Currently there is a limit of 256 plot flags per plot. 128 of these flags are standard plot flags and the other 128 are "defined" plot flags whose state is determined by scripting each time they're read.

In addition to handling quest-related journal entries, plots also handle "codex" entries that provide background information about the world and other such details. See the Entry Type property for setting this.

Tags for italics (<i> and </i>) can be used in the journal text field. Text can be emphasized with the <emp> and </emp> tags.

When a plot flag with "Final" set to "Yes" is set, the journal entry for the plot will be moved into the completed quests section of the journal.

Scripting

To interact with a plot's flags you'll need to include the plot in a script with a "plt_" prefix. For example, if you have a plot whose resource name is "kill_all_wolves", adding the following line at the top of your script would give it access to examine and change the flags in the "kill_all_wolves" plot:

#include "plt_kill_all_wolves"

You can then use the wrapper functions in wrappers_h (include "wrappers_h" to make them available) to get and set plot flags using the plot's name and flag's names as constants, like so:

int flag_value = WR_GetPlotFlag(PLT_KILL_ALL_WOLVES, FLAG_NAME);
WR_SetPlotFlag(PLT_KILL_ALL_WOLVES, FLAG_NAME, flag_value);

Plot event scripts

Many tasks in Dragon Age are accomplished by plot scripts triggered whenever a plot flag is read or set. A plot flag's ability to store a true/false value easily allows for "run once" situations without having to deal with local variables, but this is not strictly necessary and a plot's event script will run every time the plot flag is set regardless of whether it results in a change in the flag's value.

Unlike other event scripts, a plot script will have the function "int StartingConditional()" called when a plot flag is set or read. This allows the call to have a return value (an integer true/false result) that is most important when dealing with defined plot flags.

EVENT_TYPE_SET_PLOT is sent whenever a normal plot flag is set, with the event's integer 1 holding the identity of the plot flag that had been set. Note that the plot script is called before the plot flag itself is set; the plot flag's value doesn't change until after the script finishes running.

EVENT_TYPE_GET_PLOT is sent whenever a "defined" plot flag is read. The plot script's StartingConditional() function should return a result of TRUE or FALSE to indicate what the defined plot flag's value is.

To use a plot event script:

  • create a script e.g. "kill_all_wolves.ncs"
  • On your plot in the property inspector (bottom right of toolset) make sure to assign your script to your plot (instead of the default plot_core)
  • Set or get a plot flag, making sure to set the last parameter (nCallScript) to TRUE (see WR_GetPlotFlag and WR_SetPlotFlag
  • Remember that your script is executed each time a flag is set/get

If you want to trigger the plot (and thus the script) you can just call:

WR_SetPlotFlag(PLT_KILL_ALL_WOLVES, FLAG_NAME, flag_value, TRUE);

Important: Notice the last parameter TRUE. This parameter must be set to TRUE to have the function also call the plot script!

Plot assist markers

Many quest givers in the single player campaign have a "!" symbol above their heads to indicate they can offer the player a quest. This will also appear on the area map. In order to have this present, you need to set the creature as a plot giver. This can be done in one of two ways, either within the creature properties, or via script using the following function:

SetPlotGiver(oObject, TRUE);

Once the player has received the quest, you need to disable this flag, unless you wish for the "!" symbol to remain over the character and on the world map. This can be done by using the plot's event handler script and adding the following line when handling the event that accepts the quest:

SetPlotGiver(oObject, FALSE);

In order to display intermediate plot markers (the downward pointing arrow symbol), you will need to modify the plot itself. For quest destinations you will want to add the tag of the creature or placeable to the Plot Assist list (bottom right) for the individual plot flags that are triggered when you want the destination marker to apear and disappear (Status set to Yes or No).

Plot flag ordering

Order doesn't matter for standard plot files, but does matter for codex plots.

For standard plots, whichever journal flag was last set to true will be the one that shows up in the journal. (I don't remember for certain at the moment, but I believe if you set additional "final" flags true it won't update a completed quest.)

For codex plots all active flags are displayed in order from least to greatest. This is used in cases like character entries where several equivalent entries are plot-dependent.

For example:

0: Cookie Monster is a devourer of cookies.
1: Cookie Monster was a devourer of cookies.
2: He threatened to destroy the kingdom.
3: <FirstName/> dispatched him handily.
4: But <FirstName/> bribed him with a cookie.
5: But Big Bird made him play nice.

0 would be true initially and set to false (with 1 set to true) if Cookie monster died. 2 would always be true. Only one of 3,4, or 5 would be true, depending on the player's actions (killing, bribing, or ignoring Cookie Monster). If the player had not yet encountered the monster and chosen an action, flags 3, 4, and 5 would all be false.

Granting rewards via plots

Each plot flag can have a reward associated with it, picked from a list defined by the rewards.xls 2DA. This reward is given to the player when the plot flag is set.

Properties

General
Allow Pausing
Entry Type
GUID Unique in-game identifier for a plot.
Journal Image An optional journal image that can appear in the journal for this plot.
Name Name of the plot as shown in the journal
NameRequiresReTranslation A true/false flag used during game development for localization work
Parent Plot Associates subplots with a main plot.
Priority Sorts the plots in the journal
Resource Name A unique string identifier the toolset and the game both use to refer to this resource
Script Event script assigned to the resource.