Command Lua API Documentation, v1147.7


News

Command: Modern Operations v1147.1

Build 1147.1 brings new tools to work with sides and their missions:

  • New function: VP_GetSides()
  • New method on "Side" wrapper: unitsInArea()
  • New property on "Side" wrapper: missions

Command: Modern Operations v1143.1

Build 1143.1 provides new features to manage aircraft and their munitions at airbases:

  • New function: ScenEdit_DistributeWeaponAtAirbase()
  • New function: ScenEdit_ClearAllAircraft()
  • New function: ScenEdit_ClearAllMagazines()

Command Lua Docs gets a makeover!

After 5 years using the LDoc format, the Command Lua API Documentation struts into the 2020's with a sleek new interface, inspired by industry leaders in web documentation. The new look is accompanied by an extensive re-write and reorganisation of existing content, consolidation of content from various sources, and brand new content to assist Lua newbies and pros alike in their Command Lua adventures.

The old site can be found here for metathesiophobics, however it won't be updated.

Introduction

Welcome to the documentation for the Command Lua Application Programming Interface (API). The Command Lua API allows users to control behaviour of Command directly by using the Lua scripting language, providing a flexible and easy to use tool for users to extend or customize the built-in functionality of Command.

What Can I Do With the Command Lua API?

Since the Command Lua API interfaces directly with the source code of Command, users are provided with the ability to implement virtually any desired behaviour. Some common uses include:

  • Precise placement and orientation of units using the console
  • Customised message pop-ups
  • Randomising gameplay elements such as weather, unit types, positions etc
  • Extending existing AI behaviour
  • 'Spawning' of units in conjunction with the event editor
  • Implementation of additional features, such as:
    • Downed pilots
    • Combat search and rescue
    • 'Purchasing' additional units
    • Extended communications modelling

While the above items are common uses for the Command Lua API, the integration with source code allows users to custom-design virtually any feature or modification that they desire.

How to Use These Docs

Not everyone is a programmer--and even experienced programmers are daunted by dry, wall-of-text documentation. With this in mind, we have taken steps to make the documentation for the Command Lua API accessible to users of all levels of skill, while retaining the depth and detail of technical documentation. To achieve this:

  • Examples are offered where practical
  • Color coding and linking are used extensively, and
  • Simple language is used to explain concepts wherever possible
Need Help?

Even the best written documentation is no match for a discussion with an expert. We have a lively community of users of all levels--from casual Lua neophytes to professional users who work with the Command Lua API as their primary job--and the place to get in touch with them is the Lua Legion subforum on the Official Command Forums. The forum is actively monitored by WarfareSims staff, and most questions are answered within 24 hours.

Found Something Wrong?

We're human too; there are bound to be mistakes or inaccuracies in documentation for live, complex, evolving software. If you find something that is incorrect or unclear, please let us know by dropping us a message on the Official Discord, Twitter or FaceBook. Better yet, come join the community!

Conventions

The following conventions are used throughout this documentation to allow at-a-glance visualisation of data types, code snippets and example code.

  • Code within text is differentiated from normal text with a border, additional spacing and a console-like font.
  • Parameter references appear similar to in-text code with a light blue background. The text links to the relevant documentation (although not in this example, as a parameter can be any of the types below).
  • Selector references appear similar to in-text code with a light green background. The text links to the relevant Selector documentation.
  • Wrapper references appear similar to in-text code with a light purple background. The text links to the relevant Wrapper documentation.
  • Table references appear similar to in-text code with a light orange background. The text links to the relevant Table documentation.
  • Data type descriptions appear similar to in-text code with bold font a dark grey background. If the Data Type is not one of the standard Lua data types, the text is white and links to the relevant Data Type documentation. Otherwise, the text is color coded to match the appearance of the datatype in the console:
    • string
    • boolean
    • number
  • READ ONLY properties are denoted by a tag with the words READ ONLY in all caps, on a yellow background.
  • PRO ONLY functionality is denoted by a tag with the words PRO ONLY in all caps, on a lavender background.
  • Sections with long enumerations or data pools have a drop-down carat to show the relevant data. This reduces visual clutter when looking at other items while allowing quick access to data without leaving the page.
    • Here
    • is
    • an
    • example
    • of
    • visual
    • clutter
    • that
    • is
    • hidden
    • with
    • this
    • convention
--Example code is written as it appears in the Command Lua console, with additional spacing and indentation for clarity

--[[
Native Lua functions, comparators and boolean values are blue
Operators (+,-,/,*) and constructors ( (,),{,} ) are purple
Strings are red
Numbers are gold
Variables and function names are black
]]


local mission = ScenEdit_AddMission ( 'USA', 'Marker strike', 'strike', { type = 'land' } )
if mission == then
    if _errnum_ ~= 0 then
         ( 'Failed to add:' .. _errmsg_ )
    else
         ( 'Something else' )
    end
else
     ( mission)
end

Note: Information that is particularly useful or worthy of special mention appears in centered boxes with a blue background.

Caution: Advice on common pitfalls appears in centered boxes with a yellow background.

Warning: Information that could prevent you from losing work or otherwise disrupting your workflow appears in centered boxes with a red background. If you see one of these, pay attention!

First Steps

If you're already familiar with writing scripts in Lua, dive right in and take a look at the Functions section. This is the meat of the Command Lua API--the direct interface with the source code that makes things happen.

If you're somewhat familiar with programming in general--but not Lua in particular--take a look at the External Resources for a primer on Lua as a language, then head on over to the Functions section to get to grips with the tools at your disposal.

External Resources

The links below contain useful resources for getting started with Lua in general:

Note: These references are external to WarfareSims and are subject to change.

Overview

Case Sensitivity and Conventions

Lua is a case sensitve language. When accessing object properties directly as in unit.name, the property should be in lowercase which will match the Lua generated code.

However, when accessing the properties through the module functions, both the keyword/property and the value are case insensitive; the code will worry about matching them up.

Note: There are some special cases where uppercase letters are used to name fields (e.g. mission.SISH=true which is a shortcut for scrub_if_side_human). These are documented in the relevant wrapper, selector or table documentation.


Event Handling

An event consists of one or more triggers, an optional set of conditions, and one or actions to perform when the trigger(s) and condition(s) are fulfilled. With Lua, you can create triggers, conditions and actions independently of the editor, and create or modify events with them.

There are separate functions to handle the creation, update and deletion of the components of an event.

ScenEdit_SetTrigger( { table } )

As it sounds, a trigger is something that fires off, and results in a success or fail. Apart from a few common keywords, each trigger has a set of keywords.

The common keywords used in the Lua table are:

  • Description The name given to the trigger. The keyword 'name' can also be used for this.
  • Mode The type of operation to perform. Operations are 'list', 'add', 'remove', and 'update'.
  • ID The GUID used to reference the trigger. This is used internally and is only for reference.

The trigger related keywords are listed below.

Trigger type Keyword Comment
Points SideID Side to adjust points for
PointValue Current points
ReachDirection GoOver = 0, MatchExactly = 1, GoUnder = 2
RandomTime EarliestTime Earliest date/time to start checks
LatestTime Latest date/time to stop checks
RegularTime Interval Time interval (1 sec, 2sec, 5sec, etc)
ScenEnded No additional keywords
ScenLoaded No additional keywords
Time Time Actual date/time to fire on
UnitDamaged DamagePercent
TargetFilter See below
UnitDestroyed TargetFilter See below
UnitDetected TargetFilter See below
DetectorSideID Side doing the detecting
MCL Minimum classification level
Area Table of reference points
UnitEmissions TargetFilter See below
DetectorSideID Side doing the detecting
UnitEntersArea TargetFilter See below
Area Table of reference points
ETOA Earliest date/time of arrival
LTOA Latest date/time of arrival
NOT Not in the area
ExitArea Leaving area
UnitRemainsInArea TargetFilter See below
Area Table of reference points
TD Time to remain in area in seconds (or as days:hours:minutes:seconds)
UnitBaseStatus TargetFilter See below
TargetStatus Status number to monitor
UnitCargoMoved CargoFilter See below
TargetLimitReceived Number received to trigger
TargetLimitSent Number sent to trigger
TargetFilter

A series of filters to apply to units. Only units matching this filter will fire the trigger.

TargetFilter TargetSide Side to fillter on
TargetType Type of unit (ship, submarine, etc)
TargetSubType Subtype of the above unit type
SpecificUnitClass Unit class (DBID)
SpecificUnitID Actual unit

Note that side is mandatory, but you can specify a unit or type/sub/class. However, if using type/sub/class, you can use

  • type, or
  • type and subtype, or
  • type, subtype (optional as it is inferred from class) and class.
TargetType

Aircraft 1
Ship 2
Submarine 3
Facility 4
Aimpoint 5
Weapon 6
Satellite 7
CargoFilter

A series of filters to apply to cargo items, similar to the TargetFilter.

TargetFilter TargetType Type of cargo item (personel[1000],etc)
SpecificUnitClass Cargo class (DBID)
SpecificUnitID Actual cargo item
TargetType

Aircraft 1
Ship 2
Submarine 3
Facility 4
Aimpoint 5
Weapon 6
Satellite 7
Examples

Create a trigger for a specific unit leaving an area

local a = ScenEdit_SetTrigger({mode='add',
type='UnitEntersArea',
name='Sagami exiting hot zone',
targetfilter={SPECIFICUNIT='AOE 421 Sagami'},
area={'rp-1126','rp-1127','rp-1128','rp-1129'},
exitarea=true})

Note: The variable a will contain the trigger information. It will be nil if the trigger failed in a non-interactive script as in an event.

Rename the trigger to 'any type of AOE entering hot zone'

local a = ScenEdit_SetTrigger({mode='update',
type='UnitEntersArea',
name='Sagami exiting hot zone',
rename='Any AOE entering hot zone',
targetfilter={TargetSubType = '5023',TargetType = '2',TargetSide='sidea'},
area={'rp-1126','rp-1127','rp-1128','rp-1129'},
exitarea=false})

Remove the trigger named 'any type of AOE entering hot zone'

local a = ScenEdit_SetTrigger({mode='remove',type='UnitEntersArea',name='Any AOE entering hot zone'})

Note: If the trigger is assigned to an event, it can't be removed until removed from the event.


ScenEdit_SetCondition( { table } )

As it sounds, a condition is something that can be further applied once the trigger has fired, and results in a success or fail. Apart from a few common keywords, each condition has a set of keywords.

The common keywords used in the Lua table are:

  • Description: the name given to the condition. The keyword 'name' can also be used for this.
  • Mode: type of operation to perform. Operations are 'list', 'add', 'remove', and 'update'.
  • ID: the GUID used to reference the condition. This is used internally and is only for reference.

The condition related keywords are listed below.

Condition type Keyword Comment
LuaScript ScriptText A Lua script
ScenHasStarted NOT A NOT modifier for scenario NOT started yet
SidePosture ObserverSideID Side that views TargetSide as ...
TargetSideID
TargetPosture
NOT A NOT modifier to change condition from true to false

Caution: For scripts, use '\r\n' to represent new lines, otherwise a multi-line script may not run.

ScriptTest='--comment\r\nif unit ~= nil then\r\n return true\r\n else\r\n return false\r\n end'
Examples

Create a condition for sideA being hostile to sideB

local a = ScenEdit_SetCondition({mode='add',
type='SidePosture',
name='sideA hostile to sideB',
ObserverSideId='sidea',
TargetSideId='sideb',
targetposture='hostile'})

Note: The variable a will contain the trigger information. It will be nil if the trigger failed in a non-interactive script as in an event.


ScenEdit_SetAction( { table } )

As it sounds, a action is something that will be done once the trigger (and condition) are successful. Apart from a few common keywords, each action has a set of keywords.

The common keywords used in the Lua table are:

  • Description: the name given to the condition. The keyword 'name' can also be used for this.
  • Mode: type of operation to perform. Operations are 'list', 'add', 'remove', and 'update'.
  • ID: the GUID used to reference the condition. This is used internally and is only for reference.

The action related keywords are listed below.
Action type Keyword Comment
ChangeMissionStatus MissionID Mission identifier
NewStatus New status - active(0) or inactive (1)
EndScenario No additional keywords
LuaScript ScriptText A Lua script
Message SideID Side to see message
Text Message text to show
Points PointChange Value to change points by (+/-)
SideID Side affected
TeleportInArea UnitIDs Table of unit GUIDs
Area Table of reference points

Caution: For scripts, use '\r\n' to represent new lines, otherwise a multi-line script may not run.

Examples

Create a action changes points on SideA

local a = ScenEdit_SetAction({mode='add', type='Points', name='sideA loses some ..', SideId='sidea', PointChange=-10})

Note: The variable a will contain the trigger information. It will be nil if the trigger failed in a non-interactive script as in an event.


Modifying Events

Triggers, conditions and actions (TCA) can be linked to events. A common format is followed for each one.

The common keywords used in the Lua table are:

  • Description: The name given to the TCA. The keyword 'name' can also be used for this.
  • Mode: The type of operation to perform. Operations are 'add', 'remove', and 'replace'.
  • ID: The GUID used to reference the TCA. This is used internally and is only for reference.
The functions will return the TCA on a success as with the commands above. For the mode='replace', there is an extra keyword 'ReplacedBy' that swaps the old TCA with the new one. The previous one is returned by the function

Examples

Add a new action to an existing event

local a = ScenEdit_SetEventAction('test event', {mode='add', name='test action points'})

Note: The variable a will contain the trigger information. It will be nil if the trigger failed in a non-interactive script as in an event.

Replace an action in an existing event

local a = ScenEdit_SetEventAction('test event', {mode='replace', name='test action message', replaceby='test action points'})

Events can also be created and modified through Lua: ScenEdit_SetEvent( eventName, { table } )

The common keywords used in the Lua table are:

  • Description: The name given to the Event. The keyword 'name' can also be used for this.
  • Mode: The type of operation to perform. Operations are 'add' and 'update'.
  • ID: The GUID used to reference the Event. This is used internally and is only for reference.
The normal Event keywords are accepted in the 'table'.

Examples

Add a new event

local a = ScenEdit_SetEvent('my new event', {mode='add'})

Note: The variable a will contain the trigger information. It will be nil if the trigger failed in a non-interactive script as in an event.

The ScenEdit_SetEvent(Trigger/Condition/Action) functions then can be run on the new Event to add the required TCAs. In addtion, ScenEdit_GetEvent(EventDescriptionOrID, level) has been updated to return information on the Event.

Use level as:

  • 0 - all details,
  • 1 - triggers,
  • 2 - conditions,
  • 3 - actions,
  • 4 - event detail

Special variables:

  • _enumTable_ List of enumerated variable names and values
  • _errfnc_ Lua Function in which error occurred
  • _errmsg_ Error message from Lua Function failure


Error Handling

Usually when a Lua script fails, an error is thrown that ends the script at that point. While this may be okay in most cases, it is not often desired.

Whenever a Command Lua function gets an error, it will normally return nil, and the error message will be available as Lua global variables:

  • _errmsg_: the last error message
  • _errfnc_: the Command Lua function that gave the error
  • _errnum_: the error code (0 is no error, and any value >0 will be an error)

Thus if you get back nil, you can check to see if that is due to an error or no data.

Note: Due to how errors are now handled from SR7, if a command fails in the console window, it will show an error. If the command runs outside the console (as in an event script), it will not fail with a visible error but return a nil or or some other value.

Example

Without the new error handling, the script below would terminate after the ScenEdit_AddMission() function and the rest of script would not run.

local mission = ScenEdit_AddMission ( 'USA', 'Marker strike', 'strike', { type = 'land' } )
if mission == then
    if _errnum_ ~= 0 then
         ( 'Failed to add:' .. _errmsg_ )
    else
         ( 'Something else' )
    end
else
     ( mission)
end

Caution: One issue with commands running in an event is that sometimes they fail with an in-game message that actually stops the rest of the script from running. Now these event scripts will run without any in-game message showing. The designer should check the result of the command and handle any error condition, and let the remaining script run as needed.

The design intent is to have all command errors behave in the same fashion in the console window; and the command errors outside a console behave without stopping the script. Which requires the designer to cater for the specific error conditions.

To emulate the expected outcome from an event, put 'Tool_EmulateNoConsole(true)' at the start of the script to be tested; it is not required in the event code as the script is already not running in a console.

Note also, that the Lua history log should also record the event script errors.

Data Types

Aside from the regular string, number, boolean and table data types inherited from Lua, the Command Lua API has a range of unique data types.


Altitude

Altitude is the height or depth of a unit. The altitude is displayed in meters when accessing the data. It can be set using either meters or feet by adding M or FT after it. The default is M if just a number is used.

Example
{altitude = '100 FT'}
--or
{altitude = '100 M'}
--or
{altitude = '100'} --same as 100 M, since default is measured in metres


Arc

Arcs for sensor and mounts.

Arc Codes


DateTime

DateTime is displayed and changed as per LOCALE e.g. US would be 'MM/DD/YYYY HH:MM:SS AM/PM' eg '8/13/2002 12:14 PM'


KeyStore

