EvilEngine/SCRP: Difference between revisions

From Heavy Iron Modding
Content added Content deleted
Battlepedia>Seil
(Created page with "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 rela...")
 
Battlepedia>Seil
No edit summary
Line 4: Line 4:


==Format==
==Format==
===xScriptAsset===
SCRP are [[Object Asset|object assets]], so they start with their 0x8 byte header, then are followed by:
xScriptAsset is the data structure that defines the format for SCRP assets. It inherits from [https://github.com/pslehisl/BFBB-cpp/blob/master/Core/x/xBase.h xBaseAsset] (8 bytes long).

SCRP assets store an array of [[#xScriptEventAsset|xScriptEventAssets]] at offset 0x14, followed by its array of [[Events#Links|links]].


{| class="wikitable"
{| class="wikitable"
! Offset !! Type !! Variable !! Description
! Offset !! Type !! Variable !! Description
|-
|-
| 0x08 || float || unknown || Always 1. Maybe a speed multiplier?
| 0x08 || float || '''scriptStartTime''' || Always 1. Not known what this is yet.
|-
|-
| 0x0C || int || '''timedEventCount''' || Number of timed events.
| 0x0C || int || '''eventCount''' || Number of xScriptEventAssets.
|-
! colspan="4" | Not present in BFBB?
|-
|-
| 0x10 || byte || '''flag1''' || Always 0 or 1
| 0x10 || byte || '''flag1''' || Always 0 or 1
Line 21: Line 26:
| 0x13 || byte || '''flag4''' || Always 0
| 0x13 || byte || '''flag4''' || Always 0
|-
|-
! colspan="4" |
| 0x14 || [[#TimedEvent|TimedEvent]][timedEventCount] || '''timedEvents''' || Array of [[#TimedEvent|TimedEvent]] definitions. (See below)
|-
|-
! colspan="4" | Events
! colspan="4" | [[#xScriptEventAsset|xScriptEventAsset]] array offset = 0x14
|-
|-
! colspan="4" | [[Events#Links|Link]] array offset = 0x14 + 0x20*eventCount
| - || Event[numberOfEvents] || '''[[Events]]''' ||
|}
|}


===TimedEvent===
===xScriptEventAsset===
xScriptEventAsset defines the format for timed events in SCRP assets.

{| class="wikitable"
{| class="wikitable"
! Offset !! Type !! Variable !! Description
! Offset !! Type !! Variable !! Description
Line 34: Line 41:
| 0x00 || float || '''time''' || Time of event in seconds, relative to the time the script starts running.
| 0x00 || float || '''time''' || Time of event in seconds, relative to the time the script starts running.
|-
|-
| 0x04 || [[AssetID]] || '''targetAssetID''' || Asset to send this asset to.
| 0x04 || [[AssetID]] || '''widget''' || Asset to send this asset to.
|-
| 0x08 || int || '''paramEvent''' || Event ID enum. (See the [[Events#List of Events|list of events]] for your game to find the correct event ID)
|-
|-
| 0x08 || int || '''event''' || Event ID enum. (See the [[Events#List of Events|list of events]] for your game to find the correct event ID)
| 0x0C || float[4] || '''param''' || Event parameters (can be floats, ints, [[AssetID]]s, etc.)
|-
|-
| 0x0C || number32[5] || '''arguments''' || Event parameters (can be floats, ints, [[AssetID]]s, etc.)
| 0x1C || [[AssetID]] || '''paramWidget''' || Asset ID parameter.
|}
|}

Revision as of 23:17, 7 March 2019

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.