Difference between revisions of "Event"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(more splitting. Almost done!)
(finished! For now, anyway.)
Line 154: Line 154:
 
**[[ EVENT_TYPE_SPELLSCRIPT_IMPACT ]]
 
**[[ EVENT_TYPE_SPELLSCRIPT_IMPACT ]]
 
**[[ EVENT_TYPE_SPELLSCRIPT_PENDING ]]
 
**[[ EVENT_TYPE_SPELLSCRIPT_PENDING ]]
 
+
* '''Proving events'''
== Proving events ==
+
**[[ EVENT_TYPE_PROVING_ENTER ]]
 
+
**[[ EVENT_TYPE_PROVING_EXIT ]]
[[ EVENT_TYPE_PROVING_ENTER ]]
+
**[[ EVENT_TYPE_PROVING_LOSE ]]
 
+
**[[ EVENT_TYPE_PROVING_START ]]
*<b>Sent When:</b>
+
**[[ EVENT_TYPE_PROVING_WIN ]]
*<b>Sent From:</b>
+
* '''Debugging'''
*<b>Sent To:</b>
+
** [[ EVENT_TYPE_DEBUG_KICKSTART_AI ]]
 
+
**[[ EVENT_TYPE_DEATH_RES_PARTY ]]
Parameters:
+
**[[ EVENT_TYPE_DEBUG_RESURRECTION ]]
[[ EVENT_TYPE_PROVING_EXIT ]]
+
* '''Stats'''
 
+
**[[ EVENT_TYPE_STAT_REGEN ]]
*<b>Sent When:</b>
+
**[[ EVENT_TYPE_MANA_STAM_DEPLETED ]]
*<b>Sent From:</b>
+
* '''Miscellaney'''
*<b>Sent To:</b>
+
**[[ EVENT_TYPE_CLICK ]]
 
+
**[[ EVENT_TYPE_CUSTOM_COMMAND_COMPLETE ]]
Parameters:
+
**[[ EVENT_TYPE_FAILTOOPEN ]]
[[ EVENT_TYPE_PROVING_LOSE ]]
+
**[[ EVENT_TYPE_HANDLE_CUSTOM_AI ]]
 
+
**[[ EVENT_TYPE_INVALID ]]
*<b>Sent When:</b>
+
**[[ EVENT_TYPE_LISTENER ]]
*<b>Sent From:</b>
+
**[[ EVENT_TYPE_LOCKED ]]
*<b>Sent To:</b>
+
**[[ EVENT_TYPE_QA_EVENT ]]
 
+
**[[ EVENT_TYPE_QA_EVENT_BLA ]]
Parameters:
+
**[[ EVENT_TYPE_STEALING_FAILURE ]]
[[ EVENT_TYPE_PROVING_START ]]
+
**[[ EVENT_TYPE_STEALING_SUCCESS ]]
 
+
**[[ EVENT_TYPE_UNIQUE_POWER ]]
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
[[ EVENT_TYPE_PROVING_WIN ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
 
+
 
+
== Debugging ==
+
 
+
[[ EVENT_TYPE_DEBUG_KICKSTART_AI ]]
+
 
+
*<b>Sent When:</b> Kickstart the AI if it was frozen out. Debug Event, do not use in production scripts
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_DEATH_RES_PARTY ]]
+
 
+
Party Resurrection button (cheat, death UI)
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
 
+
[[ EVENT_TYPE_DEBUG_RESURRECTION ]]
+
 
+
This makes the resurrection button work.
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
 
+
== Stats ==
+
 
+
[[ EVENT_TYPE_STAT_REGEN ]]
+
 
+
*<b>Sent When:</b> Stat regeneration. might be changed in the future.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_MANA_STAM_DEPLETED ]]
+
 
+
*<b>Sent When:</b> Creature ran out of mana or stamina
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
== Miscellaney ==
+
 
+
[[ EVENT_TYPE_CLICK ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_CUSTOM_COMMAND_COMPLETE ]]
+
 
+
Also EVENT_TYPE_CUSTOM_EVENT_01 to EVENT_TYPE_CUSTOM_EVENT_08
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_FAILTOOPEN ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_HANDLE_CUSTOM_AI ]]
+
 
+
Handle any custom AI before handling the built-in AI.
+
 
+
This event is sent to creature scripts after custom AI has been enabled (call CAI_SetCustomAI(OBJECT_SELF, CAI_INITIATE) in the EVENT_TYPE_SPAWN event).
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_INVALID ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_LISTENER ]]
+
 
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
[[ EVENT_TYPE_LOCKED ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_QA_EVENT ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
[[ EVENT_TYPE_QA_EVENT_BLA ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_STEALING_FAILURE ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
[[ EVENT_TYPE_STEALING_SUCCESS ]]
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
[[ EVENT_TYPE_UNIQUE_POWER ]]
+
 
+
*<b>Sent When: a unique power for an item is used</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
*Ability = Integer 0
+
*Item    = Object 0
+
*Caster  = Object 1
+
*Target  = Object 2
+
 
+
  
 
== Shouts ==
 
== Shouts ==

Revision as of 22:28, 20 July 2009

Events are a package of information that can be passed around in the game to trigger some behaviour. They 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
    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:

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

  • 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)