The simulation allows for user data to be stored within the save file. This is done by associating keys with values. Key and value pairs added to the persistent store are retained when the game is saved and resumed. Keys with values are both represented as non-nil strings .

Note: The KeyStore datatype only accepts strings as parameters. Numbers can only be stored using a KeyStore if the number is first converted to a string --e.g. by using the Lua native function tostring().

Conversely, a number stored in a KeyStore as a string can be converted back to a number using the the Lua native function tonumber().


Latitude

Latitude is degrees N or S of the equator as 'S 60.20.10' or as +/- as -60.336. The data in the tables is held as a signed number.

Example
{latitude = 'S 60.20.10'}
--or
{latitude = -60.336}

LoadoutRole

A string and number that correlates to the role of a loadout in the database.

  • Description = Code
  • None = 1001
  • Intercept_BVR = 2001
  • Intercept_WVR = 2002
  • AirSuperiority_BVR = 2003
  • AirSuperiority_WVR = 2004
  • PointDefence_BVR = 2005
  • PointDefence_WVR = 2006
  • GunsOnly = 2007
  • AntiSatellite_Intercept = 2101
  • AirborneLaser = 2102
  • LandNaval_Strike = 3001
  • LandNaval_Standoff = 3002
  • LandNaval_SEAD_ARM = 3003
  • LandNaval_SEAD_TALD = 3004
  • LandNaval_DEAD = 3005
  • LandOnly_Strike = 3101
  • LandOnly_Standoff = 3102
  • LandOnly_SEAD_ARM = 3103
  • LandOnly_SEAD_TALD = 3104
  • LandOnly_DEAD = 3105
  • NavalOnly_Strike = 3201
  • NavalOnly_Standoff = 3202
  • NavalOnly_SEAD_ARM = 3203
  • NavalOnly_SEAD_TALD = 3204
  • NavalOnly_DEAD = 3205
  • BAI_CAS = 3401
  • Buddy_Illumination = 3501
  • OECM = 4001
  • AEW = 4002
  • CommandPost = 4003
  • ChaffLaying = 4004
  • SearchAndRescue = 4101
  • CombatSearchAndRescue = 4102
  • MineSweeping = 4201
  • MineRecon = 4202
  • NavalMineLaying = 4301
  • ASW_Patrol = 6001
  • ASW_Attack = 6002
  • Forward_Observer = 7001
  • Area_Surveillance = 7002
  • Armed_Recon = 7003
  • Unarmed_Recon = 7004
  • Maritime_Surveillance = 7005
  • Paratroopers = 7101
  • Troop_Transport = 7102
  • Cargo = 7201
  • AirRefueling = 8001
  • Training = 8101
  • TargetTow = 8102
  • TargetDrone = 8103
  • Ferry = 9001
  • Unavailable = 9002
  • Reserve = 9003
  • ArmedFerry = 9004


LoadoutTimeOfDay

A string and number that correlates to the time of day specified for a loadout in the database.

  • Description = Code
  • None = 1001
  • DayNight = 2001
  • NightOnly = 2002
  • DayOnly = 2003

Note: As of v1142.2 loadout time of day restrictions are not enforced for aircraft launch, however they do affect quick-turnaround.


LoadoutWeather

A string and number that correlates to the time of day specified for a loadout in the database.

  • Description = Code
  • None = 1001
  • AllWeather = 2001
  • LimitedAllWeather = 2002
  • ClearWeather = 2003

Note: As of v1142.2 loadout weather restrictions are not enforced, however the individual weapons in a loadout are affected by weather. For example: There are no restrictions on launching an aircraft with a loadout carrying laser-guided bombs, however they will not be able to use those weapons if the target is obscured by cloud, fog or heavy precipitation.


Longitude

Longitude is degrees E or W of Greenwich line as 'W 60.20.10' or as +/- as -60.336. The data in the tables is held as a signed number.

Example
{longitude = 'W 60.20.10'}
--or
{longitude = -60.336}

Size

Size various size attributes (eg flightsize in mission).

When setting the value, either the number or the description (in quotes) can be used.

Size Codes

Flight size:

  • Description = Code
  • None* = 0
  • SingleAircraft = 1
  • TwoAircraft = 2
  • ThreeAircraft = 3
  • FourAircraft = 4
  • SixAircraft = 6

Flight quantity:

  • Description = Code
  • None = 0
  • Flight_x1 = 1
  • Flight_x2 = 2
  • Flight_x3 = 3
  • Flight_x4 = 4
  • Flight_x6 = 6
  • Flight_x8 = 8
  • Flight_x12 = 12
  • All = All

Group size:

  • Description = Code
  • None* = 0
  • SingleVessel = 1
  • TwoVessel = 2
  • ThreeVessel = 3
  • FourVessel = 4
  • SixVessel = 6

*This can also be set by using a value of 'all'.


Stance

Stance/Posture: how one side sees another.

When setting the value, either the number or the description (in quotes) can be used.

Stance Codes

  • Description = Code
  • Neutral = 0
  • Friendly = 1
  • Unfriendly = 2
  • Hostile = 3
  • Unknown = 4

TargetTypeWRA

Target type.

Target Type Codes

Description = Code

  • None = 1001
  • Decoy = 1002
  • Air_Contact_Unknown_Type = 1999
  • Aircraft_Unspecified = 2000
  • Aircraft_5th_Generation = 2001
  • Aircraft_4th_Generation = 2002
  • Aircraft_3rd_Generation = 2003
  • Aircraft_Less_Capable = 2004
  • Aircraft_High_Perf_Bombers = 2011
  • Aircraft_Medium_Perf_Bombers = 2012
  • Aircraft_Low_Perf_Bombers = 2013
  • Aircraft_High_Perf_Recon_EW = 2021
  • Aircraft_Medium_Perf_Recon_EW = 2022
  • Aircraft_Low_Perf_Recon_EW = 2023
  • Aircraft_AEW = 2031
  • Helicopter_Unspecified = 2100
  • Guided_Weapon_Unspecified = 2200
  • Guided_Weapon_Supersonic_Sea_Skimming = 2201
  • Guided_Weapon_Subsonic_Sea_Skimming = 2202
  • Guided_Weapon_Supersonic = 2203
  • Guided_Weapon_Subsonic = 2204
  • Guided_Weapon_Ballistic = 2211
  • Satellite_Unspecified = 2300
  • Surface_Contact_Unknown_Type = 2999
  • Ship_Unspecified = 3000
  • Ship_Carrier_0_25000_tons = 3001
  • Ship_Carrier_25001_45000_tons = 3002
  • Ship_Carrier_45001_95000_tons = 3003
  • Ship_Carrier_95000_tons = 3004
  • Ship_Surface_Combatant_0_500_tons = 3101
  • Ship_Surface_Combatant_501_1500_tons = 3102
  • Ship_Surface_Combatant_1501_5000_tons = 3103
  • Ship_Surface_Combatant_5001_10000_tons = 3104
  • Ship_Surface_Combatant_10001_25000_tons = 3105
  • Ship_Surface_Combatant_25001_45000_tons = 3106
  • Ship_Surface_Combatant_45001_95000_tons = 3107
  • Ship_Surface_Combatant_95000_tons = 3108
  • Ship_Amphibious_0_500_tons = 3201
  • Ship_Amphibious_501_1500_tons = 3202
  • Ship_Amphibious_1501_5000_tons = 3203
  • Ship_Amphibious_5001_10000_tons = 3204
  • Ship_Amphibious_10001_25000_tons = 3205
  • Ship_Amphibious_25001_45000_tons = 3206
  • Ship_Amphibious_45001_95000_tons = 3207
  • Ship_Amphibious_95000_tons = 3208
  • Ship_Auxiliary_0_500_tons = 3301
  • Ship_Auxiliary_501_1500_tons = 3302
  • Ship_Auxiliary_1501_5000_tons = 3303
  • Ship_Auxiliary_5001_10000_tons = 3304
  • Ship_Auxiliary_10001_25000_tons = 3305
  • Ship_Auxiliary_25001_45000_tons = 3306
  • Ship_Auxiliary_45001_95000_tons = 3307
  • Ship_Auxiliary_95000_tons = 3308
  • Ship_Merchant_Civilian_0_500_tons = 3401
  • Ship_Merchant_Civilian_501_1500_tons = 3402
  • Ship_Merchant_Civilian_1501_5000_tons = 3403
  • Ship_Merchant_Civilian_5001_10000_tons = 3404
  • Ship_Merchant_Civilian_10001_25000_tons = 3405
  • Ship_Merchant_Civilian_25001_45000_tons = 3406
  • Ship_Merchant_Civilian_45001_95000_tons = 3407
  • Ship_Merchant_Civilian_95000_tons = 3408
  • Submarine_Surfaced = 3501
  • Subsurface_Contact_Unknown_Type = 3999
  • Submarine_Unspecified = 4000
  • Land_Contact_Unknown_Type = 4999
  • Land_Structure_Soft_Unspecified = 5000
  • Land_Structure_Soft_Building_Surface = 5001
  • Land_Structure_Soft_Building_Reveted = 5002
  • Land_Structure_Soft_Structure_Open = 5005
  • Land_Structure_Soft_Structure_Reveted = 5006
  • Land_Structure_Soft_Aerostat_Moring = 5011
  • Land_Structure_Hardened_Unspecified = 5100
  • Land_Structure_Hardened_Building_Surface = 5101
  • Land_Structure_Hardened_Building_Reveted = 5102
  • Land_Structure_Hardened_Building_Bunker = 5103
  • Land_Structure_Hardened_Building_Underground = 5104
  • Land_Structure_Hardened_Structure_Open = 5105
  • Land_Structure_Hardened_Structure_Reveted = 5106
  • Runway_Facility_Unspecified = 5200
  • Runway = 5201
  • Runway_Grade_Taxiway = 5202
  • Runway_Access_Point = 5203
  • Radar_Unspecified = 5300
  • Mobile_Target_Soft_Unspecified = 5400
  • Mobile_Target_Soft_Mobile_Vehicle = 5401
  • Mobile_Target_Soft_Mobile_Personnel = 5402
  • Mobile_Target_Hardened_Unspecified = 5500
  • Mobile_Target_Hardened_Mobile_Vehicle = 5501
  • Underwater_Structure = 5601
  • Air_Base_Single_Unit_Airfield = 5801

TimeStamp

TimeStamp is a representation of time defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970


UnitAircraft

The category and sub-type for aircraft.

Aircraft Category Codes

Description = Code

  • None = 1001
  • Fixed Wing = 2001
  • Fixed Wing, Carrier Capable = 2002
  • Helicopter = 2003
  • Tiltrotor = 2004
  • Airship = 2006
  • Seaplane = 2007
  • Amphibian = 2008
Aircraft SubType Codes

Description = Code

  • None = 1001
  • Fighter = 2001
  • Multirole (Fighter/Attack) = 2002
  • Anti-Satellite Interceptor (ASAT) = 2101
  • Airborne Laser Platform = 2102
  • Attack = 3001
  • Wild Weasel = 3002
  • Bomber = 3101
  • Battlefield Air Interdiction (BAI/CAS) = 3401
  • Electronic Warfare = 4001
  • Airborne Early Warning (AEW) = 4002
  • Airborne Command Post (ACP) = 4003
  • Search And Rescue (SAR) = 4101
  • Mine Sweeper (MCM) = 4201
  • Anti-Submarine Warfare (ASW) = 6001
  • Maritime Patrol Aircraft (MPA) = 6002
  • Forward Observer = 7001
  • Area Surveillance = 7002
  • Recon = 7003
  • Electronic Intelligence (ELINT) = 7004
  • Signals Intelligence (SIGINT) = 7005
  • Transport = 7101
  • Cargo = 7201
  • Commercial = 7301
  • Civilian = 7302
  • Utility = 7401
  • Naval Utility = 7402
  • Tanker (Air Refueling) = 8001
  • Trainer = 8101
  • Target Towing = 8102
  • Target Drone = 8103
  • Unmanned Aerial Vehicle (UAV) = 8201
  • Unmanned Combat Aerial Vehicle (UCAV) = 8202
  • Airship = 8901
  • Aerostat = 8902


UnitFacility

The category and sub-type for Facility.

Fixed Facility Category Codes

Description = Code

  • 1001 = None
  • 2001 = Runway
  • 2002 = Runway-Grade Taxiway
  • 2003 = Runway Access Point
  • 3001 = Building (Surface)
  • 3002 = Building (Reveted)
  • 3003 = Building (Bunker)
  • 3004 = Building (Underground)
  • 3005 = Structure (Open)
  • 3006 = Structure (Reveted)
  • 4001 = Underwater
  • 5001 = Mobile Vehicle(s)
  • 5002 = Mobile Personnel
  • 6001 = Aerostat Mooring
  • 9001 = Air Base
Mobile Facility Category Codes

Description = Code

  • 0 = None
  • 1000 = Infantry
  • 2000 = Armor
  • 3000 = Artillery Gun
  • 4000 = Artillery SSM
  • 5000 = AAA
  • 6000 = SAM
  • 7000 = Engineer
  • 8000 = Supply
  • 9000 = Surveillance
  • 10000 = Recon
  • 11000 = MechInfantry


UnitSatellite

The category and sub-type for Satellite.

Satellite Category Codes

Description = Code

  • 1001 = None
  • 2001 = Geo-Stationary
  • 2002 = Something Else
  • 2003 = Unmanned Test Vehicle
Satellite SubType Codes

Description = Code

  • 1001 = None
  • 2001 = IMGSAT
  • 2002 = RORSAT
  • 2003 = EORSAT
  • 2004 = SIGINT
  • 2005 = ELINT
  • 2006 = NOSS
  • 2007 = MASINT
  • 2008 = Reusable Test Vehicle


UnitShip

The category and sub-type for Ship.

Ship Category Codes

Description = Code

  • 1001 = None
  • 2001 = Carrier (Aviation Ship)
  • 2002 = Surface Combatant
  • 2003 = Amphibious
  • 2004 = Auxiliary
  • 2005 = Merchant
  • 2006 = Civilian
  • 2007 = Surface Combatant (Aviation Capable)
  • 2008 = Mobile Offshore Base (Aviation Capable)
Ship SubType Codes

