Banner Image

Module Functional.Fox

Functional - Yet Another Missile Trainer.

Practice to evade missiles without being destroyed.

Main Features:

  • Handles air-to-air and surface-to-air missiles.
  • Define your own training zones on the map. Players in this zone will be protected.
  • Define launch zones. Only missiles launched in these zones are tracked.
  • Define protected AI groups.
  • F10 radio menu to adjust settings for each player.
  • Alert on missile launch (optional).
  • Marker of missile launch position (optional).
  • Adaptive update of missile-to-player distance.
  • Finite State Machine (FSM) implementation.
  • Easy to use. See examples below.

Demo Missions


Author: funkyfranky

Global(s)

Global FOX

Fox 3!


Banner Image

The FOX Concept

As you probably know Fox is a NATO brevity code for launching air-to-air munition.

#FOX FOX

Fox 3!


Banner Image

The FOX Concept

As you probably know Fox is a NATO brevity code for launching air-to-air munition.

Therefore, the class name is not 100% accurate as this script handles air-to-air but also surface-to-air missiles.

Basic Script

-- Create a new missile trainer object.
fox=FOX:New()

-- Start missile trainer.
fox:Start()

Training Zones

Players are only protected if they are inside one of the training zones.

-- Create a new missile trainer object.
fox=FOX:New()

-- Add training zones.
fox:AddSafeZone(ZONE:New("Training Zone Alpha"))
fox:AddSafeZone(ZONE:New("Training Zone Bravo"))

-- Start missile trainer.
fox:Start()

Launch Zones

Missile launches are only monitored if the shooter is inside the defined launch zone.

-- Create a new missile trainer object.
fox=FOX:New()

-- Add training zones.
fox:AddLaunchZone(ZONE:New("Launch Zone SA-10 Krim"))
fox:AddLaunchZone(ZONE:New("Training Zone Bravo"))

-- Start missile trainer.
fox:Start()

Protected AI Groups

Define AI protected groups. These groups cannot be harmed by missiles.

Add Individual Groups

-- Create a new missile trainer object.
fox=FOX:New()

-- Add single protected group(s).
fox:AddProtectedGroup(GROUP:FindByName("A-10 Protected"))
fox:AddProtectedGroup(GROUP:FindByName("Yak-40"))

-- Start missile trainer.
fox:Start()

Notes

The script needs to be running before you enter an airplane slot. If FOX is not available to you, go back to observers and then join a slot again.

Type(s)

FOX , extends Core.Fsm#FSM , extends Core.Base#BASE
Fields and Methods inherited from FOX Description

FOX:AddLaunchZone(zone)

Add a launch zone.

FOX:AddProtectedGroup(group)

Add a group to the protected set.

FOX:AddSafeZone(zone)

Add a training zone.

FOX.ClassName

Name of the class.

FOX.Debug

Debug mode. Messages to all about status.

FOX:EnterSafeZone(player)

Triggers the FSM event "EnterSafeZone".

FOX:ExitSafeZone(player)

Triggers the FSM event "ExitSafeZone".

FOX:GetMissileTarget(missile)

Get missile target.

FOX.MenuF10

Main radio menu on group level.

FOX.MenuF10Root

Main radio menu on mission level.

FOX:MissileDestroyed(missile)

Triggers the FSM event "MissileDestroyed".

FOX:MissileLaunch(missile)

Triggers the FSM event "MissileLaunch".

FOX:New()

Create a new FOX class object.

FOX:OnAfterEnterSafeZone(From, Event, To, player)

On after "EnterSafeZone" event user function.

FOX:OnAfterExitSafeZone(From, Event, To, player)

On after "ExitSafeZone" event user function.

FOX:OnAfterMissileDestroyed(From, Event, To, missile)

On after "MissileDestroyed" event user function.

FOX:OnAfterMissileLaunch(From, Event, To, missile)

On after "MissileLaunch" event user function.

FOX:OnEventBirth(EventData)

FOX event handler for event birth.

FOX:OnEventHit(EventData)

FOX event handler for event hit.

FOX:OnEventPlayerEnterAircraft(EventData)

FOX event handler for event birth.

FOX:OnEventShot(EventData)

