List of builtin events

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi digdug,


Thanks in advance for the topic move. When will we know when the list is finished ? I suggest to grep the source for all "<On" sequences and take away every event that appears in Timer triggers.

For the difference between Jump and Gate, I should have thought about that. Thanks for the precision !
Last edited by Mutos on Tue Nov 04, 2008 4:39 am, edited 1 time in total.
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

Thanks for the topic move. When will we know when the list is finished ?
I would like to have a general description of nearly all of the events, then I'm going to move the topic.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

DIrectly from 0.99 New modding features page (this is what I'm looking for for all the hardcoded events):

<OnAIUpdate> Event
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.

<OnUpdate> Event
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.

<OnDestroy> Event
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.

<OnObjDestroyed> Event
gSource = object called
aObjDestroyed = object destroyed
aDestroyer = object that caused destruction
aWreckObj = ship wreck left behind

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.

<OnDamage> Event
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.

<OnEnteredGate>
gSource = station object
aGateObj = gate object

Version 0.99 uses aGateObj instead of aGate (as in previous versions) to be consistent with <OnObjEnteredGate>.

<OnGlobalSystemCreated>
(no parameters)

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.

<OnGlobalTopologyCreated>
(no parameters)

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.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

cool! 1 thing more, we have to distinguish between events that are for itemtypes, shipclasses or stationtypes (or combinations of them). :D
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi digdug,


Indeed we're nearing to get something useable ! I'll apply your latest remark asap...
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

MOVED!

However it would be nice to finish this list. :)
User avatar
Mutos
Militia Lieutenant
Militia Lieutenant
Posts: 218
Joined: Thu Aug 14, 2008 3:31 am
Location: Near Paris, France
Contact:

Hi digdug,


Thanks for the move. I'll be able to complete some event, as I've learnt from the last time ^-^ But still not all. I'l have some time tomorrow.
@+

Benoît 'Mutos' ROBIN
Hoshikaze 2250 Project
Post Reply