Description = Code

  • 1001 = None
  • 2001 = CV - Aircraft Carrier
  • 2002 = CVA - Attack Carrier
  • 2003 = CVB - Large Aircraft Carrier
  • 2004 = CVE - Escort Aircraft Carrier
  • 2005 = CVGH - Guided Missile Helicopter Carrier
  • 2006 = CVH - Helicopter Carrier
  • 2007 = CVL - Light Aircraft Carrier
  • 2008 = CVN - Nuclear Powered Aircraft Carrier
  • 2009 = CVS - Seaplane Carrier
  • 2010 = CVS - Anti-Submarine Aircraft Carrier
  • 2011 = AVT - Training Carrier
  • 3001 = B - Battleship
  • 3002 = BB - Battleship
  • 3003 = BBC - Command Battleship
  • 3004 = BBG - Guided Missile Battleship
  • 3005 = BBH - Helicopter Battleship
  • 3006 = BCGN - Nuclear Powered Guided Missile Battle Cruiser
  • 3007 = BM - Monitor
  • 3101 = C - Cruiser
  • 3102 = CA - Heavy Cruiser
  • 3103 = CAG - Heavy Guided Missile Cruiser
  • 3104 = CB - Large Cruiser
  • 3105 = CBG - Large Guided Missile Cruiser
  • 3106 = CG - Guided Missile Cruiser
  • 3107 = CGH - Guided Missile Helicopter Cruiser
  • 3108 = CGN - Nuclear Powered Guided Missile Cruiser
  • 3109 = CL - Light Cruiser
  • 3110 = CLAA - Light Anti-Aircraft Cruiser
  • 3111 = CLC - Light Command Cruiser
  • 3112 = CLG - Light Guided Missile Cruiser
  • 3113 = CLH - Light Helicopter Cruiser
  • 3114 = CS - Scout Cruiser
  • 3201 = D - Destroyer
  • 3202 = DD - Destroyer
  • 3203 = DDG - Guided Missile Destroyer
  • 3204 = DDH - Helicopter Destroyer
  • 3205 = DDK - ASW Submarine Killer Destroyer
  • 3206 = DDR - Radar Picket Destroyer
  • 3207 = DE - Destroyer Escort
  • 3208 = DEG - Guided Missile Destroyer Escort
  • 3209 = DER - Radar Picket Destroyer Escort
  • 3210 = DL - Destroyer
  • 3211 = DLG - Guided Missile Destroyer
  • 3212 = DM - Destroyer Minelayer (converted destroyer)
  • 3301 = F - Frigate
  • 3302 = FF - Frigate
  • 3303 = FFG - Guided Missile Frigate
  • 3304 = FFL - Corvette
  • 3305 = PF - Patrol Frigate
  • 3306 = LCS - Littoral Combat Ship
  • 3307 = OPV - Offshore Patrol Vessel
  • 3308 = USV - Unmanned Surface Vessel
  • 3401 = PB - Patrol Boat
  • 3402 = PC - Coastal Patrol Boat
  • 3403 = PC - Submarine Chaser
  • 3404 = PCE - Submarine Chaser Escort
  • 3405 = PCF - Fast Patrol Craft
  • 3406 = PCFG - Fast Guided Missile Patrol Craft
  • 3407 = PG - Patrol Gunboat
  • 3408 = PG - Corvette
  • 3409 = PGM - Missile Gunboat
  • 3410 = PH - Hydrofoil Gunboat
  • 3411 = PHM - Missile Hydrofoil
  • 3412 = PHT - Hydrofoil Torpedo Boat
  • 3413 = PT - Patrol Torpedo Boat
  • 3414 = PTS - Patrol Torpedo Boat Small
  • 3415 = MTB - Motor Torpedo Boat
  • 3416 = WHEC - Coast Guard High Endurance Cutter
  • 3417 = WMEC - Coast Guard Medium Endurance Cutter
  • 3418 = WPB - Coast Guard Patrol Boat
  • 3419 = WPG - Coast Guard Patrol Gunboat
  • 3420 = MCDV - Maritime Coastal Defense Vessel
  • 4000 = AGF - Fleet Flagship
  • 4001 = AGC - Amphibious Fleet Flagship
  • 4002 = LCAC - Air Cushion Landing Craft
  • 4003 = LCC - Amphibious Command Vessel
  • 4004 = LCM - Mechanized Landing Craft
  • 4005 = LCP - Personnel Landing Craft
  • 4006 = LCT - Tank Landing Craft
  • 4007 = LCU - Utility Landing Craft
  • 4008 = LCVP - Vehicle and Personnel Landing Craft
  • 4009 = LFR - Inshore Fire Support Vessel
  • 4010 = LHA - Amphibious Assault Ship, General Purpose
  • 4011 = LHD - Amphibious Assault Ship, Multi-purpose
  • 4012 = LKA - Amphibious Cargo Vessel
  • 4013 = LPD - Amphibious Transport Dock Vessel
  • 4014 = LPH - Amphibious Assault Helicopter Carrier
  • 4015 = LSD - Dock Landing Ship
  • 4016 = LSH - Unknown! British Designation!
  • 4017 = LSL - Landing Ships Logistic
  • 4018 = LSM - Medium Landing Ship
  • 4019 = LSM(R) - Medium Landing Ship, Rocket
  • 4020 = LST - Tank Landing Ship
  • 4021 = LSU - Utility Landing Ship
  • 4022 = LSV - Vehicle Landing Ship
  • 4023 = LCI - Landing Craft, Infantry
  • 4024 = LSDV - Saboteur Infiltration Craft
  • 4025 = LCPA - Personnel Landing Craft, Air-Cushioned
  • 4026 = EPF - Expeditionary Fast Transport
  • 4027 = ESD - Expeditionary Transfer Dock
  • 4028 = ESB - Expeditionary Mobile Base
  • 5001 = A - Auxiliary
  • 5002 = AD - Destroyer Tender
  • 5003 = AE - Ammunition Ship
  • 5004 = AF - Refrigerated Stores Ship
  • 5005 = AFS - Combat Stores Ship
  • 5006 = AG - Generic Auxiliary
  • 5007 = AGB - Heavy Icebreaker
  • 5008 = AGF - Fleet Flagship
  • 5009 = AGI - Intelligence Gathering Ship
  • 5010 = AGMR - Communications Major Relay Ship
  • 5011 = AGOR - Oceanographic Research Ship
  • 5012 = AGOS - Ocean Surveillance Ship
  • 5013 = AGR - Radar Picket Ship (converted cargo ship)
  • 5014 = AGS - Surveying Ship
  • 5015 = AGTR - Technical Research Ship
  • 5016 = AH - Hospital Ship
  • 5017 = AK - Cargo Ship
  • 5018 = AKA - Attack Cargo Ship
  • 5019 = AKE - Dry Cargo Ship
  • 5020 = AKR - Roll-on/Roll-off Cargo Ship
  • 5021 = AKS - General Stores Ship
  • 5022 = AO - Fleet Oiler
  • 5023 = AOE - Fast Combat Support Ship
  • 5024 = AOL - Small Oiler
  • 5025 = AOR - Replenishment Oiler
  • 5026 = AOT - Transport Oiler
  • 5027 = APA - Attack Personnel Transport Ship
  • 5028 = APD - Troop Transport (High Speed)
  • 5029 = AR - Repair Ship
  • 5030 = AS - Submarine Tender
  • 5031 = ATC - Armored Troop Carrier (Tango Boat)
  • 5032 = ATA - Auxiliary Ocean Tug
  • 5033 = ATS - Salvage Tug
  • 5034 = AV - Seaplane Tender
  • 5035 = AX - Training Vessel
  • 5036 = ASR - Submarine Rescue Ship
  • 5037 = AP - Personnel Transport Ship
  • 5038 = DSV - Diving Support Vessel / Deep Submergence Vehicle
  • 5039 = AGM - Missile Range instrumentation Ship
  • 5040 = AD - Destroyer Tender
  • 5101 = T-AGOS - MSC Ocean Surveillance Ship
  • 5102 = T-AH - MSC Hospital Ship
  • 5103 = T-AK - Cargo Ship
  • 5104 = T-AKE - MSC Dry Cargo Ship
  • 5105 = T-AKR - MSC Roll-on/Roll-off Cargo Ship
  • 5106 = T-AO - MSC Fleet Oiler
  • 5107 = T-AO - MSC Transport Oiler
  • 5108 = T-MLP - MSC Mobile Landing Platforms
  • 6001 = MCD - Mine Countermeasures Drone
  • 6002 = MCM - Mine Countermeasures Ship
  • 6003 = MCS - Mine Countermeasures Support Ship
  • 6004 = MHC - Coastal Minehunter
  • 6005 = ML - Minelayer
  • 6006 = MSC - Coastal Minesweeper
  • 6007 = MSF - Steel Hull Fleet Minesweeper
  • 6008 = MSI - Inshore Minesweeper
  • 6010 = MSO - Ocean Minesweeper
  • 6011 = MST - Minesweeper Tender
  • 6012 = MHI - Mine Hunter Inshore
  • 6013 = MM - Controlled Minefield Tender
  • 7001 = YAG - Miscellaneous Service Craft
  • 7002 = YRT - Torpedo Retriever
  • 7003 = YRM - Missile Retriever
  • 9001 = Civilian
  • 9002 = Merchant
  • 9003 = Platform
  • 9004 = NGS Buoy
  • 9005 = Bottom Fixed Array Sonar
  • 9006 = Moored Sonobuoy
  • 9007 = Special (Land Unit/Satellite)
  • 9008 = Small Watercraft
  • 9011 = Mobile Offshore Base (MOB)


UnitSubmarine

The category and sub-type for Submarine.

Submarine Category Codes

Description = Code

  • 1001 = None
  • 2001 = Submarine
  • 2002 = Biologics
  • 2003 = False Target
Submarine SubType Codes

Description = Code

  • 1001 = None
  • 2001 = AGSS - Auxilary/Experimental Submarine
  • 2002 = APSS - Auxiliary Cargo Submarine
  • 2003 = SS - Attack/Fleet Submarine
  • 2004 = SSB - Ballistic Missile Submarine
  • 2005 = SSBN - Nuclear Powered Ballistic Missile Submarine
  • 2006 = SSG - Guided Missile Attack Submarine
  • 2007 = SSGN - Nuclear Powered Guided Missile Attack Submarine
  • 2008 = SSK - Hunter-Killer Submarine
  • 2009 = SSM - Midget Submarine
  • 2010 = SSN - Nuclear Powered Attack Submarine
  • 2011 = SSP - Transport Submarine
  • 2012 = SSR - Radar Picket Submarine
  • 2013 = SSRN - Nuclear Powered Radar Picket Submarine
  • 3001 = SDV - Swimmer Delivery Vehicle
  • 4001 = ROV - Remotely Operated Vehicle
  • 4002 = UUV - Unmanned Underwater Vehicle
  • 4003 = Unmanned Underwater Glider
  • 9001 = Biologics
  • 9002 = False Target


WeaponDoctrine

Weapon Doctrine Codes

Value - Number - Explanation

  • LoadoutSetting - 0 - use setting from database
  • Winchester - 2001 - Vanilla Winchester.
  • Winchester_ToO - 2002 - Same as above, but engage nearby bogies with guns after we're out of missiles. Applies to air-to-air missile loadouts only. For guns-only air-to-air loadouts and all air-to-ground loadouts the behaviour is the same as above. PREFERRED OPTION!
  • ShotgunBVR - 3001 - Disengage after firing all Beyond Visual Range (BVR, air-to-air) or Stand-Off (SO, air-to-ground) weapons. This is a risky option as your fighter aircraft may only have one medium-range air-to-air missile (AAM) left, and attempt to engage 'fresh' flights of bogies. Use with caution.
  • ShotgunBVR_WVR - 3002 - Same as above, but if easy targets or threats are nearby then shoot at them with remaining Within Visual Range (WVR, air-to-air) or SR (Short-Range, air-to-ground) weapons before disengaging.
  • ShotgunBVR_WVR_Guns - 3003 - Same as above, but also engage bogies with guns. Applies to air-to-air (A/A) loadouts only. For air-to-ground (A/G) loadouts the behaviour is the same as above.
  • ShotgunOneEngagementBVR - 5001 - Make one engagement with BVR or SO weapons. Continue fighting for as long as there are targets within easy reach and then disengage. This is a safe option as it ensures aircraft do not 'hang around' after they have expended their most potent weapons, and becoming easy targets when engaged by 'fresh' enemy units.
  • ShotgunOneEngagementBVR_Opportunity_WVR - 5002 - Same as above, but if easy targets or threats are nearby, shoot at them with remaining WVR or Short-Range weapons before disengaging. A target is considered 'easy' when within 120% of the remaining WVR or Strike weapon's maximum range. In other words, the fighter won't spend much energy chasing down a target after the Shotgun weapon state has been reached, and will leave the target area as quickly as possible. PREFERRED OPTION!
  • ShotgunOneEngagementBVR_Opportunity_WVR_Guns - 5003 - Same as above, but also engage bogies with guns. Applies to air-to-air (A/A) loadouts only. For air-to-ground (A/G) loadouts the behaviour is the same as above.
  • ShotgunOneEngagementBVR_And_WVR - 5005 - Make one engagement with BVR and WVR, or SO and Strike Weapons. Do not disengage when out of BVR or SO weapons, but continue the engagement with WVR weapons.
  • ShotgunOneEngagementBVR_And_WVR_Opportunity_Guns - 5006 -
  • ShotgunOneEngagementWVR - 5011 - Make one engagement with WVR or SR weapons. Continue fighting for as long as there are targets within easy reach and then disengage.
  • ShotgunOneEngagementWVR_Guns - 5012 - Same as above but also engage bogies with guns. Applies to air-to-air (A/A) loadouts only. For air-to-ground (A/G) loadouts, the behaviour is the same as above. PREFERRED OPTION!
  • ShotgunOneEngagementGun - 5021 - Make one engagement with guns. Continue fighting for as long as there are targets nearby and then disengage.
  • Shotgun25 - 4001 - Disengage after 1/4 of mission-specific weapons have been expended.
  • Shotgun25_ToO - 4002 - Same as above, but if easy targets or threats are nearby then shoot at those too. Also engage bogies with guns. Applies to air-to-air (A/A) loadouts only.
  • Shotgun50 - 4011 - Disengage after half of mission-specific weapons have been expended.
  • Shotgun50_ToO - 4012 - Same as above, but if easy targets or threats are nearby then shoot at those too. Also engage bogies with guns. Applies to air-to-air (A/A) loadouts only.
  • Shotgun75 - 4021 - Disengage after 3/4 of mission-specific weapons have been expended.
  • Shotgun75_ToO - 4022 - Same as above, but if easy targets or threats are nearby then shoot at those too. Also engage bogies with guns. Applies to air-to-air (A/A) loadouts only.

WeaponType

Weapon Type Codes

Description = Code

  • None = 1001
  • GuidedWeapon = 2001
  • Rocket = 2002
  • IronBomb = 2003
  • Gun = 2004
  • Decoy_Expendable = 2005
  • Decoy_Towed = 2006
  • Decoy_Vehicle = 2007
  • TrainingRound = 2008
  • Dispenser = 2009
  • ContactBomb_Suicide = 2010
  • ContactBomb_Sabotage = 2011
  • GuidedProjectile = 2012
  • SensorPod = 3001
  • DropTank = 3002
  • BuddyStore = 3003
  • FerryTank = 3004
  • Torpedo = 4001
  • DepthCharge = 4002
  • Sonobuoy = 4003
  • BottomMine = 4004
  • MooredMine = 4005
  • FloatingMine = 4006
  • MovingMine = 4007
  • RisingMine = 4008
  • DriftingMine = 4009
  • DummyMine = 4011
  • HeliTowedPackage = 4101
  • RV = 5001
  • Laser = 6001
  • HGV = 8001
  • Cargo = 9001
  • Troops = 9002
  • Paratroops = 9003

Weather

Weather conditions.

  • tempnumber Temperature (average for GetWeather(), or time-of-day for unit/contact)
  • rainfallnumber Rainfall rate
  • undercloudnumber Fraction under cloud
  • seastatenumber Sea state

Functions

Functions listed below are available in all editions of Command.


Command: Professional Edition

Functions listed below are only available in Command: Professional Edition.



GetBuildNumber()

Returns the build number of the game executable.

Parameters

  • None

Returns

  • string The build number of the game executable.
Example
(GetBuildNumber())
>>> 1134.3

GetScenarioTitle()

Returns the title of the currently loaded scenario.

Parameters

  • None

Returns

  • string The title of the currently loaded scenario.
Example
(GetScenarioTitle())
>>> Lone Wolf

ScenEdit_AddCustomLoss ()

Add entries to the loss list so it can displyed. It wil also show up in the wrapper side.losses.
The additional entries replace any existing ones. To remove an entry, use a number of 0.

Parameters

  • ScenEdit_AddCustomLoss(side name/guid, table of {'name', number})
Example
ScenEdit_AddCustomLoss( 'sidea', { {'removethis',0},{'Casualties', 10000} } )


ScenEdit_AddExplosion()

Detonates a warhead at a specified location.

Syntax

ScenEdit_AddExplosion(Explosion)

Parameters

Example
ScenEdit_AddExplosion({warheadid=253, lat=unit.latitude, lon=unit.longitude, altitude=unit.altitude})


ScenEdit_AddMinefield()

Attempt to lay a minefield

Syntax

ScenEdit_AddMinefield( side, dbid, number, delay, area )

Example

ScenEdit_AddMinefield ( { side='Blue', dbid=2345, number=100, delay=60000, area={'rp-1','rp-2','rp-3','rp-4'} } )

Parameters

  • side string Side name or guid
  • dbid number The database id of the mine to use
  • number number The number to try to lay
  • delay number The arming delay in seconds
  • area table The area (as table of RP points) to lay mines in

Returns

number number of mines laid

Example
local a = ScenEdit_AddMinefield({side='Blue', dbid=2345, number=100, delay=60000, area={'rp-1','rp-2','rp-3','rp-4'} } )

ScenEdit_AddMission (SideNameOrId, MissionNameOrId, MissionType, MissionOptions)

Add new mission.

Parameters

  • SideNameOrId string The mission side
  • MissionNameOrId string The mission name
  • MissionType string The mission type (Strike, Ferry, Patrol, etc)
  • MissionOptions NewMission The mission specific options as a table

Returns

MissionA mission descriptor of the added mission ornil otherwise.

Example
local mission = ScenEdit_AddMission('USA','Marker strike','strike',{type='land'})

ScenEdit_AddReferencePoint (descriptor)

Add new reference point(s).

This function adds new reference point(s) as defined by a descriptor.As this function also calls ScenEdit_SetReferencePoint() at the end, those parameters can also be passed in this function.

It can take a new referrnce point, or a table of new reference points.The descriptormust contain at least a side, and one set of latitude and longitude, or an area defined by one or more latitude and longitude values. Points can also be relative to a unit based on bearing and distence.This applies to ALL bearing type rp(s) in the function. Field = RelativeTo The unit name/GUID that the RP(s) are relative to.

Parameters

  • descriptor ReferencePointSelector or {ReferencePoint} The reference point details to be created. Field 'area' can be
    (a) Table of reference points {name, longitude, latitude} if 'RelativeTo' not used, or
    (b) table of reference points {name, bearing, distance} if 'RelativeTo' used.
    Leaving out name will default it to noraml 'RP-..'

Returns

ReferencePointThe reference point wrapper for the new reference point, or the first one in an area.

Example
ScenEdit_AddReferencePoint( {side="United States", name="Downed Pilot", lat=0.1, lon=4, highlighted=true})
ScenEdit_AddReferencePoint( {side='sidea', RelativeTo='USN Dewey', bearing=45 ,distance=20, clear=true })

ScenEdit_AddReloadsToUnit (descriptor)

Adds weapons into a mount.

Parameters

  • descriptorWeapon2Mount Describes the weapon and mount to update

Returns

number Number of items added to the magazine

