Event keyword

From Dragon Age Toolset Wiki
Jump to: navigation, search

The event type represents a package of information that can be passed around in the game to trigger some behaviour.


The constructor for an event is the Event function.


There is no literal for an event.


There is no explicit or implicit conversion to or from an event.


void main()
    // uninitialised
    event evDefault;
    // initialised using the constructor
    event evConstructed = Event(EVENT_TYPE_USE);
    // initialised using a function
    event evCurrent = GetCurrentEvent();    


Events are usually passed off to an object's event script for handling, but there are a few engine-only event types that are not exposed to the end-users.

Scripting Events have an integer type, target object, a time delay and a package of parameters (arbitrary number of ints, objects, floats and strings). Certain event types will be defined by the engine and referenced as #defines in the scripts.

Events are handled in the scripting language with the following types of commands:

  • Event() Constructor — Scripters can create events of any type and signal them to other objects
  • Signal Event commands — Events can be signalled to a single object, by proximity or to all objects with a certain group id
  • Parameter access — All of the parameters on an event can be get and set through scripting.
  • 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.

A typical event-handling script would have the form

void main()
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev); //extract event type from current event
    int nEventHandled = FALSE; //keep track of whether the event has been handled
             nEventHandled = TRUE; //set this if no further action is required for this event
    if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
        HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);

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:


(constants for referencing core script resources are available in the "global_objects_h" include file)

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 event type categories.


Shouts (events) are used to make creatures communicate with one another. This is a list of all the shouts referenced in the AI documentation.

Creature Shouts

  • 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.
  • SHOUT_TYPE_SAWENEMY Attack enemy.
  • SHOUT_TYPE_KILLEDME Attack enemy.
  • SHOUT_TYPE_SWITCH_MELEE Will switch to melee weapons, useful for certain plot situations
  • SHOUT_TYPE_WAKE_UP Any creature that hears this shout will wake up, if sleeping. This shout needs to be manually called.
  • SHOUT_TYPE_FOUND_SOMEONE (YaronToDo) a scout sees someone they broadcasts this event. Allies go here. (NOT DONE)

Commander-Specific Orders

  • SHOUT_TYPE_FINISHHIM Attacks a specified enemy till they are dead. A Commander issues order generally.
  • SHOUT_TYPE_ATTACK_WIZARD (YaronToDo) Starting targeting wizard class enemies instead of others.
  • SHOUT_TYPE_FLANK Rogues will get into a flanking position to an appropriate enemy
  • 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)

See Also

IsEventValid, HandleEvent, SignalEvent

Language: English  • русский