diff --git a/Mission-Script-API.md b/Mission-Script-API.md new file mode 100644 index 0000000..ee6d5eb --- /dev/null +++ b/Mission-Script-API.md @@ -0,0 +1,46 @@ +# Mission Script API — Documentation + +This folder documents the API available to mission scripts. Mission scripts derive from `AMission` and are loaded by the game at runtime. + +Mission scripts also use additional types such as `LimbNames`, `NamedDamageTypes`, `Point2d`, and `Point3d`; those are summarized in [External Types](External Types.-). + +## How mission scripts are loaded + +1. The game loads a **battle** (one `ABattle` instance) via `IScriptRemote.loadBattleScript`. +2. Missions are attached with `loadMissionScript(fileName, missionNumber, scriptFileName)`, which instantiates a class named `Mission` that inherits from `AMission`. +3. Each mission's `Init(battle, missionNumber)` is called; then the battle runs and invokes the mission's virtual `On*` methods in response to game events. + +## Documentation index + +### Core + +| Document | Description | +|----------|-------------| +| [Mission And Battle](Mission And Battle.-) | **AMission**, **ABattle**, **IBattle**, **DoTimeout** | +| [Gameplay](Gameplay.-) | **IGamePlay** — main interface to the game (actors, HUD, triggers, section files, etc.) | +| [Time And Difficulty](Time And Difficulty.-) | **ITime**, **DifficultySetting** | +| [Player](Player.-) | **Player** | +| [Events And Section File](Events And Section File.-) | **GameEventId**, **ISectionFile** | +| [Pathfinding And Terrain](Pathfinding And Terrain.-) | **RecalcPathState**, **PathType**, **LandTypes**, **IRecalcPathParams**, **ActorName** | +| [Script Loading](Script Loading.-) | **IScriptRemote**, **ScriptRemote** | +| [External Types](External Types.-) | Additional types used by missions (limbs, damage, geometry) | + +### World + +| Document | Description | +|----------|-------------| +| [World](World.-) | Index of world types | +| [Actor Hierarchy](Actor Hierarchy.-) | **AiActor**, **AiPerson**, **AiCart**, **AiGroup**, damage types, **CrewFunction** | +| [Air](Air.-) | **AiAircraft**, **AiAirGroup**, air waypoints, enums, **EnemyAirInterf** | +| [Ground](Ground.-) | **AiGroundActor**, **GroundStationary**, buildings, bomb explosion, enums | +| [Triggers Spawns And Targets](Triggers Spawns And Targets.-) | **AiTrigger**, **AiAction**, **AiBirthPlace**, **AiAirport**, **AiTarget**, **Regiment** | +| [Time And User Labels](Time And User Labels.-) | **ITime** (cross-link), **GPUserLabel**, **GPUserIconType** | + +## Quick start + +1. Create a class `Mission` that inherits from `AMission`. +2. Override `OnBattleInit`, `OnBattleStarted`, and any `On*` events you need (e.g. `OnTrigger`, `OnActorCreated`, `OnAircraftKilled`). +3. Use `GamePlay` (IGamePlay) for querying actors, triggers, spawning groups, HUD messages, and section files. +4. Use `Time` (ITime) for game time and tick conversion (e.g. with `Timeout`). + +Reference the API documented here when building your mission script project.