Example
ScenEdit_AddReloadsToUnit({unitname='Mech Inf #1', wpn_dbid=773, number=1, w_max=10})


ScenEdit_AddSide (table)

Add a side with the specified name.

Parameters

  • table Table with 'name' key

Returns

Side

Example
ScenEdit_AddSide({name='OPFOR'})

ScenEdit_AddSpecialAction(table)

Add special action to a side

Parameters

Returns

SpecialAction Details of the Special Action


ScenEdit_AddUnit (unit)

Adds a unit based on a descriptor.

Parameters

  • unit NewUnit The unit details to add

Returns

Unit A complete descriptor for the added unit

Example
ScenEdit_AddUnit({type ='Aircraft', name ='F-15C Eagle', loadoutid =16934, heading =0, dbid =3500, side ='NATO', Latitude="N46.00.00",Longitude="E25.00.00", altitude="5000 ft",autodetectable="false",holdfire="true",proficiency=4})
ScenEdit_AddUnit({type ='Air', unitname ='F-15C Eagle', loadoutid =16934, dbid =3500, side ='NATO', Lat="5.123",Lon="-12.51",alt=5000})

ScenEdit_AddWeaponToUnitMagazine (descriptor)

Adds weapons into a magazine.

Parameters

Returns

number Number of items added to the magazine

Example
ScenEdit_AddWeaponToUnitMagazine({unitname='Ammo', wpn_dbid=773, number=1, w_max=10})


ScenEdit_AddZone (sideName, zoneType, table)

Add no-nav or exclusion zone.
...The RPs are normally visible to the side. They can start out 'hidden' by adding hidden=1 to the table

Parameters

  • sideName string Side name/GUID
  • zoneType string Type of zone to add: 0 = no-nav, 1 = exclusion
  • table table Description, Isactive, Area { of RPs }, Affects { of UnitTypes }, MarkAs (exc only), Locked (non only)

Returns

{ Zone }


ScenEdit_AssignUnitAsTarget (AUNameOrIDOrTable, MissionNameOrID)

Assigns targets to a Strike mission.

'UnitX' can be used as a unit descriptor.Contacts can also be assigned. Refer to the VP_ functions for details

Parameters

  • AUNameOrIDOrTable string ortable The name/GUID of the unit, or a table ofname/GUID to add to target list
  • MissionNameOrID string The mission to update

Returns

{ GUID }A table of targets added

Example
ScenEdit_AssignUnitAsTarget({'target1','target2'},'Land strike')
ScenEdit_AssignUnitAsTarget('UnitX','Land strike')

ScenEdit_AssignUnitToMission (unitname, mission, escort)

Assign a unit to a mission.

The function takes a unit and mission descriptor, and assigns the unit to the mission if it exists. Produces a pop up error (not catchable) if the unit or mission does not exist.The 'UnitX' can be used as the unit descriptor

Parameters

  • unitname string The name/GUID of the unit to assign
  • mission string The mission name/GUID to use
  • escort boolean [Default=False] If the mission is a strike one, then assign unit to the 'Escort' for the strike

Returns

booleanTrue/False for Successful/Failure

Example
ScenEdit_AssignUnitToMission("Bar #1","Strike")


ScenEdit_AttackContact (attackerID, contactId, options)

Attack a contact as an auto-target or manual target with weapon allocation.

For a BOL attack, use "BOL" as the contactId.

Parameters

  • attackerID string The unit attacking as GUID or Name
  • contactId string The contact being attacked as GUID or Name (GUID is better as the name can change as its classification changes)
  • options { AttackOptions } Contains type of attack and weapon allocation if required)

Returns

boolean True if attack successfully assigned

Example
ScenEdit_AttackContact(attackerID, contactId ,{mode='1', mount=438, weapon=1413, qty=10})-- alloc 10 gunfire

Note: The function will use the weapon from the aircraft loadout if applicable when no mount is supplied.


ScenEdit_ClearKeyValue (key, forCampaign)

Clears a key

.. or all keys from the persistent key store.

Parameters

  • key string The key to clear or empty for all
  • forCampaign boolean Use key store for passing ed to next scenario in campaign. Optional, default = false

Returns

booleanSuccess or failure.

Example
ScenEdit_ClearKeyValue("A")


ScenEdit_CurrentLocalTime ()

Get the current scenario local time.

Returns

stringThe local time as HH:MM:SS.


ScenEdit_CurrentTime ()

Get the current scenario time.

Returns

TimeStampThe UTC Unix timestamp of the current time in-game.

Example
local now = ScenEdit_CurrentTime() local elapsed = now - timeFromLastTiggered if elapsed >60*5then -- been more than 5 minutes, set the lastTriggered time to now timeFromLastTiggered = now end

ScenEdit_DeleteMine (side, guid)

delete a mine

Parameters

  • side string Side name or guid
  • guid string Mine guid

Returns

booleantrue/false

Example
local a = ScenEdit_DeleteMine({side='Blue', guid='cccccccc'} )


ScenEdit_DeleteMinefield (side, area)

delete a minefield

Parameters

  • side string Side name or guid
  • area table The area (as table of RP points) to lay mines in

Returns

numbermines removed

Example
local a = ScenEdit_DeleteMinefield({side='Blue', area={'rp-1','rp-2','rp-3','rp-4'} } )


ScenEdit_DeleteMission (SideNameOrId, MissionNameOrId)

Delete mission... unassigns any units attached to it.

Parameters

  • SideNameOrId string The mission side
  • MissionNameOrId string The mission name

Returns

boolean True if mission has been removed.

Example
local mission = ScenEdit_DeleteMission('USA','Marker strike')


ScenEdit_DeleteReferencePoint (selector)

Delete a reference point.

Given a reference point selector, this function will remove it.

Parameters

Returns

booleanTrue if deleted


ScenEdit_DeleteUnit (unit, include)

Deletes unit... and no event triggers.

Parameters

  • unit
  • include attached units with group for deleting
Example
ScenEdit_DeleteUnit({side="United States", unitname="USS Abcd"})


ScenEdit_EndScenario ()

Ends the current scenario.

Example
ScenEdit_EndScenario()


ScenEdit_EventX ()

Active Event .. that has been triggered.Otherwise, anil is returned.

Note that EventX() can also be used as a shortcut for ScenEdit_EventX()

Returns

EventThe triggering event

Example
local event = ScenEdit_EventX()


ScenEdit_ExecuteEventAction (EventDescriptionOrID)

Execute a Lua Event action script... but does not show results of execution of the action

Parameters

  • EventDescriptionOrID string The description or ID of the event action

Returns

string"Ok" on execution or nothing.


ScenEdit_ExecuteSpecialAction (eventNameOrId)

Execute a Lua Special action script .. but does not show results of execution of the action

Parameters

  • eventNameOrId string The name or ID of the event action

Returns

string"Ok" on execution or nothing.


ScenEdit_ExportInst (side, unitList, fileData)

Export unit(s) to an inst file.

Parameters

  • side string The name or GUID of the side owning the exported units
  • unitList table list of GUIDs of units to be written to INST file
  • fileData table Table of {filename=string, name=string, comment=string} for the INST file. Filename is mandatory.
Example
ScenEdit_ExportInst('Russia', {'c1a0e312-9ccc-43d1-9e6c-01899c8433d9'}, {filename='ssbn_patrol.inst',name='SSBN on Patrol',comment='Russian SSBN on patrol in Barents'})

ScenEdit_ExportMission (SideNameOrId,MissionNameOrId)

Export mission parameters... as a XML file in folder Command_base/Defaults.[Experimental as this should really be treated like an attachment so can be imported with Scenario]

Parameters

  • SideNameOrId string The mission side
  • MissionNameOrId string The mission name

Returns

{ guid }Mission GUID exported.

Example
local mission = ScenEdit_ExportMission('USA','Marker strike'})

ScenEdit_ExportScenarioToXML() PRO ONLY

Export the entire scenario in XML format.

Returns

stringThe scenario graph in unformatted XML string

Example
theXML = ScenEdit_ExportScenarioToXML()


ScenEdit_FillMagsForLoadout (unit,loadoutid, quantity)

Fill a unit's magazine(s) with aircraft stores ... for a specified loadout ID.(options)

Parameters

  • unit UnitSelector The unit to select (name or GUID)
  • loadoutid number ID of the desired loadout
  • quantity number How many 'packs' of the specified loadout to populate for

Returns

List of reports for successful (or not)additions

Example
ScenEdit_FillMagsForLoadout('{unit='RAF Lakenheath', loadoutid=45162, quantity=12}')


ScenEdit_GetContact (contact)

Fetches a contact based on a selector.

This function is mostly identical toScenEdit_GetUnitexcept that if references contacts on a side,

Parameters

  • contact ContactSelector The contact to select. Must be defined by a side and contact GUID for that side.

Returns

ContactA contact descriptor if it ornilotherwise.

Example
ScenEdit_GetContact({side="United States", guid="c4114322-900c-428d-a3e3-0af701e81a7a"})


ScenEdit_GetContacts (side)

Contacts from a side.

Parameters

  • side string The name/guid of the side's contacts.

Returns

{ Contacts}Table of contact details

Example
local con = ScenEdit_GetContacts('south korea')


ScenEdit_GetDoctrine (selector)

Gets the doctrine of the designated object.

This function looks up the doctrine of the object selected by selector, and throws an exception if the unit does not exist.

Parameters

Returns

DoctrineThe doctrine of the selected object

Example
ScenEdit_GetDoctrine({side="Soviet Union"}).use_nuclear_weapons


ScenEdit_GetDoctrineWRA (selector)

Gets the WRA doctrine.

Returns the WRA setting In a table For the selected side/mission/unit based On the target type.Nothing returned Or empty values means that the weapon Is Not For the target type.

Parameters

Returns

DoctrineWRAThe WRA doctrine of the selected object

Example
ScenEdit_GetDoctrineWRA({guid ='a1a52edf-3541-4b55-bea4-58d4e1ab11dc', contact_id='Boeing 747-8F #610', weapon_id=1575})
ScenEdit_GetDoctrineWRA({side='sidea', target_type='Surface_Contact_Unknown_Type', weapon_id=1575})

ScenEdit_GetEvent (EventDescriptionOrID,level)

Gets the properties of an event.

Parameters

  • EventDescriptionOrID string The event to retrieve
  • level number The detail required: 0 - full event, (limit return to 1 - triggers, 2 - conditions, 3 - actions, 4 - event)

Returns

EventThe event details


ScenEdit_GetEvents (level)

Gets all events.

Parameters

  • level number The detail required: 0 - full event, (limit return to 1 - triggers, 2 - conditions, 3 - actions, 4 - event)

Returns

{ Event}Table of event details


ScenEdit_GetKeyValue (key,forCampaign)

Gets the value for a key from the persistent key store.

This function retrieves a value put into the store by ScenEdit_SetKeyValue.The keys must be identical.

Parameters

  • key string The key to fetch the associated value of
  • forCampaign boolean Read from the store being passed to next scenario in campaign. Optional, default = false

Returns

stringThe value associated with the key. "" if none exists.

Example
ScenEdit_SetKeyValue("A","2") ScenEdit_GetKeyValue("A")-- returns "2"


ScenEdit_GetLoadout (loadoutinfo)

Gets the loadout details for a unit. Use loadoutid =0 or omit to get the a/c current loadout status (ie number of weapons left)

Parameters

  • loadoutinfo LoadoutInfo The loadout information to apply

Returns

LoadoutLoadout wrapper


ScenEdit_GetMinefield (side, area)

get a minefield

Parameters

  • side string Side name or guid
  • areatable The area (as table of RP points) to lay mines in

Returns

tabletable of mines in the area

Example
local a = ScenEdit_GetMinefield({side='Blue', area={'rp-1','rp-2','rp-3','rp-4'} } )


ScenEdit_GetMission (SideNameOrId,MissionNameOrId)

Get details of a mission.

Parameters

  • SideNameOrId string The mission side
  • MissionNameOrId string The mission name

Returns

MissionA mission descriptor if the mission exists ornilotherwise.

Example
local mission = ScenEdit_GetMission('USA','CV CAP Left')


ScenEdit_GetReferencePoints (selector)

Get a set of reference point(s).

Given a reference point selector,the function will return a table of the reference point descriptors.

Parameters

Returns

{ReferencePoint}The table of reference point descriptors for the selector

Example
local points = ScenEdit_GetReferencePoints({side="United States", area={"rp-100","rp-101","rp-102","rp-103","rp-104"})


ScenEdit_GetScenHasStarted ()

Has the scenario started?

Returns

booleanTrue if the scenario has started

Example
local state = ScenEdit_GetScenHasStarted()


ScenEdit_GetScore (side)

Get a given side's score.

Parameters

  • side string The name of the side

Returns

numberThe side's score

Example
ScenEdit_GetScore("PlayerSide")


ScenEdit_GetSideIsHuman (sidename)

Returns true if side is played by a human player

Parameters

  • sidename string The name of the side to check if is human controlled

Returns

True iff the side specified is human


ScenEdit_GetSideOptions (options)

Get side options....for components on unit.(options)

Parameters

Returns

SideOption The side options

Example
ScenEdit_GetSideOptions({side='SideA'})


ScenEdit_GetSidePosture (sideA,sideB)

Gets the posture of one side towards another.

Parameters

  • sideA string The name of the first side
  • sideB string The name of the second side

Returns

The posture of sideA towards sideB,one of 'N','F','H',or 'A'.


ScenEdit_GetSpecialAction (action_info)

Gets the properties of an existing special action.

Parameters


ScenEdit_GetTimeOfDay (table)

Get the current time of day at a location use an unit selector (guid or side/name)or position selector (latitude,longitude)

Parameters

  • table table The unit location or position

Returns

tabletable {'tod'[0=Day 2=Night 3=Dawn 4=Dusk],'localtime'[local time],'zulutime'[zulu time],'TOD'['day','night','dawn','dusk']}

Example
ScenEdit_GetTimeOfDay(table)


ScenEdit_GetUnit()

Returns a Unit wrapper using a UnitSelector.

Syntax

ScenEdit_GetUnit(UnitSelector)

Example

ScenEdit_GetUnit({name='Eagle #1',side='Blue'})

This function returns the properties of a specified unit. If no unit is found the function returns nil if run non-interactively, and raises an exception if run from the console (see note below for a technique to bypass this behaviour if desired).

Parameters

Returns

  • Unit if the unit exists, or
  • nil

Note: When run interactively (i.e. in the console) ScenEdit_GetUnit() will raise an exception if the selected unit is not found. This can be prevented using Tool_EmulateNoConsole().

Use

The UnitSelector accepts either a name and side, or a guid to return a unit

Example 1

local myUnit = ScenEdit_GetUnit({ guid= 'f4f9e0af-15c2-4582-8e80-b827c2ec2f56' })
( myUnit )

>> unit { type = 'Ship', subtype = '3106', name = 'CG 56 San Jacinto', side = 'United States', guid = 'f4f9e0af-15c2-4582-8e80-b827c2ec2f56', class = 'CG 56 San Jacinto [Ticonderoga Baseline 3, VLS]', proficiency = 'Regular', latitude = '22.3252605703301', longitude = '62.1828983227462', altitude = '0', heading = '0', speed = '10', throttle = 'FullStop', autodetectable = 'False', group = 'Bush CSG', mounts = '25', magazines = '32', unitstate = 'Unassigned', fuelstate = 'None', weaponstate = 'None', }

Example 2

local myUnit = ScenEdit_GetUnit({ side = 'United States' , name = 'CG 56 San Jacinto' })
( myUnit )

>> unit { type = 'Ship', subtype = '3106', name = 'CG 56 San Jacinto', side = 'United States', guid = 'f4f9e0af-15c2-4582-8e80-b827c2ec2f56', class = 'CG 56 San Jacinto [Ticonderoga Baseline 3, VLS]', proficiency = 'Regular', latitude = '22.3252605703301', longitude = '62.1828983227462', altitude = '0', heading = '0', speed = '10', throttle = 'FullStop', autodetectable = 'False', group = 'Bush CSG', mounts = '25', magazines = '32', unitstate = 'Unassigned', fuelstate = 'None', weaponstate = 'None', }


ScenEdit_HostUnitToParent (host_info)

Host/base ..to the specified host.SelectedHostNameOrID'option:the unit will be moved from any location,including flying,to the new location.

Parameters

  • host_info HostUnit The information about the hosting request

ScenEdit_ImportInst (side,filename)

Imports an inst file.

Parameters

  • side string The side to import the inst file as
  • filename string The filename of the inst file

ScenEdit_ImportMission (SideNameOrId,MissionNameOrId)

Import mission parameters...from a XML file in folder Command_base/Defaults.[Experimental as this should really be treated like an attachment so can be imported with Scenario]

Parameters

  • SideNameOrId string The mission side
  • MissionNameOrId string The mission name

Returns

guid Mission GUID imported.

Example
local mission = ScenEdit_ExportMission('USA','Marker strike'})

ScenEdit_ImportScenarioFromXML() PRO ONLY

Returns

boolean Returns true if the import completed successfully, false otherwise

