EvilEngine/Events
An event can be thought of as a signal or message that can be sent to any object. Events are usually used to notify an object of something happening between that object and another object. For example, when the Player walks inside a Trigger, the EnterPlayer event is automatically sent to the trigger. Events are also used to notify objects of something important happening in the scene. For example, all entities receive the Scene Prepare event during xSceneInit()
, which some entities use internally to know when to set themselves up. Events can also be sent directly from one object to another, which can be set up in the asset for an object by using links. Links are extremely powerful since they let you design all kinds of custom interactions between objects without having to edit code.
Links
A link is a property of an object that can be used to "link" that object to another object in a scene.
TODO
Format
Links are usually defined to be stored at the end of the main data struct of a base asset (usually a struct inheriting from xBaseAsset
or xEntAsset
). The format for a link stored in an asset is defined in the xLinkAsset
struct, in xBase.h:
Offset | Type | Variable | Description |
---|---|---|---|
0x00 | short | srcEvent | Source event enum |
0x02 | short | dstEvent | Destination event enum |
0x04 | AssetID | dstAssetID | ID of asset who will receive the destination event |
0x08 | float[4] | param | Parameters for destination event, these are usually all floats but for some events they are ints/Asset IDs. |
0x18 | AssetID | paramWidgetAssetID | Base asset ID parameter for destination event |
0x1C | AssetID | chkAssetID | If this is non-null, the destination event is only sent if the source event was received from the asset with this specific ID. |