Plot

From Dragon Age Toolset Wiki
Revision as of 00:13, 29 June 2009 by BryanDerksen (Talk | contribs) (Scripting)

Jump to: navigation, search

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. 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.

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", you could write a script that read and wrote the flags in this plot by adding the line <ptr>

  1. include "plt_kill_all_wolves"

</pre> at the top.

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, which are 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.

Properties

General
Allow Pausing  !!Property description!!
Entry Type  !!Property description!!
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.