SCRP

From Battlepedia
Jump to navigationJump to search

A script is essentially a timeline of events. Upon receiving the Run event, the script will start to send events to other objects in the scene at the relative time offsets they are defined at.

Scripts can still receive and send events separately from its timed events.

Format

xScriptAsset

xScriptAsset is the data structure that defines the format for SCRP assets. It inherits from xBaseAsset (8 bytes long).

SCRP assets store an array of xScriptEventAssets at offset 0x14, followed by its array of links.

Offset Type Variable Description
0x08 float scriptStartTime Always 1. Not known what this is yet.
0x0C int eventCount Number of xScriptEventAssets.
Not present in BFBB?
0x10 byte flag1 Always 0 or 1
0x11 byte flag2 Always 0
0x12 byte flag3 Always 0
0x13 byte flag4 Always 0
xScriptEventAsset array offset = 0x14
Link array offset = 0x14 + 0x20*eventCount

xScriptEventAsset

xScriptEventAsset defines the format for timed events in SCRP assets.

Offset Type Variable Description
0x00 float time Time of event in seconds, relative to the time the script starts running.
0x04 AssetID widget Asset to send this asset to.
0x08 int paramEvent Event ID enum. (See the list of events for your game to find the correct event ID)
0x0C float[4] param Event parameters (can be floats, ints, AssetIDs, etc.)
0x1C AssetID paramWidget Asset ID parameter.