Difference between revisions of "Event"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(moving stuff about the event type in general into this page. Eventually I'll split out the event list into a bunch of separate pages and leave just that.)
m (Updating links)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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.
+
:''This article is about the event constructor function. For information about how events work in general, see [[Event keyword]]''
  
Scripting Events have an integer type, target object, a time delay and a package of parameters (arbitrary number of [[int]]s, [[object]]s, [[float]]s and [[string]]s).  Certain event types will be defined by the engine and referenced as #defines in the scripts.
+
{{dafunction
 +
|name=Event
 +
|brief=Creates an event of the specified type.
 +
|param1type=int
 +
|param1name=nEventType
 +
|param1desc=The type of event to create
 +
|returntype=event
 +
|returndesc=Returns an event of the specified type, returns an invalid event on error.
 +
|sourcefile=script.ldf
 +
|sourcemodule=
 +
}}
  
Events are handled in the scripting language with the following types of commands:
+
== Description ==
* Event() Constructor —  Scripters can create events of any type and signal them to other objects
+
<!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. -->
* Signal Event commands —  Events can be signalled to a single object, by proximity or to all objects with a certain group id
+
Creates an event of the specified type.
* 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
+
<!-- == Remarks == -->
 +
<!-- This section contains additional comments, observations and known issues. -->
  
<dascript>
+
<!-- == Examples == -->
void main()
+
<!-- This section contains examples transcluded from the snippet library. -->
{
+
    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);
+
    }
+
}
+
</dascript>
+
  
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:
+
== See also ==
 +
<!-- This section contains links to articles, functions or constant groups. -->
 +
[[Event keyword]]
  
<dascript>
+
[[Category: Event functions]]
    HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE);
+
</dascript>
+
 
