Difference between revisions of "Event"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(Generated by Sunjammer's Dragon Age Script Paser)
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.  
+
{{Generated}}
 +
{{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=
 +
}}
  
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.
+
== Description ==
 +
<!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. -->
 +
Creates an event of the specified type.
  
Events are handled in the scripting language with the following types of commands:
+
<!-- == Remarks == -->
* Event() Constructor —  Scripters can create events of any type and signal them to other objects
+
<!-- This section contains additional comments, observations and known issues. -->
* 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
+
<!-- == Examples == -->
 +
<!-- This section contains examples transcluded from the snippet library. -->
  
<dascript>
+
<!-- == See also == -->
void main()
+
<!-- This section contains links to articles, functions or constant groups. -->
{
+
    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:
+
[[Category: Event functions]]
 
+
<dascript>
+
    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]] - A creature enters the perception area of creature receiving the event
+
** [[EVENT_TYPE_PERCEPTION_DISAPPEAR]] - A creature exits the perception area of creature receiving the event
+
* '''Effects'''
+
**[[EVENT_TYPE_APPLY_EFFECT]] - an effect is applied to the receiving object
+
**[[EVENT_TYPE_REMOVE_EFFECT]] - an effect is removed from the receiving object
+
* '''Combat'''
+
**[[ EVENT_TYPE_COMBAT_INITIATED ]] - 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.
+
**[[ EVENT_TYPE_COMBAT_END ]] - a creature doesn't perceive any more hostiles.
+
**[[ EVENT_TYPE_MELEE_ATTACK_START ]] - {{undocumented}}
+
**[[ EVENT_TYPE_COMMAND_PENDING ]] - Fires at the beginning of the attack part of the attack command OR at the beginning of an ability execution.
+
**[[ EVENT_TYPE_COMMAND_COMPLETE ]] - creature finishes doing a command(attack, special ability, spell, conversation, etc)
+
**[[ 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').
+
**[[ EVENT_TYPE_ATTACKED ]] - another object tried attacking this creature using melee/ranged weapons (hit or miss), talents or spells.
+
**[[ EVENT_TYPE_ALLY_ATTACKED ]] - an ally has received the ATTACKED event. An ally is an object with the same group ID.
+
* '''Damage and death'''
+
**[[ EVENT_TYPE_DAMAGED ]] - an object loses 1 hit point or more
+
**[[ EVENT_TYPE_DOT_TICK ]] - Damage over time tick event.
+
**[[ EVENT_TYPE_DYING ]] - a creature received the killing blow.
+
**[[ EVENT_TYPE_DEATH ]] - creature or placeable have the death effect applied (regardless of hitpoints)
+
**[[ EVENT_TYPE_RESURRECTION ]] - Creature resurrected.
+
**[[ EVENT_TYPE_TEAM_DESTROYED ]] - Fires when an entire team of creatures is destroyed.
+
* '''Inventory '''
+
**[[ EVENT_TYPE_INVENTORY_ADDED ]] - An item is added to the personal inventory of the object receiving the event or the party inventory.
+
**[[ EVENT_TYPE_INVENTORY_REMOVED ]] - An item is removed from the personal inventory of the object receiving the event or the party inventory.
+
**[[ EVENT_TYPE_EQUIP ]] - The current creature has equipped an item
+
**[[ EVENT_TYPE_UNEQUIP ]] - The current creature has unequipped an item
+
**[[ EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED ]] - items with the ITEM_ACQUIRED_EVENT_ID variable set are picked up.
+
**[[ EVENT_TYPE_INVENTORY_FULL ]] - {{undocumented}}
+
**[[ EVENT_TYPE_OUT_OF_AMMO ]] - {{undocumented}}
+
* '''Movement'''
+
**[[ EVENT_TYPE_BLOCKED ]] - 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.
+
**[[ EVENT_TYPE_ENTER ]] - A creature enters the object receiving the event
+
**[[ EVENT_TYPE_EXIT ]] - A creature exits the object receiving the event
+
**[[ EVENT_TYPE_REACHED_WAYPOINT ]] - {{undocumented}}
+
* '''Traps'''
+
**[[ EVENT_TYPE_APPROACH_TRAP ]] - Trap triggered and the creature receiving this event should approach the trap
+
**[[ EVENT_TYPE_TRAP_ARM ]] Sent by script to request that a trap arm itself.
+
**[[ EVENT_TYPE_TRAP_TRIGGER_ENTER ]] - {{undocumented}}
+
**[[ EVENT_TYPE_TRAP_DISARMED ]] - {{undocumented}}
+
**[[ EVENT_TYPE_TRAP_TRIGGER_ARMED ]] - {{undocumented}}
+
**[[ EVENT_TYPE_TRAP_TRIGGER_EXIT ]] - {{undocumented}}
+
**[[ EVENT_TYPE_TRAP_TRIGGERED ]] - {{undocumented}}
+
* '''Game state events'''
+
**[[ EVENT_TYPE_SPAWN ]] - an object spawns into the game. This event can fire only once per game for each object, regardless of save games.
+
**[[ EVENT_TYPE_MODULE_START ]] - The module starts. This can happen only once for a single game instance.
+
**[[ EVENT_TYPE_MODULE_LOAD ]] - The module loads from a save game. This event can fire more than once for a single module or game instance.
+
**[[ EVENT_TYPE_AREALOAD_SPECIAL ]]- for playing things like cutscenes and movies when you enter an area, things that do not involve AI or actual game play
+
**[[ EVENT_TYPE_AREALOAD_PRELOADEXIT ]] - for things you want to happen while the load screen is still up, things like moving creatures around
+
**[[ EVENT_TYPE_AREALOAD_POSTLOADEXIT ]] - 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 ]] - fires at the same time that the load screen is going away, but only when loading a savegame.
+
**[[ EVENT_TYPE_GAMEMODE_CHANGE ]]
+
**[[ EVENT_TYPE_DELAYED_GM_CHANGE ]]
+
**[[ EVENT_TYPE_SET_GAME_MODE ]]
+
*'''Plots'''
+
**[[ EVENT_TYPE_SET_PLOT ]] - A plot is setting a plot flag
+
**[[ EVENT_TYPE_GET_PLOT ]] - A plot is setting a plot flag
+
*''' Dialogue'''
+
**[[ EVENT_TYPE_DIALOGUE ]] - An object tries to initiate dialog with the object receiving the event, either by clicking or by scripting
+
**[[ EVENT_TYPE_DELAYED_SHOUT ]] - Used to fire a dialog shout every few seconds.
+
**[[ EVENT_TYPE_AMBIENT_CONTINUE ]] - conversation ends or player is nearby to resume ambient behaviour
+
*'''Party management'''
+
**[[ EVENT_TYPE_PARTYMEMBER_ADDED ]] - Party member added to active party using the party GUI
+
**[[ EVENT_TYPE_PARTYMEMBER_DROPPED ]] - Party member removed from active party using the party GUI
+
**[[ EVENT_TYPE_PARTYPICKER_CLOSED ]] - {{undocumented}}
+
**[[ EVENT_TYPE_PARTY_MEMBER_HIRED ]] - 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
+
**[[ EVENT_TYPE_PARTY_MEMBER_FIRED ]] - Fires when an active or locked-active party member is removed from the active party
+
**[[ EVENT_TYPE_PARTY_MEMBER_RES_TIMER ]] - Resurrection timer used if a creature dies in explore mode.
+
**[[ EVENT_TYPE_GIFT_ITEM ]]- {{undocumented}}
+
**[[ EVENT_TYPE_MODULE_HANDLE_FOLLOWER_DEATH ]] - {{undocumented}}
+
**[[ EVENT_TYPE_MODULE_HANDLE_GIFT ]] - {{undocumented}}
+
**[[ EVENT_TYPE_SUMMON_DIED ]] - {{undocumented}}
+
* '''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.
+
**[[ EVENT_TYPE_PLAYER_LEVELUP ]] Fired by sys_rewards_h.RewardXP (the levelup system)
+
**[[ EVENT_TYPE_PLAYERLEVELUP ]]
+
**[[ EVENT_TYPE_CHARGEN_AUTOLEVEL ]]
+
**[[ EVENT_TYPE_MODULE_CHARGEN_DONE ]]
+
**[[ EVENT_TYPE_GUI_OPENED ]] - GUI tutorial calls
+
* '''World map'''
+
**[[ EVENT_TYPE_TRANSITION_TO_WORLD_MAP ]] - Player uses the generic transition system to open the world map
+
**[[ EVENT_TYPE_WORLD_MAP_CLOSED ]]
+
**[[ EVENT_TYPE_WORLD_MAP_USED ]] - the player clicks on a destination in the world map
+
** [[ EVENT_TYPE_BEGIN_TRAVEL ]]
+
** [[ EVENT_TYPE_WORLDMAP_PRETRANSITION ]]
+
**[[ EVENT_TYPE_WORLDMAP_POSTTRANSITION ]]
+
**[[ EVENT_TYPE_FINISH_TRAVEL ]]
+
*''' Found in placeable_core '''
+
**[[ EVENT_TYPE_PLACEABLE_ONCLICK ]] player clicks on object.
+
**[[ EVENT_TYPE_USE ]]
+
**[[ EVENT_TYPE_UNLOCKED ]] Sent by script when placeable is unlocked.
+
**[[ EVENT_TYPE_SET_OBJECT_ACTIVE ]] Sent by script to change active state. Needed since CommandDoFunction was removed and we're using CommandDoEvent
+
**[[ EVENT_TYPE_PLACEABLE_COLLISION ]] player collides with object (if EnableCollisionEvent column in placeables.xls is non-zero).
+
**[[ EVENT_TYPE_POPUP_RESULT ]]
+
* '''Found in rules_core'''
+
**[[ EVENT_TYPE_ITEM_ONHIT ]]
+
**[[ EVENT_TYPE_CONFUSION_CALLBACK ]]
+
**[[ EVENT_TYPE_DESTROY_OBJECT ]]
+
* '''Found in player_core'''
+
**[[ EVENT_TYPE_HEARTBEAT ]]
+
**[[ EVENT_TYPE_LOAD_TACTICS_PRESET ]]
+
*'''Spellcasting'''
+
**[[ EVENT_TYPE_ABILITY_CAST_START ]]
+
**[[ EVENT_TYPE_ABILITY_CAST_IMPACT ]]
+
**[[ EVENT_TYPE_CAST_AT ]]
+
**[[ EVENT_TYPE_COMBO_IGNITE ]]
+
**[[ EVENT_TYPE_SPELLCASTAT ]]
+
**[[ EVENT_TYPE_SPELLSCRIPT_CAST ]]
+
**[[ EVENT_TYPE_SPELLSCRIPT_DEACTIVATE ]]
+
**[[ EVENT_TYPE_SPELLSCRIPT_IMPACT ]]
+
**[[ EVENT_TYPE_SPELLSCRIPT_PENDING ]]
+
* '''Proving events'''
+
**[[ EVENT_TYPE_PROVING_ENTER ]]
+
**[[ EVENT_TYPE_PROVING_EXIT ]]
+
**[[ EVENT_TYPE_PROVING_LOSE ]]
+
**[[ EVENT_TYPE_PROVING_START ]]
+
**[[ EVENT_TYPE_PROVING_WIN ]]
+
* '''Debugging'''
+
** [[ EVENT_TYPE_DEBUG_KICKSTART_AI ]]
+
**[[ EVENT_TYPE_DEATH_RES_PARTY ]]
+
**[[ EVENT_TYPE_DEBUG_RESURRECTION ]]
+
* '''Stats'''
+
**[[ EVENT_TYPE_STAT_REGEN ]]
+
**[[ EVENT_TYPE_MANA_STAM_DEPLETED ]]
+
* '''Miscellaney'''
+
**[[ EVENT_TYPE_CLICK ]]
+
**[[ EVENT_TYPE_CUSTOM_COMMAND_COMPLETE ]]
+
**[[ EVENT_TYPE_FAILTOOPEN ]]
+
**[[ EVENT_TYPE_HANDLE_CUSTOM_AI ]]
+
**[[ EVENT_TYPE_INVALID ]]
+
**[[ EVENT_TYPE_LISTENER ]]
+
**[[ EVENT_TYPE_LOCKED ]]
+
**[[ EVENT_TYPE_QA_EVENT ]]
+
**[[ EVENT_TYPE_QA_EVENT_BLA ]]
+
**[[ EVENT_TYPE_STEALING_FAILURE ]]
+
**[[ EVENT_TYPE_STEALING_SUCCESS ]]
+
**[[ EVENT_TYPE_UNIQUE_POWER ]]
+
 
+
== 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:Data types]]
+

Revision as of 02:40, 29 July 2009

This page was generated by Sunjammer's Dragon Age Script Parser.

The parser extracted and matched all the information required to the best of its ability however the parser relies on the source file, and especially a function's comments, to be correctly formatted. If the source file was not correctly formatted the information presented may be incomplete.

This page should be reviewed by a knowledgeable scripter as it may require updating. If an issue with the source file is identified it should be reported to BioWare.

Please remove the {{Generated}} tag once the page has been confirmed or corrected.

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.