List of builtin events
Posted: Tue Oct 07, 2008 7:11 pm
Hi all,
Would like to get a list of all available events. Maybe there's one around, but I couldn't get a hand on it...
To begin with, here are the events I know for sure for having used them, completed with the ensuing answers in this thread :
<OnAIUpdate>
- gSource = object that carries the item
- gItem = the item
The OnAIUpdate event for an item is called once every 30 ticks on every non-player ship that carries the item. Use this event to implement special behaviors. For example, an <OnAIUpdate> event on an armor patch item allows a non-player ship to use the armor patch when it is damaged.
Use this event sparingly because it will impact performance.
<OnAttacked>
<OnAttackedByPlayer>
<OnContractGenerate>
<OnContractQuery>
<OnCreate>
For systems, stations, ships, at object creation.
<OnDamage>
gSource = station object
aAttacker = object that attacked
aHitPos = vector position of hit
aHitDir = angle direction from which hit came
aDamageHP = hit points of damage
aDamageType = type of damage
This event is called when a station is hit by a weapon. The event must return the number of hit points of damage to do to the station. For example, imagine a station that takes half damage from the player (but full damage from all others). The event could check aAttacker and return half of aDamageHP if it is the player and full aDamageHP otherwise.
The event should avoid affecting other objects and should not destroy the station (e.g., by calling objDestroy). If necessary, the event could return a very large number to insure that the station is destroyed.
<OnDestroy>
gSource = ship object
- aDestroyer = object that caused destruction
- aWreckObj = ship wreck left behind
The <OnDestroy> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.
<OnEnteredGate>
gSource = station object
aGateObj = gate object
Version 0.99 uses aGateObj instead of aGate (as in previous versions) to be consistent with <OnObjEnteredGate>.
<OnGameEnd>
Found inside <AdventureDesc>
<OnGameStart>
Found inside <AdventureDesc>
<OnGlobalSystemCreated>
(no parameters)
For systems, all instances executed whenever a system is created.
This event is called after a system is created (right after <OnCreate> for the system). You may use this event to create new objects in the system or to otherwise alter the system. Remember that there is no guarantee that other systems have been created at this point.
Look at Huari.xml for an example of how this event is used.
Warning : multiple instances of this event can be created on multiple system types. They will ALL be called when ANY system is created, and their order can NOT be forecast.
<OnGlobalTopologyCreated>
(no parameters)
For topology, once when the topology is created.
This event is called at the beginning of the game right after the complete system topology has been generated. You may use this event to explore the topology and add data to topology nodes that may later be used inside systems. Remember that no systems have been created yet. You can only call functions that work on topology nodes.
For an example of how this event is used, look at Huari.xml.
<OnInvokedByPlayer>
<OnInit>
For dockscreens, when the dockscreen is shown.
<OnMining>
For asteroids.
<OnObjDestroyed>
- aWreckObj : the wreck left behind the destroyed object.
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
Is triggerred when an object A has registered for object B events and object B is destroyed. <OnDestroy> is fired on object B, and <OnObjDestroyed> is fired on object A.
0.99c : the <OnObjDestroyed> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.
See example on earth slaver.
<OnObjDocked>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
This was primarily used before <OnOrdersCompleted>.
<OnObjEnteredGate>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
<OnObjJumped>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
<OnObjReconned>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
<OnOrderChanged>
<OnOrdersCompleted>
For ships, when all queued orders are completed.
<OnRefuel>
<OnShieldDown>
<OnShow>
When a communication menu messages is shown.
<OnUpdate>
- gSource = object that carries the item
- gItem = the item
The OnUpdate event for an item is called once every 30 ticks on every object that carries the item. Use this event sparingly because it will impact performance.
EDIT #1 : a little more, I added dvlenk6, F50 and bobby contributions. Thanks again !
EDIT #2 : What I'm trying to list are the builtin events, those which exist in the engine itself and that you can override or not in XML code. Extra events that are created from the XML itself don't interest me.
EDIT #3 : thanks Betelgeuse !
EDIT #4 : thanks digdug !
EDIT #5 : more insight on some events, thanks to digdug and to the modding page of the main Transcendence site.
Would like to get a list of all available events. Maybe there's one around, but I couldn't get a hand on it...
To begin with, here are the events I know for sure for having used them, completed with the ensuing answers in this thread :
<OnAIUpdate>
- gSource = object that carries the item
- gItem = the item
The OnAIUpdate event for an item is called once every 30 ticks on every non-player ship that carries the item. Use this event to implement special behaviors. For example, an <OnAIUpdate> event on an armor patch item allows a non-player ship to use the armor patch when it is damaged.
Use this event sparingly because it will impact performance.
<OnAttacked>
<OnAttackedByPlayer>
<OnContractGenerate>
<OnContractQuery>
<OnCreate>
For systems, stations, ships, at object creation.
<OnDamage>
gSource = station object
aAttacker = object that attacked
aHitPos = vector position of hit
aHitDir = angle direction from which hit came
aDamageHP = hit points of damage
aDamageType = type of damage
This event is called when a station is hit by a weapon. The event must return the number of hit points of damage to do to the station. For example, imagine a station that takes half damage from the player (but full damage from all others). The event could check aAttacker and return half of aDamageHP if it is the player and full aDamageHP otherwise.
The event should avoid affecting other objects and should not destroy the station (e.g., by calling objDestroy). If necessary, the event could return a very large number to insure that the station is destroyed.
<OnDestroy>
gSource = ship object
- aDestroyer = object that caused destruction
- aWreckObj = ship wreck left behind
The <OnDestroy> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.
<OnEnteredGate>
gSource = station object
aGateObj = gate object
Version 0.99 uses aGateObj instead of aGate (as in previous versions) to be consistent with <OnObjEnteredGate>.
<OnGameEnd>
Found inside <AdventureDesc>
<OnGameStart>
Found inside <AdventureDesc>
<OnGlobalSystemCreated>
(no parameters)
For systems, all instances executed whenever a system is created.
This event is called after a system is created (right after <OnCreate> for the system). You may use this event to create new objects in the system or to otherwise alter the system. Remember that there is no guarantee that other systems have been created at this point.
Look at Huari.xml for an example of how this event is used.
Warning : multiple instances of this event can be created on multiple system types. They will ALL be called when ANY system is created, and their order can NOT be forecast.
<OnGlobalTopologyCreated>
(no parameters)
For topology, once when the topology is created.
This event is called at the beginning of the game right after the complete system topology has been generated. You may use this event to explore the topology and add data to topology nodes that may later be used inside systems. Remember that no systems have been created yet. You can only call functions that work on topology nodes.
For an example of how this event is used, look at Huari.xml.
<OnInvokedByPlayer>
<OnInit>
For dockscreens, when the dockscreen is shown.
<OnMining>
For asteroids.
<OnObjDestroyed>
- aWreckObj : the wreck left behind the destroyed object.
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
Is triggerred when an object A has registered for object B events and object B is destroyed. <OnDestroy> is fired on object B, and <OnObjDestroyed> is fired on object A.
0.99c : the <OnObjDestroyed> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.
See example on earth slaver.
<OnObjDocked>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
This was primarily used before <OnOrdersCompleted>.
<OnObjEnteredGate>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
<OnObjJumped>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
<OnObjReconned>
Like all <OnObj*> events, let an object know that something happenned to another object to which events it has previously registered.
<OnOrderChanged>
<OnOrdersCompleted>
For ships, when all queued orders are completed.
<OnRefuel>
<OnShieldDown>
<OnShow>
When a communication menu messages is shown.
<OnUpdate>
- gSource = object that carries the item
- gItem = the item
The OnUpdate event for an item is called once every 30 ticks on every object that carries the item. Use this event sparingly because it will impact performance.
EDIT #1 : a little more, I added dvlenk6, F50 and bobby contributions. Thanks again !
EDIT #2 : What I'm trying to list are the builtin events, those which exist in the engine itself and that you can override or not in XML code. Extra events that are created from the XML itself don't interest me.
EDIT #3 : thanks Betelgeuse !
EDIT #4 : thanks digdug !
EDIT #5 : more insight on some events, thanks to digdug and to the modding page of the main Transcendence site.