+
(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:
+
 
+
== Perception ==
+
 
+
=== EVENT_TYPE_PERCEPTION_APPEAR ===
+
*<b>Sent When:</b> A creature enters the perception area of creature receiving the event
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures
+
 
+
Parameters:
+
 
+
* object oAppear = GetEventObject(ev,0);
+
* int nHostile = GetEventInteger(ev, 0); // if hostile or not (TRUE/FALSE)
+
* int bStealthed = GetEventInteger(ev, 1); // if stealthed or not (TRUE/FALSE)
+
* int nHostilityChanged = GetEventInteger(ev, 2); // if the creature was already perceived but just changed hostility (TRUE/FALSE)
+
 
+
 
+
=== EVENT_TYPE_PERCEPTION_DISAPPEAR ===
+
*<b>Sent When:</b> A creature exits the perception area of creature receiving the event
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures
+
 
+
Parameters:
+
*<b>Creator:</b> The creature whose perception system detected a disappearing creature.
+
*<b>Target:</b> Disappearing creature
+
*<b>Bool 0:</b> Owner is hostile towards disappearing creature
+
 
+
 
+
== Effects ==
+
 
+
=== EVENT_TYPE_APPLY_EFFECT ===
+
 
+
*<b>Sent When:</b> an effect is applied to the receiving object
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures, placeables
+
 
+
Parameters:
+
*<b>Creator:</b> ???
+
*<b>Current Effect</b>: effect being applied
+
 
+
=== EVENT_TYPE_REMOVE_EFFECT ===
+
*<b>Sent When:</b> an effect is removed from the receiving object
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures, placeables
+
 
+
Parameters:
+
*<b>Creator:</b> ???
+
*<b>Current Effect</b>: effect being removed
+
 
+
 
+
 
+
 
+
== Combat ==
+
 
+
=== EVENT_TYPE_COMBAT_INITIATED ===
+
 
+
*<b>Sent When:</b> 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.
+
*<b>Sent From:</b> Engine
+
*<b>Sent To:</b> creatures, players.
+
 
+
Parameters:
+
*<b>Creator:</b> attacking creature
+
*<b>Object 0:</b> target creature
+
 
+
=== EVENT_TYPE_COMBAT_END ===
+
 
+
*<b>Sent When:</b> a creature doesn't perceive any more hostiles.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_MELEE_ATTACK_START ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_COMMAND_PENDING ===
+
 
+
*<b>Sent When:</b> Fires at the beginning of the attack part of the attack command OR at the beginning of an ability execution. The attack command includes walk->orient->attack - this event fires right before the attack part. When this event is received, the script is supposed to check if we need to disable a modal talent, verify mana/stamina values, verify valid target, calculate an attack roll (hit/miss/critical) and then calculate damage and inform the engine of the results.
+
*<b>Sent From:</b> Engine
+
*<b>Sent To:</b> creatures, players
+
 
+
Parameters:
+
*<b>Creator:</b> attacking creature
+
*<b>Object 0:</b> creature triggering the command
+
*<b>Object 1:</b> target creature, if applicable
+
*<b>Int 0:</b> command ID of the pending command
+
*<b>Int 1:</b> command sub-type, if applicable - used mostly for ability ID for CommandUseAbility.
+
*<b>Int 2:</b> ResistenceCheckResult (set in ability_core.nss)
+
 
+
=== EVENT_TYPE_COMMAND_COMPLETE ===
+
*<b>Sent When:</b> creature finishes doing a command(attack, special ability, spell, conversation, etc)
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures, player
+
 
+
Parameters:
+
*<b>Creator:</b> creature acting
+
*<b>Int 0</b> Type of the last command (e.g. COMMAND_TYPE_ATTACKED)
+
*<b>Int 1</b> The status of the execution (COMMAND_SUCCESSFUL, etc)
+
*<b>Int 2</b> last sub command
+
*<b>obj(0)</b> The target that command was applied to
+
 
+
=== 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').
+
*<b>Sent When:</b> Exact moment of impact
+
*<b>Sent From:</b> Engine
+
*<b>Sent To:</b> attacking creature or player.
+
 
+
Parameters:
+
*<b>Creator:</b> attacker
+
*<b>Object 0:</b> attacker
+
*<b>Object 1:</b> target
+
*<b>Int 0:</b> hit result (hit, miss, critical etc')
+
*<b>Int 1:</b> damage
+
 
+
=== EVENT_TYPE_ATTACKED ===
+
 
+
*<b>Sent When:</b> another object tried attacking this creature using melee/ranged weapons (hit or miss), talents or spells.
+
*<b>Sent From:</b> scripts (Rules_ResolveAttack function)
+
*<b>Sent To:</b> creatures, placeables
+
 
+
Parameters:
+
*<b>Creator:</b> attacking object
+
*<b>Object 0:</b> attacking object
+
 
+
=== EVENT_TYPE_ALLY_ATTACKED ===
+
 
+
*<b>Sent When:</b> an ally has received the ATTACKED event. An ally is an object with the same group ID.
+
*<b>Sent From:</b> scripts (rules_core - attack event handler)
+
*<b>Sent To:</b> Allied creatures, placeables (of the same group as the sender)
+
 
+
Parameters:
+
*<b>Creator:</b> ally object (object being attacked)
+
*<b>Object 0:</b> attacking object
+
 
+
 
+
== Damage and death ==
+
 
+
=== EVENT_TYPE_DAMAGED ===
+
 
+
*<b>Sent When:</b> an object loses 1 hit point or more
+
*<b>Sent From:</b> scripts
+
*<b>Sent To:</b> creatures, placeables
+
 
+
Parameters:
+
*<b>Creator:</b> creature dealing the damage
+
*<b>Int 0:</b> amount of damage dealt
+
*<b>Int 1:</b> type of damage dealt
+
 
+
=== EVENT_TYPE_DOT_TICK ===
+
 
+
Damage over time tick event.
+
This is activated from EffectDOT and keeps rescheduling itself while DOTs are in effect on the creature
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> creatures
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_DYING ===
+
 
+
*<b>Sent When:</b> a creature received the killing blow.
+
*<b>Sent From:</b> effect_death_h
+
*<b>Sent To:</b> the creature getting the killing blow.
+
 
+
creature_core handles XP and treasure awards.
+
 
+
Parameters:
+
* Object 0: Killer
+
 
+
 
+
=== EVENT_TYPE_DEATH ===
+
*<b>Sent When:</b> creature or placeable have the death effect applied (regardless of hitpoints)
+
*<b>Sent From:</b> scripts
+
*<b>Sent To:</b> creatures, placeables
+
 
+
Handles shutdown of creature's AI, perception, etc. and replaces it with a bodybag.
+
 
+
Parameters:
+
*<b>Creator:</b> killing object
+
 
+
=== EVENT_TYPE_RESURRECTION ===
+
 
+
*<b>Sent When:</b> Creature resurrected.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_TEAM_DESTROYED ===
+
 
+
*<b>Sent When:</b> Fires when an entire team of creatures is destroyed.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> Area the team is in
+
 
+
The event is fired to the last living creature on the team.
+
 
+
Parameters:
+
 
+
*integer 0 is the team number that was destroyed.
+
 
+
 
+
== Inventory ==
+
 
+
=== EVENT_TYPE_INVENTORY_ADDED ===
+
 
+
*<b>Sent When:</b> An item is added to the personal inventory of the object receiving the event or the party inventory.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures, placeables, player/party
+
 
+
Parameters:
+
*<b>Creator:</b> old owner of the item, OBJECT_INVALID if item is created on object
+
*<b>Object 0:</b> item being added
+
 
+
=== EVENT_TYPE_INVENTORY_REMOVED ===
+
 
+
*<b>Sent When:</b> An item is removed from the personal inventory of the object receiving the event or the party inventory.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures, placeables, player/party
+
 
+
Parameters:
+
*<b>Creator:</b> new owner of the item, OBJECT_INVALID if item is being destroyed on object
+
*<b>Object 0:</b> item being added
+
 
+
=== EVENT_TYPE_EQUIP ===
+
 
+
*<b>Sent When:</b> The current creature has equipped an item
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures
+
 
+
Parameters:
+
*<b>Creator:</b> The object equipping an item
+
*<b>Object0:</b> The item being equipped
+
 
+
=== EVENT_TYPE_UNEQUIP ===
+
 
+
*<b>Sent When:</b> The current creature has unequipped an item
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures
+
 
+
Parameters:
+
*<b>Creator:</b> item being unequipped
+
 
+
=== EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED ===
+
 
+
*<b>Sent When:</b> items with the ITEM_ACQUIRED_EVENT_ID variable set are picked up.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
*Creator: item acquirer
+
*Object 0: the item that's been acquired
+
 
+
=== EVENT_TYPE_INVENTORY_FULL ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_OUT_OF_AMMO ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
== Movement ==
+
 
+
=== EVENT_TYPE_BLOCKED ===
+
*<b>Sent When:</b> 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.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures
+
 
+
Parameters:
+
*<b>Creator:</b> blocking object. Also, this doesn't exist yet, but we'll need this event to fire for any time that the pathfinding failed.
+
 
+
=== EVENT_TYPE_ENTER ===
+
*<b>Sent When:</b> A creature enters the object receiving the event
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> AOEs, areas, triggers
+
 
+
Parameters:
+
*<b>Creator:</b> creature entering the object
+
 
+
=== EVENT_TYPE_EXIT ===
+
*<b>Sent When:</b> A creature exits the object receiving the event
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> AOEs, areas, triggers
+
Parameters:
+
*<b>Creator:</b> creature exiting the object
+
 
+
=== EVENT_TYPE_REACHED_WAYPOINT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
== Traps ==
+
 
+
=== EVENT_TYPE_APPROACH_TRAP ===
+
 
+
*<b>Sent When:</b> Trap triggered and the creature receiving this event should approach the trap
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> creature
+
 
+
Parameters:
+
*Object 0: trap
+
 
+
=== EVENT_TYPE_TRAP_ARM ===
+
 
+
*<b>Sent When:</b> Sent by script to request that a trap arm itself.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_TRAP_TRIGGER_ENTER ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b> area of effect 'trigger'
+
*<b>Sent To:</b> trap's signal target(s).
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_TRAP_DISARMED ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_TRAP_TRIGGER_ARMED ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_TRAP_TRIGGER_EXIT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
=== EVENT_TYPE_TRAP_TRIGGERED ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
 
+
== Game state events ==
+
 
+
=== EVENT_TYPE_SPAWN ===
+
*<b>Sent When:</b> an object spawns into the game. This event can fire only once per game for each object, regardless of save games.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creatures, placeables, triggers, AOEs,
+
 
+
Parameters:
+
*<b>Creator:</b> ??? -> should probably be parent of object spawning (area. module etc')
+
 
+
=== EVENT_TYPE_MODULE_START ===
+
*<b>Sent When:</b> The module starts. This can happen only once for a single game instance.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> module
+
Parameters:
+
*<b>Creator:</b> ???
+
 
+
=== EVENT_TYPE_MODULE_LOAD ===
+
*<b>Sent When:</b> The module loads from a save game. This event can fire more than once for a single module or game instance.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
*<b>Creator:</b> ???
+
 
+
=== EVENT_TYPE_AREALOAD_SPECIAL ===
+
 
+
*<b>Sent When:</b> it is for playing things like cutscenes and movies when you enter an area, things that do not involve AI or actual game play
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_AREALOAD_PRELOADEXIT ===
+
 
+
*<b>Sent When:</b> for things you want to happen while the load screen is still up, things like moving creatures around
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_AREALOAD_POSTLOADEXIT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
Sent by: The engine
+
When: 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.
+
 
+
=== EVENT_TYPE_AREALOADSAVE_POSTLOADEXIT ===
+
 
+
*<b>Sent When:</b> fires at the same time that the load screen is going away, but only when loading a savegame.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_GAMEMODE_CHANGE ===
+
 
+
*<b>Sent When:</b> Game Mode Switch
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
*int(0) - New Game Mode (GM_* constant)
+
*int(1) - Old Game Mode (GM_* constant)
+
 
+
=== EVENT_TYPE_DELAYED_GM_CHANGE ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_SET_GAME_MODE ===
+
 
+
*<b>Sent When:</b> the game mode is set
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
*the game mode being set is carried as an integer on the event.
+
 
+
 
+
== Plots ==
+
 
+
=== EVENT_TYPE_SET_PLOT ===
+
*<b>Sent When:</b> A plot is setting a plot flag
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> plot script
+
 
+
Parameters:
+
*<b>Creator:</b> owner of the plot table, should be a player
+
*<b>String 0:</b> plot GUID, defined as string constant
+
*<b>Int 1:</b> bit flag number being affected
+
*<b>Int 2:</b> the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')
+
*<b>Int 3:</b> On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)
+
*<b>Int 4:</b> 1 if the current flag (Int 1) is defined, 0 for normal flag.
+
 
+
IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!
+
 
+
=== EVENT_TYPE_GET_PLOT ===
+
*<b>Sent When:</b> A plot is setting a plot flag
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> plot script
+
 
+
Parameters:
+
*<b>Creator:</b> owner of the plot table, should be a player
+
*<b>String 0:</b> plot GUID, defined as string constants
+
*<b>Int 1:</b> bit flag number being affected
+
*<b>Int 4:</b> 1 if the current flag (Int 1) is defined, 0 for normal flag.
+
 
+
 
+
 
+
== Dialogue ==
+
 
+
 
+
=== EVENT_TYPE_DIALOGUE ===
+
*<b>Sent When:</b> An object tries to initiate dialog with the object receiving the event, either by clicking or by scripting
+
*<b>Sent From:</b> engine (clicking on object to talk) or scripts (manually sending this event)
+
*<b>Sent To:</b> creatures, placeables
+
 
+
Parameters:
+
*<b>Creator:</b> Initiating object
+
*<b>String 0:</b> Dialog to initiate, "" to use default object dialog
+
 
+
=== EVENT_TYPE_DELAYED_SHOUT ===
+
 
+
*<b>Sent When:</b> Used to fire a dialog shout every few seconds.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_AMBIENT_CONTINUE ===
+
 
+
*<b>Sent When:</b> conversation ends or player is nearby to resume ambient behaviour
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> creature
+
 
+
If the event was fired because the party is near a creature, the 'instigator' is the nearest party member. If the event was fired at the end of a conversation, the 'instigator' is the creature conversing.
+
 
+
Parameters:
+
*Object 0: Instigator
+
 
+
== Party management ==
+
 
+
=== EVENT_TYPE_PARTYMEMBER_ADDED ===
+
 
+
*<b>Sent When:</b> Party member added to active party using the party GUI
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_PARTYMEMBER_DROPPED ===
+
 
+
*<b>Sent When:</b> Party member removed from active party using the party GUI
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_PARTYPICKER_CLOSED ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_PARTY_MEMBER_HIRED ===
+
 
+
*<b>Sent When:</b> 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
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_PARTY_MEMBER_FIRED ===
+
 
+
*<b>Sent When:</b> Fires when an active or locked-active party member is removed from the active party
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
=== EVENT_TYPE_PARTY_MEMBER_RES_TIMER ===
+
 
+
Resurrection timer used if a creature dies in explore mode.
+
 
+
party members are rezzed on this event if it happens outside of combat.
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_GIFT_ITEM ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_MODULE_HANDLE_FOLLOWER_DEATH ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_MODULE_HANDLE_GIFT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
* Follower: Object 0
+
* GiftTag: String 0
+
 
+
=== EVENT_TYPE_SUMMON_DIED ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
 
+
== Character generation and level advancement ==
+
 
+
=== EVENT_TYPE_CHARGEN_START and EVENT_TYPE_CHARGEN_END ===
+
 
+
A range of event constants (nEvent >= EVENT_TYPE_CHARGEN_START && nEvent <= EVENT_TYPE_CHARGEN_END) that occur during character generation.
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_PLAYER_LEVELUP ===
+
 
+
*<b>Sent When:</b> Creature is spawned.
+
*<b>Sent From:</b> Fired by sys_rewards_h.RewardXP (the levelup system)
+
*<b>Sent To:</b> player_core
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_PLAYERLEVELUP ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_CHARGEN_AUTOLEVEL ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_MODULE_CHARGEN_DONE ===
+
 
+
Fired the the core chargen script into the module
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_GUI_OPENED ===
+
 
+
GUI tutorial calls
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
== World map ==
+
 
+
=== EVENT_TYPE_TRANSITION_TO_WORLD_MAP ===
+
 
+
*<b>Sent When:</b> Player uses the generic transition system to open the world map
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
*  string sWorldMap = GetEventString(ev, 0);
+
*  string sTransType = GetEventString(ev, 1);
+
*  string sWorldMapLoc1 = GetEventString(ev, 2);
+
*  string sWorldMapLoc2 = GetEventString(ev, 3);
+
*  string sWorldMapLoc3 = GetEventString(ev, 4);
+
*  string sWorldMapLoc4 = GetEventString(ev, 5);
+
*  string sWorldMapLoc5 = GetEventString(ev, 6);
+
 
+
 
+
=== EVENT_TYPE_WORLD_MAP_CLOSED ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
*Integer 0: close type, 0 for cancel, 1 for travel.
+
 
+
=== EVENT_TYPE_WORLD_MAP_USED ===
+
 
+
!!Note: This event may be obsolete, I think EVENT_TYPE_BEGIN_TRAVEL is the one that actually fires now.!!
+
 
+
*<b>Sent When:</b> the player clicks on a destination in the world map
+
*<b>Sent From:</b> engine
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
*int nFrom = GetEventInteger(ev, 0); // travel start location
+
*int nTo = GetEventInteger(ev, 1); // travel target location
+
 
+
=== EVENT_TYPE_BEGIN_TRAVEL ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
*            string sSource = GetEventString(ev, 0); // area tag source location
+
*            string sTarget = GetEventString(ev, 1); // area tag target location
+
*            string sWPOverride = GetEventString(ev, 2); // waypoint tag override
+
*            int nSourceTerrain = GetEventInteger(ev, 0);
+
*            int nTargetTerrain = GetEventInteger(ev, 1);
+
*            int nWorldMap = GetEventInteger(ev, 2);
+
*            object oSourceLocation = GetEventObject(ev, 0); // source location object
+
 
+
=== EVENT_TYPE_WORLDMAP_PRETRANSITION ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_WORLDMAP_POSTTRANSITION ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_FINISH_TRAVEL ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To: module</b>
+
 
+
Parameters:
+
 
+
 
+
== Found in placeable_core ==
+
 
+
=== EVENT_TYPE_PLACEABLE_ONCLICK ===
+
 
+
*<b>Sent When:</b> player clicks on object.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> placeable
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_USE ===
+
 
+
*<b>Sent When:</b> creature clicks on the placeable.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> placeable
+
 
+
Parameters:
+
 
+
 
+
=== EVENT_TYPE_UNLOCKED ===
+
 
+
*<b>Sent When:</b> Sent by script when placeable is unlocked.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> placeable
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_SET_OBJECT_ACTIVE ===
+
 
+
*<b>Sent When:</b> Sent by script to change active state. Needed since CommandDoFunction was removed and we're using CommandDoEvent
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
 
+
=== EVENT_TYPE_PLACEABLE_COLLISION ===
+
 
+
*<b>Sent When:</b> player collides with object (if EnableCollisionEvent column in placeables.xls is non-zero).
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_POPUP_RESULT ===
+
 
+
*<b>Sent When:</b> player responds to area transition prompt.
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
*object oOwner = GetEventObject(ev, 0);      // owner of popup
+
*int nPopupID  = GetEventInteger(ev, 0);    // popup ID
+
*int nButton  = GetEventInteger(ev, 1);    // button result (1 - 4)
+
*string sInput = GetEventString(ev,0);      // string entered into optional text field
+
 
+
Calling the "[[ShowPopup]]" script function causes a popup window to be displayed to the user, with up to four buttons whose text is defined in the "popups" 2DA and up to one text input field (with a filter on the input the player can type there that's the same as the filter on player names - up to 20 characters, no spaces, limited punctuation, no empty strings). This event is generated and sent to the module script with the popup's result.
+
 
+
== Found in rules_core ==
+
 
+
=== EVENT_TYPE_ITEM_ONHIT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_CONFUSION_CALLBACK ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
 
+
 
+
=== EVENT_TYPE_DESTROY_OBJECT ===
+
 
+
*<b>Sent When:</b> Object should be destroyed
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
== Found in player_core ==
+
 
+
=== EVENT_TYPE_HEARTBEAT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
=== EVENT_TYPE_LOAD_TACTICS_PRESET ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
== Spellcasting ==
+
 
+
=== EVENT_TYPE_ABILITY_CAST_START ===
+
 
+
- Update mana/stamina
+
- Calculate *combat* attack/miss (only for hit based talents like Deadly Strike)
+
- Calculate resistance check/failure for non-AOE abilities (if valid)
+
- Calculate *combat* damage (only for hit based talents like Deadly Strike)
+
Most of the above information is then passed on to the engine who need to decide what animations to play (or not to play). The engine then returns most of this information along with the CAST_IMPACT event back to this script (see below)
+
 
+
*<b>Sent When: whenever any ability (spell, talent) is used</b>
+
*<b>Sent From: engine</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
*Object 1 - the item used to cast the ability (optional)
+
*Object 2 - the object that the ability was targeted
+
 
+
note: in case of a projectile impact, there might be more than one target (object 2+...) this allows doing things like lightning bolts going through targets, but this is not currently made use of in Dragon Age.
+
 
+
=== EVENT_TYPE_ABILITY_CAST_IMPACT ===
+
 
+
*<b>Sent When:</b> Fires for the moment of impact for every ability. This is where damage should be applied, fireballs explode, enemies get poisoned etc. We assume that stamina/mana have been deducted when the ability was triggered (COMMAND_PENDING stage)
+
*<b>Sent From: engine</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
*Object 1 - the item used to cast the ability (optional)
+
*Object 2 - the object that the ability was targeted
+
 
+
note: in case of a projectile impact, there might be more than one target (object 2+...) this allows doing things like lightning bolts going through targets, but this is not currently made use of in Dragon Age.
+
 
+
=== EVENT_TYPE_CAST_AT ===
+
 
+
*<b>Sent When:</b> placeable is hit by a spell.
+
*<b>Sent From:</b> engine
+
*<b>Sent To:</b> placeable
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_COMBO_IGNITE ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b> module
+
 
+
Parameters:
+
 
+
 
+
 
+
=== EVENT_TYPE_SPELLCASTAT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
=== EVENT_TYPE_SPELLSCRIPT_CAST ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
=== EVENT_TYPE_SPELLSCRIPT_DEACTIVATE ===
+
 
+
*<b>Sent When:</b> Talent deactivated
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
=== EVENT_TYPE_SPELLSCRIPT_IMPACT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
=== EVENT_TYPE_SPELLSCRIPT_PENDING ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
 
+
 
+
 
+
== Proving events ==
+
 
+
=== EVENT_TYPE_PROVING_ENTER ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
=== EVENT_TYPE_PROVING_EXIT ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
=== EVENT_TYPE_PROVING_LOSE ===
+
 
+
*<b>Sent When:</b>
+
*<b>Sent From:</b>
+
*<b>Sent To:</b>
+
 
+
Parameters:
+
=== EVENT_TYPE_PROVING_START ===
+
 
+
*<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 (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)
+
 
+
 
+
[[Category:Scripts]]
+

Latest revision as of 00:05, 3 August 2011

This article is about the event constructor function. For information about how events work in general, see Event keyword

Creates an event of the specified type.

event Event(
int nEventType
);
Parameters:
nEventType
The type of event to create
Returns:

Returns an event of the specified type, returns an invalid event on error.

Source:

script.ldf

Description

Creates an event of the specified type.


See also

Event keyword