Example
ScenEdit_ImportScenarioFromXML({XML='...'})

ScenEdit_InputBox (string)

Open an input box with the passed prompt.

Parameters

  • string string The string to display to the user

Returns

Data entered into box


ScenEdit_KillUnit (unit)

Kill unit....and triggers event.(unit)

Parameters

  • unit

Returns

booleanTrue if successful

Example
ScenEdit_KillUnit({side='SideA',unitname='ship'})

ScenEdit_MsgBox (string,style)

Show a message box with a passed string.

Style numbers 1 =OK and Cancel buttons.2 =Abort,Retry,and Ignore buttons.3 =Yes,No,and Cancel buttons 4 =Yes and No buttons.5 =Retry and Cancel buttons.

Parameters

  • string string The string to display to the user
  • style number The style of the message box

Returns

button number pressed.


ScenEdit_PlaySound (string,delay)

Play a sound file.

Parameters

  • string string The name of the file. Assumed to be in the Sounds\Effects folder
  • delay number Delay to playing

Returns

bool False if it can't find the file


ScenEdit_PlayVideo (string,fullscreen,delay)

Play a video file.

Parameters

  • string string The name of the file. Assumed to be in the Video folder
  • fullscreen boolean Shown in full screen
  • delay number Delay to showing

Returns

string "N"if it can't find the file


ScenEdit_PlayerSide ()

The player's current side.

Returns

stringThe name of the current side

Example
local side = ScenEdit_PlayerSide()


ScenEdit_QueryDB (objectType,DBID)

Query database use the wrapper_object_variable.fields to see what can be returned

Parameters

  • objectType string The type of item to query; 'weapon', 'mount', 'sensor'
  • DBID number The databse id of item to query

Returns

objectObject wrapper

Example
local a = ScenEdit_QueryDB('weapon',1398)


ScenEdit_RefuelUnit (unitOptions)

Cause unit to refuel.

The unit should follow it's AAR configuration.You can force it use a specific tanker or ones from a set of missions.

Parameters

Returns

stringIf successful,then empty string.Else message showing why it failed to

Example
ScenEdit_RefuelUnit({side="United States", unitname="USS Test"})
ScenEdit_RefuelUnit({side="United States", unitname="USS Test", tanker="Hose #1"})
ScenEdit_RefuelUnit({side="United States", unitname="USS Test", missions={"Pitstop"}})

ScenEdit_RemoveSide (table)

Remove side from play.This removes ALL units and contacts.

Parameters

  • sideside The side to remove

Returns

Side


ScenEdit_RemoveUnitAsTarget (AUNameOrIDOrTable,MissionNameOrID)

Removes targets from a Strike mission.

The 'UnitX'can be used as a unit descriptor

Parameters

  • AUNameOrIDOrTable string or table The name/GUID of the unit, or a table of name/GUID to remove from target list
  • MissionNameOrID string The mission

Returns

tableA table of targets removed

Example
ScenEdit_RemoveUnitAsTarget({'target1','target2'},'Land strike')


ScenEdit_RemoveZone (sideName,zoneType,table)

Remove no-nav or exclusion zone.
...Note that this will drop the zone with any area RPs

