<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://datoolset.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Innodil+Ath+Nathosh</id>
		<title>Dragon Age Toolset Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://datoolset.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Innodil+Ath+Nathosh"/>
		<link rel="alternate" type="text/html" href="https://datoolset.net/wiki/Special:Contributions/Innodil_Ath_Nathosh"/>
		<updated>2026-11-10T19:26:01Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.6</generator>

	<entry>
		<id>https://datoolset.net/mw/index.php?title=Plot&amp;diff=9118</id>
		<title>Plot</title>
		<link rel="alternate" type="text/html" href="https://datoolset.net/mw/index.php?title=Plot&amp;diff=9118"/>
				<updated>2009-12-30T12:19:24Z</updated>
		
		<summary type="html">&lt;p&gt;Innodil Ath Nathosh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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.&lt;br /&gt;
&lt;br /&gt;
They can also be used as a convenient way to run [[script]]s.&lt;br /&gt;
&lt;br /&gt;
== Journal entries ==&lt;br /&gt;
&lt;br /&gt;
Journal entries are created in the Plot Manager. When you open a Plot, you'll see a window called &amp;quot;Journal Text&amp;quot; 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. &lt;br /&gt;
&lt;br /&gt;
For example, if you wanted to add a journal entry to the flag &amp;quot;JOURNAL_TEST&amp;quot; in the plot test_journal.plo, then you would check out test_journal, select &amp;quot;JOURNAL_TEST&amp;quot;, and enter your journal text in the &amp;quot;Journal text&amp;quot; window.&lt;br /&gt;
&lt;br /&gt;
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, &amp;quot;The Quest for the Golden Chicken&amp;quot;) must be listed under the same plot file (say, &amp;quot;test_chicken&amp;quot;). You name the journal topic in the &amp;quot;Name&amp;quot; field in the Object Inspector when you have a Plot open.&lt;br /&gt;
&lt;br /&gt;
For example, the Quest for the Golden Chicken has four parts: &lt;br /&gt;
&lt;br /&gt;
*QUEST_GIVEN: Research the last known location of the Golden Chicken. &lt;br /&gt;
*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. &lt;br /&gt;
*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. &lt;br /&gt;
*CHICKEN_FOUND: You found the Golden Chicken. You are awesome.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
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.      &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
For example, if the Quest for the Golden Chicken had subplots of &amp;quot;Go to the dig site,&amp;quot; &amp;quot;Speak with the Professor,&amp;quot; and &amp;quot;Find the Tome of Finding Stuff,&amp;quot; then you might want to create separate plots for each and begin each plot's name with &amp;quot;Golden Chicken: Go to the dig site&amp;quot; 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. &lt;br /&gt;
&lt;br /&gt;
Currently there is a limit of 256 plot flags per plot. 128 of these flags are standard plot flags and the other 128 are &amp;quot;defined&amp;quot; plot flags whose state is determined by scripting each time they're read.&lt;br /&gt;
&lt;br /&gt;
In addition to handling quest-related journal entries, plots also handle &amp;quot;codex&amp;quot; entries that provide background information about the world and other such details. See the Entry Type property for setting this.&lt;br /&gt;
&lt;br /&gt;
Tags for italics (&amp;amp;lt;i&amp;amp;gt; and &amp;amp;lt;/i&amp;amp;gt;) can be used in the journal text field. Text can be emphasized with the &amp;amp;lt;emp&amp;amp;gt; and &amp;amp;lt;/emp&amp;amp;gt; tags.&lt;br /&gt;
&lt;br /&gt;
When a plot flag with &amp;quot;Final&amp;quot; set to &amp;quot;Yes&amp;quot; is set, the journal entry for the plot will be moved into the completed quests section of the journal.&lt;br /&gt;
&lt;br /&gt;
== Scripting ==&lt;br /&gt;
&lt;br /&gt;
To interact with a plot's flags you'll need to include the plot in a script with a &amp;quot;plt_&amp;quot; prefix. For example, if you have a plot whose resource name is &amp;quot;kill_all_wolves&amp;quot;, adding the following line at the top of your script would give it access to examine and change the flags in the &amp;quot;kill_all_wolves&amp;quot; plot:&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;plt_kill_all_wolves&amp;quot;&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then use the wrapper functions in wrappers_h (include &amp;quot;wrappers_h&amp;quot; to make them available) to get and set plot flags using the plot's name and flag's names as constants, like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
int flag_value = WR_GetPlotFlag(PLT_KILL_ALL_WOLVES, FLAG_NAME);&lt;br /&gt;
WR_SetPlotFlag(PLT_KILL_ALL_WOLVES, FLAG_NAME, flag_value);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plot event scripts ===&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;run once&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
Unlike other event scripts, a plot script will have the function &amp;quot;int StartingConditional()&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
[[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.&lt;br /&gt;
&lt;br /&gt;
[[EVENT_TYPE_GET_PLOT]] is sent whenever a &amp;quot;defined&amp;quot; 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.&lt;br /&gt;
&lt;br /&gt;
To use a plot event script:&lt;br /&gt;
* create a script e.g. &amp;quot;kill_all_wolves.ncs&amp;quot;&lt;br /&gt;
* 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'')&lt;br /&gt;
* Set or get a plot flag, making sure to set the last parameter (nCallScript) to TRUE (see [[WR_GetPlotFlag]] and [[WR_SetPlotFlag]]&lt;br /&gt;
* Remember that your script is executed ''each time a flag is set/get''&lt;br /&gt;
&lt;br /&gt;
If you want to trigger the plot (and thus the script) you can just call:&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
WR_SetPlotFlag(PLT_KILL_ALL_WOLVES, FLAG_NAME, flag_value, TRUE);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Important:''' Notice the last parameter '''TRUE'''. This parameter '''must''' be set to TRUE to have the function also call the plot script!&lt;br /&gt;
&lt;br /&gt;
== Plot assist markers ==&lt;br /&gt;
&lt;br /&gt;
Many quest givers in the single player campaign have a &amp;quot;!&amp;quot; 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:&lt;br /&gt;
&amp;lt;dascript&amp;gt;SetPlotGiver(oObject, TRUE);&amp;lt;/dascript&amp;gt;&lt;br /&gt;
Once the player has received the quest, you need to disable this flag, unless you wish for the &amp;quot;!&amp;quot; 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:&lt;br /&gt;
&amp;lt;dascript&amp;gt;SetPlotGiver(oObject, FALSE);&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
== Plot flag ordering ==&lt;br /&gt;
&lt;br /&gt;
Order doesn't matter for standard plot files, but does matter for codex plots.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;final&amp;quot; flags true it won't update a completed quest.)&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
:0: Cookie Monster is a devourer of cookies.&lt;br /&gt;
:1: Cookie Monster was a devourer of cookies.&lt;br /&gt;
:2: He threatened to destroy the kingdom.&lt;br /&gt;
:3: &amp;lt;FirstName/&amp;gt; dispatched him handily.&lt;br /&gt;
:4: But &amp;lt;FirstName/&amp;gt; bribed him with a cookie.&lt;br /&gt;
:5: But Big Bird made him play nice.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Granting rewards via plots ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{{inspector start}}&lt;br /&gt;
{{inspector section|General}}&lt;br /&gt;
{{inspector row|Allow Pausing|  }}&lt;br /&gt;
{{inspector row|Entry Type|  }}&lt;br /&gt;
{{inspector row|GUID| Unique in-game identifier for a plot. }}&lt;br /&gt;
{{inspector row|Journal Image| An optional journal image that can appear in the journal for this plot. }}&lt;br /&gt;
{{inspector row|Name| Name of the plot as shown in the journal}}&lt;br /&gt;
{{inspector row|NameRequiresReTranslation| A true/false flag used during game development for localization work }}&lt;br /&gt;
{{inspector row|Parent Plot| Associates subplots with a main plot. }}&lt;br /&gt;
{{inspector row|Priority| Sorts the plots in the journal }}&lt;br /&gt;
{{inspector row|Resource Name| A unique string identifier the toolset and the game both use to refer to this resource }}&lt;br /&gt;
{{inspector row|Script| Event script assigned to the resource. }}&lt;br /&gt;
{{inspector end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plots]]&lt;/div&gt;</summary>
		<author><name>Innodil Ath Nathosh</name></author>	</entry>

	<entry>
		<id>https://datoolset.net/mw/index.php?title=Event_keyword&amp;diff=9117</id>
		<title>Event keyword</title>
		<link rel="alternate" type="text/html" href="https://datoolset.net/mw/index.php?title=Event_keyword&amp;diff=9117"/>
				<updated>2009-12-30T11:13:25Z</updated>
		
		<summary type="html">&lt;p&gt;Innodil Ath Nathosh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The '''event''' type represents a package of information that can be passed around in the game to trigger some behaviour.&lt;br /&gt;
&lt;br /&gt;
== Constructor ==&lt;br /&gt;
&lt;br /&gt;
A constructor is a function that creates an instance of a [[DAScript_types|dascript type]].&lt;br /&gt;
&lt;br /&gt;
The constructor for an event is [[Event]].&lt;br /&gt;
&lt;br /&gt;
== Literals ==&lt;br /&gt;
&lt;br /&gt;
A literal is a textual representation of a particular value of a type. &lt;br /&gt;
&lt;br /&gt;
There is no literal for an event.&lt;br /&gt;
&lt;br /&gt;
== Conversion ==&lt;br /&gt;
&lt;br /&gt;
There is no explicit or implicit conversion to or from an event.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    // uninitialised&lt;br /&gt;
    event evDefault;&lt;br /&gt;
 &lt;br /&gt;
    // initialised using the constructor&lt;br /&gt;
    event evConstructed = Event(EVENT_TYPE_USE);&lt;br /&gt;
&lt;br /&gt;
    // initialised using a function&lt;br /&gt;
    event evCurrent = GetCurrentEvent();    &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remarks ==&lt;br /&gt;
&lt;br /&gt;
Events are usually passed off to an [[object (dascript type)|object's]] [[event script]] for handling, but there are a few engine-only event types that are not exposed to the end-users. &lt;br /&gt;
&lt;br /&gt;
Scripting Events have an integer type, target object, a time delay and a package of parameters (arbitrary number of [[int (dascript type)|ints]], [[object (dascript type)|objects]], [[float (dascript type)|floats]] and [[string (dascript type)|strings]]).  Certain event types will be defined by the engine and referenced as #defines in the scripts.&lt;br /&gt;
&lt;br /&gt;
Events are handled in the scripting language with the following types of commands:&lt;br /&gt;
* Event() Constructor —  Scripters can create events of any type and signal them to other objects&lt;br /&gt;
* Signal Event commands —  Events can be signalled to a single object, by proximity or to all objects with a certain group id&lt;br /&gt;
* Parameter access —  All of the parameters on an event can be get and set through scripting.&lt;br /&gt;
* Event handling —  Events can be passed to other script files through the HandleEvent command.  This command will be run inline so that hierarchies of event-handling behaviour can be built.&lt;br /&gt;
&lt;br /&gt;
A typical event-handling script would have the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    event ev = GetCurrentEvent();&lt;br /&gt;
    int nEventType = GetEventType(ev); //extract event type from current event&lt;br /&gt;
    int nEventHandled = FALSE; //keep track of whether the event has been handled&lt;br /&gt;
    switch(nEventType)&lt;br /&gt;
    {&lt;br /&gt;
         case EVENT_TYPE_AREALOAD_SPECIAL:&lt;br /&gt;
         {&lt;br /&gt;
             ...&lt;br /&gt;
             nEventHandled = TRUE; //set this if no further action is required for this event&lt;br /&gt;
             break;&lt;br /&gt;
         }&lt;br /&gt;
    }&lt;br /&gt;
    if (!nEventHandled) //If this event wasn't handled by this script, let the core script try&lt;br /&gt;
    {&lt;br /&gt;
        HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the event that you want to intercept some events but leave others to be handled by a default script (for example if you're overriding one aspect of a creature's event response but the rest of the default creature_core responses responses are fine) you can pass execution to the default script with the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
    HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(constants for referencing core script resources are available in the &amp;quot;global_objects_h&amp;quot; include file)&lt;br /&gt;
&lt;br /&gt;
Below is a list of the event types that are defined within the core resources. Custom events can also be defined, and will also have documentation in this wiki; if you don't find an event here try browsing the [[:Category:Event types|event type categories]].&lt;br /&gt;
&lt;br /&gt;
* '''Perception'''&lt;br /&gt;
** [[EVENT_TYPE_PERCEPTION_APPEAR]] - A creature enters the perception area of creature receiving the event &lt;br /&gt;
** [[EVENT_TYPE_PERCEPTION_DISAPPEAR]] - A creature exits the perception area of creature receiving the event&lt;br /&gt;
* '''Effects'''&lt;br /&gt;
**[[EVENT_TYPE_APPLY_EFFECT]] - an effect is applied to the receiving object&lt;br /&gt;
**[[EVENT_TYPE_REMOVE_EFFECT]] - an effect is removed from the receiving object&lt;br /&gt;
* '''Combat'''&lt;br /&gt;
**[[ EVENT_TYPE_COMBAT_INITIATED ]] - Fires whenever the attack command is added into the command queue. Used to set combat mode and combat camera/music. Also fires by scripting to trigger combat after being attacked or an ally is attack. &lt;br /&gt;
**[[ EVENT_TYPE_COMBAT_END ]] - a creature doesn't perceive any more hostiles. &lt;br /&gt;
**[[ EVENT_TYPE_MELEE_ATTACK_START ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_COMMAND_PENDING ]] - Fires at the beginning of the attack part of the attack command OR at the beginning of an ability execution. &lt;br /&gt;
**[[ EVENT_TYPE_COMMAND_COMPLETE ]] - creature finishes doing a command(attack, special ability, spell, conversation, etc) &lt;br /&gt;
**[[ EVENT_TYPE_ATTACK_IMPACT ]] -- An attack has impacted the target. This can be melee (sword hit), ranged (arrow hit) or spell (fireball explodes). Used for applying damage, and handling abilities that function on hit (Berserk etc'). &lt;br /&gt;
**[[ EVENT_TYPE_ATTACKED ]] - another object tried attacking this creature using melee/ranged weapons (hit or miss), talents or spells. &lt;br /&gt;
**[[ EVENT_TYPE_ALLY_ATTACKED ]] - an ally has received the ATTACKED event. An ally is an object with the same group ID. &lt;br /&gt;
* '''Damage and death'''&lt;br /&gt;
**[[ EVENT_TYPE_DAMAGED ]] - an object loses 1 hit point or more&lt;br /&gt;
**[[ EVENT_TYPE_DOT_TICK ]] - Damage over time tick event.&lt;br /&gt;
**[[ EVENT_TYPE_DYING ]] - a creature received the killing blow.&lt;br /&gt;
**[[ EVENT_TYPE_DEATH ]] - creature or placeable have the death effect applied (regardless of hitpoints)&lt;br /&gt;
**[[ EVENT_TYPE_RESURRECTION ]] - Creature resurrected.&lt;br /&gt;
**[[ EVENT_TYPE_TEAM_DESTROYED ]] - Fires when an entire team of creatures is destroyed. &lt;br /&gt;
* '''Inventory '''&lt;br /&gt;
**[[ EVENT_TYPE_INVENTORY_ADDED ]] - An item is added to the personal inventory of the object receiving the event or the party inventory.&lt;br /&gt;
**[[ EVENT_TYPE_INVENTORY_REMOVED ]] - An item is removed from the personal inventory of the object receiving the event or the party inventory.&lt;br /&gt;
**[[ EVENT_TYPE_EQUIP ]] - The current creature has equipped an item&lt;br /&gt;
**[[ EVENT_TYPE_UNEQUIP ]] - The current creature has unequipped an item&lt;br /&gt;
**[[ EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED ]] - items with the ITEM_ACQUIRED_EVENT_ID variable set are picked up.&lt;br /&gt;
**[[ EVENT_TYPE_INVENTORY_FULL ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_OUT_OF_AMMO ]] - {{undocumented}}&lt;br /&gt;
* '''Movement'''&lt;br /&gt;
**[[ EVENT_TYPE_BLOCKED ]] - The current creature's path has been blocked while moving by a creature or door. This event will NOT fire when blocked by placeables who can not change the walk mesh or terrain.&lt;br /&gt;
**[[ EVENT_TYPE_ENTER ]] - A creature enters the object receiving the event&lt;br /&gt;
**[[ EVENT_TYPE_EXIT ]] - A creature exits the object receiving the event&lt;br /&gt;
**[[ EVENT_TYPE_REACHED_WAYPOINT ]] - {{undocumented}}&lt;br /&gt;
* '''Traps'''&lt;br /&gt;
**[[ EVENT_TYPE_APPROACH_TRAP ]] - Trap triggered and the creature receiving this event should approach the trap&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_ARM ]] Sent by script to request that a trap arm itself.&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGER_ENTER ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_DISARMED ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGER_ARMED ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGER_EXIT ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_TRAP_TRIGGERED ]] - {{undocumented}}&lt;br /&gt;
* '''Game state events'''&lt;br /&gt;
**[[ EVENT_TYPE_SPAWN ]] - an object spawns into the game. This event can fire only once per game for each object, regardless of save games.&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_START ]] - The module starts. This can happen only once for a single game instance.&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_LOAD ]] - The module loads from a save game. This event can fire more than once for a single module or game instance.&lt;br /&gt;
**[[ EVENT_TYPE_AREALOAD_SPECIAL ]]- for playing things like cutscenes and movies when you enter an area, things that do not involve AI or actual game play&lt;br /&gt;
**[[ EVENT_TYPE_AREALOAD_PRELOADEXIT ]] - for things you want to happen while the load screen is still up, things like moving creatures around&lt;br /&gt;
**[[ EVENT_TYPE_AREALOAD_POSTLOADEXIT ]] - fires at the same time that the load screen is going away, and can be used for things that you want to make sure the player sees.&lt;br /&gt;
**[[ EVENT_TYPE_AREALOADSAVE_POSTLOADEXIT ]] - fires at the same time that the load screen is going away, but only when loading a savegame.&lt;br /&gt;
**[[ EVENT_TYPE_GAMEMODE_CHANGE ]]&lt;br /&gt;
**[[ EVENT_TYPE_DELAYED_GM_CHANGE ]]&lt;br /&gt;
**[[ EVENT_TYPE_SET_GAME_MODE ]]&lt;br /&gt;
*'''Plots'''&lt;br /&gt;
**[[ EVENT_TYPE_SET_PLOT ]] - A plot is setting a plot flag&lt;br /&gt;
**[[ EVENT_TYPE_GET_PLOT ]] - A plot is setting a plot flag&lt;br /&gt;
*''' Dialogue'''&lt;br /&gt;
**[[ EVENT_TYPE_DIALOGUE ]] - An object tries to initiate dialog with the object receiving the event, either by clicking or by scripting&lt;br /&gt;
**[[ EVENT_TYPE_DELAYED_SHOUT ]] - Used to fire a dialog shout every few seconds.&lt;br /&gt;
**[[ EVENT_TYPE_AMBIENT_CONTINUE ]] - conversation ends or player is nearby to resume ambient behaviour &lt;br /&gt;
*'''Party management'''&lt;br /&gt;
**[[ EVENT_TYPE_PARTYMEMBER_ADDED ]] - Party member added to active party using the party GUI &lt;br /&gt;
**[[ EVENT_TYPE_PARTYMEMBER_DROPPED ]] - Party member removed from active party using the party GUI &lt;br /&gt;
**[[ EVENT_TYPE_PARTYPICKER_CLOSED ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_PARTY_MEMBER_HIRED ]] - Fires first time a party member is added to the party. For plot followers: follower recruited (added to pool). For other followers: UT_Hire called&lt;br /&gt;
**[[ EVENT_TYPE_PARTY_MEMBER_FIRED ]] - Fires when an active or locked-active party member is removed from the active party&lt;br /&gt;
**[[ EVENT_TYPE_PARTY_MEMBER_RES_TIMER ]] - Resurrection timer used if a creature dies in explore mode.&lt;br /&gt;
**[[ EVENT_TYPE_GIFT_ITEM ]]- {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_HANDLE_FOLLOWER_DEATH ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_HANDLE_GIFT ]] - {{undocumented}}&lt;br /&gt;
**[[ EVENT_TYPE_SUMMON_DIED ]] - {{undocumented}}&lt;br /&gt;
* '''Character generation and level advancement '''&lt;br /&gt;
**[[EVENT_TYPE_CHARGEN_START]] and [[EVENT_TYPE_CHARGEN_END ]] - A range of event constants (nEvent &amp;gt;= EVENT_TYPE_CHARGEN_START &amp;amp;&amp;amp; nEvent &amp;lt;= EVENT_TYPE_CHARGEN_END) that occur during character generation.&lt;br /&gt;
**[[ EVENT_TYPE_PLAYER_LEVELUP ]] Fired by sys_rewards_h.RewardXP (the levelup system)&lt;br /&gt;
**[[ EVENT_TYPE_PLAYERLEVELUP ]]&lt;br /&gt;
**[[ EVENT_TYPE_CHARGEN_AUTOLEVEL ]]&lt;br /&gt;
**[[ EVENT_TYPE_MODULE_CHARGEN_DONE ]]&lt;br /&gt;
**[[ EVENT_TYPE_GUI_OPENED ]] - GUI tutorial calls&lt;br /&gt;
* '''World map'''&lt;br /&gt;
**[[ EVENT_TYPE_TRANSITION_TO_WORLD_MAP ]] - Player uses the generic transition system to open the world map&lt;br /&gt;
**[[ EVENT_TYPE_WORLD_MAP_CLOSED ]]&lt;br /&gt;
**[[ EVENT_TYPE_WORLD_MAP_USED ]] - the player clicks on a destination in the world map&lt;br /&gt;
** [[ EVENT_TYPE_BEGIN_TRAVEL ]]&lt;br /&gt;
** [[ EVENT_TYPE_WORLDMAP_PRETRANSITION ]]&lt;br /&gt;
**[[ EVENT_TYPE_WORLDMAP_POSTTRANSITION ]]&lt;br /&gt;
**[[ EVENT_TYPE_FINISH_TRAVEL ]]&lt;br /&gt;
*''' Found in placeable_core '''&lt;br /&gt;
**[[ EVENT_TYPE_PLACEABLE_ONCLICK ]] player clicks on object.&lt;br /&gt;
**[[ EVENT_TYPE_USE ]]&lt;br /&gt;
**[[ EVENT_TYPE_UNLOCKED ]] Sent by script when placeable is unlocked.&lt;br /&gt;
**[[ EVENT_TYPE_SET_OBJECT_ACTIVE ]] Sent by script to change active state. Needed since CommandDoFunction was removed and we're using CommandDoEvent&lt;br /&gt;
**[[ EVENT_TYPE_PLACEABLE_COLLISION ]] player collides with object (if EnableCollisionEvent column in placeables.xls is non-zero).&lt;br /&gt;
**[[ EVENT_TYPE_POPUP_RESULT ]]&lt;br /&gt;
* '''Found in rules_core'''&lt;br /&gt;
**[[ EVENT_TYPE_ITEM_ONHIT ]]&lt;br /&gt;
**[[ EVENT_TYPE_CONFUSION_CALLBACK ]]&lt;br /&gt;
**[[ EVENT_TYPE_DESTROY_OBJECT ]]&lt;br /&gt;
* '''Found in player_core'''&lt;br /&gt;
**[[ EVENT_TYPE_HEARTBEAT ]]&lt;br /&gt;
**[[ EVENT_TYPE_LOAD_TACTICS_PRESET ]]&lt;br /&gt;
*'''Spellcasting'''&lt;br /&gt;
**[[ EVENT_TYPE_ABILITY_CAST_START ]]&lt;br /&gt;
**[[ EVENT_TYPE_ABILITY_CAST_IMPACT ]]&lt;br /&gt;
**[[ EVENT_TYPE_CAST_AT ]]&lt;br /&gt;
**[[ EVENT_TYPE_COMBO_IGNITE ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLCASTAT ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_CAST ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_DEACTIVATE ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_IMPACT ]]&lt;br /&gt;
**[[ EVENT_TYPE_SPELLSCRIPT_PENDING ]]&lt;br /&gt;
* '''Proving events'''&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_ENTER ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_EXIT ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_LOSE ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_START ]]&lt;br /&gt;
**[[ EVENT_TYPE_PROVING_WIN ]]&lt;br /&gt;
* '''Debugging'''&lt;br /&gt;
** [[ EVENT_TYPE_DEBUG_KICKSTART_AI ]]&lt;br /&gt;
**[[ EVENT_TYPE_DEATH_RES_PARTY ]]&lt;br /&gt;
**[[ EVENT_TYPE_DEBUG_RESURRECTION ]]&lt;br /&gt;
* '''Stats'''&lt;br /&gt;
**[[ EVENT_TYPE_STAT_REGEN ]]&lt;br /&gt;
**[[ EVENT_TYPE_MANA_STAM_DEPLETED ]]&lt;br /&gt;
* '''Miscellaney'''&lt;br /&gt;
**[[ EVENT_TYPE_CLICK ]]&lt;br /&gt;
**[[ EVENT_TYPE_CUSTOM_COMMAND_COMPLETE ]]&lt;br /&gt;
**[[ EVENT_TYPE_FAILTOOPEN ]]&lt;br /&gt;
**[[ EVENT_TYPE_HANDLE_CUSTOM_AI ]]&lt;br /&gt;
**[[ EVENT_TYPE_INVALID ]]&lt;br /&gt;
**[[ EVENT_TYPE_LISTENER ]]&lt;br /&gt;
**[[ EVENT_TYPE_LOCKED ]]&lt;br /&gt;
**[[ EVENT_TYPE_QA_EVENT ]]&lt;br /&gt;
**[[ EVENT_TYPE_QA_EVENT_BLA ]]&lt;br /&gt;
**[[ EVENT_TYPE_STEALING_FAILURE ]]&lt;br /&gt;
**[[ EVENT_TYPE_STEALING_SUCCESS ]]&lt;br /&gt;
**[[ EVENT_TYPE_UNIQUE_POWER ]] - Fired when an item with ability &amp;quot;ITEM_ABILITY_UNIQUE_POWER_SINGLE_USE&amp;quot; or &amp;quot;ITEM_ABILITY_UNIQUE_POWER_UNLIMITED_USE&amp;quot; is &amp;quot;used&amp;quot;. this event is sent to the '''module''' script. Fired by the core &amp;quot;item_unique_power.ncs&amp;quot; script.&lt;br /&gt;
&lt;br /&gt;
== Shouts ==&lt;br /&gt;
&lt;br /&gt;
Shouts (events) are used to make creatures communicate with one another. This is a list of all the shouts referenced in the AI documentation. &lt;br /&gt;
&lt;br /&gt;
[[ Creature Shouts ]]&lt;br /&gt;
&lt;br /&gt;
*SHOUT_TYPE_WASATTACKED When I am attacked, signal this event for all allies. What do the allies do? They will go into combat round, not specifically targeting this attacker but becoming combat ready. &lt;br /&gt;
*SHOUT_TYPE_SAWENEMY Attack enemy. &lt;br /&gt;
*SHOUT_TYPE_KILLEDME Attack enemy. &lt;br /&gt;
*SHOUT_TYPE_SWITCH_MELEE Will switch to melee weapons, useful for certain plot situations &lt;br /&gt;
*SHOUT_TYPE_WAKE_UP Any creature that hears this shout will wake up, if sleeping. This shout needs to be manually called. &lt;br /&gt;
*SHOUT_TYPE_FOUND_SOMEONE (YaronToDo) a scout sees someone they broadcasts this event. Allies go here. (NOT DONE)&lt;br /&gt;
&lt;br /&gt;
[[ Commander-Specific Orders ]]&lt;br /&gt;
&lt;br /&gt;
*SHOUT_TYPE_FINISHHIM Attacks a specified enemy till they are dead. A Commander issues order generally. &lt;br /&gt;
*SHOUT_TYPE_ATTACK_WIZARD (YaronToDo) Starting targeting wizard class enemies instead of others. &lt;br /&gt;
*SHOUT_TYPE_FLANK Rogues will get into a flanking position to an appropriate enemy &lt;br /&gt;
*SHOUT_TYPE_SWITCH_RANGED Will randomly choose one ally and ask them to switch to a ranged weapon. This is mostly done to even out the number of participants in melee battle for animation purposes (closer to even the sides are, the better things look)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
[[IsEventValid]], [[HandleEvent]], [[SignalEvent]]&lt;br /&gt;
&lt;br /&gt;
[[Category: DAScript types]]&lt;br /&gt;
[[Category:Events]]&lt;/div&gt;</summary>
		<author><name>Innodil Ath Nathosh</name></author>	</entry>

	<entry>
		<id>https://datoolset.net/mw/index.php?title=Scripting_overview&amp;diff=9116</id>
		<title>Scripting overview</title>
		<link rel="alternate" type="text/html" href="https://datoolset.net/mw/index.php?title=Scripting_overview&amp;diff=9116"/>
				<updated>2009-12-30T10:53:06Z</updated>
		
		<summary type="html">&lt;p&gt;Innodil Ath Nathosh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Scripting is used whenever the designers need control over the game's behaviour. The syntax for DA scripts is very similar to the C programming language. &lt;br /&gt;
&lt;br /&gt;
Detailed documentation for the scripting language can be found in the &amp;quot;dascript.chm&amp;quot; file, available in your &amp;quot;Dragon Age\packages\core&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main uses for it are to: &lt;br /&gt;
&lt;br /&gt;
*Trigger plot events &lt;br /&gt;
*Script conversation &lt;br /&gt;
*Handle creature and party member [[AI]]&lt;br /&gt;
*Script abilities - skills, talents, and spells &lt;br /&gt;
&lt;br /&gt;
DA also has a client-side scripting language whose primary responsibility is automated testing of the game. See [[client script]]s for more details.&lt;br /&gt;
&lt;br /&gt;
AI Scripts are event based. Objects will have only one event-handling script assigned to them that will be run whenever they receive a game event. This script will receive the event type as a parameter and will need to determine the appropriate response for itself.&lt;br /&gt;
&lt;br /&gt;
There are several file extensions associated with scripts:&lt;br /&gt;
* NSS - script source file&lt;br /&gt;
* NCS - compiled script&lt;br /&gt;
* NDB - debug information file (required for using the script debugger to trace through this file)&lt;br /&gt;
&lt;br /&gt;
== Script editor ==&lt;br /&gt;
&lt;br /&gt;
Scripts are created in the Designer Toolset using the Script Editor. Once created, scripts must be assigned to such things as Creatures before they can be used. Once assigned, both the referencing object and the script must be exported in order to be viewed in the game. Exporting happens automatically or can be done manually by the designer during testing. &lt;br /&gt;
&lt;br /&gt;
The script editor supports the following features: &lt;br /&gt;
&lt;br /&gt;
*Undo and redo &lt;br /&gt;
*Find and replace &lt;br /&gt;
*Bookmarking: View -&amp;gt; Other Windows -&amp;gt; Bookmarks&lt;br /&gt;
*Function, variable, constant, and template browser (visible on the right-hand side of the screen).&lt;br /&gt;
*Auto-complete when typing function and variable names &lt;br /&gt;
*Syntax highlighting &lt;br /&gt;
*Auto-indention &lt;br /&gt;
*Brace matching/highlighting &lt;br /&gt;
*Ability to test compile a script &lt;br /&gt;
*Jump to definition&lt;br /&gt;
&lt;br /&gt;
To the right of the script editor is a sidebar with a browser that can display all currently-defined functions, variables, or constants, or a set of 'template' scripts that can serve as a starting point when writing a script from scratch. The browser also has a filter field where you can type in a partial string and have the list automatically exclude everything that doesn't include it in the name.&lt;br /&gt;
&lt;br /&gt;
This is the constant browser:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser.png]]&lt;br /&gt;
&lt;br /&gt;
Here it is with &amp;quot;team&amp;quot; typed into the filter field, displaying only constants with names that contain the substring &amp;quot;team&amp;quot; (not case sensitive):&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting constant browser filtered.png]]&lt;br /&gt;
&lt;br /&gt;
The templates that come with Dragon Age include frameworks for the most common event scripts found in the game. You can add your own templates quite easily, just create a text file with the template code in it and place it in the Dragon Age\Toolset\scripttemplates directory with the others.&lt;br /&gt;
&lt;br /&gt;
[[Image:scripting template browser.png]]&lt;br /&gt;
&lt;br /&gt;
Dragon Age's toolset supports Doxygen-style comments. If you double-click on a function name a help window will pop open to display its documentation. You can also jump to a function's definition (provided it isn't an engine-defined function in script.ldf) by right-clicking on it and selecting &amp;quot;go to definition&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scripting help window.png]]&lt;br /&gt;
&lt;br /&gt;
== Writing scripts ==&lt;br /&gt;
&lt;br /&gt;
For a script to compile, it needs a body:&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
The parameters on this can't be changed or the script won't compile.&lt;br /&gt;
&lt;br /&gt;
Scripts associated with a dialog node take this alternate form:&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
int StartingConditional()&lt;br /&gt;
{&lt;br /&gt;
    return 1;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Including files ===&lt;br /&gt;
Other script files can be included by using the #include directive. &lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
#include &amp;quot;rules_h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    DoSomethingOrOther();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
The included file is '''inserted''' into the main file before the script is compiled. Any number of files can be included.&lt;br /&gt;
'''Important:''' this means that whenever you change an &amp;quot;include file&amp;quot; you must export all script that include it before they will use the new version!&lt;br /&gt;
&lt;br /&gt;
No other C-style preprocessor commands are supported.&lt;br /&gt;
&lt;br /&gt;
=== Operators ===&lt;br /&gt;
&lt;br /&gt;
The scripting language supports the following operators:&lt;br /&gt;
&lt;br /&gt;
====Arithmetic Operators====&lt;br /&gt;
{|style=&amp;quot;width:100%;border:solid 1px black;&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:25%;background-color:#ffffcc;&amp;quot; | Operator Name&lt;br /&gt;
! style=&amp;quot;width:75%;background-color:#ffffcc;&amp;quot; | Example&lt;br /&gt;
|-&lt;br /&gt;
| Prefix Increment&lt;br /&gt;
| &amp;lt;dascript&amp;gt;while ( ++a &amp;lt; 10) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Postfix Increment&lt;br /&gt;
| &amp;lt;dascript&amp;gt; for (i = 0; i &amp;lt; 10; i++) { } &amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Assignment by addition&lt;br /&gt;
| &amp;lt;dascript&amp;gt;a += b;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Subtraction (difference)&lt;br /&gt;
| &amp;lt;dascript&amp;gt;x = a - b;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Addition (sum)&lt;br /&gt;
| &amp;lt;dascript&amp;gt;x = a + b;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Prefix decrement&lt;br /&gt;
| &amp;lt;dascript&amp;gt;while (--a &amp;gt; 10) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Postfix decrement&lt;br /&gt;
| &amp;lt;dascript&amp;gt;while (a-- &amp;gt; 10) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Assignment by subtraction&lt;br /&gt;
| &amp;lt;dascript&amp;gt;a -= b;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Multiplication (product)&lt;br /&gt;
| &amp;lt;dascript&amp;gt;x = a * b;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Division (quotient)&lt;br /&gt;
| &amp;lt;dascript&amp;gt;x = a / b;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Modulo (remainder)&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a % b == 1) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Comparison Operators====&lt;br /&gt;
{|style=&amp;quot;width:100%;border:solid 1px black;&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:25%;background-color:#ffffcc;&amp;quot; | Operator Name&lt;br /&gt;
! style=&amp;quot;width:75%;background-color:#ffffcc;&amp;quot; | Example&lt;br /&gt;
|-&lt;br /&gt;
| Less than&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a &amp;lt; b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Less than or equal to&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a &amp;lt;= b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Greater than&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a &amp;gt; b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Greater than or equal to&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a &amp;gt;= b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Not Equal to&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a != b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Equal to&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a == b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Logical Operators====&lt;br /&gt;
{|style=&amp;quot;width:100%;border:solid 1px black;&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:25%;background-color:#ffffcc;&amp;quot; | Operator Name&lt;br /&gt;
! style=&amp;quot;width:75%;background-color:#ffffcc;&amp;quot; | Example&lt;br /&gt;
|-&lt;br /&gt;
| Logical negation (NOT)&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (!a) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Logical AND&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a &amp;amp;&amp;amp; b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Logical OR&lt;br /&gt;
| &amp;lt;dascript&amp;gt;if (a || b) { }&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Other Operators====&lt;br /&gt;
{|style=&amp;quot;width:100%;border:solid 1px black;&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:25%;background-color:#ffffcc;&amp;quot; | Operator Name&lt;br /&gt;
! style=&amp;quot;width:75%;background-color:#ffffcc;&amp;quot; | Example&lt;br /&gt;
|-&lt;br /&gt;
| Basic assignment&lt;br /&gt;
| &amp;lt;dascript&amp;gt;a = b;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Function call&lt;br /&gt;
| &amp;lt;dascript&amp;gt;a();&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Array subscript&lt;br /&gt;
| &amp;lt;dascript&amp;gt;array[0] = 1;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Member (on structures)&lt;br /&gt;
| &amp;lt;dascript&amp;gt;structure.member = 0;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Ternary conditional&lt;br /&gt;
| &amp;lt;dascript&amp;gt;return a &amp;lt; b ? c : d;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
=== Types &amp;amp; Variable  ===&lt;br /&gt;
&lt;br /&gt;
The scripting language natively supports:&lt;br /&gt;
* [[float]] - floating-point numbers. &amp;lt;dascript&amp;gt;float fFloat = 0.1234f;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
* [[int]] - integer numbers. &amp;lt;dascript&amp;gt;int nInteger = 1234;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
* [[object]] -game object files. &amp;lt;dascript&amp;gt;object oObject = GetObjectByTag(&amp;quot;monster_001&amp;quot;);&amp;lt;/dascript&amp;gt;&lt;br /&gt;
* [[resource]] - game resource files. &amp;lt;dascript&amp;gt;resource rGameIntroCutscene = R&amp;quot;game_intro_.cut&amp;quot;;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
* [[string]] - text strings. &amp;lt;dascript&amp;gt;string sString = &amp;quot;Hello World!&amp;quot;;&amp;lt;/dascript&amp;gt;&lt;br /&gt;
* [[vector]] - positions or directions. &amp;lt;dascript&amp;gt;vector vVector = Vector(0.0, 1.1, 2.2);&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server language has been expanded to support these engine defined structures:&lt;br /&gt;
* [[event]] - events are signals that are sent to scripts by other scripts or by the world engine.&lt;br /&gt;
* [[location]]&lt;br /&gt;
* [[command]] - a command for a creature or object to do something. Commands are constructed using functions that return them, and then are added to a target's command queue with the AddCommand function.&lt;br /&gt;
* [[effect]]&lt;br /&gt;
* [[itemproperty]]&lt;br /&gt;
* [[player]]&lt;br /&gt;
&lt;br /&gt;
All of these types are always passed by value, which means a new copy is made whenever they are passed into a function or copied to another variable.&lt;br /&gt;
&lt;br /&gt;
This means that most functions that are supposed to modify a structure in some way need to return the modified one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    effect e1 = Effect(100);&lt;br /&gt;
    effect e2 = SetEffectType(e1, 101); // e1 != e2&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Structures ====&lt;br /&gt;
&lt;br /&gt;
Users can define their own structures using the [[struct]] keyword:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
// user-defined type&lt;br /&gt;
struct quaternion&lt;br /&gt;
{&lt;br /&gt;
    float w, x, y, z;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// constructor&lt;br /&gt;
struct quaternion Quaternion(float fW, float fX, float fY, float fZ)&lt;br /&gt;
{&lt;br /&gt;
    struct quaternion q;&lt;br /&gt;
&lt;br /&gt;
    q.w = fW;&lt;br /&gt;
    q.x = fX;&lt;br /&gt;
    q.y = fY;&lt;br /&gt;
    q.z = fZ;&lt;br /&gt;
&lt;br /&gt;
    return q;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    struct quaternion q = Quaternion(0.0, 0.0, 0.0, 0.0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Arrays ====&lt;br /&gt;
Variables can be declared as arrays for any type except user-defined structs. Designers can create their own arrays of any major data type (int, string, object). Many functions will also return arrays (for example, creatures in an area will be returned as an array, and the action queue will be returned as an array).&lt;br /&gt;
&lt;br /&gt;
These are different from C-style arrays in that they can be resized like STL vectors, and their notation is slightly different.&lt;br /&gt;
&lt;br /&gt;
Arrays also behave differently from other objects in the scripting language because they are passed by reference.  If an array is passed into a function and modified:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    int[] i;                 // new array of integers with a size of zero &lt;br /&gt;
    i[0] = 5;                // value of array position 0 is now 5&lt;br /&gt;
    i[1] = -1;               // value of array position 1 is now -1&lt;br /&gt;
&lt;br /&gt;
    int[] j = i;             // i and j point to the same array&lt;br /&gt;
    j[1] = 12;               // value of array position 1 for both i and j is now 12!&lt;br /&gt;
&lt;br /&gt;
    SortArrayDescending(i);  // i and j are both sorted now, this function has no return value&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[GetArraySize]] returns the size of an array.&lt;br /&gt;
&lt;br /&gt;
==== Local Variables ====&lt;br /&gt;
&lt;br /&gt;
In Neverwinter Nights, variables for various objects could be created and set with functions such as SetLocalInt(). Dragon Age does not have analogous functions. Instead, all of the variables that a given object is able to have values assigned to must be defined ahead of time in a 2DA. This more restrictive approach is intended to improve performance and reduce the opportunity for errors (for example, making a typo in the name of a variable and losing track of it as a result).&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
&lt;br /&gt;
There are two ways to discover a function and what it does.&lt;br /&gt;
&lt;br /&gt;
If you type in the name of a function that's been defined and then an opening bracket, a tooltip will pop up showing the function's parameter types and return type.&lt;br /&gt;
&lt;br /&gt;
Alternately, if you have the help window open (View -&amp;gt; Other Windows -&amp;gt; Help Window), then whenever you select a function in the function browser a help page describing the function will be displayed.&lt;br /&gt;
&lt;br /&gt;
=== Passing parameters to scripts ===&lt;br /&gt;
&lt;br /&gt;
To pass parameters to scripts they must be called with the 'runscript' command. This can be useful for writing debug scripts or changing actions based on input. To accept parameters simply add this line to your script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
string sParams = GetLocalString(GetModule(),&amp;quot;RUNSCRIPT_VAR&amp;quot;);&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then type 'runscript scriptname parameter1 parameter2 ... paramaterN' to pass parameters.&lt;br /&gt;
&lt;br /&gt;
Some examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Debug script: heals the object with the given tag. If tag is invalid, nothing happens&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
    string sTag = GetLocalString(GetModule(),&amp;quot;RUNSCRIPT_VAR&amp;quot;);    &lt;br /&gt;
    object oCreature = GetObjectByTag(sTag);&lt;br /&gt;
    effect   eHeal = EffectHeal(25.0f)&lt;br /&gt;
    //ApplyEffect...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Debug script: applies the visual effect passed in as parameter to the player&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
    string sEffect = GetLocalString(GetModule(),&amp;quot;RUNSCRIPT_VAR&amp;quot;);    &lt;br /&gt;
    int    nEffect = StringToInt(sEffect);&lt;br /&gt;
    effect eVfx = EffectVisualEffect(nEffect);&lt;br /&gt;
    //ApplyEffect...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/dascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Error messages and logging ===&lt;br /&gt;
&lt;br /&gt;
See [[Script error]] for details of how to correct errors in scripts.&lt;br /&gt;
&lt;br /&gt;
To enable script logging, edit or create &amp;lt;DragonAgeInstallDirectory&amp;gt;\bin_ship\[[ECLog.ini]] and set Script=1 in the [LogTypes] section.&lt;br /&gt;
&lt;br /&gt;
The [[PrintToLog]] function prints messages to the log file once logging is enabled.&lt;br /&gt;
&lt;br /&gt;
== Timing ==&lt;br /&gt;
&lt;br /&gt;
Commands, delayed events and object destruction all take place after the current script is finished running. Plot flags set in script are set in-line but the triggered plot script runs before the flag is actually set (this is clarified a bit in the plot script template).&lt;br /&gt;
&lt;br /&gt;
Given that ExecuteScript is deprecated, HandleEvent should be used when you want the script to run in-line and DelayEvent should be used when you want to delay execution.&lt;br /&gt;
&lt;br /&gt;
To delay execution when dealing with creatures, custom AI and (safe) command complete are nice tools. DelayEvent should be used whenever you know how long you want to wait before the event fires. (It can also be used in quite small time increments to give the illusion of smoothly sliding placeables with SetPosition or interpolate between two different atmosphere/lighting settings, but the overhead of this is noticeable if overused).&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Innodil Ath Nathosh</name></author>	</entry>

	</feed>