Difference between revisions of "Script"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(moved Script to Scripting overview: Moving this to make room for turning script into a "portal" page)
 
(starting into a portal page for scripting)
Line 1: Line 1:
#REDIRECT [[Scripting overview]]
+
Scripts in Dragon Age are used to control all manner of game activity. Much of the functionality that would normally be handled by the game engine is actually managed by core scripts, allowing deep customizability.
 +
 
 +
See [[Scripting overview]] for an overview of the scripting language's syntax.
 +
 
 +
== [[Event (dascript type)|Event]]s - driving practically everything ==
 +
 
 +
Dragon Age has an event-driven scripting model, with event objects being passed to scripts containing different parameters depending on the event's type. A large portion of script-writing for a standard adventure is going to involve dealing with events. Common examples include:
 +
 
 +
* An event is fired to a plot's script whenever one of its flags is set or cleared
 +
* An event is fired to an area's script when a team of creatures dies in it or when a creature (such as the player) enters
 +
* Events are fired to the module's script during character generation
 +
* Events are fired to creatures when certain things happen to them (such as being hit)
 +
 
 +
[[Custom AI]] for creatures is handled by creating custom AI event handlers.
 +
 
 +
== [[Effect (dascript type)|Effect]]s and [[Ability|Abilities]] - how to make things affect other things ==
 +
 
 +
Effects are a bundle of modifiers that are applied to an object or creature. Every effect has a type set on it that determines how it affects the object it is applied to. They also have a number of parameters on them, which vary based on the type, that change the specific behaviour. When the effect is removed (usually because the duration on the effect expires) the modifier is removed. These modifiers can be rule or stat based or more complicated visual and game effects.
 +
 
 +
They can be assigned different duration types which affect how they're applied and removed:
 +
 
 +
# Temporary: Applied for a short duration (measured in seconds)
 +
# Permanent: Applied until manually removed through scripting
 +
# Instant: These are one-shot modifiers that are not stored on the object (the death effect is an instant modifier for example)
 +
# Equipped: Associated with an equipped item. The effect is removed when the item is unequipped.
 +
 
 +
Effects are commonly applied by abilities, which are possessed by both creatures and player characters.
 +
 
 +
==[[2DA]] files - All-purpose game-wide data repositories ==
 +
 
 +
2-Dimensional Arrays contain much of the raw data used by the game. They are generated from Microsoft Excel files. If you want to add new basic creature types, new treasure types, and so forth, you'll need to create new 2DA files.
 +
 
 +
== [[Treasure system]] ==
 +
 
 +
 
 +
== [[Local variable]]s - data repositories for individual objects ==

Revision as of 22:00, 23 October 2009

Scripts in Dragon Age are used to control all manner of game activity. Much of the functionality that would normally be handled by the game engine is actually managed by core scripts, allowing deep customizability.

See Scripting overview for an overview of the scripting language's syntax.

Events - driving practically everything

Dragon Age has an event-driven scripting model, with event objects being passed to scripts containing different parameters depending on the event's type. A large portion of script-writing for a standard adventure is going to involve dealing with events. Common examples include:

  • An event is fired to a plot's script whenever one of its flags is set or cleared
  • An event is fired to an area's script when a team of creatures dies in it or when a creature (such as the player) enters
  • Events are fired to the module's script during character generation
  • Events are fired to creatures when certain things happen to them (such as being hit)

Custom AI for creatures is handled by creating custom AI event handlers.

Effects and Abilities - how to make things affect other things

Effects are a bundle of modifiers that are applied to an object or creature. Every effect has a type set on it that determines how it affects the object it is applied to. They also have a number of parameters on them, which vary based on the type, that change the specific behaviour. When the effect is removed (usually because the duration on the effect expires) the modifier is removed. These modifiers can be rule or stat based or more complicated visual and game effects.

They can be assigned different duration types which affect how they're applied and removed:

  1. Temporary: Applied for a short duration (measured in seconds)
  2. Permanent: Applied until manually removed through scripting
  3. Instant: These are one-shot modifiers that are not stored on the object (the death effect is an instant modifier for example)
  4. Equipped: Associated with an equipped item. The effect is removed when the item is unequipped.

Effects are commonly applied by abilities, which are possessed by both creatures and player characters.

2DA files - All-purpose game-wide data repositories

2-Dimensional Arrays contain much of the raw data used by the game. They are generated from Microsoft Excel files. If you want to add new basic creature types, new treasure types, and so forth, you'll need to create new 2DA files.

Treasure system

Local variables - data repositories for individual objects