Parameters

  • sideNamestringSide name/GUID
  • zoneTypestringType of zone to remove:0 =no-nav,1 =exclusion
  • tabletable Description,Isactive,Area {of RPs },Affects {of UnitTypes },MarkAs (exc only),Locked (non only)
  • Returns

    { Zone }


    ScenEdit_RunScript (script)

    Runs a script from a file.The file scriptmust be inside the [Command base directory]/Lua directory,or else the game will not be able to load it.You can make the file point to files within a sub-directory of this,as in 'library/cklib.lua'The file to find will be of the form [Command base directory]/Lua/[script]A file can also be loaded indirectly from an attachment ScenEdit_UseAttachment

    Parameters

    • script The file containing the script to run.
    Example
    ScenEdit_RunScript('mylibrary.lua')


    ScenEdit_SelectedUnits ()

    list of selected unit ids

    Returns

    table Table of unit ids as table 'units'and 'contacts'.


    ScenEdit_SetAction (options)

    Sets the attributes of an action.

    Parameters

    Returns

    table Table of action options (new or previous value)


    ScenEdit_SetCondition (options)

    Sets the attributes of an condition.

    Parameters

    Returns

    table Table of condition options (new or previous value)


    ScenEdit_SetDoctrine (selector,doctrine)

    Set the doctrine of the designated object.

    This function uses selector to find the thing to modify,then modifies the doctrine of that object based on the given object.Can be used to affect doctrine for Side,Mission,Unit/Group

    Parameters

    Example
    ScenEdit_SetDoctrine({side="Soviet Union"}, {kinematic_range_for_torpedoes ="AutomaticAndManualFire",use_nuclear_weapons="yes" })
    ScenEdit_SetDoctrine({side="Soviet Union", mission="ASW PATROL"}, {kinematic_range_for_torpedoes ="AutomaticAndManualFire",use_nuclear_weapons="yes" })
    ScenEdit_SetDoctrine({side="Soviet Union", unitname="Bear #2"}, {use_nuclear_weapons="yes" })

    ScenEdit_SetDoctrineWRA (selector,options)

    Sets the WRA doctrine.

    Returns the WRA setting like GetDoctrineWRA

    The values below can be used in the option settings 'inherit' = reverts to the side level setting 'system' = reverts to the database level setting (does not apply to 'firing_range') 'max' = use the appropriate maximum setting 'none' = not to be used

    Parameters

    • selector DoctrineWRASelector The selector for the object to update
    • options WRA Table of settings {qty_salvo, shooter_salvo,firing_range,self_defence}. The order IS IMPORTANT as no keys used.

    Returns

    DoctrineWRAThe WRA doctrine of the selected object

    Example
    ScenEdit_SetDoctrineWRA({guid ='a1a52edf-3541-4b55-bea4-58d4e1ab11dc', target_type='Surface_Contact_Unknown_Type', weapon_dbid=1575}, {'inherit','inherit','system','inherit'})
    ScenEdit_SetDoctrineWRA({guid ='a1a52edf-3541-4b55-bea4-58d4e1ab11dc', target_type='Surface_Contact_Unknown_Type', weapon_dbid=1575}, {'max','inherit',90,'inherit'})

    ScenEdit_SetEMCON (type,name,emcon)

    Sets the EMCON of the selected object. Select the object by specifying the type and the object's name.

    Type is the type of object to set the EMCON on. It can be one of 4 values:

    • Side - Set an entire side's EMCON (e.g. United States using active radar)
    • Mission - Set the EMCON for a mission (e.g. Minesweepers active sonar)
    • Group - Set the EMCON for an entire group (e.g Package #20 active radar)
    • Unit - Set the EMCON for a single group (e.g. Hornet #14 passive radar)

    emcon is a compound structure.The string follows the following grammar,with each clause separated by a semicolon (;)

    • Inherit indicates that the output EMCON should be at least the parent's EMCON. Inherit must come first.
    • A transmitter "set" statement. Each is of the form type=status, where type can be any one of Radar, Sonar, and OECM, and status can be any one of Passive or Active.

    Parameters

    • type string The type of the thing to set the EMCON on.
    • name string The name or GUID of the object to select.
    • emcon string The new EMCON for the object.
    Example
    ScenEdit_SetEMCON('Side','NATO','Radar=Active;Sonar=Passive')
    ScenEdit_SetEMCON('Mission','ASW Patrol #1','Inherit;Sonar=Active')
    ScenEdit_SetEMCON('Unit','Camel 2','OECM=Active')

    ScenEdit_SetEvent (EventDescriptionOrID,options)

    Sets the attributes of an event.

    Parameters

    • EventDescriptionOrID string The event name/GUID to perform operation on
    • options { EventUpdate } The event options

    Returns

    { table }Table of event options (new or previous value)


    ScenEdit_SetEventAction (EventDescriptionOrID,options)

    Sets the attributes of a T/C/A.

    Parameters

    • EventDescriptionOrID string The action name/GUID to perform operation on
    • options { EventTCAUpdate } The options

    Returns

    { table }Table of options (new or previous value)


    ScenEdit_SetEventCondition (EventDescriptionOrID,options)

    Sets the attributes of a T/C/A.

    Parameters

    • EventDescriptionOrID string The condition name/GUID to perform operation on
    • options { EventTCAUpdate } The options

    Returns

    { table }Table of options (new or previous value)


    ScenEdit_SetEventTrigger (EventDescriptionOrID,options)

    Sets the attributes of a T/C/A.

    Parameters

    • EventDescriptionOrID string The trigger name/GUID to perform operation on
    • options { EventTCAUpdate } The options

    Returns

    { table }Table of options (new or previous value)


    ScenEdit_SetKeyValue (key,value,forCampaign)

    Sets the value for a key in the persistent key store.

    This function allows you to add values,associated with keys,to a persistent store KeyStorethat is retained when the game is saved and resumed.Keys and values are both represented as non-nilstrings.The value is retrieved by ScenEdit_GetKeyValue.

    Parameters

    • key string The key to associate with
    • value string The value to associate
    • forCampaign boolean Pass the store to next scenario in campaign. Optional, default = false
    Example
    ScenEdit_SetKeyValue("A","B") ScenEdit_GetKeyValue("A")-- returns "B"


    ScenEdit_SetLoadout (loadoutinfo)

    Sets the loadout for a unit

    Parameters

    • loadoutinfo LoadoutInfo The loadout information to apply

    Returns

    booleanTrue


    ScenEdit_SetMine (side,guid,delay)

    update a mine

    Parameters

    • side string Side name or guid
    • guid string Mine guid
    • delay number The arming delay in seconds [optional]

    Returns

    booleantrue/false

    Example
    local a = ScenEdit_SetMine({side='Blue', guid='cccccccc', [delay=99999]} )


    ScenEdit_SetMission (SideName,MissionNameOrId,MissionOptions)

    Set details for a mission.

    Parameters

    • SideName string The mission side
    • MissionNameOrId string The mission name
    • MissionOptions Mission The mission options as a table.

    Returns

    MissionA mission descriptor if the mission exists or nilotherwise.

    Example
    local mission = ScenEdit_SetMission('USA','CV CAP Left',{TankerUsage=1,OnStation=2})


    ScenEdit_SetReferencePoint (descriptor)

    Update a reference point(s)with new values.

    Given a valid ReferencePointSelectoras part of the descriptor,the function wil update the values contained in the descriptor.Values may be omitted from the descriptor if they are intended to remain unmodified.The 'area'selector is useful for changing some common attribute,like locking or highlighting,in bulk.

    Additional key=value options are;
    NEWNAME='string'to rename a reference point
    TOGGLEHIGHLIGHTED =True to flip the reference point(s)highlight
    CLEAR =True to remove the 'relative to'of the reference point(s)

    Parameters

    • descriptor ReferencePoint A valid selector with other values to update.

    Returns

    ReferencePointThe reference point descriptor for the reference point or first one in the area.

    Example
    ScenEdit_SetReferencePoint({side="United States", name="Downed Pilot", lat=0.5})
    ScenEdit_SetReferencePoint({side="United States", name="Downed Pilot", lat=0.5, lon="N50.50.50", highlighted =true})
    ScenEdit_SetReferencePoint({side="United States", area={"rp-100","rp-101","rp-102","rp-103","rp-104"}, highlighted =true})

    ScenEdit_SetScore (side,score,reason)

    Sets a given side's score.

    Parameters

    • side string The name/GUID of the side
    • score number The new score for the side
    • reason string The reason for the score to change

    Returns

    numberThe new score for the side

    Example
    ScenEdit_SetScore("PlayerSide",20,"Reset score")


    ScenEdit_SetSideOptions (options)

    Set side options....AWARENESS and PROFICIENCY.(options)

    Parameters

    • options SideOptions The side items to be changed.

    Returns

    { SideOption }The side options

    Example
    ScenEdit_SetSideOptions('{side='SideA',awareness='OMNI',PROFICIENCY='ace')


    ScenEdit_SetSidePosture (sideAName,sideBName,posture)

    Set the posture of a side towards another.

    This will set side A's posture towards side B to the specified posture.This is the same as Stance,but only the first character of the name is used as shown in the table

    Posture codes:
    F Friendly
    H Hostile
    N Neutral
    U Unfriendly

    Parameters

    • sideAName string Side A's name or GUID
    • sideBName string Side B's name or GUID
    • posture string The posture of side A towards side B

    Returns

    booleanTrue/False for Successful/Failure

    Example
    ScenEdit_SetSidePosture("LuaSideA","LuaSideB","H")


    ScenEdit_SetSpecialAction (action_info)

    Sets the properties of an existing special action.

    Parameters


    ScenEdit_SetTime (new_time)

    Sets the scenario time (UTC).

    Parameters

    • new_time string The desired UTC datetime as a table in MM:DD:YYYY & HH:MM:SS or MM.DD.YYYY & HH.MM.SS format
    Example
    ScenEdit_SetTime({Date="2.12.2007", Time="22.46.23"})


    ScenEdit_SetTrigger (options)

    Sets the attributes of a trigger.

    Parameters

    Returns

    { table }Table of trigger options (new or previous value)


    ScenEdit_SetUnit (unit)

    Sets the properties of a unit that already exists.

    Parameters

    • unit Unit The unit to edit. Must be at least a selector.

    Returns

    UnitA complete descriptor for the added unit

    Example
    ScenEdit_SetUnit({side="United States", unitname="USS Test", lat =5})
    ScenEdit_SetUnit({side="United States", unitname="USS Test", lat =5})
    ScenEdit_SetUnit({side="United States", unitname="USS Test", lat =5, lon ="N50.20.10"})
    ScenEdit_SetUnit({side="United States", unitname="USS Test", newname="USS Barack Obama"})
    ScenEdit_SetUnit({side="United States", unitname="USS Test", heading=0, HoldPosition=1, HoldFire=1,Proficiency="Ace", Autodetectable="yes"})

    ScenEdit_SetUnitDamage (options)

    Set unit damage....for components on unit.(options)

    Parameters

    Returns

    ComponentThe unit's components object

    Example
    ScenEdit_SetUnitDamage({side='SideA', unitname='Ship', fires=1, components={ {'rudder','Medium'}, {'type',type='sensor',1} } })


    ScenEdit_SetUnitSide (sidedesc)

    Changes the side of a unit

    Parameters

    • sidedesc SideDescription The sides to change for the unit. Group will change attached units
    Example
    ScenEdit_SetUnitSide({side='Old Side', name='Eagle #1', newside='New Side'})


    ScenEdit_SetWeather (temperature,rainfall,undercloud,seastate)

    Set the current weather conditions.

    This function takes four numbers that describe the desired weather conditions.These conditions are applied globally.

    Parameters

    • temperature number The current baseline temperature (in deg C). Varies by latitude.
    • rainfall number The rainfall rate, 0-50.
    • undercloud number The amount of sky that is covered in cloud, 0.0-1.0
    • seastate number The current sea state 0-9.

    Returns

    booleanTrue/False for Successful/Failure

    Example
    ScenEdit_SetWeather(math.random(0,25),math.random(0,50),math.random(0,10)/10.0,math.random(0,9))


    ScenEdit_SetZone (sideName,zoneType,table)

    update no-nav or exclusion zone.
    ...Only need to pass the parts to update

    Parameters

    • sideName string Side name/GUID
    • zoneType string Type of zone to remove: 0 = no-nav, 1 = exclusion
    • table table Description, Isactive, Area { of RPs }, Affects { of UnitTypes }, MarkAs (exc only), Locked (non only)

    Returns

    Zone


    ScenEdit_SpecialMessage (side,message)

    Displays a special message consisting of the HTML text messageto side `side.Can include an optional location to jump to

    Parameters

    • side string The side name/guid to display the message on
    • message string The HTML text to display to the player

    ScenEdit_TransferCargo (fromUnit,toUnit,cargoList)

    Transfer cargo ..list from 'mother'to 'child'

    Parameters

    • fromUnit UnitSelector The unit with cargo
    • toUnit UnitSelector The unit to get cargo
    • cargoList Cargo List of cargo to transfer: table of {guids}, or { {number,DBID}, [{DBID}]}

    Returns

    booleanSuccessful or not


    ScenEdit_UnitC ()

    Detected Contact ...from a Unit Detected event trigger.Otherwise,a nilis returned.

    Note that UnitC()can also be used as a shortcut for ScenEdit_UnitC()

    Returns

    ContactA contact descriptor or nil


    ScenEdit_UnitX ()

    Activating Unit ..that triggered the current Event.Otherwise,a nilis returned.

    Note that UnitX()can also be used as a shortcut for ScenEdit_UnitX()

    Returns

    UnitThe triggering unit

    Example
    ScenEdit_SetUnitDamage({side=UnitX().side, unitname=UnitX().name, fires=1, components={ {'rudder','Medium'}, {'type',type='sensor',1} } })
    local unit = ScenEdit_UnitX()

    ScenEdit_UnitY ()

    Detecting Unit ...from a Unit Detected event trigger.Otherwise,a nilis returned.

    Note that UnitY()can also be used as a shortcut for ScenEdit_UnitY()

    Returns

    { table }The detecting unit and sensors used as {unit ={unit object},sensor ={[1]={name,type},[2]={name,type},etc}}

    Example
    ScenEdit_SetUnitDamage({side=UnitY().side, unitname=UnitY().name, fires=1, components={ {'rudder','Medium'}, {'type',type='sensor',1} } })
    local by = ScenEdit_UnitY() print('Y:');print( by) print('Detected by: ');print( by.unit.name ..' of type ' .. by.unit.type ..' from ' .. by.unit.side) print('Sensor: ');print( by.sensor[1].name ..' of type ' .. by.sensor[1].type);

    ScenEdit_UnloadCargo (fromUnit,cargoList)

    Unload cargo

    Parameters

    • fromUnit UnitSelector The unit with cargo
    • cargoList { Cargo } List of cargo to unload: table of {guids}, or { { number, DBID}}

    Returns

    boolean Successful or not


    ScenEdit_UpdateUnit (options)

    Update items on a unit.

    Parameters

    • options UpdateUnit The unit sensor/mount/weapon details to update

    Returns

    UnitThe updated unit

    Example
    ScenEdit_UpdateUnit({guid='2cd64757-1b66-4609-ad56-df41bee652e5',mode='add_sensor',dbid=3352})
    ScenEdit_UpdateUnit({guid='2cd64757-1b66-4609-ad56-df41bee652e5',mode='remove_sensor',dbid=3352,sensorId='871aea14-d963-4052-a7fc-ed36e97bb732'})
    ScenEdit_UpdateUnit({guid='2cd64757-1b66-4609-ad56-df41bee652e5',mode='delta',file='new.ini'})

    ScenEdit_UpdateUnitCargo (options)

    Update cargo on a unit.

    Parameters

    Returns

    UnitThe updated unit

    Example
    ScenEdit_UpdateUnitCargo({guid='2cd64757-1b66-4609-ad56-df41bee652e5', mode='add_cargo', cargo={{5,752},{700}} })
    ScenEdit_UpdateUnitCargo({guid='2cd64757-1b66-4609-ad56-df41bee652e5', mode='remove_cargo', cargo={'871aea14-d963-4052-a7fc-ed36e97bb732',{5,752}} })

    ScenEdit_UseAttachment (attachment)

    Import an attachment into the scene.

    Parameters

    • attachment string Either the name of the attachment (as shown in the properties section when created/added) or the GUID of the attachment

    ScenEdit_UseAttachmentOnSide (attachment,sidename)

    Use an attachment on a side (used for .inst files as attachments).

    Parameters

    • attachment string Either the name of the attachment (as shown in the properties section when created/added) or the GUID of the attachment
    • sidename string The name of the side to import the attachment into

    Tool_Bearing ()

    Get bearing between points.

    The points can be a GUID of a unit/contact or a latitude/longitude point.(fromHere,toHere)

    Returns

    numberThe bearing

    Example
    Tool_Bearing('8269b881-20ce-4f2e-baa0-6823e46d55a4','004aa55d-d553-428d-a727-26853737c8f4' )
    Tool_Bearing( {latitude='33.1991547589118', longitude='138.376876749942'},'8269b881-20ce-4f2e-baa0-6823e46d55a4' )

    Tool_DumpEvents ()

    Dump scenario events...useful for checking.Also writes a file to the scenario folder()

    Returns

    xmlDump of events with trigger/condition/action


    Tool_EmulateNoConsole ()

    Emulates no console...useful running event code in the console and seeing how it behaves as an 'event'(mode)

    Returns

    booleanIf interactive


    Tool_Range ()

    Get range between points.

    The points can be a GUID of a unit/contact or a latitude/longitude point.(fromHere,toHere)

    Returns

    numberThe horizontal distance in NM

    Example
    Tool_Range('8269b881-20ce-4f2e-baa0-6823e46d55a4','004aa55d-d553-428d-a727-26853737c8f4' )
    Tool_Range( {latitude='33.1991547589118', longitude='138.376876749942'},'8269b881-20ce-4f2e-baa0-6823e46d55a4' )

    VP_ExportUnits (table,filename)

    Export unit details

    ...to a file for later import parameters filename,filter by unit type,side

    Parameters

    • table table of Filters: TARGETSIDE, TARGETTYPE, TARGETSUBTYPE, SPECIFICUNITCLASS, SPECIFICUNIT. The values are like the Event Target triigers, but can take multiple ones. As in TargetType={'aircraft','submarine'}}
    • filename string of exported file

    Returns

    booleanSuccess or failure {Filter}


    VP_GetContact (ContactGUID)

    Get contact details This will get the information about a contact unit

    Parameters

    Returns

    Contact The information associated with the contact

    Example
    local side = VP_GetSide({name ="NATO"})
    local contacts = side.contacts --List Of contacts
    local guid = contacts[12].objectid -- GUID of a specific contact
    local a_contact = VP_GetContact({guid=guid}) -- details of contact as distinct to unit details


    VP_GetSide (side)

    Side information from player's perspective.

    Gets a side object from the perspective of the player.

    Parameters

    Returns

    SideInformation about the side selected,from the perspective of the player.

    Example
    local a = VP_GetSide({Side ='sidea'})-- a side objectlocal z = a.nonavzones--List of no-nav zones for the side if you need to find itlocal n = a : getnonavzone(z[1].guid)-- required zone object for a particular zonen.isactive =false-- turn it off


    VP_GetSides ()

    List of sides in the scenario.

    Parameters

    • None

    Returns

    Table Table of side references (name, guid)


    VP_GetUnit (ActiveOrContact)

    Get unit details This will get the information about an active unit or a contact unit

    Parameters

    • ActiveOrContact UnitSelector The unit selector to interrogate

    Returns

    UnitThe information associated with the unit


    World_GetCircleFromPoint (table)

    Returns a circle around point.

    Parameters

    Returns

    table Table of Points

    local circle = World_GetCircleFromPoint({latitude = '-37.8307390636104'longitude = '144.932549348204', numpoints = 12})

    World_GetElevation (location)

    Returns the elevation in meters of a given position

    Parameters

    • location Point The position to find the elevation of

    Returns

    number The elevation of the point in meters


    World_GetLocation (location)

    Returns table of details at a given position. These details are similar to what is shown by the map cursor box.

    Parameters

    • location Point The position to return the values for.

    Returns

    table {altitude, layer {ceiling, floor, strength}, cz{1, 2, 3, 4}, slope, cover {text, value}}


    World_GetPointFromBearing (table)

    Returns a location based on bearing.

    Parameters

    • table {latitude, longitude, distance, bearing}

    Returns

    Table of the new point

    local position = World_GetPointFromBearing({latitude = '-37.8307390636104'longitude = '144.932549348204', distance = 12, bearing = 90})

    Wrappers

    These define the information that is returned from some functions. This information can be usually modified either directly (object.field) or by a wrapper Set(..) function. The particular wrapper Set(..) function is preferred as some validation is performed on the input to ensure that it is within the bounds of the field being updated.


    AttackOptions

    Attack options.

    • mode string Targeting mode "AutoTargeted"|"0", "ManualWeaponAlloc"|"1"
    • mount number The attacker's mount DBID
    • weapon number The attacker's weapon DBID
    • qty number How many to allocate

    Contact

    This is from the perspective of the side being looked at. What is a contact for one side, may not be the same contact on another side. Note also the GUID of the contact is not the same as the actual unit. So depending on what functions you call, you may need to 'convert' the contact 'GUID' into the actual 'GUID' and call GetUnit() to process the actual GUID.

    • name string The contact name.
    • guid string The contact GUID. READ ONLY
    • actualunitid string The contact actual GUID. READ ONLY
    • latitude Latitude The latitude of the contact. READ ONLY
    • longitude Longitude The longitude of the contact. READ ONLY
    • speed number Speed if known READ ONLY
    • heading number Heading if known READ ONLY
    • altitude number Altitude if known READ ONLY
    • missile_defence number Applicable to Facility and Ships. -1 = unknown contact READ ONLY
    • age number How long has contact been detected (in seconds) READ ONLY
    • type string Type of contact. READ ONLY
    • typed number Type of contact. READ ONLY
    • areaofuncertainty LatLon Table of points defining the area of contact. READ ONLY
    • type_description string Contact type description. READ ONLY
    • actualunitdbid number Actual contact type. READ ONLY
    • classificationlevel string Contact classification. READ ONLY
    • potentialmatches EMmatch Table {EMmatch} on potential EMCON emission matches. READ ONLY
    • side Side Contact's actual side. READ ONLY
    • fromside Side The side who sees this contact. READ ONLY
    • detectedBySide Side The side who originally saw this contact. Would be same as fromside unless shared READ ONLY
    • posture string Posture towards contact.
    • FilterOut boolean True to filtered out contact
    • weather Weather Table of weather parameters (temp, rainfall, underrain, seastate)
    • BDA table Table of battle damage assessment (fires, flood, structural)
    • emissions Emissions Table of detected emmissions from contact
    • detectionBy table Table of how long ago was detected by type (radar, esm, visual, infrared, sonaractive, sonarpassive)
    • targetedBy table Table of unit guids that have this contact as a target
    • firingAt table Table of contact guids that this contact is firing at
    • firedOn table Table of guids that are firing on this contact
    • DropContact method () Drops contact from the reporting side
    • inArea method ({area}) Is contact in the 'area' defined by table of RPs (true/false)

    Doctrine

    Doctrine options.

    For each field, adding the suffix "_player_editable" determines if the player can alter the setting. Not applicable to the Withdraw/Deploy options.

    When setting the option, the indicated value or it's number can be used.

    • use_nuclear_weapons boolean True if the unit should be able to employ nuclear weapons
    • engage_non_hostile_targets boolean True if the unit should attempt hostile action against units that are not hostile
    • rtb_when_winchester boolean (obsolete, see the new doctrine options) True if the unit should return to base when out of weapons
    • ignore_plotted_course boolean True if the unit should ignore plotted course
    • engaging_ambiguous_targets string Ignore(0), Optimistic(1), or Pessimistic(2)
    • automatic_evasion boolean True if the unit should automatically evade
    • maintain_standoff boolean True if the unit should try to avoid approaching its target, only valid for ships
    • use_refuel_unrep string Always_ExceptTankersRefuellingTankers(0), Never(1), Always_IncludingTankersRefuellingTankers(2)
    • engage_opportunity_targets boolean True if the unit should take opportunistic shots
    • use_sams_in_anti_surface_mode boolean True if SAMs should be used to engage surface targets
    • ignore_emcon_while_under_attack boolean True if EMCON should be ignored and all systems should go active when engaged
    • quick_turnaround_for_aircraft string Yes(0), FightersAndASW(1), No(2)
    • air_operations_tempo string Surge(0), Sustained(1)
    • kinematic_range_for_torpedoes string AutomaticAndManualFire(0), ManualFireOnly(1), No(2)
    • weapon_control_status_air string Free(0), Tight(1), Hold(2)
    • weapon_control_status_surface string Free(0), Tight(1), Hold(2)
    • weapon_control_status_subsurface string Free(0), Tight(1), Hold(2)
    • weapon_control_status_land string Free(0), Tight(1), Hold(2)
    • refuel_unrep_allied string Yes(0), Yes_ReceiveOnly(1), Yes_DeliverOnly(2), No(3)
    • fuel_state_planned string Bingo(0), Joker10Percent(1), Joker20Percent(2), Joker25Percent(3), Joker30Percent(4), Joker40Percent(5), Joker50Percent(6), Joker60Percent(7), Joker70Percent(8), Joker75Percent(9), Joker80Percent(10), Joker90Percent(11)
    • fuel_state_rtb string No(0), YesLastUnit(1), YesFirstUnit(2), YesLeaveGroup(3)
    • weapon_state_planned WeaponDoctrine See Weapon Doctrine table below
    • weapon_state_rtb string No(0), YesLastUnit(1), YesFirstUnit(2), YesLeaveGroup(3)
    • gun_strafing string No(0), Yes(1)
    • jettison_ordnance string No(0), Yes(1)
    • avoid_contact string No(0), Yes_ExceptSelfDefence(1), Yes_Always(2)
    • dive_on_threat string Yes(0), Yes_ESM_Only(1), Yes_Ships20nm_Aircraft30nm(2), No(3)
    • recharge_on_patrol string Recharge_Empty(0), Recharge_10_Percent(10), Recharge_20_Percent(20), Recharge_30_Percent(30), Recharge_40_Percent(40), Recharge_50_Percent(50), Recharge_60_Percent(60), Recharge_70_Percent(70), Recharge_80_Percent(80), Recharge_90_Percent(90)
    • recharge_on_attack string Recharge_Empty(0), Recharge_10_Percent(10), Recharge_20_Percent(20), Recharge_30_Percent(30), Recharge_40_Percent(40), Recharge_50_Percent(50), Recharge_60_Percent(60), Recharge_70_Percent(70), Recharge_80_Percent(80), Recharge_90_Percent(90)
    • use_aip string No(0), Yes_AttackOnly(1), Yes_Always(2)
    • dipping_sonar string Automatically_HoverAnd150ft(0), ManualAndMissionOnly(1)
    • bvr_logic string StraightIn(0), Crank(1), Drag(2)
    • withdraw_on_damage string Ignore(0), Percent5(1), Percent25(2), Percent50(3), Percent75(4)
    • withdraw_on_fuel string Ignore(0), Bingo(1), Percent25(2), Percent50(3), Percent75(4), Percent100(5)
    • withdraw_on_attack string Ignore(0), Exhausted(1), Percent25(2), Percent50(3), Percent75(4), Percent100(5), LoadFullWeapons(6)
    • withdraw_on_defence string Ignore(0), Exhausted(1), Percent25(2), Percent50(3), Percent75(4), Percent100(5), LoadFullWeapons(6)
    • deploy_on_damage string Ignore(0), Percent5(1), Percent25(2), Percent50(3), Percent75(4)
    • deploy_on_fuel string Ignore(0) Bingo(1), Percent25(2), Percent50(3), Percent75(4), Percent100(5)
    • deploy_on_attack string Ignore(0), Exhausted(1), Percent25(2), Percent50(3), Percent75(4), Percent100(5), LoadFullWeapons(6)
    • deploy_on_defence string Ignore(0), Exhausted(1), Percent25(2), Percent50(3), Percent75(4), Percent100(5), LoadFullWeapons(6)

    DoctrineWRA

    WRA Doctrine options.
    • weapon_dbid string Weapon number [info]
    • weapon_name string Weapon name [info]
    • target_type TargetTypeWRA Type of target [info]
    • level string The doctrine selected (at unit/mission/side) - useful Is just using GUIDs [info]
    • wra WRA The WRA doctrine for a single weapon, or wra_# for each weapon against a specific target_type

    Event

    Event details .
    • name string The event name.
    • guid string The event GUID. READ ONLY
    • description string The event GUID.
    • details table The details of the event with tables for triggers/conditions/actions. READ ONLY
    • isActive boolean The event is active
    • isRepeatable boolean The event repeats
    • isShown boolean The event shows in log
    • probability string The event chance to occur (0-100)
    • actions table The details of the actions in event READ ONLY
    • conditions table The details of the conditions in event READ ONLY
    • triggers table The details of the triggers in event READ ONLY
    Example
    -- first trigger; as a 'Unit Detected'; what was the target filter values
    local Event = ScenEdit_EventX()
    -- current active event
    print(event.details.triggers[1].UnitDetected.TargetFilter)

    Group

    Group details.
    • type string Type of group. READ ONLY
    • guid string READ ONLY
    • name string
    • side string READ ONLY
    • lead string Group leader guid
    • unitlist table Table of unit GUIDs in the group. READ ONLY

    Loadout

    Loadout.

    Mission

    Mission.
    • guid string The GUID of the mission. READ ONLY
    • name string Name of mission
    • isactive boolean True if mission is currently active
    • side string Mission belongs to side
    • starttime DateTime Time mission starts
    • endtime DateTime Time mission ends
    • type MissionClass Mission class(patrol,strike,etc). READ ONLY
    • subtype MissionSubClass Mission class(asw,land,etc). READ ONLY
    • SISH boolean 'Scrub if side human' tick box
    • unitlist GUID A table of units assigned to mission. READ ONLY
    • targetlist GUID A table of targets assigned to mission. READ ONLY
    • aar AAR A table of the mission air-to-air refueling options. READ ONLY
    • ferrymission FerryMission A table of the mission specific options. READ ONLY
    • mineclearmission MineClearMission A table of the mission specific options. READ ONLY
    • minemission MineMission A table of the mission specific options. READ ONLY
    • supportmission SupportMission A table of the mission specific options. READ ONLY
    • patrolmission PatrolMission A table of the mission specific options. READ ONLY
    • strikemission StrikeMission A table of the mission specific options. READ ONLY
    • cargomission CargoMission A table of the mission specific options. READ ONLY

    ReferencePoint

    Reference point information.
    • guid string The unique identifier for the reference point
    • side string The side the reference point is visible to
    • name string The name of the reference point
    • latitude Latitude The latitude of the reference point
    • longitude Longitude The longitude of the reference point
    • highlighted boolean True if the point should be selected
    • locked boolean True if the point is locked
    • bearingtype bearing Type of bearing Fixed (0) or Rotating (1)
    • relativeto Unit The unit that reference point is realtive to

    RefuelOptions

    Unit refueling options.
    • unitSelector UnitSelector A normal unit selector defining the unit.
    • tanker string A specific tanker defined by its name (side is assumed to be the same as unit) or GUID.
    • missions mission A table of mission names or mission GUIDs.
    Example
    {side="United States", name="USS Test", missions={"Pitstop"}, tanker="Hose #1"}

    Side

    Side perspective
    • guid string The GUID of the side.
    • name string The name of the side.
    • units SideUnit Table of units for the designated side. READ ONLY
    • contacts SideContact Table of current contacts for the designated side. READ ONLY
    • exclusionzones Zone Zones for the designated side READ ONLY
    • nonavzones Zone Zones for the designated side READ ONLY
    • rps Zone RPs for the designated side READ ONLY
    • awareness Awareness READ ONLY
    • proficiency Proficiency READ ONLY
    • hasmines boolean READ ONLY
    • losses Table of losses to date - {type, dbid, name, number}
    • expenditures Table of expenditure to date - {type, dbid, name, number}
    • missions Table of Mission wrappers for missions on the side

    • getexclusionzone method (ZoneGUID|ZoneName|ZoneDescription) Returns matching Zone or nil
    • getnonavzone method (ZoneGUID|ZoneName|ZoneDescription) Returns matching Zone or nil
    • unitsBy method (UnitType[[,Category],Subtype]) Returns table of units filtered by type of unit or nil.
      local u = side:side:unitsBy('Ship') -- all ships
      u = side:unitsBy('Ship', 2002, 3003) -- ships fitered for 'Surface combatant' and 'BBC'
    • contactsBy method (UnitType) Returns table of current contacts filtered by type of unit or nil.
    • unitsInArea method ({Area[,TargetFilter]}) Returns table of units {name,guid} filtered by type of unit
      Example
      local u = side:unitsInArea({Area = { 'RP-3137', 'RP-3139', 'RP-3136', 'RP-3138'}, TargetFilter = { TargetType = 'Ship' } })

    Special action

    Special action details
    • name string The event name.
    • guid string The event GUID. READ ONLY
    • description string The event GUID.
    • isActive boolean The event is active
    • isRepeatable boolean The event repeats
    • side string The side GUID
    • ScriptText string The Lua script

    Unit

    Represents an active unit.

    • type string The type of object, may be 'Facility', 'Ship', 'Submarine', or 'Aircraft'.READ ONLY
    • name string The unit's name.
    • side string The unit's side. READ ONLY
    • guid string The unit's unique ID. READ ONLY
    • subtype string The unit's subtype (if applicable). READ ONLY
    • base Unit The unit's assigned base.
    • latitude Latitude The latitude of the unit.
    • longitude Longitude The longitude of the unit .
    • DBID number The database ID of the unit READ ONLY
    • altitude number The altitude of the unit in meters.
    • speed number The unit's current speed.
    • throttle Throttle The unit's current throttle setting.
    • autodetectable boolean True if the unit is automatically detected.
    • holdposition boolean True if the unit should hold.
    • holdfire table Doctrine WCS setting for {air,surface,subsurface,land}. READ ONLY
    • heading number The unit's heading .
    • proficiency string The unit proficiency, "Novice"|0, "Cadet"|1,"Regular"|2, "Veteran"|3, "Ace"|4.
    • newname string If changing existing unit, the unit's new name .
    • course WayPoint The unit's course, as a table of waypoints
    • fuel Fuel A table of fuel types used by unit.
    • fuels Fuel A table of fuel types in tanks used by unit.
    • mission Mission The unit's assigned mission. Can be changed by setting to the Mission name or guid (calls ScenEdit_AssignUnitToMission)
    • group Group The unit's group (if applicable). Can be changed assigning an existing or new name. It will try to create a group if new (experimental)
    • airbornetime number how long aircraft has been flying. READ ONLY
    • loadoutdbid number current aircraft loadout DBID. READ ONLY
    • readytime number how long aircraft/ship takes to be ready. READ ONLY
    • unitstate string Message on unit status. READ ONLY
    • fuelstate string Message on unit fuel status. READ ONLY
    • weaponstate string Message on unit weapon status. READ ONLY
    • condition_v string Docking/Air Ops condition value. READ ONLY
    • condition string Message on unit dock/air ops status. READ ONLY
    • classname string Unit class name READ ONLY
    • manualSpeed string or number Desired speed or 'OFF' to turn off manual mode
    • manualAltitude string or number Desired altitude/depth or 'OFF' to turn off manual mode
    • damage table Table {dp,flood,fires,startDp} of start and current DP, flood and fire level. READ ONLY
    • magazines Magazine A table of magazines (with weapon loads) in the unit or group. Can be updated by ScenEdit_AddWeaponToUnitMagazine READ ONLY
    • mounts Mount A table of mounts (with weapon loads) in the unit or group. Can be updated by ScenEdit_AddReloadsToUnit READ ONLY
    • components Component A table of components on the unit. READ ONLY
    • ascontact table A table {side,guid,name} of this unit seen from the other sides (as contacts). READ ONLY
    • weather Weather Table of weather parameters (temp, rainfall, underrain, seastate)
    • areaTriggersFired table Table of active 'in area' triggers that have fired for unit
    • OODA table Table contain unit's "observe, orient, decide, act" values {evasion, targeting, detection}
    • embarkedUnits table Table of boats and aircraft docked/embarked on the unit
    • assignedUnits table Table of boats and aircraft assigned to the unit (base)
    • weapon table Table of shooter unit, at contact unit and detonated (when destroyed) if a weapon READ ONLY
    • targetedBy table Table of unit guids that have this unit as a target
    • firingAt table Table of contact guids that this unit is firing at
    • firedOn table Table of guids that are firing on this unit
    • formation table Table of unit's formation info {bearing, type (of bearing), distance, sprint (and drift)
    • sprintDrift boolean Sprint and drift 'True/False'
    • hostFacility Facility Where unit is hosted
    • cargo Cargo Unit cargo information
    • RTB boolean Trigger the unit to return to base
    • outOfComms boolean is unit connected to side comms network (false = connected) READ ONLY
    • AI_EvaluateTargets_enabled boolean AI evaluates targets
    • AI_DeterminePrimaryTarget_enabled boolean AI determines primary target
    • obeyEMCON boolean Unit obeys EMCON. Turn off to manually set sensors
    • category Number The unit category code for the Aircraft, Facility, Ship, Submarine or Satellite.
    • sensors Sensor Unit sensor information
    • inArea method ({area}) Is unit in the 'area' defined by table of RPs (true/false)
    • delete method () Immediately removes unit object
    • filterOnComponent method (type) Filters unit on type of component and returns a Component table.
    • rangetotarget method ('contactid') Calculate flat distance to a contact location
    • Launch method (true/false) Trigger the unit to launch from base (true) or abort launch (false)
    Modifiable through ScenEdit_ functions only
    • refuel boolean Trigger the unit to attempt an UNREP
    • RTB boolean Trigger the unit to return to base
    • moveto boolean Set a desired alt/depth instead of jumping to actual
    • manualSpeed string or number Desired speed or 'OFF' to turn off manual mode
    • manualThrottle string or number Desired throttle or 'OFF' to turn off manual mode
    • manualAltitude string or number Desired altitude/depth or 'OFF' to turn off manual mode
    • sensors Sensor Sensors set to active or inactive in table format (sensor_guid,sensor_isactive)

    Zone

    Exclusion/No navigatation zone.
    • guid string The GUID of the zone. READ ONLY
    • description string The description of the zone.
    • isactive boolean Zone is currently active.
    • area ZoneMarker A set of reference points marking the zone. Can be updated by a list of RPs, or a table of new RP values.
    • affects unitTypes List of unit types (ship, submarine, aircraft, facility)
    • locked boolean Zone is locked.
    • markas Posture Posture of violator of exclusion zone.

    Selectors

    These define the information required as part of the 'select' process for the functions. In the case of functions that 'add' things, these are also key elements to the adding process. Other properties may be included in the 'selector' such as when updating an existing table.

    When selecting units, it is preferrable to use the GUID as the identifier for a precise match. If not, then the side and name for a more limited search. And as a last option, just the name which search all units in the scenario. When using just the name, usually the first matching name is returned. This is okay if the names are unique. Thus including the side, it will only check the units on that side for a match.


    ActionUpdate

    Action update.

    • ID string The GUID of the action [READONLY]
    • Description string Description or GUID of action
    • NewName string If specified, the new name of the action
    • Mode string Operation to do - 'list', 'add', 'remove', 'update' (default) SE_Set...()
    • Type string Type of action [required only for 'add' option]

    Note: Other various values apply to the type of action.


    ConditionUpdate

    Condition update.

    • ID string The GUID of the condition [READONLY]
    • Description string Description or GUID of condition
    • NewName string If specified, the new name of the condition
    • Mode string Operation to do - 'list', 'add', 'remove', 'update' (default) SE_Set...()
    • Type string Type of condition [required only for 'add' option]

    Note: Other various values apply to the type of condition.


    ContactSelector

    Contact selector.

    Note: A unit and its contact GUIDs are different for the same physical unit. The contact GUIDs represent contacts associated with this unit from the perspective of any detecting sides.

    • side string The side to find the the contact on.
    • guid string The GUID of the contact. Interrogate ScenEdit_GetContacts(side) for the side's contacts and use the GUID from there.

    DamageOptions

    Unit damage. The component table list consists of entries for each component, identified by guid and new level.

    Special Cases
    • if guid is 'type', then you can set a type of component to be damaged,
    • if damageLevel is 'none', then the component will be repaired.
    • side string
    • unitname string
    • guid string
    • fires string
    • flood string
    • dp number Damage points
    • components table Table of component damage setting { guid, damageLevel }
    Example
    components={{'16a883a2-8e7f-4313-aae7-0af644c16337','none'},{'rudder','Medium'},{'type',type='sensor',1}}}')

    DoctrineSelector

    Selects a doctrine for a side, mission, group or unit.

    • side string The side to select/from
    • mission string The name of the mission to select
    • unitname string The name of the unit (or group) to select
    • actual boolean =true Show the actual doctrine setting based on doctrine inheritance (defaults to only showing non-inherited values)
    • escort boolean If a strike mission, adding 'escort=true' will update the escort doctrine

    DoctrineWRASelector

    Selects a WRA doctrine for on a side, group, mission, or unit. weapon_id is mandatory.

    One of side, mission, unitname or guid is mandatory. One of contact_id or target_type is mandatory

    If no weapon_id is supplied but just the target_type, then a WRA table (WRA_#) is returned for each weapon for the doctrine that can engage the target_type

    • side string The side to select/from
    • mission string The name of the mission to select
    • unitname string The name of the unit to select
    • guid string The unit GUID to select
    • weapon_id string The weapon database id
    • contact_id string A contact GUID (mutually exclusive with target_type)
    • target_type string The target type (mutually exclusive with contact_id)

    EventTCAUpdate

    Event Trigger/Condition/Action update.
    • GUID string The GUID of the trigger
    • Description string The description or ID of the T/C/A
    • Mode string Operation to do - 'add', 'remove', replace', 'update' (default) SE_Set...()

    EventUpdate

    Event update.
    • ID string The GUID of the event [READONLY]
    • Description string If specified, the new description for the event
    • NewName string If specified, the new name of the event
    • IsActive boolean If the event is active
    • IsRepeatable boolean If the event can occur multiple times
    • IsShown boolean If the event is shown in message log
    • Probability number Chance of it happening
    • Mode string Operation to do - 'add', 'update' (default), 'remove'

    NewMission

    New mission options.
    • type string Mission sub-type (Applies to Patrol and Strike)
    • destination string Ferry mission destination
    • zone string A table of reference points as names or GUIDs (Can apply to Patrol, Support, Mining, Cargo)

    NewUnit

    New unit selector.

    ... lists minimum fields required. Other fields fromUnit may be included.

    • type string The type of unit (Ship, Sub, Aircraft, Facility, Satellite, Weapon)
    • unitname string The name of the unit
    • side string The side name or GUID to add unit to
    • dbid number The database id of the unit
    • latitude Latitude Not required if abase is defined
    • longitude Longitude Not required if abase is defined
    • base string Unit base name or GUID where the unit will be 'hosted' (applicable to AIR, SHIP, SUB)
    • loadoutid number Aircraft database loadout id (applicable to AIR)
    • altitude number Unit altitude (applicable to AIR)
    • depth number Unit depth (applicable to SUBMARINE - note no sign)
    • orbit number Orbit index (applicable to SATELLITE)
    • guid string Optional custom GUID to override auto one

    ReferencePointSelector

    Reference point selector.

    To select reference point(s), specify either

    • name andside, to select a reference pointname belonging toside [name AND side if possible] or
    • guid, if the unique ID of the reference point is known [preferred] or
    • area, table of reference points (name or guid)

    GUID method takes precedence over name/side if both present.

    • side string The side the reference point is visible to
    • name string The name of the reference point
    • guid string The unique identifier for the reference point
    • area name or GUID Table of reference points by name and/or guid (used with the Set()/Get() functions)

    SideOption

    Side options.
    • side string Side name
    • guid string Side guid
    • awareness string Side awareness
    • proficiency string Side proficiency
    • switchto boolean Change game side to above (only applicable with SetSideOptions)

    SpecialAction

    Special action selector.
    • GUID string The GUID of the special action [READONLY]
    • ActionNameOrID string The name or ID of the special action
    • IsActive boolean If the action is visible to the player
    • IsRepeatable boolean If the player can use the action multiple times
    • NewName string If specified, the new name of the action
    • Description string If specified, the new description for the action
    • Side string The name/GUID of the side for the action. Mandatory for AddSpeciaAction()
    • Mode string If specified, the action to apply. Use "mode='remove'" to delete the SA. Use "mode='list'" to list the SAs - all are listed unless 'side=' is supplied.
    • ScriptText string The Lua script for the SA. Note as the script is a multi line string, it requires a '\r\n' to be appended after each line so it is formated in the Editor.

    TargetFilter

    Filter by side, type, subtype, unitclass, unit in that order.
    • TargetSide string The side name or GUID
    • TargetType string Type of unit (ship, sub, etc)
    • targetSubType string Subtype of unit ( )
    • SpecificUnitClass number Class of unit ( )
    • SpecificUnit string Name or GUID of unit

    TriggerUpdate

    Trigger update.
    • ID string The GUID of the trigger [READONLY]
    • Description string Description or GUID of trigger
    • NewName string If specified, the new name of the trigger
    • Mode string Operation to do - 'list', 'add', 'remove', 'update' (default) SE_Set...()
    • Type string Type of trigger [required only for 'add' option]

    Note: Other various values apply to the type of trigger.


    UnitSelector

    Select a unit based on either the side and name or the unique identifier (GUID).

    You can use either:

    • name and side;
    • or GUID.

    If both are given, then the GUID is used preferentially.

    • name string The name of the unit to select
    • side string The side of the unit to select
    • guid string The guid of the unit to select

    UpdateUnit

    Lists minimum fields required. Other fields from Unit may be included. For the 'delta' mode, the function willl look for a matching GUID (or unit name if no GUID match) in the INI file.

    • guid string The unit identifier
    • mode string The function to perform (add_ sensor,remove_ sensor,add_ mount,remove_ mount,add_ weapon,remove_ weapon,add_comms,remove_comms,delta)
    • dbid number The database id of the item to add [required for 'add_' mode]. If used with 'remove_' mode, and no sensorid/mountid, the first matching DBID will be removed.
    • sensorid string The identifier (guid) of the particular sensor to remove [required for remove_ sensor mode]
    • mountid string The identifier (guid) of the particular mount to remove [required for remove_ mount mode]
    • weaponid string The identifier (guid) of the particular weapon to remove [required for remove_ weapon mode]. Must have a preceeding mountid to update
    • commsid string The identifier (guid) of the particular communication device to remove [required for remove_ mount mode]
    • file string File name of the INI delta to apply [required for delta mode]
    • arc_detect Arc The effective arcs for the particular sensor to detect in [override defaults]
    • arc_track Arc The effective arcs for the particular sensor to track/illuminate in [override defaults]
    • arc_mount Arc The effective arcs for the particular mount [override defaults]

    UpdateUnitCargo

    Lists minimum fields required. Other fields from Unit may be included.

    • guid string The unit identifier
    • mode string The function to perform (add_ cargo,remove_ cargo)
    • cargoList { Cargo } List of cargo to update: table of {guids}, or { {number, DBID}}

    VPContactSelector

    Contact selector.

    • guid string The GUID of the contact. Interrogate VP_GetSide().contacts for the side's contacts and use the GUID from there.

    Note: A unit and its contact GUIDs are different for the same physical unit. The contact GUIDs represent contacts associated with this unit from the perspective of any detecting sides.


    Weapon2Magazine

    Select magazine and weapon. A group magazine, for example, tend to have multiple magazines, with the same name. So you can specify a particular magazine by the GUID--or leave it out and the function will try to fill up any available space with the weapon.

    • side string The side name/GUID of the unit with magazine
    • unitname string The name/GUID of unit with magazine
    • guid string GUID of the unit with magazine
    • mag_guid string The magazine GUID
    • wpn_dbid string The weapon database ID
    • number number Number to add
    • maxcap number Maximum capacity of the weapon to store
    • remove boolean If true, this will debuct the number of weapons
    • new boolean If true, will add the weapon if it does not exist
    • fillout boolean If true, will fill out the weapon record to its maximum

    Weapon2Mount

    Select mount and weapon. You can specify a particular mount by the GUID--or leave it out and the function will try to fill up any available space with the weapon.

    • side string The side name/GUID of the unit with mount
    • unitname string The name/GUID of unit with mount
    • guid string GUID of the unit with mount
    • mount_guid string The mount GUID
    • wpn_dbid string The weapon database ID
    • number number Number to add
    • remove boolean If true, this will debuct the number of weapons
    • fillout boolean If true, will fill out the weapon record to its maximum

    Tables



    AAR

    Air-to-Air Refueling options; these are updated by ScenEdit_SetMission()

    Fields

    • use_refuel_unrep string This is same as the one from Doctrine setting
    • tankerUsage string or number Automatic(0), Mission(1)
    • launchMissionWithoutTankersInPlace boolean
    • tankerMissionList {mission name or GUID Table of missions to use as source of refuellers
    • tankerMinNumber_total number
    • tankerMinNumber_airborne number
    • tankerMinNumber_station number
    • maxReceiversInQueuePerTanker_airborne number
    • fuelQtyToStartLookingForTanker_airborne number Percentage of fuel (0-100)
    • tankerMaxDistance_airborne string or number Use 'internal' or set a range. The code will match the lowest availble setting

    Cargo

    Cargo in ship/air or dock facility

    Fields

    • GUID string GUID
    • dbid number Database ID
    • name string Name
    • type number Type
    • status string Status
    • area number Cargo unit area
    • crew number Cargo unit crew
    • mass number Cargo unit mass
    • quantity number Items present
    • damage string Damage
    • statusR string Inoperative reason

    CargoMission

    CargoMission options; these are updated by ScenEdit_SetMission()

    Fields

    • oneThirdRule boolean True if activated
    • transitThrottleAircraft string
    • transitAltitudeAircraft string
    • stationThrottleAircraft string
    • stationAltitudeAircraft string
    • transitThrottleSubmarine string
    • transitDepthSubmarine string
    • stationThrottleSubmarine string
    • stationDepthSubmarine string
    • transitThrottleShip string
    • stationThrottleShip string
    • useFlightSize boolean True if minimum size required
    • useGroupSize boolean True if minimum size required
    • zone name or GUID Table of reference point names and/or GUIDs

    Component

    This identifies the component/item(s) that are present in a unit. SeeUnit:filterOnComponent on how to filter this table

    Fields

    • comp_GUID string GUID
    • comp_dbid string Database ID
    • comp_name string Name
    • comp_type string Type of component (mount, sensor, rudder, etc)
    • comp_status string Status
    • comp_statusR string Reason why inoperative [if not operational]
    • comp_damage string Damage Severity [if not operational]

    EMmatch

    EM matches details

    Fields

    • dbid number Databse id.
    • name string Matching id name.
    • category string Not applicable to weapons (Missile,Torpedo)
    • type string Not applicable to Facility
    • subtype number Type of item within the contact type ( subtype is "Fighter" within scope of Aircraft)
    • missile_defence number Applicable to Facility and Ships

    Emissions

    Contact emission details

    Fields

    • name string
    • age number Time detection held
    • solid string Precise detected (True/false)
    • sensor_dbid number Databse id.
    • sensor_name string Sensor name.
    • sensor_type string Sensor type
    • sensor_role string Sensor role
    • sensor_maxrange number Sensor range

    Explosion

    Defines the warhead to detonate.

    Fields

    • warheadid number The ID of the warhead to detonate
    • lat Latitude The latitude of the detonation
    • lon Longitude The longitude of the detonation
    • altitude Altitude The altitude of the detonation
    Example
      {warheadid=253 , lat=unit.latitude, lon=unit.longitude, altitude=unit.altitude}

    Facility

    Facility air or dock facility

    Fields

    • GUID string GUID
    • dbid number Database ID
    • name string Name
    • type number Type
    • status string Status
    • capacity number Units present

    FerryMission

    FerryMission options; these are updated by ScenEdit_SetMission()

    Fields

    • ferryBehavior string Values OneWay(0), Cycle(1), Random(2)
    • ferryThrottleAircraft string
    • ferryAltitudeAircraft string
    • ferryTerrainFollowingAircraft boolean
    • flightSize Size
    • minAircraftReq string
    • useFlightSize boolean

    Fuel

    The various types of fuel(s), and their state, carried by the unit. Use ScenEdit_SetUnit() to set the fuel rather than the unit.fuel. ScenEdit_SetUnit({...,fuel={{'GasFuel',1500},{2001,8000}}..})/. It is easier and less prone to error; you can use the fuel name or the fuel number code.

    Fuel Types

    • Description = Code
    • NoFuel = 1001
    • AviationFuel = 2001
    • DieselFuel = 3001
    • OilFuel = 3002
    • GasFuel = 3003
    • Battery = 4001
    • AirIndepedent = 4002
    • RocketFuel = 5001
    • TorpedoFuel = 5002
    • WeaponCoast = 5003

    Fields

    • fueltype {FuelState} The state of the type(s) of fuel in the unit.

    Note: The type is normally 4 digits. Use .fuels to get any breakdown of multiple tanks if present.

    Example
    local u = ScenEdit_GetUnit(...)
    local fuel = u.fuel
    fuel[3001].current =400
    u.fuel = fuel

    FuelState

    Status of a fueltype.

    Fields

    • current number The current fuel level of the type
    • max number How much can be stored for the type
    • name string Name of the fuel
    Example
    local fuel = u.fuel
    fuel[3001].current = 400
    u.fuel = fuel

    HostUnit

    Requests that a unit be hosted/based to another

    Fields

    • HostedUnitNameOrID string The name or GUID of the unit to put into the host
    • SelectedHostNameOrID string The name or GUID of the host to put the unit into use SetUnit() with 'base=xxx' to assign the unit to a 'base'

    LatLon

    A Position on the map, referred to with latitude (north/south) and longitude (east/west) coordinates. These can be represented in two forms, degrees minutes seconds, and decimal degrees. The Command Lua API supports both forms.

    A set of latitude and longitude to define a point. Within the simulation, the values are recorded in decimal degrees.

    Fields

    • latitude number
    • longitude number

    LoadoutInfo

    Information on a loadout to add/alter

    Fields

    • UnitName string The name/GUID of the unit to change the loadout on
    • LoadoutID number The ID of the new loadout; 0 = use the current loadout
    • TimeToReady_Minutes number How many minutes until the loadout is ready (default = database loadout time) (_optional_)
    • IgnoreMagazines boolean If the new loadout should rely on the magazines having the right weapons ready (default = false) (_optional_)
    • ExcludeOptionalWeapons boolean Exclude optional weapons from loadout (default = false) (_optional_)
    • Wpn_DBID number Weapon DB number - required if WPN_GUID is not supplied
    • Wpn_GUID string Actual weapon to update - DBID is not required as this take precedence (_optional_)
    • Number number Number to change current weapon load by (sign ignored)
    • Remove boolean Deduct 'number' rather than add

    Magazine

    Magazine.

    Note: When dealing with a magazine in a unit, it may constist of one or more actual magazine 'blocks'. This is what is being referred to here, rather than the ONE magazine group for the unit/group.

    Fields

    • mag_capacity string Capacity|Storage
    • mag_dbid string Database ID
    • mag_GUID string GUID
    • mag_name string Name
    • mag_weapons WeaponLoaded Table of weapon loads in magazine

    MineClearMission

    MineClearMission options; these are updated by ScenEdit_SetMission()

    Fields

    • oneThirdRule boolean
    • transitThrottleAircraft string
    • transitAltitudeAircraft string
    • transitTerrainFollowingAircraft boolean
    • stationThrottleAircraft string
    • stationAltitudeAircraft string
    • stationTerrainFollowingAircraft boolean
    • transitThrottleSubmarine string
    • transitDepthSubmarine string
    • stationThrottleSubmarine string
    • stationDepthSubmarine string
    • transitThrottleShip string
    • stationThrottleShip string
    • flightSize Size
    • minAircraftReq string
    • useFlightSize boolean
    • groupSize Size
    • useGroupSize boolean
    • zone name or GUID Table of reference point names and/or GUIDs

    MineMission

    MineMission. .. options; these are updated by ScenEdit_SetMission()

    Fields

    • oneThirdRule boolean
    • transitThrottleAircraft string
    • transitAltitudeAircraft string
    • transitTerrainFollowingAircraft boolean
    • stationThrottleAircraft string
    • stationAltitudeAircraft string
    • stationTerrainFollowingAircraft boolean
    • transitThrottleSubmarine string
    • transitDepthSubmarine string
    • stationThrottleSubmarine string
    • stationDepthSubmarine string
    • transitThrottleShip string
    • stationThrottleShip string
    • flightSize Size
    • minaircraftreq string
    • useFlightSize boolean
    • groupSize Size
    • useGroupSize boolean
    • zone table Table of reference point names and/or GUIDs
    • armingdelay time In format of 'days:hours:minutes:seconds' e.g. 1 day, 4 hours, 30 minutes would be '1:4:30:0'

    Mount

    A mount is similar to a magazine, but it refers to the actual loads on the weapon, rather than a storage area.

    Fields

    • mount_dbid string Database ID
    • mount_GUID string GUID
    • mount_name string Name
    • mount_status string Status
    • mount_statusR string Reason why inoperative [if not operational]
    • mount_damage string Damage Severity [if not operational]
    • mount_weapons WeaponLoaded Table of weapon loads on mount

    PatrolMission

    PatrolMission options; these are updated by ScenEdit_SetMission()

    Fields

    • type string Subtype of mission (ASW = 'asw', ASuW_Naval = 'naval', AAW = 'aaw', ASuW_Land = 'land', ASuW_Mixed = 'mixed', SEAD = 'sead', SeaControl = 'sea')
    • oneThirdRule boolean True if activated
    • checkOPA boolean True if can investigate outside zones
    • checkWWR boolean True if can investigate within weapon range
    • activeEMCON boolean True if active EMCON in patrol zone
    • transitThrottleAircraft string
    • transitAltitudeAircraft string
    • transitTerrainFollowingAircraft boolean True if terrain following
    • stationThrottleAircraft string
    • stationAltitudeAircraft string
    • stationTerrainFollowingAircraft boolean True if terrain following
    • attackThrottleAircraft string
    • attackAltitudeAircraft string
    • attackTerrainFollowingAircraft boolean True if terrain following
    • attackDistanceAircraft string
    • transitThrottleSubmarine string
    • transitDepthSubmarine string
    • stationThrottleSubmarine string
    • stationDepthSubmarine string
    • attackThrottleSubmarine string
    • attackDepthSubmarine string
    • attackDistanceSubmarine string
    • transitThrottleShip string
    • stationThrottleShip string
    • attackThrottleShip string
    • attackDistanceShip string
    • flightSize Size
    • minAircraftReq string
    • useFlightSize boolean True if min size required
    • groupSize Size
    • useGroupSize boolean True if min size required
    • prosecutionZone name or GUID Table of reference point names and/or GUIDs
    • patrolZone name or GUID Table of reference point names and/or GUIDs
    • FlightsToInvestigate string
    • FlightsToEngage string
    • WingmanEngageDistance string
    • BoatsToInvestigate string
    • BoatsToEngage string
    • GroupMemberEngageDistance string

    Sensor

    A list of sensors associated with a Unit wrapper

    Fields

    • sensor_dbid string The DBID of the sensor.
    • sensor_guid string The GUID of the sensor.
    • sensor_name string The name of the sensor.
    • sensor_type string The high-level type of sensor.
    • sensor_role string The role of the sensor (e.g. 3D Air Search - Medium Range).
    • sensor_maxrange number The maximum range of the sensor.
    • sensor_status string The operational status of the sensor.
    • sensor_isactive boolean Whether the sensor is active or not.

    Note: To set sensor on or off, use a table of {sensor_guid,sensor_isactive}

    Caution: The GUID returned here is the GUID of the individual sensor component, not the GUID of the parent unit.


    SideContact

    Side's contact.

    Fields

    • GUID string The GUID of the contact. Note that this is not the GUID of the unit, you must use VP_GetUnit to resolve it.
    • name string The name of the contact.

    SideDescription

    Information on how to change a unit's side.

    Fields

    • side string The original side
    • name string The name/GUID of the unit
    • newside string The new side

    Caution: The order in which these paramaters are passed is important!


    SideSelector

    Information to select a particular side.

    Fields

    • GUID string The GUID of the side to select. Preferred.
    • Name string The name of the side to select.

    SideUnit

    Side's unit.

    Fields

    • GUID string The GUID of the unit. This is the actual GUID.
    • name string The name of the unit.

    StrikeMission

    StrikeMission options; these are updated by ScenEdit_SetMission(). Note that these are split between the escorts and strikers

    Fields

    • type string Subtype of mission (Air_Intercept = 'air', Land_Strike = 'land', Maritime_Strike = 'sea', Sub_Strike = 'sub')
    • escortFlightSizeShooter Size
    • escortMinShooter number
    • escortMaxShooter number
    • escortResponseRadius number
    • escortUseFlightSize boolean True if minimum size required
    • escortFlightSizeNonshooter Size
    • escortMinNonshooter number
    • escortMaxNonshooter number
    • escortGroupSize Size
    • escortUseGroupSize boolean True if minimum size required
    • strikeOneTimeOnly boolean True if activated
    • strikeMinimumTrigger string
    • strikeMax number
    • strikeFlightSize Size
    • strikeMinAircraftReq number
    • strikeUseFlightSize boolean True if minimum size required
    • strikeGroupSize Size
    • strikeUseGroupSize boolean True if minimum size required
    • strikeAutoPlanner boolean True if activated
    • strikePreplan boolean True if pre-planned target list only
    • strikeRadarUasge number Radar usage
    • strikeMinDistAircraft number Strike minimum distance
    • strikeMaxDistAircraft number Strike maximum distance
    • strikeMinDistShip number Strike minimum distance
    • strikeMaxDistShip number Strike maximum distance
    • FlightsToInvestigate string
    • FlightsToEngage string
    • WingmanEngageDistance string
    • BoatsToInvestigate string
    • BoatsToEngage string
    • GroupMemberEngageDistance string

    SupportMission

    SupportMission options; these are updated by ScenEdit_SetMission()

    Fields

    • oneThirdRule boolean
    • transitThrottleAircraft string
    • transitAltitudeAircraft string
    • transitTerrainFollowingAircraft boolean
    • stationThrottleAircraft string
    • stationAltitudeAircraft string
    • stationTerrainFollowingAircraft boolean
    • transitThrottleSubmarine string
    • transitDepthSubmarine string
    • stationThrottleSubmarine string
    • stationDepthSubmarine string
    • transitThrottleShip string
    • stationThrottleShip string
    • flightSize Size
    • minAircraftReq string
    • useFlightSize boo
    • groupSize Size
    • useGroupSize boolean
    • zone name or GUID Table of reference point names and/or GUIDs
    • loopType string Values of ContinousLoop(0) or SingleLoop(1)
    • onStation string
    • oneTimeOnly boolean
    • activeEMCON boolean
    • tankerOneTime boolean
    • tankerMaxReceivers string
    • ccenable string
    • ccallowqra string
    • ccflightgenmethod string
    • ccstationtime string
    • ccoverlap string

    WRA

    WRA settings

    Fields

    • qty_salvo string Weapons per salvo ('Max','DoNoUse' or a number)
    • shooter_salvo string Shooters per salvo ('Max','DoNoUse' or a number)
    • firing_range string Firing range ('Max','DoNoUse' or a number)
    • self_defence string Self-defence range ('Max','DoNoUse' or a number)

    Note: The absence of a field implies that it is not used.


    Waypoint

    Waypoint describing the long/lat points as in a plotted course

    Fields

    • longitude number
    • latitude number
    • description string
    • presetAltitude string
    • presetDepth string
    • presetThrottle string
    • desiredAltitude number
    • desiredSpeed number
    • desiredAltitudeTF number Enter desired altitude AGL to set altitude as terrain-following

    WeaponLoaded

    Weapon loads on mount or in magazine.

    Fields

    • wpn_GUID string GUID
    • wpn_current string Current loads available
    • wpn_maxcap string Maximum loads
    • wpn_default string Default loads (to fill out)
    • wpn_name string Name
    • wpn_dbid string Database ID of weapon
    • wpn_type string Type of weapon

    ZoneMarker

    Zone marker fields are the same as a ReferencePoint marker.