FOX event handler for event shot (when a unit releases a rocket or bomb (but not a fast firing gun).

FOX:SetDebugOff()

Set debug mode off.

FOX:SetDebugOn()

Set debug mode on.

FOX:SetDebugOnOff(switch)

Set debug mode on/off.

FOX:SetDefaultLaunchAlerts(switch)

Set default player setting for launch alerts.

FOX:SetDefaultLaunchMarks(switch)

Set default player setting for marking missile launch coordinates

FOX:SetDefaultMissileDestruction(switch)

Set default player setting for missile destruction.

FOX:SetDisableF10Menu()

Disable F10 menu for all players.

FOX:SetEnableF10Menu()

Enable F10 menu for all players.

FOX:SetExplosionDistance(distance)

Set missile-player distance when missile is destroyed.

FOX:SetExplosionDistanceBigMissiles(distance, explosivemass)

Set missile-player distance when BIG missiles are destroyed.

FOX:SetExplosionPower(power)

Set explosion power.

FOX:SetProtectedGroupSet(groupset)

Add a protected set of groups.

FOX:SetVerbosity(VerbosityLevel)

Set verbosity level.

FOX:Start()

Triggers the FSM event "Start".

FOX:Status()

Triggers the FSM event "Status".

FOX:_AddF10Commands(_unitName)

Add menu commands for player.

FOX:_CheckCoordLaunch(coord)

Check if a coordinate lies within a launch zone.

FOX:_CheckCoordSafe(coord)

Check if a coordinate lies within a safe training zone.

FOX:_CheckMissileStatus()

Missile status.

FOX:_CheckPlayers()

Check status of players.

FOX:_DeadText()

Get a random text message in case you die.

FOX._FuncImpact(weapon, self, missile)

Callback function on impact or destroy otherwise.

FOX._FuncTrack(weapon, self, missile)

Function called from weapon tracking.

FOX:_GetNotchingHeadings(weapon)

Returns the unit of a player and the player name.

FOX:_GetPlayerFromUnit(unit)

Retruns the player data from a unit.

FOX:_GetPlayerFromUnitname(unitName)

Returns the player data from a unit name.

FOX:_GetPlayerUnitAndName(_unitName)

Returns the unit of a player and the player name.

FOX:_GetTargetMissiles(playername)

Turn player's launch alert on/off.

FOX:_GetWeapongHeading(weapon)

Returns the unit of a player and the player name.

FOX:_IsProtected(targetunit)

Check if missile target is protected.

FOX:_MyStatus(_unitname)

Turn player's launch alert on/off.

FOX:_RemoveMissile(missile)

Remove missile.

FOX:_SayNotchingHeadings(playerData, weapon)

Tell player notching headings.

FOX:_ToggleDestroyMissiles(_unitname)

Turn destruction of missiles on/off for player.

FOX:_ToggleLaunchAlert(_unitname)

Turn player's launch alert on/off.

FOX:_ToggleLaunchMark(_unitname)

Turn player's launch marks on/off.

FOX:__EnterSafeZone(delay, player)

Triggers the FSM delayed event "EnterSafeZone".

FOX:__ExitSafeZone(delay, player)

Triggers the FSM delayed event "ExitSafeZone".

FOX:__MissileDestroyed(delay, missile)

Triggers the FSM delayed event "MissileDestroyed".

FOX:__MissileLaunch(delay, missile)

Triggers the FSM delayed event "MissileLaunch".

FOX:__Start(delay)

Triggers the FSM event "Start" after a delay.

FOX:__Status(delay)

Triggers the FSM event "Status" after a delay.

FOX:__Stop(delay)

Triggers the FSM event "Stop" after a delay.

FOX.bigmissilemass

Explosion power of big missiles. Default 50 kg TNT. Big missiles will be destroyed earlier.

FOX.destroy

Default player setting for destroying missiles.

FOX.dt00

Time step [sec] for missile position updates if distance to target < 1 km. Default 0.01 sec.

FOX.dt01

Time step [sec] for missile position updates if distance to target > 1 km and < 5 km. Default 0.1 sec.

FOX.dt05

Time step [sec] for missile position updates if distance to target > 5 km and < 10 km. Default 0.5 sec.

FOX.dt10

Time step [sec] for missile position updates if distance to target > 10 km and < 50 km. Default 1 sec.

FOX.dt50

Time step [sec] for missile position updates if distance to target > 50 km. Default 5 sec.

FOX.explosiondist

Missile player distance in meters for destroying smaller missiles. Default 200 m.

FOX.explosiondist2

Missile player distance in meters for destroying big missiles. Default 500 m.

FOX.explosionpower

Power of explostion when destroying the missile in kg TNT. Default 5 kg TNT.

FOX.launchalert

Default player setting for launch alerts.

FOX.launchzones

Table of launch zones.

FOX.lid

Class id string for output to DCS log file.

FOX.marklaunch

Default player setting for mark launch coordinates.

FOX.menuadded

Table of groups the menu was added for.

FOX.menudisabled

If true, F10 menu for players is disabled.

FOX.missiles

Table of tracked missiles.

FOX:onafterMissileLaunch(From, Event, To, missile)

Missle launch event.

FOX:onafterStart(From, Event, To)

On after Start event.

FOX:onafterStatus(From, Event, To)

Check spawn queue and spawn aircraft if necessary.

FOX:onafterStop(From, Event, To)

On after Stop event.

FOX.players

Table of players.

FOX.protectedset

Set of protected groups.

FOX.safezones

Table of practice zones.

FOX.verbose

Verbosity level.

FOX.version

FOX class version.

Fields and Methods inherited from FSM Description

FOX:AddEndState(State)

Adds an End state.

FOX:AddProcess(From, Event, Process, ReturnEvents)

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

FOX:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

FOX:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

FOX:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

FOX.CallScheduler

Call scheduler.

FOX.ClassName

Name of the class.

FOX.Events

FOX:GetCurrentState()

Get current state.

FOX:GetEndStates()

Returns the End states.

FOX:GetProcess(From, Event)

FOX:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

FOX:GetScores()

Returns a table with the scores defined.

FOX:GetStartState()

Returns the start state of the FSM.

FOX:GetState()

Get current state.

FOX:GetSubs()

Returns a table with the Subs defined.

FOX:GetTransitions()

Returns a table of the transition rules defined within the FSM.

FOX:Is(State)

Check if FSM is in state.

FOX:LoadCallBacks(CallBackTable)

Load call backs.

FOX:New()

Creates a new FSM object.

FOX.Scores

Scores.

FOX:SetProcess(From, Event, Fsm)

FOX:SetStartState(State)

Sets the start state of the FSM.

FOX._EndStates

FOX._EventSchedules

FOX._Processes

FOX._Scores

FOX._StartState

FOX._Transitions

FOX:_add_to_map(Map, Event)

Add to map.

FOX:_call_handler(step, trigger, params, EventName)

Call handler.

FOX:_create_transition(EventName)

Create transition.

FOX:_delayed_transition(EventName)

Delayed transition.

FOX:_eventmap(Events, EventStructure)

Event map.

FOX:_gosub(ParentFrom, ParentEvent)

Go sub.

FOX:_handler(EventName, ...)

Handler.

FOX:_isendstate(Current)

Is end state.

FOX:_submap(subs, sub, name)

Sub maps.

FOX:can(e)

Check if can do an event.

FOX:cannot(e)

Check if cannot do an event.

FOX.current

Current state name.

FOX.endstates

FOX:is(State, state)

Check if FSM is in state.

FOX.options

Options.

FOX.subs

Subs.

Fields and Methods inherited from BASE Description

FOX.ClassID

The ID number of the class.

FOX.ClassName

The name of the class.

FOX.ClassNameAndID

The name of the class concatenated with the ID number of the class.

FOX:ClearState(Object, StateName)

Clear the state of an object.

FOX:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

Creation of a Birth Event.

FOX:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

FOX:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

FOX:CreateEventDynamicCargoLoaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

FOX:CreateEventDynamicCargoRemoved(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

FOX:CreateEventDynamicCargoUnloaded(DynamicCargo)

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

FOX:CreateEventNewDynamicCargo(DynamicCargo)

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

FOX:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

FOX:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

FOX:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

FOX:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

FOX:E(Arguments)

Log an exception which will be traced always.

FOX:EventDispatcher()

Returns the event dispatcher

FOX:EventRemoveAll()

Remove all subscribed events

FOX:F(Arguments)

Trace a function call.

FOX:F2(Arguments)

Trace a function call level 2.

FOX:F3(Arguments)

Trace a function call level 3.

FOX:GetClassID()

Get the ClassID of the class instance.

FOX:GetClassName()

Get the ClassName of the class instance.

FOX:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

FOX:GetEventPriority()

Get the Class Core.Event processing Priority.

FOX:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

FOX:GetState(Object, Key)

Get a Value given a Key from the Object.

FOX:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

FOX:I(Arguments)

Log an information which will be traced always.

FOX:Inherit(Child, Parent)

This is the worker method to inherit from a parent class.

FOX:IsInstanceOf(ClassName)

This is the worker method to check if an object is an (sub)instance of a class.

FOX:IsTrace()

Enquires if tracing is on (for the class).

FOX:New()

BASE constructor.

FOX:OnEvent(EventData)

Occurs when an Event for an object is triggered.

FOX:OnEventBDA(EventData)

BDA.

FOX:OnEventBaseCaptured(EventData)

Occurs when a ground unit captures either an airbase or a farp.

FOX:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

FOX:OnEventCrash(EventData)

Occurs when any aircraft crashes into the ground and is completely destroyed.

FOX:OnEventDead(EventData)

Occurs when an object is dead.

FOX:OnEventDetailedFailure(EventData)

Unknown precisely what creates this event, likely tied into newer damage model.

FOX:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

FOX:OnEventDynamicCargoLoaded(EventData)

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

FOX:OnEventDynamicCargoRemoved(EventData)

Occurs when a dynamic cargo crate is removed.

FOX:OnEventDynamicCargoUnloaded(EventData)

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

FOX:OnEventEjection(EventData)

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

FOX:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

FOX:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

FOX:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

FOX:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

FOX:OnEventKill(EventData)

Occurs on the death of a unit.

FOX:OnEventLand(EventData)

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

FOX:OnEventLandingAfterEjection(EventData)

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

FOX:OnEventLandingQualityMark(EventData)

Landing quality mark.

FOX:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

FOX:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

FOX:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

FOX:OnEventMissionEnd(EventData)

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

FOX:OnEventMissionStart(EventData)

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

FOX:OnEventNewDynamicCargo(EventData)

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

FOX:OnEventParatrooperLanding(EventData)

Weapon add.

FOX:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

FOX:OnEventPlayerEnterAircraft(EventData)

Occurs when a player enters a slot and takes control of an aircraft.

FOX:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

FOX:OnEventPlayerLeaveUnit(EventData)

Occurs when any player relieves control of a unit to the AI.

FOX:OnEventRefueling(EventData)

Occurs when an aircraft connects with a tanker and begins taking on fuel.

FOX:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

FOX:OnEventScore(EventData)

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

FOX:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

FOX:OnEventShootingStart(EventData)

Occurs when any unit begins firing a weapon that has a high rate of fire.

FOX:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

FOX:OnEventTakeoff(EventData)

Occurs when an aircraft takes off from an airbase, farp, or ship.

FOX:OnEventTriggerZone(EventData)

Trigger zone.

FOX:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

FOX:ScheduleOnce(Start, SchedulerFunction, ...)

Schedule a new time event.

FOX:ScheduleRepeat(Start, Repeat, RandomizeFactor, Stop, SchedulerFunction, ...)

Schedule a new time event.

FOX:ScheduleStop(SchedulerID)

Stops the Schedule.

FOX.Scheduler

FOX:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

FOX:SetState(Object, Key, Value)

Set a state or property of the Object given a Key and a Value.

FOX:T(Arguments)

Trace a function logic level 1.

FOX:T2(Arguments)

Trace a function logic level 2.

FOX:T3(Arguments)

Trace a function logic level 3.

FOX:TraceAll(TraceAll)

Trace all methods in MOOSE

FOX:TraceClass(Class)

Set tracing for a class

FOX:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

FOX:TraceLevel(Level)

Set trace level

FOX:TraceOff()

Set trace off.

FOX:TraceOn()

Set trace on.

FOX:TraceOnOff(TraceOnOff)

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

FOX:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

FOX._

FOX:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

FOX:_Serialize(Arguments)

(Internal) Serialize arguments

FOX:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

FOX.__

FOX:onEvent(event)

The main event handling function...

Fields and Methods inherited from FOX.MissileData Description

FOX.MissileData.Weapon

Weapon object.

FOX.MissileData.active

If true the missile is active.

FOX.MissileData.explosive

Explosive mass in kg TNT.

FOX.MissileData.fuseDist

Fuse distance in meters.

FOX.MissileData.missileCoord

Missile coordinate during tracking.

FOX.MissileData.missileName

Name of missile.

FOX.MissileData.missileRange

Range of missile in meters.

FOX.MissileData.missileType

Type of missile.

FOX.MissileData.shooterCoalition

Coalition side of the shooter.

FOX.MissileData.shooterGroup

Group that shot the missile.

FOX.MissileData.shooterName

Name of the shooter unit.

FOX.MissileData.shooterUnit

Unit that shot the missile.

FOX.MissileData.shotCoord

Coordinate where the missile was fired.

FOX.MissileData.shotTime

Abs. mission time in seconds the missile was fired.

FOX.MissileData.targetName

Name of the target unit or "unknown".

FOX.MissileData.targetOrig

Name of the "original" target, i.e. the one right after launched.

FOX.MissileData.targetPlayer

Player that was targeted or nil.

FOX.MissileData.targetUnit

Unit that was targeted.

FOX.MissileData.weapon

Missile weapon object.

Fields and Methods inherited from FOX.PlayerData Description

FOX.PlayerData.callsign

Callsign of player.

FOX.PlayerData.client

Client object of player.

FOX.PlayerData.coalition

Coalition number of player.

FOX.PlayerData.dead

Number of missiles not defeated.

FOX.PlayerData.defeated

Number of missiles defeated.

FOX.PlayerData.destroy

Destroy missile.

FOX.PlayerData.group

Aircraft group of player.

FOX.PlayerData.groupname

Name of the the player aircraft group.

FOX.PlayerData.inzone

Player is inside a protected zone.

FOX.PlayerData.launchalert

Alert player on detected missile launch.

FOX.PlayerData.marklaunch

Mark position of launched missile on F10 map.

FOX.PlayerData.name

Player name.

FOX.PlayerData.unit

Aircraft of the player.

FOX.PlayerData.unitname

Name of the unit.

FOX class.

Field(s)

#string FOX.ClassName

Name of the class.

#boolean FOX.Debug

Debug mode. Messages to all about status.

#table FOX.MenuF10

Main radio menu on group level.

#table FOX.MenuF10Root

Main radio menu on mission level.

#number FOX.bigmissilemass

Explosion power of big missiles. Default 50 kg TNT. Big missiles will be destroyed earlier.

#boolean FOX.destroy

Default player setting for destroying missiles.

#number FOX.dt00

Time step [sec] for missile position updates if distance to target < 1 km. Default 0.01 sec.

#number FOX.dt01

Time step [sec] for missile position updates if distance to target > 1 km and < 5 km. Default 0.1 sec.

#number FOX.dt05

Time step [sec] for missile position updates if distance to target > 5 km and < 10 km. Default 0.5 sec.

#number FOX.dt10

Time step [sec] for missile position updates if distance to target > 10 km and < 50 km. Default 1 sec.

#number FOX.dt50

Time step [sec] for missile position updates if distance to target > 50 km. Default 5 sec.

#number FOX.explosiondist

Missile player distance in meters for destroying smaller missiles. Default 200 m.

#number FOX.explosiondist2

Missile player distance in meters for destroying big missiles. Default 500 m.

#number FOX.explosionpower

Power of explostion when destroying the missile in kg TNT. Default 5 kg TNT.

#boolean FOX.launchalert

Default player setting for launch alerts.

#table FOX.launchzones

Table of launch zones.

#string FOX.lid

Class id string for output to DCS log file.

#boolean FOX.marklaunch

Default player setting for mark launch coordinates.

#table FOX.menuadded

Table of groups the menu was added for.

#boolean FOX.menudisabled

If true, F10 menu for players is disabled.

#table FOX.missiles

Table of tracked missiles.

#table FOX.players

Table of players.

Core.Set#SET_GROUP FOX.protectedset

Set of protected groups.

#table FOX.safezones

Table of practice zones.

#number FOX.verbose

Verbosity level.

#string FOX.version

FOX class version.

Function(s)

Add a launch zone.

Only missiles launched within these zones will be tracked.

Defined in:

FOX

Parameter:

Training zone.

Return value:

#FOX:

self

Add a group to the protected set.

Works only with AI!

Defined in:

FOX

Parameter:

Protected group.

Return value:

#FOX:

self

Add a training zone.

Players in the zone are safe.

Defined in:

FOX

Parameter:

Training zone.

Return value:

#FOX:

self

Triggers the FSM event "EnterSafeZone".

Defined in:

FOX

Parameter:

Player data.

Triggers the FSM event "ExitSafeZone".

Defined in:

FOX

Parameter:

Player data.

Get missile target.

Defined in:

FOX

Parameter:

The missile data table.

Triggers the FSM event "MissileDestroyed".

Defined in:

FOX

Parameter:

Data of the destroyed missile.

Triggers the FSM event "MissileLaunch".

Defined in:

FOX

Parameter:

Data of the fired missile.

Create a new FOX class object.

Defined in:

FOX

Return value:

#FOX:

self.

On after "EnterSafeZone" event user function.

Called when a player enters a safe zone.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Player data.

On after "ExitSafeZone" event user function.

Called when a player exists a safe zone.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Player data.

On after "MissileDestroyed" event user function.

Called when a missile was destroyed.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Data of the destroyed missile.

On after "MissileLaunch" event user function.

Called when a missile was launched.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Data of the fired missile.

FOX event handler for event birth.

Defined in:

FOX

Parameter:

FOX event handler for event hit.

Defined in:

FOX

Parameter:

FOX event handler for event birth.

Defined in:

FOX

Parameter:

FOX event handler for event shot (when a unit releases a rocket or bomb (but not a fast firing gun).

Defined in:

FOX

Parameter:

Set debug mode off.

Defined in:

FOX

Return value:

#FOX:

self

Set debug mode on.

Defined in:

FOX

Return value:

#FOX:

self

Set debug mode on/off.

Defined in:

FOX

Parameter:

#boolean switch

If true debug mode on. If false/nil debug mode off.

Return value:

#FOX:

self

Set default player setting for launch alerts.

Defined in:

FOX

Parameter:

#boolean switch

If true launch alerts to players are active. If false/nil no launch alerts are given.

Return value:

#FOX:

self

Set default player setting for marking missile launch coordinates

Defined in:

FOX

Parameter:

#boolean switch

If true missile launches are marked. If false/nil marks are disabled.

Return value:

#FOX:

self

Set default player setting for missile destruction.

Defined in:

FOX

Parameter:

#boolean switch

If true missiles are destroyed. If false/nil missiles are not destroyed.

Return value:

#FOX:

self

Disable F10 menu for all players.

Defined in:

FOX

Return value:

#FOX:

self

Enable F10 menu for all players.

Defined in:

FOX

Return value:

#FOX:

self

Set missile-player distance when missile is destroyed.

Defined in:

FOX

Parameter:

#number distance

Distance in meters. Default 200 m.

Return value:

#FOX:

self

Set missile-player distance when BIG missiles are destroyed.

Defined in:

FOX

Parameters:

#number distance

Distance in meters. Default 500 m.

#number explosivemass

Explosive mass of missile threshold in kg TNT. Default 50 kg.

Return value:

#FOX:

self

Set explosion power.

This is an "artificial" explosion generated when the missile is destroyed. Just for the visual effect. Don't set the explosion power too big or it will harm the aircraft in the vicinity.

Defined in:

FOX

Parameter:

#number power

Explosion power in kg TNT. Default 0.1 kg.

Return value:

#FOX:

self

Add a protected set of groups.

Defined in:

FOX

Parameter:

The set of groups.

Return value:

#FOX:

self

Set verbosity level.

Defined in:

FOX

Parameter:

#number VerbosityLevel

Level of output (higher=more). Default 0.

Return value:

#FOX:

self

Triggers the FSM event "Start".

Starts the FOX. Initializes parameters and starts event handlers.

Defined in:

FOX

Triggers the FSM event "Status".

Defined in:

FOX

Add menu commands for player.

Defined in:

FOX

Parameter:

#string _unitName

Name of player unit.

Check if a coordinate lies within a launch zone.

Defined in:

FOX

Parameter:

Coordinate to check. Can also be a DCS#Vec2.

Return value:

#boolean:

True if in launch zone.

Check if a coordinate lies within a safe training zone.

Defined in:

FOX

Parameter:

Coordinate to check. Can also be a DCS#Vec3.

Return value:

#boolean:

True if safe.

Missile status.

Defined in:

FOX

Check status of players.

Defined in:

FOX

Get a random text message in case you die.

Defined in:

FOX

Return value:

#string:

Text in case you die.

Callback function on impact or destroy otherwise.

Defined in:

FOX

Parameters:

Weapon object.

#FOX self

FOX object.

Fired missile.

Function called from weapon tracking.

Defined in:

FOX

Parameters:

Weapon object.

#FOX self

FOX object.

Fired missile

Returns the unit of a player and the player name.

If the unit does not belong to a player, nil is returned.

Defined in:

FOX

Parameter:

DCS#Weapon weapon

The weapon.

Return values:

#number:

Notching heading right, i.e. missile heading +90°.

#number:

Notching heading left, i.e. missile heading -90°.

Retruns the player data from a unit.

Defined in:

FOX

Parameter:

Return value:

Player data.

Returns the player data from a unit name.

Defined in:

FOX

Parameter:

#string unitName

Name of the unit.

Return value:

Player data.

Returns the unit of a player and the player name.

If the unit does not belong to a player, nil is returned.

Defined in:

FOX

Parameter:

#string _unitName

Name of the player unit.

Return values:

Unit of player or nil.

#string:

Name of the player or nil.

Turn player's launch alert on/off.

Defined in:

FOX

Parameter:

#string playername

Name of the player.

Return values:

#number:

Number of missiles targeting the player.

#string:

Missile info.

Returns the unit of a player and the player name.

If the unit does not belong to a player, nil is returned.

Defined in:

FOX

Parameter:

DCS#Weapon weapon

The weapon.

Return value:

#number:

Heading of weapon in degrees or -1.

Check if missile target is protected.

Defined in:

FOX

Parameter:

Wrapper.Unit#UNIT targetunit

Target unit.

Return value:

#boolean:

If true, unit is protected.

Turn player's launch alert on/off.

Defined in:

FOX

Parameter:

#string _unitname

Name of the player unit.

Remove missile.

Defined in:

FOX

Parameter:

Missile data.

Tell player notching headings.

Defined in:

FOX

Parameters:

#FOX.PlayerData playerData

Player data.

DCS#Weapon weapon

The weapon.

Turn destruction of missiles on/off for player.

Defined in:

FOX

Parameter:

#string _unitname

Name of the player unit.

Turn player's launch alert on/off.

Defined in:

FOX

Parameter:

#string _unitname

Name of the player unit.

Turn player's launch marks on/off.

Defined in:

FOX

Parameter:

#string _unitname

Name of the player unit.

Triggers the FSM delayed event "EnterSafeZone".

Defined in:

FOX

Parameters:

#number delay

Delay in seconds before the function is called.

Player data.

Triggers the FSM delayed event "ExitSafeZone".

Defined in:

FOX

Parameters:

#number delay

Delay in seconds before the function is called.

Player data.

Triggers the FSM delayed event "MissileDestroyed".

Defined in:

FOX

Parameters:

#number delay

Delay in seconds before the function is called.

Data of the destroyed missile.

Triggers the FSM delayed event "MissileLaunch".

Defined in:

FOX

Parameters:

#number delay

Delay in seconds before the function is called.

Data of the fired missile.

Triggers the FSM event "Start" after a delay.

Starts the FOX. Initializes parameters and starts event handlers.

Defined in:

FOX

Parameter:

#number delay

Delay in seconds.

Triggers the FSM event "Status" after a delay.

Defined in:

FOX

Parameter:

#number delay

Delay in seconds.

Triggers the FSM event "Stop" after a delay.

Stops the FOX and all its event handlers.

Defined in:

FOX

Parameter:

#number delay

Delay in seconds.

Missle launch event.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Fired missile

On after Start event.

Starts the missile trainer and adds event handlers.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Check spawn queue and spawn aircraft if necessary.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

On after Stop event.

Stops the missile trainer and unhandles events.

Defined in:

FOX

Parameters:

#string From

From state.

#string Event

Event.

#string To

To state.

Field(s)

#string FOX.ClassName

Name of the class.

#boolean FOX.Debug

Debug mode. Messages to all about status.

#table FOX.MenuF10

Main radio menu on group level.

#table FOX.MenuF10Root

Main radio menu on mission level.

#number FOX.bigmissilemass

Explosion power of big missiles. Default 50 kg TNT. Big missiles will be destroyed earlier.

#boolean FOX.destroy

Default player setting for destroying missiles.

#number FOX.dt00

Time step [sec] for missile position updates if distance to target < 1 km. Default 0.01 sec.

#number FOX.dt01

Time step [sec] for missile position updates if distance to target > 1 km and < 5 km. Default 0.1 sec.

#number FOX.dt05

Time step [sec] for missile position updates if distance to target > 5 km and < 10 km. Default 0.5 sec.

#number FOX.dt10

Time step [sec] for missile position updates if distance to target > 10 km and < 50 km. Default 1 sec.

#number FOX.dt50

Time step [sec] for missile position updates if distance to target > 50 km. Default 5 sec.

#number FOX.explosiondist

Missile player distance in meters for destroying smaller missiles. Default 200 m.

#number FOX.explosiondist2

Missile player distance in meters for destroying big missiles. Default 500 m.

#number FOX.explosionpower

Power of explostion when destroying the missile in kg TNT. Default 5 kg TNT.

#boolean FOX.launchalert

Default player setting for launch alerts.

#table FOX.launchzones

Table of launch zones.

#string FOX.lid

Class id string for output to DCS log file.

#boolean FOX.marklaunch

Default player setting for mark launch coordinates.

#table FOX.menuadded

Table of groups the menu was added for.

#boolean FOX.menudisabled

If true, F10 menu for players is disabled.

#table FOX.missiles

Table of tracked missiles.

#table FOX.players

Table of players.

Core.Set#SET_GROUP FOX.protectedset

Set of protected groups.

#table FOX.safezones

Table of practice zones.

#number FOX.verbose

Verbosity level.

#string FOX.version

FOX class version.

Function(s)

Adds an End state.

Defined in:

Parameter:

#string State

The FSM state.

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

An sub-process FSM.

#table ReturnEvents

A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.

Return value:

The SubFSM.

Adds a score for the FSM to be achieved.

Defined in:

Parameters:

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Adds a score for the FSM_PROCESS to be achieved.

Defined in:

Parameters:

#string From

is the From State of the main process.

#string Event

is the Event of the main process.

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Add a new transition rule to the FSM.

A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

#string To

The To state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns the End states.

Defined in:

Return value:

#table:

End states.

Defined in:

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

Return value:

#table:

Sub processes.

Returns a table with the scores defined.

Defined in:

Return value:

#table:

Scores.

Returns the start state of the FSM.

Defined in:

Return value:

#string:

A string containing the start state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns a table with the Subs defined.

Defined in:

Return value:

#table:

Sub processes.

Returns a table of the transition rules defined within the FSM.

Defined in:

Return value:

#table:

Transitions.

Check if FSM is in state.

Defined in:

Parameter:

#string State

State name.

Return value:

#boolean:

If true, FSM is in this state.

Load call backs.

Defined in:

Parameter:

#table CallBackTable

Table of call backs.

Creates a new FSM object.

Defined in:

Return value:

#FSM:

Defined in:

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

Parameter:

#string State

A string defining the start state.

Add to map.

Defined in:

Parameters:

#table Map

Map.

#table Event

Event table.

Call handler.

Defined in:

Parameters:

#string step

Step "onafter", "onbefore", "onenter", "onleave".

#string trigger

Trigger.

#table params

Parameters.

#string EventName

Event name.

Return value:

Value.

Create transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Delayed transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Event map.

Defined in:

Parameters:

#table Events

Events.

#table EventStructure

Event structure.

Go sub.

Defined in:

Parameters:

#string ParentFrom

Parent from state.

#string ParentEvent

Parent event name.

Return value:

#table:

Subs.

Handler.

Defined in:

Parameters:

#string EventName

Event name.

...

Arguments.

Is end state.

Defined in:

Parameter:

#string Current

Current state name.

Return values:

#table:

FSM parent.

#string:

Event name.

Sub maps.

Defined in:

Parameters:

#table subs

Subs.

#table sub

Sub.

#string name

Name.

Check if can do an event.

Defined in:

Parameter:

#string e

Event name.

Return values:

#boolean:

If true, FSM can do the event.

#string:

To state.

Check if cannot do an event.

Defined in:

Parameter:

#string e

Event name.

Return value:

#boolean:

If true, FSM cannot do the event.

Check if FSM is in state.

Defined in:

Parameters:

#string State

State name.

state

Return value:

#boolean:

If true, FSM is in this state.

Field(s)

#string FOX.ClassName

Name of the class.

#boolean FOX.Debug

Debug mode. Messages to all about status.

#table FOX.MenuF10

Main radio menu on group level.

#table FOX.MenuF10Root

Main radio menu on mission level.

#number FOX.bigmissilemass

Explosion power of big missiles. Default 50 kg TNT. Big missiles will be destroyed earlier.

#boolean FOX.destroy

Default player setting for destroying missiles.

#number FOX.dt00

Time step [sec] for missile position updates if distance to target < 1 km. Default 0.01 sec.

#number FOX.dt01

Time step [sec] for missile position updates if distance to target > 1 km and < 5 km. Default 0.1 sec.

#number FOX.dt05

Time step [sec] for missile position updates if distance to target > 5 km and < 10 km. Default 0.5 sec.

#number FOX.dt10

Time step [sec] for missile position updates if distance to target > 10 km and < 50 km. Default 1 sec.

#number FOX.dt50

Time step [sec] for missile position updates if distance to target > 50 km. Default 5 sec.

#number FOX.explosiondist

Missile player distance in meters for destroying smaller missiles. Default 200 m.

#number FOX.explosiondist2

Missile player distance in meters for destroying big missiles. Default 500 m.

#number FOX.explosionpower

Power of explostion when destroying the missile in kg TNT. Default 5 kg TNT.

#boolean FOX.launchalert

Default player setting for launch alerts.

#table FOX.launchzones

Table of launch zones.

#string FOX.lid

Class id string for output to DCS log file.

#boolean FOX.marklaunch

Default player setting for mark launch coordinates.

#table FOX.menuadded

Table of groups the menu was added for.

#boolean FOX.menudisabled

If true, F10 menu for players is disabled.

#table FOX.missiles

Table of tracked missiles.

#table FOX.players

Table of players.

Core.Set#SET_GROUP FOX.protectedset

Set of protected groups.

#table FOX.safezones

Table of practice zones.

#number FOX.verbose

Verbosity level.

#string FOX.version

FOX class version.

Function(s)

Clear the state of an object.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

StateName

The key that is should be cleared.

Creation of a Birth Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

#string IniUnitName

The initiating unit name.

place

subplace

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a Dead Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

IniObjectCategory

Creation of a S_EVENT_DYNAMIC_CARGO_LOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_REMOVED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_DYNAMIC_CARGO_UNLOADED event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.

Defined in:

Parameter:

the dynamic cargo object

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

Defined in:

Parameter:

Wrapper.Unit#UNIT PlayerUnit

The aircraft unit the player entered.

Creation of a Remove Unit Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Takeoff Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Creation of a Crash Event.

Defined in:

Parameters:

DCS#Time EventTime

The time stamp of the event.

DCS#Object Initiator

The initiating object of the event.

Log an exception which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Returns the event dispatcher

Defined in:

Return value:

Remove all subscribed events

Defined in:

Return value:

Trace a function call.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 2.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function call level 3.

Must be at the beginning of the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Get the ClassID of the class instance.

Defined in:

Return value:

#string:

The ClassID of the class instance.

Get the ClassName of the class instance.

Defined in:

Return value:

#string:

The ClassName of the class instance.

Get the ClassName + ClassID of the class instance.

The ClassName + ClassID is formatted as '%s#%09d'.

Defined in:

Return value:

#string:

The ClassName + ClassID of the class instance.

Get the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Return value:

#number:

The Core.Event processing Priority.

This is the worker method to retrieve the Parent class.

Note that the Parent class must be passed to call the parent class method.

self:GetParent(self):ParentMethod()

Defined in:

Parameters:

#BASE Child

This is the Child class from which the Parent class needs to be retrieved.

#BASE FromClass

(Optional) The class from which to get the parent.

Return value:

Get a Value given a Key from the Object.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that holds the Value set by the Key.

Key

The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!

Return value:

The Value retrieved or nil if the Key was not found and thus the Value could not be retrieved.

Subscribe to a DCS Event.

Defined in:

Parameters:

Event ID.

#function EventFunction

(optional) The function to be called when the event occurs for the unit.

Return value:

Log an information which will be traced always.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

This is the worker method to inherit from a parent class.

Defined in:

Parameters:

Child

is the Child class that inherits.

#BASE Parent

is the Parent class that the Child inherits from.

Return value:

Child

This is the worker method to check if an object is an (sub)instance of a class.

Examples:

  • ZONE:New( 'some zone' ):IsInstanceOf( ZONE ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'ZONE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'zone' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'BASE' ) will return true

  • ZONE:New( 'some zone' ):IsInstanceOf( 'GROUP' ) will return false

Defined in:

Parameter:

ClassName

is the name of the class or the class itself to run the check against

Return value:

#boolean:

Enquires if tracing is on (for the class).

Defined in:

Return value:

#boolean:

BASE constructor.

This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.

function EVENT:New()
  local self = BASE:Inherit( self, BASE:New() ) -- #EVENT
  return self
end

Defined in:

Return value:

Occurs when an Event for an object is triggered.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that triggered the event.

Defined in:

Parameter:

The EventData structure.

BDA.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a ground unit captures either an airbase or a farp.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that captured the base place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.

Defined in:

Parameter:

The EventData structure.

Occurs when any object is spawned into the mission.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was spawned

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft crashes into the ground and is completely destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that has crashed

Defined in:

Parameter:

The EventData structure.

Occurs when an object is dead.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is dead.

Defined in:

Parameter:

The EventData structure.

Unknown precisely what creates this event, likely tied into newer damage model.

Will update this page when new information become available.

  • initiator: The unit that had the failure.

Defined in:

Parameter:

The EventData structure.

Discard chair after ejection.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player loads a dynamic cargo object with the F8 ground crew menu into a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a dynamic cargo crate is removed.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a player unloads a dynamic cargo object with the F8 ground crew menu from a helo.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Occurs when a pilot ejects from an aircraft Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has ejected

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft shuts down its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is stopping its engines.

Defined in:

Parameter:

The EventData structure.

Occurs when any aircraft starts its engines.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is starting its engines.

Defined in:

Parameter:

The EventData structure.

Occurs whenever an object is hit by a weapon.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit object the fired the weapon weapon: Weapon object that hit the target target: The Object that was hit.

Defined in:

Parameter:

The EventData structure.

Occurs when any system fails on a human controlled aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that had the failure

Defined in:

Parameter:

The EventData structure.

Occurs on the death of a unit.

Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that killed the target
  • target: Target Object
  • weapon: Weapon Object

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft lands at an airbase, farp or ship Have a look at the class Core.Event#EVENT as these are just the prototypes.

initiator : The unit that has landed place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Occurs shortly after the landing animation of an ejected pilot touching the ground and standing up.

Event does not occur if the pilot lands in the water and sub combs to Davey Jones Locker. Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: Static object representing the ejected pilot. Place : Aircraft that the pilot ejected from.
  • place: may not return as a valid object if the aircraft has crashed into the ground and no longer exists.
  • subplace: is always 0 for unknown reasons.

Defined in:

Parameter:

The EventData structure.

Landing quality mark.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a new mark was added.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark text was changed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mark was removed.

Have a look at the class Core.Event#EVENT as these are just the prototypes. MarkID: ID of the mark.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission ends Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a mission starts Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.

* NOTE * this is a workarounf for DCS not creating these events as of Aug 2024.

Defined in:

Parameter:

The EventData structure.

Weapon add.

Fires when entering a mission per pylon with the name of the weapon (double pylons not counted, infinite wep reload not counted. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the pilot of an aircraft is killed.

Can occur either if the player is alive and crashes or if a weapon kills the pilot without completely destroying the plane. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the pilot has died in.

Defined in:

Parameter:

The EventData structure.

Occurs when a player enters a slot and takes control of an aircraft.

Have a look at the class Core.Event#EVENT as these are just the prototypes. NOTE: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player assumes direct control of a unit.

Note - not Mulitplayer safe. Use PlayerEnterAircraft. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is being taken control of.

Defined in:

Parameter:

The EventData structure.

Occurs when any player relieves control of a unit to the AI.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that the player left.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft is finished taking fuel.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was receiving fuel.

Defined in:

Parameter:

The EventData structure.

Occurs when any modification to the "Score" as seen on the debrief menu would occur.

There is no information on what values the score was changed to. Event is likely similar to player_comment in this regard. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit stops firing its weapon.

Event will always correspond with a shooting start event. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that was doing the shooting.

Defined in:

Parameter:

The EventData structure.

Occurs when any unit begins firing a weapon that has a high rate of fire.

Most common with aircraft cannons (GAU-8), autocannons, and machine guns. Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that is doing the shooting. target: The unit that is being targeted.

Defined in:

Parameter:

The EventData structure.

Occurs whenever any unit in a mission fires a weapon.

But not any machine gun or autocannon based weapon, those are handled by EVENT.ShootingStart. Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when an aircraft takes off from an airbase, farp, or ship.

Have a look at the class Core.Event#EVENT as these are just the prototypes. initiator : The unit that tookoff place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships

Defined in:

Parameter:

The EventData structure.

Trigger zone.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

Defined in:

Parameter:

The EventData structure.

Occurs when the game thinks an object is destroyed.

Have a look at the class Core.Event#EVENT as these are just the prototypes.

  • initiator: The unit that is was destroyed.

Defined in:

Parameter:

The EventData structure.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Schedule a new time event.

Note that the schedule will only take place if the scheduler is started. Even for a single schedule event, the scheduler needs to be started also.

Defined in:

Parameters:

#number Start

Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.

#number Repeat

Specifies the interval in seconds when the scheduler will call the event function.

#number RandomizeFactor

Specifies a randomization factor between 0 and 1 to randomize the Repeat.

#number Stop

Specifies the amount of seconds when the scheduler will be stopped.

#function SchedulerFunction

The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.

#table ...

Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.

Return value:

#string:

The Schedule ID of the planned schedule.

Stops the Schedule.

Defined in:

Parameter:

#string SchedulerID

(Optional) Scheduler ID to be stopped. If nil, all pending schedules are stopped.

Set the Class Core.Event processing Priority.

The Event processing Priority is a number from 1 to 10, reflecting the order of the classes subscribed to the Event to be processed.

Defined in:

Parameter:

#number EventPriority

The Core.Event processing Priority.

Return value:

self

Set a state or property of the Object given a Key and a Value.

Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.

Defined in:

Parameters:

Object

The object that will hold the Value set by the Key.

Key

The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!

Value

The value to is stored in the object.

Return value:

The Value set.

Trace a function logic level 1.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 2.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace a function logic level 3.

Can be anywhere within the function logic.

Defined in:

Parameter:

Arguments

A #table or any field.

Trace all methods in MOOSE

Defined in:

Parameter:

#boolean TraceAll

true = trace all methods in MOOSE.

Set tracing for a class

Defined in:

Parameter:

#string Class

Class name.

Set tracing for a specific method of class

Defined in:

Parameters:

#string Class

Class name.

#string Method

Method.

Set trace level

Defined in:

Parameter:

#number Level

Set trace off.

Defined in:

Usage:

-- Switch the tracing Off
BASE:TraceOff()

Set trace on.

Defined in:

Usage:

-- Switch the tracing On
BASE:TraceOn()

Set trace on or off Note that when trace is off, no BASE.Debug statement is performed, increasing performance! When Moose is loaded statically, (as one file), tracing is switched off by default.

So tracing must be switched on manually in your mission if you are using Moose statically. When moose is loading dynamically (for moose class development), tracing is switched on by default.

Defined in:

Parameter:

#boolean TraceOnOff

Switch the tracing on or off.

Usage:


  -- Switch the tracing On
  BASE:TraceOnOff( true )

  -- Switch the tracing Off
  BASE:TraceOnOff( false )

UnSubscribe to a DCS event.

Defined in:

Parameter:

Event ID.

Return value:

Trace a function call.

This function is private.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

(Internal) Serialize arguments

Defined in:

Parameter:

#table Arguments

Return value:

#string:

Text

Trace a function logic.

Defined in:

Parameters:

Arguments

A #table or any field.

DebugInfoCurrentParam

DebugInfoFromParam

The main event handling function...

This function captures all events generated for the class.

Defined in:

Parameter:

DCS#Event event

Missile data table.

Field(s)

#boolean FOX.MissileData.active

If true the missile is active.

#number FOX.MissileData.explosive

Explosive mass in kg TNT.

#number FOX.MissileData.fuseDist

Fuse distance in meters.

Core.Point#COORDINATE FOX.MissileData.missileCoord

Missile coordinate during tracking.

#string FOX.MissileData.missileName

Name of missile.

#number FOX.MissileData.missileRange

Range of missile in meters.

#string FOX.MissileData.missileType

Type of missile.

#number FOX.MissileData.shooterCoalition

Coalition side of the shooter.

Wrapper.Group#GROUP FOX.MissileData.shooterGroup

Group that shot the missile.

#string FOX.MissileData.shooterName

Name of the shooter unit.

Wrapper.Unit#UNIT FOX.MissileData.shooterUnit

Unit that shot the missile.

Core.Point#COORDINATE FOX.MissileData.shotCoord

Coordinate where the missile was fired.

#number FOX.MissileData.shotTime

Abs. mission time in seconds the missile was fired.

#string FOX.MissileData.targetName

Name of the target unit or "unknown".

#string FOX.MissileData.targetOrig

Name of the "original" target, i.e. the one right after launched.

#FOX.PlayerData FOX.MissileData.targetPlayer

Player that was targeted or nil.

DCS#Weapon FOX.MissileData.weapon

Missile weapon object.

Function(s)

Player data table holding all important parameters of each player.

Field(s)

#string FOX.PlayerData.callsign

Callsign of player.

Wrapper.Client#CLIENT FOX.PlayerData.client

Client object of player.

#number FOX.PlayerData.coalition

Coalition number of player.

#number FOX.PlayerData.dead

Number of missiles not defeated.

#number FOX.PlayerData.defeated

Number of missiles defeated.

#boolean FOX.PlayerData.destroy

Destroy missile.

Wrapper.Group#GROUP FOX.PlayerData.group

Aircraft group of player.

#string FOX.PlayerData.groupname

Name of the the player aircraft group.

#boolean FOX.PlayerData.inzone

Player is inside a protected zone.

#boolean FOX.PlayerData.launchalert

Alert player on detected missile launch.

#boolean FOX.PlayerData.marklaunch

Mark position of launched missile on F10 map.

#string FOX.PlayerData.name

Player name.

Wrapper.Unit#UNIT FOX.PlayerData.unit

Aircraft of the player.

#string FOX.PlayerData.unitname

Name of the unit.

Function(s)