Event keyword

From Dragon Age Toolset Wiki

Jump to: navigation, search
Scripting


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

Constructor

The constructor for an event is the Event function.

Literals

There is no literal for an event.

Conversion

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

Examples

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

Remarks

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:

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
    switch(nEventType)
    {
         case EVENT_TYPE_AREALOAD_SPECIAL:
         {
             ...
             nEventHandled = TRUE; //set this if no further action is required for this event
             break;
         }
    }
    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:

    HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE);

(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

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

Commander-Specific Orders

See Also

IsEventValid, HandleEvent, SignalEvent

Language: English  • Русский
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox