This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Time and Difficulty
Mission scripts use ITime for game and real time and tick conversion, and DifficultySetting to read or apply difficulty flags (realism, fuel, ammo, views, etc.).
ITime
Kind: interface
Application (game) time and real time, both in seconds. Game time can pause; real time always advances. Access via Mission.Time or GamePlay.gpTime().
Pause and mode
| Method | Return | Description |
|---|---|---|
bool isPaused() |
bool | True if game time is paused. |
bool isRealOnly() |
bool | True if game time is constantly stopped (real-time only). |
Ticks
| Method | Return | Description |
|---|---|---|
int tickCounter() |
int | Current tick number. |
double tick() |
double | Start time of current tick (seconds). |
double tickNext() |
double | Start time of next tick (seconds). |
double tickLen() |
double | Tick duration (seconds). |
double tickConstLen() |
double | Constant tick length (seconds). |
double tickOffset() |
double | Relative position in current tick (0–1). |
double tickOffset(double t) |
double | Relative position of time t in its tick (0–1). |
Current time
| Method | Return | Description |
|---|---|---|
double current() |
double | Current game time (seconds); changes during the real tick. |
double currentReal() |
double | Current real time (seconds); non-negative. |
double end() |
double | End of game time in the current real tick. |
double endReal() |
double | End of real time in the current real tick. |
double raw() |
double | Time since application start in seconds; always advances. |
Conversion
| Method | Return | Description |
|---|---|---|
double fromReal(double real) |
double | Convert real time to game time. |
double toReal(double t) |
double | Convert game time to real time. |
double TicksToSecs(long tm) |
double | Convert ticks to seconds. |
long SecsToTicks(double tm) |
long | Convert seconds to ticks. |
Usage
- Use
current()for in-game delays andTimeout(sec, callback)(game time). - Use
SecsToTicks/TicksToSecswhen APIs or AMission.GetBattleLengthTicks() work in ticks.
DifficultySetting
Kind: class
Holds difficulty options as boolean flags. Get current settings with GamePlay.gpDifficultyGet(). Use get() / set(long) for bitmask I/O, or the preset methods and properties.
Preset masks and methods
| Member | Type | Description |
|---|---|---|
REALISTIC_MASK |
static long | Bitmask for full realism. |
EASY_MASK |
static long | Bitmask for easy. |
NORMAL_MASK |
static long | Bitmask for normal. |
bool isRealistic() |
bool | True if current flags match realism preset. |
bool isNormal() |
bool | True if match normal preset. |
bool isEasy() |
bool | True if match easy preset. |
bool isCustom() |
bool | True if not exactly one of the presets. |
void setRealistic() |
— | Apply realism preset. |
void setNormal() |
— | Apply normal preset. |
void setEasy() |
— | Apply easy preset. |
void set(DifficultySetting s) |
— | Copy from another instance. |
void set(long state) |
— | Set from bitmask. |
long get() |
long | Current state as bitmask. |
Main properties (flags)
Flight and systems: Wind_N_Turbulence, Flutter_Effect, Stalls_N_Spins, Blackouts_N_Redouts, Engine_Temperature_Effects, Torque_N_Gyro_Effects, Realistic_Landings, Takeoff_N_Landing, ComplexEManagement.
Views and HUD: Cockpit_Always_On, No_Outside_Views, Head_Shake, No_Icons, No_Padlock, Clouds, No_Map_Icons, NoMinimapPath.
Weapons and vulnerability: Realistic_Gunnery, Limited_Ammo, Limited_Fuel, Vulnerability, Realistic_Bombing.
Game rules: NoAutopilot, NoReplacement, NoSelect, NoReplacementArmy, NoReplacementPlace, NoSelectArmy, NoCreate, NoGroundControlTargets.
AntropomorphicControl exists but is disabled in the current implementation.
Usage
- Read difficulty with
GamePlay.gpDifficultyGet()and check flags orisRealistic()/isNormal()/isEasy(). - Modify only if your mission is intended to change global difficulty; use
set(long)or the preset methods.