IGamePlay
Kind: interface
IGamePlay is the main interface for mission scripts to interact with the game: time, players, actors, birth places, airports, triggers, HUD messages, section files, pathfinding, and user labels. Access it via Mission.GamePlay (or Battle.GamePlay).
Access and mode
| Method |
Return |
Description |
bool gpIsValidAccess() |
bool |
Whether the current context may call gameplay methods. |
object[] gpInvoke(object[] args) |
object[] |
Invoke internal gameplay logic (implementation-specific). |
bool gpIsServerSingle() |
bool |
True if single-player server. |
bool gpIsServerDedicated() |
bool |
True if dedicated server. |
bool gpBattleIsRun() |
bool |
True if battle is running. |
Time and difficulty
| Method |
Return |
Description |
double gpTimeofDay() |
double |
Time of day. |
ITime gpTime() |
ITime |
Time interface (ticks, current time, conversion). |
DifficultySetting gpDifficultyGet() |
DifficultySetting |
Current difficulty settings. |
Players
| Method |
Return |
Description |
Player gpPlayer() |
Player |
Local player. |
Player[] gpRemotePlayers() |
Player[] |
Remote players (multiplayer). |
Actors and world objects
| Method |
Return |
Description |
bool gpActorIsValid(AiActor actor) |
bool |
Whether the actor reference is still valid. |
AiActor gpActorByName(string actorName) |
AiActor |
Find actor by full name (e.g. "0:ShortName"). |
int[] gpArmies() |
int[] |
Army indices. |
string gpArmyName(int army) |
string |
Name of the army. |
AiBirthPlace[] gpBirthPlaces() |
AiBirthPlace[] |
All spawn points. |
AiAirport[] gpAirports() |
AiAirport[] |
All airports. |
AiAirGroup[] gpAirGroups(int Army) |
AiAirGroup[] |
Air groups for the given army. |
GroundStationary[] gpGroundStationarys() |
GroundStationary[] |
All stationary objects. |
GroundStationary[] gpGroundStationarys(string Country) |
GroundStationary[] |
Stationaries filtered by country. |
GroundStationary[] gpGroundStationarys(double x, double y, double r) |
GroundStationary[] |
Stationaries in radius r around (x, y). |
GroundStationary[] gpGroundStationarys(string Country, double x, double y, double r) |
GroundStationary[] |
By country and position/radius. |
AiGroundGroup[] gpGroundGroups(int Army) |
AiGroundGroup[] |
Ground groups for the given army. |
Air groups (create / get)
| Method |
Return |
Description |
AiAirGroup gpMakeAirGroup(AiAircraft[] items, AiAirWayPoint[] way) |
AiAirGroup |
Create an air group from aircraft and waypoints. |
AiAirGroup gpAiAirGroup(int ID, int army) |
AiAirGroup |
Get air group by ID and army. |
Triggers and actions
| Method |
Return |
Description |
AiTrigger gpGetTrigger(string name) |
AiTrigger |
Get trigger by name. |
AiAction gpGetAction(string name) |
AiAction |
Get action by name (e.g. to call Do() when a trigger fires). |
Front and terrain
| Method |
Return |
Description |
bool gpFrontExist() |
bool |
Whether a front exists. |
int gpFrontArmy(double x, double y) |
int |
Army at front at (x, y). |
double gpFrontDistance(int army, double x, double y) |
double |
Front distance for army at (x, y). |
string gpSectorName(double x, double y) |
string |
Sector name at (x, y). |
LandTypes gpLandType(double x, double y) |
LandTypes |
Land type at (x, y). |
IRecalcPathParams gpFindPath(Point2d a, double ra, Point2d b, double rb, PathType type, int army) |
IRecalcPathParams |
Find path between two circles; see Pathfinding And Terrain. |
Missions and battle control
| Method |
Return |
Description |
int gpNextMissionNumber() |
int |
Next mission number (for loading additional missions). |
void gpPostMissionLoad(string fileName) |
— |
Load mission by file name. |
void gpPostMissionLoad(ISectionFile file) |
— |
Load mission from section file. |
void gpBattleStop() |
— |
Stop the battle. |
HUD and logging
| Method |
Return |
Description |
void gpAviPlay(string args) |
— |
Play AVI (arguments format is implementation-specific). |
void gpHUDLogCenter(string msg) |
— |
Show message in HUD center (all). |
void gpHUDLogCenter(Player[] to, string msg) |
— |
Show to specific players. |
void gpHUDLogCenter(Player[] to, string msg, object[] parms) |
— |
With format parameters. |
void gpHUDLogCenter(Player[] to, string msg, object[] parms, double lifeTime) |
— |
With format parameters and lifetime. |
void gpLogServer(string format) |
— |
Log on server. |
void gpLogServer(string format, object[] args) |
— |
Log with format args. |
void gpLogServer(Player[] to, string format, object[] args) |
— |
Log to specific players. |
void gpLogServerBegin(Player[] to, string format) |
— |
Begin multi-part log. |
void gpLogServerArg(bool newArg, string format, object[] parms) |
— |
Add log argument. |
void gpLogServerEnd() |
— |
End multi-part log. |
Section files (config / data)
| Method |
Return |
Description |
ISectionFile gpConfigUserFile() |
ISectionFile |
User config section file. |
ISectionFile gpCreateSectionFile() |
ISectionFile |
Create empty section file. |
ISectionFile gpCreateSectionFile(string line, out string firstWord) |
ISectionFile |
Create from line; firstWord is first token. |
ISectionFile gpLoadSectionFile(string fileName) |
ISectionFile |
Load section file from path. |
| Method |
Return |
Description |
void gpSetOrderMissionMenu(Player player, bool thisSubMenu, int ID, string[] keys, bool[] bSubMenu) |
— |
Set order mission menu for player (keys and submenu flags). |
Translator
| Member |
Type |
Description |
gpDictionaryFilePath |
string |
Path to dictionary (get/set). |
string gpTranslate(string msg, string language, int debugLevel) |
string |
Translate message for language. |
User labels (map labels)
| Method |
Return |
Description |
GPUserLabel gpMakeUserLabel(Point2d pos, Player Player, string Text, double Time, int type) |
GPUserLabel |
Create a user label. |
void gpDrawUserLabel(GPUserLabel ul) |
— |
Draw label (all). |
void gpDrawUserLabel(Player[] to, GPUserLabel ul) |
— |
Draw for specific players. |
void gpDrawUserLabel(int army, GPUserLabel ul) |
— |
Draw for army. |
void gpDeleteUserLabel(GPUserLabel ul) |
— |
Delete label (all). |
void gpDeleteUserLabel(Player[] to, GPUserLabel ul) |
— |
Delete for specific players. |
void gpDeleteUserLabel(int army, GPUserLabel ul) |
— |
Delete for army. |
Typical usage
- Resolve actors with
gpActorByName; check with gpActorIsValid before use.
- Get spawn points and airports with
gpBirthPlaces(), gpAirports().
- Create or get air groups with
gpMakeAirGroup, gpAiAirGroup.
- Fire actions when triggers activate (e.g. in
OnTrigger) by getting the action with gpGetAction(name) and calling Do().
- Show messages with
gpHUDLogCenter or gpLogServer.
- Load/save config or mission data with
gpLoadSectionFile, gpCreateSectionFile, gpConfigUserFile, and the ISectionFile API (see Events And Section File).
- Pathfinding:
gpFindPath with PathType and IRecalcPathParams (see Pathfinding And Terrain).