Ground of Aces Scripting API
|
The game uses Python for scripting. The current supported version of Python is 3.4.
The script are located in the game folder, under the directory GroundOfAces_Data/StreamingAssets/Scripts
. They are grouped into directories that can be loaded individually.
By default, only the scripts located inside the Default
directory are loaded on game startup.
In order to load scripts from other directory, use the command load_scripts <name>
in the cheats console.
Inside of the directory, scripts are contained inside .py
files, where each one can contain one or more event handlers.
Mission scripts are a specific type of scripts that are used to define all inner workings of missions, for more info about mission scripts head over to the mission scripting section of the documentation
Each script has access to some predefined global variables that provide functionality to interact which the game. They are:
The list of default events and their arguments can be found here.
Event handler functions are normal Python functions, decorated with the event_handler
decorator. The name of the function can be any valid Python function name, and will be used together with the containing module name to identify the function internally when calculating how many times a function was called (in order to implement max occurrences limit). The function arguments depend on the particular event (see here).
The handler function can optionally return False
- this will cause the execution not to be counted towards the max_occurrences
limit. This is useful if particular handler should be invoked limited number of times, but only under certain conditions. Not returning anything (or explicitly returning True
) causes the execution to be counted normally.
event_name
- Name of the event to handle. This can be any string that corresponds to an existing event, but for built-in events the easier way is to from Blindflug.MinorEvents import MinorEvent
and the use the constants defined there.chance
- A chance of the event handler being called when the event happens, from 0.0
to 1.0
. E.g. setting chance to 0.5
would give the handler 50% chance to be called when the event happens. This default to 1.0
(always call the handler on event).max_occurrences
- Maximum number of times the handler can be called during a single playthrough. Negative value means "no limit". The default in -1
.This code would be located in a file under the scripts directory, e.g. GroundOfAces_Data/StreamingAssets/Scripts/Default/example.py
.