Banner Image

Module Core.Spawn

Core - Spawn dynamically new groups of units in running missions.


Features:

  • Spawn new groups in running missions.
  • Schedule spawning of new groups.
  • Put limits on the amount of groups that can be spawned, and the amount of units that can be alive at the same time.
  • Randomize the spawning location between different zones.
  • Randomize the initial positions within the zones.
  • Spawn in array formation.
  • Spawn uncontrolled (for planes or helicopters only).
  • Clean up inactive helicopters that "crashed".
  • Place a hook to capture a spawn event, and tailor with customer code.
  • Spawn late activated.
  • Spawn with or without an initial delay.
  • Respawn after landing, on the runway or at the ramp after engine shutdown.
  • Spawn with custom heading, both for a group formation and for the units in the group.
  • Spawn with different skills.
  • Spawn with different liveries.
  • Spawn with an inner and outer radius to set the initial position.
  • Spawn with a randomize route.
  • Spawn with a randomized template.
  • Spawn with a randomized start points on a route.
  • Spawn with an alternative name.
  • Spawn and keep the unit names.
  • Spawn with a different coalition and country.
  • Enquiry methods to check on spawn status.

Demo Missions


YouTube Playlist


Author: FlightControl

Contributions: A lot of people within this community!


Global(s)

Global SPAWN

Allows to spawn dynamically new Wrapper.Groups.

#SPAWN SPAWN

Allows to spawn dynamically new Wrapper.Groups.

Each SPAWN object needs to be have related template groups setup in the Mission Editor (ME), which is a normal group with the Late Activation flag set. This template group will never be activated in your mission. SPAWN uses that template group to reference to all the characteristics (air, ground, livery, unit composition, formation, skill level etc) of each new group to be spawned.

Therefore, when creating a SPAWN object, the SPAWN.New and SPAWN.NewWithAlias require the name of the template group to be given as a string to those constructor methods.

Initialization settings can be applied on the SPAWN object, which modify the behavior or the way groups are spawned. These initialization methods have the prefix Init. There are also spawn methods with the prefix Spawn and will spawn new groups in various ways.

IMPORTANT! The methods with prefix Init must be used before any methods with prefix Spawn method are used, or unexpected results may appear!!!

Because SPAWN can spawn multiple groups of a template group, SPAWN has an internal index that keeps track which was the latest group that was spawned.

Limits can be set on how many groups can be spawn in each SPAWN object, using the method SPAWN.InitLimit. SPAWN has 2 kind of limits:

  • The maximum amount of Wrapper.Units that can be alive at the same time...
  • The maximum amount of Wrapper.Groups that can be spawned... This is more of a resource-type of limit.

When new groups get spawned using the Spawn methods, it will be evaluated whether any limits have been reached. When no spawn limit is reached, a new group will be created by the spawning methods, and the internal index will be increased with 1.

These limits ensure that your mission does not accidentally get flooded with spawned groups. Additionally, it also guarantees that independent of the group composition, at any time, the most optimal amount of groups are alive in your mission. For example, if your template group has a group composition of 10 units, and you specify a limit of 100 units alive at the same time, with unlimited resources = :InitLimit( 100, 0 ) and 10 groups are alive, but two groups have only one unit alive in the group, then a sequent Spawn(Scheduled) will allow a new group to be spawned!!!

IMPORTANT!! If a limit has been reached, it is possible that a Spawn method returns nil, meaning, no Wrapper.Group had been spawned!!!

Spawned groups get the same name as the name of the template group. Spawned units in those groups keep by default the same name as the name of the template group. However, because multiple groups and units are created from the template group, a suffix is added to each spawned group and unit.

Newly spawned groups will get the following naming structure at run-time:

  1. Spawned groups will have the name GroupName#nnn, where GroupName is the name of the template group, and nnn is a counter from 0 to 999.
  2. Spawned units will have the name GroupName#nnn-uu, where uu is a counter from 0 to 99 for each new spawned unit belonging to the group.

That being said, there is a way to keep the same unit names! The method SPAWN.InitKeepUnitNames() will keep the same unit names as defined within the template group, thus:

  1. Spawned units will have the name UnitName#nnn-uu, where UnitName is the unit name as defined in the template group*, and uu is a **counter from 0 to 99 for each new spawned unit belonging to the group.

Some additional notes that need to be considered!!:

  • templates are actually groups defined within the mission editor, with the flag "Late Activation" set. As such, these groups are never used within the mission, but are used by the #SPAWN module.
  • It is important to defined BEFORE you spawn new groups, a proper initialization of the SPAWN instance is done with the options you want to use.
  • When designing a mission, NEVER name groups using a "#" within the name of the group Spawn template(s), or the SPAWN module logic won't work anymore.

SPAWN construction methods

Create a new SPAWN object with the SPAWN.New() or the SPAWN.NewWithAlias() methods:

  • SPAWN.New(): Creates a new SPAWN object taking the name of the group that represents the GROUP template (definition).
  • SPAWN.NewWithAlias(): Creates a new SPAWN object taking the name of the group that represents the GROUP template (definition), and gives each spawned Wrapper.Group an different name.

It is important to understand how the SPAWN class works internally. The SPAWN object created will contain internally a list of groups that will be spawned and that are already spawned. The initialization methods will modify this list of groups so that when a group gets spawned, ALL information is already prepared when spawning. This is done for performance reasons. So in principle, the group list will contain all parameters and configurations after initialization, and when groups get actually spawned, this spawning can be done quickly and efficient.

SPAWN Initialization methods

A spawn object will behave differently based on the usage of initialization methods, which all start with the Init prefix:

Unit Names

  • SPAWN.InitKeepUnitNames(): Keeps the unit names as defined within the mission editor, but note that anything after a # mark is ignored, and any spaces before and after the resulting name are removed. IMPORTANT! This method MUST be the first used after :New !!!

Route randomization

Group composition randomization

  • SPAWN.InitRandomizeTemplate(): Randomize the group templates so that when a new group is spawned, a random group template is selected from one of the templates defined.

Uncontrolled

Array formation

  • SPAWN.InitArray(): Make groups visible before they are actually activated, and order these groups like a battalion in an array.

Group initial position - if wanted different from template position, for use with e.g. SPAWN.SpawnScheduled().

Set the positions of a group's units to absolute positions, or relative positions to unit No. 1

Position randomization

Enable / Disable AI when spawning a new Wrapper.Group

Limit scheduled spawning

  • SPAWN.InitLimit(): Limits the amount of groups that can be alive at the same time and that can be dynamically spawned.

Delay initial scheduled spawn

Repeat spawned Wrapper.Groups upon landing

Link-16 Datalink STN and SADL IDs (limited at the moment to F15/16/18/AWACS/Tanker/B1B, but not the F15E for clients, SADL A10CII only)

*{#SPAWN.InitSTN}(): Set the STN of the first unit in the group. All other units will have consecutive STNs, provided they have not been used yet. *{#SPAWN.InitSADL}(): Set the SADL of the first unit in the group. All other units will have consecutive SADLs, provided they have not been used yet.

Callsigns

*{#SPAWN.InitRandomizeCallsign}(): Set a random callsign name per spawn. *{#SPAWN.SpawnInitCallSign}(): Set a specific callsign for a spawned group.

Speed

*{#SPAWN.InitSpeedMps}(): Set the initial speed on spawning in meters per second. *{#SPAWN.InitSpeedKph}(): Set the initial speed on spawning in kilometers per hour. *{#SPAWN.InitSpeedKnots}(): Set the initial speed on spawning in knots.

SPAWN Spawn methods

Groups can be spawned at different times and methods:

Single spawning methods

Note that SPAWN.Spawn and SPAWN.ReSpawn return a Wrapper.Group#GROUP.New object, that contains a reference to the DCSGroup object. You can use the Wrapper.Group#GROUP object to do further actions with the DCSGroup.

Scheduled spawning methods

Retrieve alive GROUPs spawned by the SPAWN object

The SPAWN class administers which GROUPS it has reserved (in stock) or has created during mission execution. Every time a SPAWN object spawns a new GROUP object, a reference to the GROUP object is added to an internal table of GROUPS. SPAWN provides methods to iterate through that internal GROUP object reference table:

  • SPAWN.GetFirstAliveGroup(): Will find the first alive GROUP it has spawned, and return the alive GROUP object and the first Index where the first alive GROUP object has been found.
  • SPAWN.GetNextAliveGroup(): Will find the next alive GROUP object from a given Index, and return a reference to the alive GROUP object and the next Index where the alive GROUP has been found.
  • SPAWN.GetLastAliveGroup(): Will find the last alive GROUP object, and will return a reference to the last live GROUP object and the last Index where the last alive GROUP object has been found.

You can use the methods SPAWN.GetFirstAliveGroup() and sequently SPAWN.GetNextAliveGroup() to iterate through the alive GROUPS within the SPAWN object, and to actions... See the respective methods for an example. The method SPAWN.GetGroupFromIndex() will return the GROUP object reference from the given Index, dead or alive...

Spawned cleaning of inactive groups

Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damaged stop their activities, while remaining alive. In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't, and it may occur that no new groups are or can be spawned as limits are reached. To prevent this, a SPAWN.InitCleanUp() initialization method has been defined that will silently monitor the status of each spawned group. Once a group has a velocity = 0, and has been waiting for a defined interval, that group will be cleaned or removed from run-time. There is a catch however :-) If a damaged group has returned to an airbase within the coalition, that group will not be considered as "lost"... In such a case, when the inactive group is cleaned, a new group will Re-spawned automatically. This models AI that has successfully returned to their airbase, to restart their combat activities. Check the SPAWN.InitCleanUp() for further info.

Catch the Wrapper.Group Spawn Event in a callback function!

When using the SPAWN.SpawnScheduleds are created following the spawn time interval parameters. When a new Wrapper.Group is spawned, you maybe want to execute actions with that group spawned at the spawn event. The SPAWN class supports this functionality through the method SPAWN.OnSpawnGroup( *function( SpawnedGroup ) end * ), which takes a function as a parameter that you can define locally. Whenever a new Wrapper.Group is spawned, the given function is called, and the Wrapper.Group that was just spawned, is given as a parameter. As a result, your spawn event handling function requires one parameter to be declared, which will contain the spawned Wrapper.Group object. A coding example is provided at the description of the SPAWN.OnSpawnGroup( *function( SpawnedGroup ) end * ) method.

Delay the initial spawning

When using the SPAWN.SpawnScheduled immediately when :SpawnScheduled() is initiated. The methods SPAWN.InitDelayOnOff() and SPAWN.InitDelayOn() can be used to activate a delay before the first Wrapper.Group is spawned. For completeness, a method SPAWN.InitDelayOff() is also available, that can be used to switch off the initial delay. Because there is no delay by default, this method would only be used when a SPAWN.SpawnScheduleStop() ; SPAWN.SpawnScheduleStart() sequence would have been used.

Type(s)

SPAWN , extends Core.Base#BASE
Fields and Methods inherited from SPAWN Description

SPAWN.AIOnOff

SPAWN.AliveUnits

SPAWN.ClassName

SPAWN.CleanUpScheduler

SPAWN.DelayOnOff

SPAWN:GetCoordinate()

Get the Coordinate of the Group that is Late Activated as the template for the SPAWN object.

SPAWN:GetFirstAliveGroup()

Will find the first alive Wrapper.Group it has spawned, and return the alive Wrapper.Group object and the first Index where the first alive Wrapper.Group object has been found.

SPAWN:GetGroupFromIndex(SpawnIndex)

Get the group from an index.

SPAWN:GetLastAliveGroup()

Will find the last alive Wrapper.Group object, and will return a reference to the last live Wrapper.Group object and the last Index where the last alive Wrapper.Group object has been found.

SPAWN:GetNextAliveGroup(SpawnIndexStart)

Will find the next alive Wrapper.Group object from a given Index, and return a reference to the alive Wrapper.Group object and the next Index where the alive Wrapper.Group has been found.

SPAWN:GetSpawnIndexFromGroup(SpawnGroup)

Get the index from a given group.

SPAWN:InitAIOff()

Turns the AI Off for the Wrapper.Group when spawning.

SPAWN:InitAIOn()

Turns the AI On for the Wrapper.Group when spawning.

SPAWN:InitAIOnOff(AIOnOff)

Turns the AI On or Off for the Wrapper.Group when spawning.

SPAWN:InitAirbase(AirbaseName, Takeoff, TerminalType)

Set spawns to happen at a particular airbase.

SPAWN:InitArray(SpawnAngle, SpawnWidth, SpawnDeltaX, SpawnDeltaY)

Makes the groups visible before start (like a battalion).

SPAWN:InitCallSign(ID, Name, Minor, Major)

[BLUE AIR only!] This method sets a specific callsign for a spawned group.

SPAWN:InitCategory(Category)

Sets category ID of the group.

SPAWN:InitCleanUp(SpawnCleanUpInterval)

Delete groups that have not moved for X seconds - AIR ONLY!!! DO NOT USE ON GROUPS THAT DO NOT MOVE OR YOUR SERVER WILL BURN IN HELL (Pikes - April 2020) When groups are still alive and have become inactive due to damage and are unable to contribute anything, then this group will be removed at defined intervals in seconds.

SPAWN:InitCoalition(Coalition)

Sets the coalition of the spawned group.

SPAWN:InitCountry(Country)

Sets the country of the spawn group.

SPAWN:InitDelayOff()

Turns the Delay Off for the Wrapper.Group when spawning.

SPAWN:InitDelayOn()

Turns the Delay On for the Wrapper.Group when spawning with #SpawnScheduled().

SPAWN:InitDelayOnOff(DelayOnOff)

SPAWN:InitGroupHeading(HeadingMin, HeadingMax, unitVar)

Defines the heading of the overall formation of the new spawned group.

SPAWN:InitGrouping(Grouping)

When spawning a new group, make the grouping of the units according the InitGrouping setting.

SPAWN:InitHeading(HeadingMin, HeadingMax)

Defines the Heading for the new spawned units.

SPAWN:InitKeepUnitNames(KeepUnitNames)

Keeps the unit names as defined within the mission editor, but note that anything after a # mark is ignored, and any spaces before and after the resulting name are removed.

SPAWN:InitLateActivated(LateActivated)

Flags that the spawned groups must be spawned late activated.

SPAWN:InitLimit(SpawnMaxUnitsAlive, SpawnMaxGroups)

Stops any more repeat spawns from happening once the UNIT count of Alive units, spawned by the same SPAWN object, exceeds the first parameter.

SPAWN:InitLivery(Livery)

Sets livery of the group.

SPAWN:InitModex(modex, prefix, postfix)

Sets the modex of the first unit of the group.

SPAWN:InitPositionCoordinate(Coordinate)

This method sets a spawn position for the group that is different from the location of the template.

SPAWN:InitPositionVec2(Vec2)

This method sets a spawn position for the group that is different from the location of the template.

SPAWN:InitRadioCommsOnOff(switch)

Sets the radio communication on or off.

SPAWN:InitRadioFrequency(frequency)

Sets the radio frequency of the group.

SPAWN:InitRadioModulation(modulation)

Set radio modulation.

SPAWN:InitRandomizeCallsign()

[AIR/Fighter only!] This method randomizes the callsign for a new group.

SPAWN:InitRandomizePosition(RandomizePosition, OuterRadius, InnerRadius)

Randomizes the position of Wrapper.Groups that are spawned within a radius band, given an Outer and Inner radius, from the point that the spawn happens.

SPAWN:InitRandomizeRoute(SpawnStartPoint, SpawnEndPoint, SpawnRadius, SpawnHeight)

Randomizes the defined route of the SpawnTemplatePrefix group in the ME.

SPAWN:InitRandomizeTemplate(SpawnTemplatePrefixTable)

This method is rather complicated to understand.

SPAWN:InitRandomizeTemplatePrefixes(SpawnTemplatePrefixes)

Randomize templates to be used as the unit representatives for the Spawned group, defined by specifying the prefix names.

SPAWN:InitRandomizeTemplateSet(SpawnTemplateSet)

Randomize templates to be used as the unit representatives for the Spawned group, defined using a SET_GROUP object.

SPAWN:InitRandomizeUnits(RandomizeUnits, OuterRadius, InnerRadius)

Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius.

SPAWN:InitRandomizeZones(SpawnZoneTable)

This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.

SPAWN:InitRepeat()

For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.

SPAWN:InitRepeatOnEngineShutDown()

Respawn after landing when its engines have shut down.

SPAWN:InitRepeatOnLanding()

Respawn group after landing.

SPAWN:InitSADL(Octal)

[Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set.

SPAWN:InitSTN(Octal)

[Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set.

SPAWN:InitSetUnitAbsolutePositions(Positions)

Spawn the UNITs of this group with individual absolute positions and individual headings.

SPAWN:InitSetUnitRelativePositions(Positions)

Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.

SPAWN:InitSkill(Skill)

Sets skill of the group.

SPAWN.InitSpeed

SPAWN:InitSpeedKnots(Knots)

[Airplane] Set the initial speed on spawning in knots.

SPAWN:InitSpeedKph(KPH)

[Airplane] Set the initial speed on spawning in kilometers per hour.

SPAWN:InitSpeedMps(MPS)

[Airplane] Set the initial speed on spawning in meters per second.

SPAWN:InitUnControlled(UnControlled)

(AIR) Will spawn a plane group in UnControlled or Controlled mode...

SPAWN.LateActivated

SPAWN.MaxAliveGroups

SPAWN.MaxAliveUnits

SPAWN:New(SpawnTemplatePrefix)

Creates the main object to spawn a Wrapper.Group defined in the DCS ME.

SPAWN:NewFromTemplate(SpawnTemplate, SpawnTemplatePrefix, SpawnAliasPrefix, NoMooseNamingPostfix)

Creates a new SPAWN instance to create new groups based on the provided template.

SPAWN:NewWithAlias(SpawnTemplatePrefix, SpawnAliasPrefix)

Creates a new SPAWN instance to create new groups based on the defined template and using a new alias for each new group.

SPAWN:OnSpawnGroup(SpawnCallBackFunction, SpawnFunctionArguments, ...)

Allows to place a CallFunction hook when a new group spawns.

SPAWN:ParkAircraft(SpawnAirbase, TerminalType, Parkingdata, SpawnIndex)

Will park a group at an Wrapper.Airbase.

SPAWN:ParkAtAirbase(SpawnAirbase, TerminalType, Parkingdata)

Will park a group at an Wrapper.Airbase.

SPAWN:ReSpawn(SpawnIndex)

Will re-spawn a group based on a given index.

SPAWN.Repeat

SPAWN.RepeatOnEngineShutDown

SPAWN.RepeatOnLanding

SPAWN:SetSpawnIndex(SpawnIndex)

Set the spawn index to a specified index number.

SPAWN:Spawn()

Will spawn a group based on the internal index.

SPAWN.SpawnAliasPrefix

SPAWN:SpawnAtAirbase(SpawnAirbase, Takeoff, TakeoffAltitude, TerminalType, EmergencyAirSpawn, Parkingdata)

Will spawn a group at an Wrapper.Airbase.

SPAWN:SpawnAtParkingSpot(Airbase, Spots, Takeoff)

Spawn a group on an Wrapper.Airbase at a specific parking spot.

SPAWN.SpawnCleanUpInterval

SPAWN.SpawnCleanUpTimeStamps

SPAWN.SpawnCount

SPAWN:SpawnFromCoordinate(Coordinate, SpawnIndex)

Will spawn a group from a Coordinate in 3D space.

SPAWN.SpawnFromNewPosition

SPAWN:SpawnFromPointVec2(PointVec2, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a POINT_VEC2 in 3D space.

SPAWN:SpawnFromPointVec3(PointVec3, SpawnIndex)

Will spawn a group from a PointVec3 in 3D space.

SPAWN:SpawnFromStatic(HostStatic, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a hosting static.

SPAWN:SpawnFromUnit(HostUnit, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a hosting unit.

SPAWN:SpawnFromVec2(Vec2, MinHeight, MaxHeight, SpawnIndex)

Will spawn a group from a Vec2 in 3D space.

SPAWN:SpawnFromVec3(Vec3, SpawnIndex)

Will spawn a group from a Vec3 in 3D space.

SPAWN.SpawnFunctionArguments

SPAWN.SpawnFunctionHook

SPAWN:SpawnGroupName(SpawnIndex)

Will return the SpawnGroupName either with with a specific count number or without any count.

SPAWN.SpawnGrouping

SPAWN.SpawnGroups

SPAWN.SpawnHookScheduler

SPAWN:SpawnInZone(Zone, RandomizeGroup, MinHeight, MaxHeight, SpawnIndex)

Will spawn a Group within a given Core.Zone.

SPAWN.SpawnIndex

SPAWN.SpawnInitAirbase

SPAWN.SpawnInitCallSign

SPAWN.SpawnInitCallSignID

SPAWN.SpawnInitCallSignMajor

SPAWN.SpawnInitCallSignMinor

SPAWN.SpawnInitCallSignName

SPAWN.SpawnInitCategory

SPAWN.SpawnInitCoalition

SPAWN.SpawnInitCountry

SPAWN.SpawnInitFreq

SPAWN.SpawnInitGroupHeadingMax

SPAWN.SpawnInitGroupHeadingMin

SPAWN.SpawnInitGroupUnitVar

SPAWN.SpawnInitHeadingMax

SPAWN.SpawnInitHeadingMin

SPAWN.SpawnInitKeepUnitNames

SPAWN.SpawnInitLimit

SPAWN.SpawnInitLivery

SPAWN.SpawnInitModex

SPAWN.SpawnInitModexPostfix

SPAWN.SpawnInitModexPrefix

SPAWN.SpawnInitModu

SPAWN.SpawnInitPosition

SPAWN.SpawnInitRadio

SPAWN.SpawnInitSADL

SPAWN.SpawnInitSTN

SPAWN.SpawnInitSkill

SPAWN.SpawnInitTakeoff

SPAWN.SpawnInitTerminalType

SPAWN.SpawnInnerRadius

SPAWN.SpawnIsScheduled

SPAWN.SpawnMaxGroups

SPAWN.SpawnMaxUnitsAlive

SPAWN.SpawnOuterRadius

SPAWN.SpawnRandomCallsign

SPAWN.SpawnRandomize

SPAWN.SpawnRandomizePosition

SPAWN.SpawnRandomizePositionInnerRadius

SPAWN.SpawnRandomizePositionOuterRadius

SPAWN.SpawnRandomizeRoute

SPAWN.SpawnRandomizeRouteEndPoint

SPAWN.SpawnRandomizeRouteHeight

SPAWN.SpawnRandomizeRouteRadius

SPAWN.SpawnRandomizeRouteStartPoint

SPAWN.SpawnRandomizeTemplate

SPAWN.SpawnRandomizeUnits

SPAWN.SpawnRandomizeZones

SPAWN:SpawnScheduleStart()

Will re-start the spawning scheduler.

SPAWN:SpawnScheduleStop()

Will stop the scheduled spawning scheduler.

SPAWN:SpawnScheduled(SpawnTime, SpawnTimeVariation, WithDelay)

Spawns new groups at varying time intervals.

SPAWN.SpawnScheduler

SPAWN.SpawnTemplate

SPAWN.SpawnTemplatePrefix

SPAWN.SpawnTemplatePrefixTable

SPAWN.SpawnUnControlled

SPAWN.SpawnUnitsWithAbsolutePositions

SPAWN.SpawnUnitsWithRelativePositions

SPAWN.SpawnVisible

SPAWN:SpawnWithIndex(SpawnIndex, NoBirth)

Will spawn a group with a specified index number.

SPAWN.SpawnZoneTable

SPAWN.Takeoff

SPAWN.TweakedTemplate

SPAWN.UnControlled

SPAWN.UnitsAbsolutePositions

SPAWN.UnitsRelativePositions

SPAWN:_GetGroupCategoryID(SpawnPrefix)

Gets the CategoryID of the Group with the given SpawnPrefix

SPAWN:_GetGroupCoalitionID(SpawnPrefix)

Gets the CoalitionID of the Group with the given SpawnPrefix

SPAWN:_GetGroupCountryID(SpawnPrefix)

Gets the CountryID of the Group with the given SpawnPrefix

SPAWN:_GetLastIndex()

Return the last maximum index that can be used.

SPAWN:_GetPrefixFromGroup(SpawnGroup)

Return the prefix of a SpawnUnit.

SPAWN:_GetPrefixFromGroupName(SpawnGroupName)

Return the prefix of a spawned group.

SPAWN:_GetSpawnIndex(SpawnIndex)

Get the next index of the groups to be spawned.

SPAWN:_GetTemplate(SpawnTemplatePrefix)

Gets the Group Template from the ME environment definition.

SPAWN:_InitializeSpawnGroups(SpawnIndex)

Initalize the SpawnGroups collection.

SPAWN:_OnBirth(EventData)

SPAWN:_OnDeadOrCrash(EventData)

SPAWN:_OnEngineShutDown(EventData)

Will detect AIR Units shutting down their engines ...

SPAWN:_OnLand(EventData)

Will detect AIR Units landing...

SPAWN:_OnTakeOff(EventData)

Will detect AIR Units taking off...

SPAWN:_Prepare(SpawnTemplatePrefix, SpawnIndex)

Prepares the new Group Template.

SPAWN:_RandomizeRoute(SpawnIndex)

Private method randomizing the routes.

SPAWN:_RandomizeTemplate(SpawnIndex)

Private method that randomizes the template of the group.

SPAWN:_RandomizeZones(SpawnIndex)

Private method that randomizes the Core.Zones where the Group will be spawned.

SPAWN:_Scheduler()

This function is called automatically by the Spawning scheduler.

SPAWN:_SetInitialPosition(SpawnIndex)

Private method that sets the DCS#Vec2 where the Group will be spawned.

SPAWN:_SpawnCleanUpScheduler()

Schedules the CleanUp of Groups

SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)

SPAWN.communication

SPAWN.frequency

SPAWN.modulation

Fields and Methods inherited from BASE Description

SPAWN.ClassID

The ID number of the class.

SPAWN.ClassName

The name of the class.

SPAWN.ClassNameAndID

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

SPAWN:ClearState(Object, StateName)

Clear the state of an object.

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

Creation of a Birth Event.

SPAWN:CreateEventCrash(EventTime, Initiator, IniObjectCategory)

Creation of a Crash Event.

SPAWN:CreateEventDead(EventTime, Initiator, IniObjectCategory)

Creation of a Dead Event.

SPAWN:CreateEventPlayerEnterAircraft(PlayerUnit)

Creation of a S_EVENT_PLAYER_ENTER_AIRCRAFT event.

SPAWN:CreateEventRemoveUnit(EventTime, Initiator)

Creation of a Remove Unit Event.

SPAWN:CreateEventTakeoff(EventTime, Initiator)

Creation of a Takeoff Event.

SPAWN:CreateEventUnitLost(EventTime, Initiator)

Creation of a Crash Event.

SPAWN:E(Arguments)

Log an exception which will be traced always.

SPAWN:EventDispatcher()

Returns the event dispatcher

SPAWN:EventRemoveAll()

Remove all subscribed events

SPAWN:F(Arguments)

Trace a function call.

SPAWN:F2(Arguments)

Trace a function call level 2.

SPAWN:F3(Arguments)

Trace a function call level 3.

SPAWN:GetClassID()

Get the ClassID of the class instance.

SPAWN:GetClassName()

Get the ClassName of the class instance.

SPAWN:GetClassNameAndID()

Get the ClassName + ClassID of the class instance.

SPAWN:GetEventPriority()

Get the Class Core.Event processing Priority.

SPAWN:GetParent(Child, FromClass)

This is the worker method to retrieve the Parent class.

SPAWN:GetState(Object, Key)

Get a Value given a Key from the Object.

SPAWN:HandleEvent(EventID, EventFunction)

Subscribe to a DCS Event.

SPAWN:I(Arguments)

Log an information which will be traced always.

SPAWN:Inherit(Child, Parent)

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

SPAWN:IsInstanceOf(ClassName)

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

SPAWN:IsTrace()

Enquires if tracing is on (for the class).

SPAWN:New()

BASE constructor.

SPAWN:OnEvent(EventData)

Occurs when an Event for an object is triggered.

SPAWN:OnEventBDA(EventData)

BDA.

SPAWN:OnEventBaseCaptured(EventData)

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

SPAWN:OnEventBirth(EventData)

Occurs when any object is spawned into the mission.

SPAWN:OnEventCrash(EventData)

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

SPAWN:OnEventDead(EventData)

Occurs when an object is dead.

SPAWN:OnEventDetailedFailure(EventData)

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

SPAWN:OnEventDiscardChairAfterEjection(EventData)

Discard chair after ejection.

SPAWN: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.

SPAWN:OnEventEngineShutdown(EventData)

Occurs when any aircraft shuts down its engines.

SPAWN:OnEventEngineStartup(EventData)

Occurs when any aircraft starts its engines.

SPAWN:OnEventHit(EventData)

Occurs whenever an object is hit by a weapon.

SPAWN:OnEventHumanFailure(EventData)

Occurs when any system fails on a human controlled aircraft.

SPAWN:OnEventKill(EventData)

Occurs on the death of a unit.

SPAWN: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.

SPAWN:OnEventLandingAfterEjection(EventData)

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

SPAWN:OnEventLandingQualityMark(EventData)

Landing quality mark.

SPAWN:OnEventMarkAdded(EventData)

Occurs when a new mark was added.

SPAWN:OnEventMarkChange(EventData)

Occurs when a mark text was changed.

SPAWN:OnEventMarkRemoved(EventData)

Occurs when a mark was removed.

SPAWN:OnEventMissionEnd(EventData)

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

SPAWN:OnEventMissionStart(EventData)

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

SPAWN:OnEventParatrooperLanding(EventData)

Weapon add.

SPAWN:OnEventPilotDead(EventData)

Occurs when the pilot of an aircraft is killed.

SPAWN:OnEventPlayerEnterAircraft(EventData)

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

SPAWN:OnEventPlayerEnterUnit(EventData)

Occurs when any player assumes direct control of a unit.

SPAWN:OnEventPlayerLeaveUnit(EventData)

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

SPAWN:OnEventRefueling(EventData)

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

SPAWN:OnEventRefuelingStop(EventData)

Occurs when an aircraft is finished taking fuel.

SPAWN:OnEventScore(EventData)

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

SPAWN:OnEventShootingEnd(EventData)

Occurs when any unit stops firing its weapon.

SPAWN:OnEventShootingStart(EventData)

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

SPAWN:OnEventShot(EventData)

Occurs whenever any unit in a mission fires a weapon.

SPAWN:OnEventTakeoff(EventData)

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

SPAWN:OnEventTriggerZone(EventData)

Trigger zone.

SPAWN:OnEventUnitLost(EventData)

Occurs when the game thinks an object is destroyed.

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

Schedule a new time event.

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

Schedule a new time event.

SPAWN:ScheduleStop(SchedulerID)

Stops the Schedule.

SPAWN.Scheduler

SPAWN:SetEventPriority(EventPriority)

Set the Class Core.Event processing Priority.

SPAWN:SetState(Object, Key, Value)

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

SPAWN:T(Arguments)

Trace a function logic level 1.

SPAWN:T2(Arguments)

Trace a function logic level 2.

SPAWN:T3(Arguments)

Trace a function logic level 3.

SPAWN:TraceAll(TraceAll)

Trace all methods in MOOSE

SPAWN:TraceClass(Class)

Set tracing for a class

SPAWN:TraceClassMethod(Class, Method)

Set tracing for a specific method of class

SPAWN:TraceLevel(Level)

Set trace level

SPAWN:TraceOff()

Set trace off.

SPAWN:TraceOn()

Set trace on.

SPAWN: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.

SPAWN:UnHandleEvent(EventID)

UnSubscribe to a DCS event.

SPAWN._

SPAWN:_F(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function call.

SPAWN:_Serialize(Arguments)

(Internal) Serialize arguments

SPAWN:_T(Arguments, DebugInfoCurrentParam, DebugInfoFromParam)

Trace a function logic.

SPAWN.__

SPAWN:onEvent(event)

The main event handling function...

SPAWN Class

Field(s)

#boolean SPAWN.AIOnOff

The AI is on by default when spawning a group.

#boolean SPAWN.DelayOnOff

No initial delay when spawning the first group.

#boolean SPAWN.Repeat
#number SPAWN.SpawnCount

The internal counter of the amount of spawning the has happened since SpawnStart.

#table SPAWN.SpawnGroups

Array containing the descriptions of each Group to be Spawned.

#boolean SPAWN.SpawnInitKeepUnitNames

Overwrite unit names by default with group name.

#boolean SPAWN.SpawnInitLimit

By default, no InitLimit

#boolean SPAWN.SpawnIsScheduled

Reflects if the spawning for this SpawnTemplatePrefix is going to be scheduled or not.

#number SPAWN.SpawnMaxGroups

The maximum amount of groups that can be spawned.

#number SPAWN.SpawnMaxUnitsAlive

The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time.

#boolean SPAWN.SpawnRandomize

Sets the randomization flag of new Spawned units to false.

SPAWN.SpawnTemplate

Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!

#boolean SPAWN.SpawnVisible

When the first Spawn executes, all the Groups need to be made visible before start.

#table SPAWN.Takeoff

@field #SPAWN.Takeoff Takeoff

#boolean SPAWN.TweakedTemplate

Check if the user is using self made template.

#boolean SPAWN.UnControlled

When working in UnControlled mode, all planes are Spawned in UnControlled mode before the scheduler starts.

Function(s)

Get the Coordinate of the Group that is Late Activated as the template for the SPAWN object.

Defined in:

SPAWN

Return value:

The Coordinate

Will find the first alive Wrapper.Group it has spawned, and return the alive Wrapper.Group object and the first Index where the first alive Wrapper.Group object has been found.

Defined in:

SPAWN

Return values:

The Wrapper.Group object found, the new Index where the group was found.

#nil, #nil:

When no group is found, #nil is returned.

Usage:


  -- Find the first alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
  local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
  while GroupPlane ~= nil do
    -- Do actions with the GroupPlane object.
    GroupPlane, Index = SpawnPlanes:GetNextAliveGroup( Index )
  end

Get the group from an index.

Returns the group from the SpawnGroups list. If no index is given, it will return the first group in the list.

Defined in:

SPAWN

Parameter:

#number SpawnIndex

The index of the group to return.

Return value:

Will find the last alive Wrapper.Group object, and will return a reference to the last live Wrapper.Group object and the last Index where the last alive Wrapper.Group object has been found.

Defined in:

SPAWN

Return values:

The last alive Wrapper.Group object found, the last Index where the last alive Wrapper.Group object was found.

#nil, #nil:

When no alive Wrapper.Group object is found, #nil is returned.

Usage:


  -- Find the last alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
  local GroupPlane, Index = SpawnPlanes:GetLastAliveGroup()
  if GroupPlane then -- GroupPlane can be nil!!!
    -- Do actions with the GroupPlane object.
  end

Will find the next alive Wrapper.Group object from a given Index, and return a reference to the alive Wrapper.Group object and the next Index where the alive Wrapper.Group has been found.

Defined in:

SPAWN

Parameter:

#number SpawnIndexStart

A Index holding the start position to search from. This method can also be used to find the first alive Wrapper.Group object from the given Index.

Return values:

The next alive Wrapper.Group object found, the next Index where the next alive Wrapper.Group object was found.

#nil, #nil:

When no alive Wrapper.Group object is found from the start Index position, #nil is returned.

Usage:


  -- Find the first alive @{Wrapper.Group} object of the SpawnPlanes SPAWN object @{Wrapper.Group} collection that it has spawned during the mission.
  local GroupPlane, Index = SpawnPlanes:GetFirstAliveGroup()
  while GroupPlane ~= nil do
    -- Do actions with the GroupPlane object.
    GroupPlane, Index = SpawnPlanes:GetNextAliveGroup( Index )
  end

Get the index from a given group.

The function will search the name of the group for a #, and will return the number behind the #-mark.

Defined in:

SPAWN

Parameter:

SpawnGroup

Turns the AI Off for the Wrapper.Group when spawning.

Defined in:

SPAWN

Return value:

The SPAWN object

Turns the AI On for the Wrapper.Group when spawning.

Defined in:

SPAWN

Return value:

The SPAWN object

Turns the AI On or Off for the Wrapper.Group when spawning.

Defined in:

SPAWN

Parameter:

#boolean AIOnOff

A value of true sets the AI On, a value of false sets the AI Off.

Return value:

The SPAWN object

Set spawns to happen at a particular airbase.

Only for aircraft, of course.

Defined in:

SPAWN

Parameters:

#string AirbaseName

Name of the airbase.

#number Takeoff

(Optional) Takeoff type. Can be SPAWN.Takeoff.Hot (default), SPAWN.Takeoff.Cold or SPAWN.Takeoff.Runway.

#number TerminalType

(Optional) The terminal type.

Return value:

self

Makes the groups visible before start (like a battalion).

The method will take the position of the group as the first position in the array. CAUTION: this directive will NOT work with OnSpawnGroup function.

Defined in:

SPAWN

Parameters:

#number SpawnAngle

The angle in degrees how the groups and each unit of the group will be positioned.

#number SpawnWidth

The amount of Groups that will be positioned on the X axis.

#number SpawnDeltaX

The space between each Group on the X-axis.

#number SpawnDeltaY

The space between each Group on the Y-axis.

Return value:

self

Usage:


  -- Define an array of Groups.
  Spawn_BE_Ground = SPAWN:New( 'BE Ground' )
                         :InitLimit( 2, 24 )
                         :InitArray( 90, 10, 100, 50 )

[BLUE AIR only!] This method sets a specific callsign for a spawned group.

Use for a group with one unit only!

Defined in:

SPAWN

Parameters:

#number ID

ID of the callsign enumerator, e.g. CALLSIGN.Tanker.Texaco - - resulting in e.g. Texaco-2-1

#string Name

Name of this callsign as it cannot be determined from the ID because of the dependency on the task type of the plane, and the plane type. E.g. "Texaco"

#number Minor

Minor number, i.e. the unit number within the group, e.g 2 - resulting in e.g. Texaco-2-1

#number Major

Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1

Return value:

self

Sets category ID of the group.

Defined in:

SPAWN

Parameter:

#number Category

Category id.

Return value:

self

Delete groups that have not moved for X seconds - AIR ONLY!!! DO NOT USE ON GROUPS THAT DO NOT MOVE OR YOUR SERVER WILL BURN IN HELL (Pikes - April 2020) When groups are still alive and have become inactive due to damage and are unable to contribute anything, then this group will be removed at defined intervals in seconds.

Defined in:

SPAWN

Parameter:

#string SpawnCleanUpInterval

The interval to check for inactive groups within seconds.

Return value:

self

Usage:


  Spawn_Helicopter:InitCleanUp( 20 )  -- CleanUp the spawning of the helicopters every 20 seconds when they become inactive.

Sets the coalition of the spawned group.

Note that it might be necessary to also set the country explicitly!

Defined in:

SPAWN

Parameter:

DCS#coalition.side Coalition

Coalition of the group as number of enumerator:

Return value:

self

Sets the country of the spawn group.

Note that the country determines the coalition of the group depending on which country is defined to be on which side for each specific mission!

Defined in:

SPAWN

Parameter:

#number Country

Country id as number or enumerator:

Return value:

self

Turns the Delay Off for the Wrapper.Group when spawning.

Defined in:

SPAWN

Return value:

The SPAWN object

Turns the Delay On for the Wrapper.Group when spawning with #SpawnScheduled().

In effect then the 1st group will only be spawned after the number of seconds given in SpawnScheduled as arguments, and not immediately.

Defined in:

SPAWN

Return value:

The SPAWN object

Defined in:

SPAWN

Parameter:

DelayOnOff

Defines the heading of the overall formation of the new spawned group.

The heading can be given as one fixed degree, or can be randomized between minimum and maximum degrees. The Group's formation as laid out in its template will be rotated around the first unit in the group Group individual units facings will rotate to match. If InitHeading is also applied to this SPAWN then that will take precedence for individual unit facings. Note that InitGroupHeading does not rotate the groups route; only its initial facing!

Defined in:

SPAWN

Parameters:

#number HeadingMin

The minimum or fixed heading in degrees.

#number HeadingMax

(optional) The maximum heading in degrees. This there is no maximum heading, then the heading for the group will be HeadingMin.

#number unitVar

(optional) Individual units within the group will have their heading randomized by +/- unitVar degrees. Default is zero.

Return value:

self

Usage:


mySpawner = SPAWN:New( ... )

  -- Spawn the Group with the formation rotated +100 degrees around unit #1, compared to the mission template.
  mySpawner:InitGroupHeading( 100 )

  -- Spawn the Group with the formation rotated units between +100 and +150 degrees around unit #1, compared to the mission template, and with individual units varying by +/- 10 degrees from their templated facing.
  mySpawner:InitGroupHeading( 100, 150, 10 )

  -- Spawn the Group with the formation rotated -60 degrees around unit #1, compared to the mission template, but with all units facing due north regardless of how they were laid out in the template.
  mySpawner:InitGroupHeading(-60):InitHeading(0)
  -- or
  mySpawner:InitHeading(0):InitGroupHeading(-60)

When spawning a new group, make the grouping of the units according the InitGrouping setting.

Defined in:

SPAWN

Parameter:

#number Grouping

Indicates the maximum amount of units in the group.

Return value:

Defines the Heading for the new spawned units.

The heading can be given as one fixed degree, or can be randomized between minimum and maximum degrees.

Defined in:

SPAWN

Parameters:

#number HeadingMin

The minimum or fixed heading in degrees.

#number HeadingMax

(optional) The maximum heading in degrees. This there is no maximum heading, then the heading will be fixed for all units using minimum heading.

Return value:

self

Usage:


  Spawn = SPAWN:New( ... )

  -- Spawn the units pointing to 100 degrees.
  Spawn:InitHeading( 100 )

  -- Spawn the units pointing between 100 and 150 degrees.
  Spawn:InitHeading( 100, 150 )

Keeps the unit names as defined within the mission editor, but note that anything after a # mark is ignored, and any spaces before and after the resulting name are removed.

IMPORTANT! This method MUST be the first used after :New !!!

Defined in:

SPAWN

Parameter:

#boolean KeepUnitNames

(optional) If true, the unit names are kept, false or not provided to make new unit names.

Return value:

self

Flags that the spawned groups must be spawned late activated.

Defined in:

SPAWN

Parameter:

#boolean LateActivated

(optional) If true, the spawned groups are late activated.

Return value:

self

Stops any more repeat spawns from happening once the UNIT count of Alive units, spawned by the same SPAWN object, exceeds the first parameter.

Also can stop spawns from happening once a total GROUP still alive is met. Exceptionally powerful when combined with SpawnSchedule for Respawning. Note that this method is exceptionally important to balance the performance of the mission. Depending on the machine etc, a mission can only process a maximum amount of units. If the time interval must be short, but there should not be more Units or Groups alive than a maximum amount of units, then this method should be used... When a SPAWN.New is executed and the limit of the amount of units alive is reached, then no new spawn will happen of the group, until some of these units of the spawn object will be destroyed.

Defined in:

SPAWN

Parameters:

#number SpawnMaxUnitsAlive

The maximum amount of units that can be alive at runtime.

#number SpawnMaxGroups

The maximum amount of groups that can be spawned. When the limit is reached, then no more actual spawns will happen of the group. This parameter is useful to define a maximum amount of airplanes, ground troops, helicopters, ships etc within a supply area. This parameter accepts the value 0, which defines that there are no maximum group limits, but there are limits on the maximum of units that can be alive at the same time.

Return value:

self

Usage:


  -- NATO helicopters engaging in the battle field.
  -- This helicopter group consists of one Unit. So, this group will SPAWN maximum 2 groups simultaneously within the DCSRTE.
  -- There will be maximum 24 groups spawned during the whole mission lifetime. 
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitLimit( 2, 24 )

Sets livery of the group.

Defined in:

SPAWN

Parameter:

#string Livery

Livery name. Note that this is not necessarily the same name as displayed in the mission editor.

Return value:

self

Sets the modex of the first unit of the group.

If more units are in the group, the number is increased by one with every unit.

Defined in:

SPAWN

Parameters:

#number modex

Modex of the first unit.

#string prefix

(optional) String to prefix to modex, e.g. for French AdA Modex, eg. -L-102 then "-L-" would be the prefix.

#string postfix

(optional) String to postfix to modex, example tbd.

Return value:

self

This method sets a spawn position for the group that is different from the location of the template.

Defined in:

SPAWN

Parameter:

The position to spawn from

Return value:

self

This method sets a spawn position for the group that is different from the location of the template.

Defined in:

SPAWN

Parameter:

DCS#Vec2 Vec2

The position to spawn from

Return value:

self

Sets the radio communication on or off.

Same as checking/unchecking the COMM box in the mission editor.

Defined in:

SPAWN

Parameter:

#number switch

If true (or nil), enables the radio communication. If false, disables the radio for the spawned group.

Return value:

self

Sets the radio frequency of the group.

Defined in:

SPAWN

Parameter:

#number frequency

The frequency in MHz.

Return value:

self

Set radio modulation.

Default is AM.

Defined in:

SPAWN

Parameter:

#string modulation

Either "FM" or "AM". If no value is given, modulation is set to AM.

Return value:

self

[AIR/Fighter only!] This method randomizes the callsign for a new group.

Defined in:

SPAWN

Return value:

self

Randomizes the position of Wrapper.Groups that are spawned within a radius band, given an Outer and Inner radius, from the point that the spawn happens.

Defined in:

SPAWN

Parameters:

#boolean RandomizePosition

If true, SPAWN will perform the randomization of the Wrapper.Groups position between a given outer and inner radius.

DCS#Distance OuterRadius

(optional) The outer radius in meters where the new group will be spawned.

DCS#Distance InnerRadius

(optional) The inner radius in meters where the new group will NOT be spawned.

Return value:

Randomizes the defined route of the SpawnTemplatePrefix group in the ME.

This is very useful to define extra variation of the behavior of groups.

Defined in:

SPAWN

Parameters:

#number SpawnStartPoint

is the waypoint where the randomization begins. Note that the StartPoint = 0 equaling the point where the group is spawned.

#number SpawnEndPoint

is the waypoint where the randomization ends counting backwards. This parameter is useful to avoid randomization to end at a waypoint earlier than the last waypoint on the route.

#number SpawnRadius

is the radius in meters in which the randomization of the new waypoints, with the original waypoint of the original template located in the middle ...

#number SpawnHeight

(optional) Specifies the additional height in meters that can be added to the base height specified at each waypoint in the ME.

Return value:

Usage:


  -- NATO helicopters engaging in the battle field.
  -- The KA-50 has waypoints Start point ( =0 or SP ), 1, 2, 3, 4, End point (= 5 or DP).
  -- Waypoints 2 and 3 will only be randomized. The others will remain on their original position with each new spawn of the helicopter.
  -- The randomization of waypoint 2 and 3 will take place within a radius of 2000 meters.
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeRoute( 2, 2, 2000 )

This method is rather complicated to understand.

But I'll try to explain. This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.

Defined in:

SPAWN

Parameter:

#string SpawnTemplatePrefixTable

A table with the names of the groups defined within the mission editor, from which one will be chosen when a new group will be spawned.

Return value:

Usage:


  -- NATO Tank Platoons invading Gori.
  -- Choose between 13 different 'US Tank Platoon' configurations for each new SPAWN the Group to be spawned for the
  -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SpawnTemplatePrefixes.
  -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
  -- with a limit set of maximum 12 Units alive simultaneously  and 150 Groups to be spawned during the whole mission.
  Spawn_US_Platoon = { 'US Tank Platoon 1', 'US Tank Platoon 2', 'US Tank Platoon 3', 'US Tank Platoon 4', 'US Tank Platoon 5',
                       'US Tank Platoon 6', 'US Tank Platoon 7', 'US Tank Platoon 8', 'US Tank Platoon 9', 'US Tank Platoon 10',
                       'US Tank Platoon 11', 'US Tank Platoon 12', 'US Tank Platoon 13' }
  Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplate( Spawn_US_Platoon ):InitRandomizeRoute( 3, 3, 2000 )

Randomize templates to be used as the unit representatives for the Spawned group, defined by specifying the prefix names.

This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.

Defined in:

SPAWN

Parameter:

#string SpawnTemplatePrefixes

A string or a list of string that contains the prefixes of the groups that are possible unit representatives of the group to be spawned.

Return value:

Usage:


 -- NATO Tank Platoons invading Gori.

  -- Choose between different 'US Tank Platoon Templates' configurations to be spawned for the
  -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.

  -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
  -- with a limit set of maximum 12 Units alive simultaneously  and 150 Groups to be spawned during the whole mission.

  Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplatePrefixes( "US Tank Platoon Templates" ):InitRandomizeRoute( 3, 3, 2000 )

Randomize templates to be used as the unit representatives for the Spawned group, defined using a SET_GROUP object.

This method becomes useful when you need to spawn groups with random templates of groups defined within the mission editor, but they will all follow the same Template route and have the same prefix name. In other words, this method randomizes between a defined set of groups the template to be used for each new spawn of a group.

Defined in:

SPAWN

Parameter:

Core.Set#SET_GROUP SpawnTemplateSet

A SET_GROUP object set, that contains the groups that are possible unit representatives of the group to be spawned.

Return value:

Usage:


  -- NATO Tank Platoons invading Gori.

  -- Choose between different 'US Tank Platoon Template' configurations to be spawned for the
  -- 'US Tank Platoon Left', 'US Tank Platoon Middle' and 'US Tank Platoon Right' SPAWN objects.

  -- Each new SPAWN will randomize the route, with a defined time interval of 200 seconds with 40% time variation (randomization) and
  -- with a limit set of maximum 12 Units alive simultaneously  and 150 Groups to be spawned during the whole mission.

  Spawn_US_PlatoonSet = SET_GROUP:New():FilterPrefixes( "US Tank Platoon Templates" ):FilterOnce()

  -- Now use the Spawn_US_PlatoonSet to define the templates using InitRandomizeTemplateSet.
  Spawn_US_Platoon_Left = SPAWN:New( 'US Tank Platoon Left' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )
  Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):InitLimit( 12, 150 ):SpawnScheduled( 200, 0.4 ):InitRandomizeTemplateSet( Spawn_US_PlatoonSet ):InitRandomizeRoute( 3, 3, 2000 )

Randomizes the UNITs that are spawned within a radius band given an Outer and Inner radius.

Defined in:

SPAWN

Parameters:

#boolean RandomizeUnits

If true, SPAWN will perform the randomization of the Wrapper.Unit#UNITs position within the group between a given outer and inner radius.

DCS#Distance OuterRadius

(optional) The outer radius in meters where the new group will be spawned.

DCS#Distance InnerRadius

(optional) The inner radius in meters where the new group will NOT be spawned.

Return value:

Usage:


  -- NATO helicopters engaging in the battle field.
  -- UNIT positions of this group will be randomized around the base unit #1 in a circle of 50 to 500 meters.
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitRandomizeUnits( true, 500, 50 )

This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.

Defined in:

SPAWN

Parameter:

#table SpawnZoneTable

A table with Core.Zone objects. If this table is given, then each spawn will be executed within the given list of Core.Zones objects.

Return value:

self

Usage:


   -- Create a zone table of the 2 zones.
   ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }

   Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" )
                          :InitLimit( 10, 10 )
                          :InitRandomizeRoute( 1, 1, 200 )
                          :InitRandomizeZones( ZoneTable )
                          :SpawnScheduled( 5, .5 )

For planes and helicopters, when these groups go home and land on their home airbases and FARPs, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the runtime environment.

This method is used to re-spawn automatically (so no extra call is needed anymore) the same group after it has landed. This will enable a spawned group to be re-spawned after it lands, until it is destroyed... Note: When the group is respawned, it will re-spawn from the original airbase where it took off. So ensure that the routes for groups that respawn, always return to the original airbase, or players may get confused ...

Defined in:

SPAWN

Return value:

self

Usage:


  -- RU Su-34 - AI Ship Attack
  -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
  SpawnRU_SU34 = SPAWN:New( 'Su-34' )
                      :Schedule( 2, 3, 1800, 0.4 )
                      :SpawnUncontrolled()
                      :InitRandomizeRoute( 1, 1, 3000 )
                      :InitRepeatOnEngineShutDown()

Respawn after landing when its engines have shut down.

Defined in:

SPAWN

Return value:

self

Usage:


  -- RU Su-34 - AI Ship Attack
  -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
  SpawnRU_SU34 = SPAWN:New( 'Su-34' )
                      :SpawnUncontrolled()
                      :InitRandomizeRoute( 1, 1, 3000 )
                      :InitRepeatOnEngineShutDown()
                      :Spawn()

Respawn group after landing.

Defined in:

SPAWN

Return value:

self

Usage:


  -- RU Su-34 - AI Ship Attack
  -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
  SpawnRU_SU34 = SPAWN:New( 'Su-34' )
                      :InitRandomizeRoute( 1, 1, 3000 )
                      :InitRepeatOnLanding()
                      :Spawn()

[Airplane - A10-C II only] Set the SADL TN starting number of the Group; each unit of the spawned group will have a consecutive SADL set.

Defined in:

SPAWN

Parameter:

#number Octal

The octal number (digits 1..7, max 4 digits, i.e. 1..7777) to set the SADL to. Every SADL needs to be unique!

Return value:

self

[Airplane - F15/16/18/AWACS/B1B/Tanker only] Set the STN Link16 starting number of the Group; each unit of the spawned group will have a consecutive STN set.

Defined in:

SPAWN

Parameter:

#number Octal

The octal number (digits 1..7, max 5 digits, i.e. 1..77777) to set the STN to. Every STN needs to be unique!

Return value:

self

Spawn the UNITs of this group with individual absolute positions and individual headings.

Defined in:

SPAWN

Parameter:

#table Positions

Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z absolute positions, and optionally an individual heading.

Return value:

Usage:


  -- NATO helicopter group of three units engaging in the battle field.
  local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitAbsolutePositions(Positions)

Spawn the UNITs of this group with individual relative positions to unit #1 and individual headings.

Defined in:

SPAWN

Parameter:

#table Positions

Table of positions, needs to one entry per unit in the group(!). The table contains one table each for each unit, with x,y, and optionally z relative positions, and optionally an individual heading.

Return value:

Usage:


  -- NATO helicopter group of three units engaging in the battle field.
  local Positions = { [1] = {x = 0, y = 0, heading = 0}, [2] = {x = 50, y = 50, heading = 90}, [3] = {x = -50, y = 50, heading = 180} }
  Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):InitSetUnitRelativePositions(Positions)

Sets skill of the group.

Defined in:

SPAWN

Parameter:

#string Skill

Skill, possible values "Average", "Good", "High", "Excellent" or "Random".

Return value:

self

[Airplane] Set the initial speed on spawning in knots.

Useful when spawning in-air only.

Defined in:

SPAWN

Parameter:

#number Knots

The speed in knots to use.

Return value:

self

[Airplane] Set the initial speed on spawning in kilometers per hour.

Useful when spawning in-air only.

Defined in:

SPAWN

Parameter:

#number KPH

The speed in KPH to use.

Return value:

self

[Airplane] Set the initial speed on spawning in meters per second.

Useful when spawning in-air only.

Defined in:

SPAWN

Parameter:

#number MPS

The speed in MPS to use.

Return value:

self

(AIR) Will spawn a plane group in UnControlled or Controlled mode...

This will be similar to the uncontrolled flag setting in the ME. You can use UnControlled mode to simulate planes startup and ready for take-off but aren't moving (yet). ReSpawn the plane in Controlled mode, and the plane will move...

Defined in:

SPAWN

Parameter:

#boolean UnControlled

true if UnControlled, false if Controlled.

Return value:

self

Creates the main object to spawn a Wrapper.Group defined in the DCS ME.

Defined in:

SPAWN

Parameter:

#string SpawnTemplatePrefix

is the name of the Group in the ME that defines the Template. Each new group will have the name starting with SpawnTemplatePrefix.

Return value:

Usages:

  • -- NATO helicopters engaging in the battle field.
    Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' )
  • local Plane = SPAWN:New( "Plane" ) -- Creates a new local variable that can initiate new planes with the name "Plane#ddd" using the template "Plane" as defined within the ME.

Creates a new SPAWN instance to create new groups based on the provided template.

This will also register the template for future use.

Defined in:

SPAWN

Parameters:

#table SpawnTemplate

is the Template of the Group. This must be a valid Group Template structure - see Hoggit Wiki!

#string SpawnTemplatePrefix

[Mandatory] is the name of the template and the prefix of the GROUP on spawn. The name in the template will be overwritten!

#string SpawnAliasPrefix

[Optional] is the prefix that will be given to the GROUP on spawn.

#boolean NoMooseNamingPostfix

[Optional] If true, skip the Moose naming additions (like groupname#001-01) - but you need to ensure yourself no duplicate group names exist!

Return value:

self

Usage:

-- Spawn a P51 Mustang from scratch
local ttemp =  
  {
      ["modulation"] = 0,
      ["tasks"] = 
      {
      }, -- end of ["tasks"]
      ["task"] = "Reconnaissance",
      ["uncontrolled"] = false,
      ["route"] = 
      {
          ["points"] = 
          {
              [1] = 
              {
                  ["alt"] = 2000,
                  ["action"] = "Turning Point",
                  ["alt_type"] = "BARO",
                  ["speed"] = 125,
                  ["task"] = 
                  {
                      ["id"] = "ComboTask",
                      ["params"] = 
                      {
                          ["tasks"] = 
                          {
                          }, -- end of ["tasks"]
                      }, -- end of ["params"]
                  }, -- end of ["task"]
                  ["type"] = "Turning Point",
                  ["ETA"] = 0,
                  ["ETA_locked"] = true,
                  ["y"] = 666285.71428571,
                  ["x"] = -312000,
                  ["formation_template"] = "",
                  ["speed_locked"] = true,
              }, -- end of [1]
          }, -- end of ["points"]
      }, -- end of ["route"]
      ["groupId"] = 1,
      ["hidden"] = false,
      ["units"] = 
      {
          [1] = 
          {
              ["alt"] = 2000,
              ["alt_type"] = "BARO",
              ["livery_id"] = "USAF 364th FS",
              ["skill"] = "High",
              ["speed"] = 125,
              ["type"] = "TF-51D",
              ["unitId"] = 1,
              ["psi"] = 0,
              ["y"] = 666285.71428571,
              ["x"] = -312000,
              ["name"] = "P51-1-1",
              ["payload"] = 
              {
                  ["pylons"] = 
                  {
                  }, -- end of ["pylons"]
                  ["fuel"] = 340.68,
                  ["flare"] = 0,
                  ["chaff"] = 0,
                  ["gun"] = 100,
              }, -- end of ["payload"]
              ["heading"] = 0,
              ["callsign"] = 
              {
                  [1] = 1,
                  [2] = 1,
                  ["name"] = "Enfield11",
                  [3] = 1,
              }, -- end of ["callsign"]
              ["onboard_num"] = "010",
          }, -- end of [1]
      }, -- end of ["units"]
      ["y"] = 666285.71428571,
      ["x"] = -312000,
      ["name"] = "P51",
      ["communication"] = true,
      ["start_time"] = 0,
      ["frequency"] = 124,
  } 


local mustang = SPAWN:NewFromTemplate(ttemp,"P51D")
-- you MUST set the next three:
mustang:InitCountry(country.id.FRANCE)
mustang:InitCategory(Group.Category.AIRPLANE)
mustang:InitCoalition(coalition.side.BLUE)
mustang:OnSpawnGroup(
  function(grp)
    MESSAGE:New("Group Spawned: "..grp:GetName(),15,"SPAWN"):ToAll()
  end
)
mustang:Spawn()

Creates a new SPAWN instance to create new groups based on the defined template and using a new alias for each new group.

Defined in:

SPAWN

Parameters:

#string SpawnTemplatePrefix

is the name of the Group in the ME that defines the Template.

#string SpawnAliasPrefix

is the name that will be given to the Group at runtime.

Return value:

self

Usages:

  • -- NATO helicopters engaging in the battle field.
    Spawn_BE_KA50 = SPAWN:NewWithAlias( 'BE KA-50@RAMP-Ground Defense', 'Helicopter Attacking a City' )
  • local PlaneWithAlias = SPAWN:NewWithAlias( "Plane", "Bomber" ) -- Creates a new local variable that can instantiate new planes with the name "Bomber#ddd" using the template "Plane" as defined within the ME.

Allows to place a CallFunction hook when a new group spawns.

The provided method will be called when a new group is spawned, including its given parameters. The first parameter of the SpawnFunction is the Wrapper.Group#GROUP that was spawned.

Defined in:

SPAWN

Parameters:

#function SpawnCallBackFunction

The function to be called when a group spawns.

SpawnFunctionArguments

A random amount of arguments to be provided to the function when the group spawns.

...

Return value:

Usage:


   -- Declare SpawnObject and call a function when a new Group is spawned.
   local SpawnObject = SPAWN:New( "SpawnObject" )
                            :InitLimit( 2, 10 )
                            :OnSpawnGroup( function( SpawnGroup )
                                SpawnGroup:E( "I am spawned" )
                                end
                              )
                            :SpawnScheduled( 300, 0.3 )

Will park a group at an Wrapper.Airbase.

Defined in:

SPAWN

Parameters:

The Wrapper.Airbase where to spawn the group.

(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.

#table Parkingdata

(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactily these spots!

SpawnIndex

Return value:

#nil:

Nothing is returned!

Will park a group at an Wrapper.Airbase.

This method is mostly advisable to be used if you want to simulate parking units at an airbase and be visible. Note that each point in the route assigned to the spawning group is reset to the point of the spawn.

All groups that are in the spawn collection and that are alive, and not in the air, are parked.

The Wrapper.Airbase#AIRBASE object must refer to a valid airbase known in the sim. You can use the following enumerations to search for the pre-defined airbases on the current known maps of DCS:

Use the method Wrapper.Airbase#AIRBASE.FindByName() to retrieve the airbase object. The known AIRBASE objects are automatically imported at mission start by MOOSE. Therefore, there isn't any New() constructor defined for AIRBASE objects.

Ships and FARPs are added within the mission, and are therefore not known. For these AIRBASE objects, there isn't an Wrapper.Airbase#AIRBASE enumeration defined. You need to provide the exact name of the airbase as the parameter to the Wrapper.Airbase#AIRBASE.FindByName() method!

Defined in:

SPAWN

Parameters:

The Wrapper.Airbase where to spawn the group.

(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.

#table Parkingdata

(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactily these spots!

Return value:

#nil:

Nothing is returned!

Usage:

  Spawn_Plane = SPAWN:New( "Plane" )
  Spawn_Plane:ParkAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ) )

  Spawn_Heli = SPAWN:New( "Heli")

  Spawn_Heli:ParkAtAirbase( AIRBASE:FindByName( "FARP Cold" ) )

  Spawn_Heli:ParkAtAirbase( AIRBASE:FindByName( "Carrier" ) )

  Spawn_Plane:ParkAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), AIRBASE.TerminalType.OpenBig )

Will re-spawn a group based on a given index.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

SPAWN

Parameter:

#string SpawnIndex

The index of the group to be spawned.

Return value:

The group that was spawned. You can use this group for further actions.

Set the spawn index to a specified index number.

This method can be used to "reset" the spawn counter to a specific index number. This will actually enable a respawn of groups from the specific index.

Defined in:

SPAWN

Parameter:

#string SpawnIndex

The index of the group from where the spawning will start again. The default value would be 0, which means a complete reset of the spawnindex.

Return value:

self

Will spawn a group based on the internal index.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

SPAWN

Return value:

The group that was spawned. You can use this group for further actions.

Will spawn a group at an Wrapper.Airbase.

This method is mostly advisable to be used if you want to simulate spawning units at an airbase. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

The Wrapper.Airbase#AIRBASE object must refer to a valid airbase known in the sim. You can use the following enumerations to search for the pre-defined airbases on the current known maps of DCS:

Use the method Wrapper.Airbase#AIRBASE.FindByName() to retrieve the airbase object. The known AIRBASE objects are automatically imported at mission start by MOOSE. Therefore, there isn't any New() constructor defined for AIRBASE objects.

Ships and FARPs are added within the mission, and are therefore not known. For these AIRBASE objects, there isn't an Wrapper.Airbase#AIRBASE enumeration defined. You need to provide the exact name of the airbase as the parameter to the Wrapper.Airbase#AIRBASE.FindByName() method!

Defined in:

SPAWN

Parameters:

The Wrapper.Airbase where to spawn the group.

#SPAWN.Takeoff Takeoff

(optional) The location and takeoff method. Default is Hot.

#number TakeoffAltitude

(optional) The altitude above the ground.

(optional) The terminal type the aircraft should be spawned at. See Wrapper.Airbase#AIRBASE.TerminalType.

#boolean EmergencyAirSpawn

(optional) If true (default), groups are spawned in air if there is no parking spot at the airbase. If false, nothing is spawned if no parking spot is available.

#table Parkingdata

(optional) Table holding the coordinates and terminal ids for all units of the group. Spawning will be forced to happen at exactly these spots!

Return value:

The group that was spawned or nil when nothing was spawned.

Usage:


  Spawn_Plane = SPAWN:New( "Plane" )
  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Cold )
  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Hot )
  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Runway )

  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( "Carrier" ), SPAWN.Takeoff.Cold )

  Spawn_Heli = SPAWN:New( "Heli")

  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Cold" ), SPAWN.Takeoff.Cold )
  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Hot" ), SPAWN.Takeoff.Hot )
  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Runway" ), SPAWN.Takeoff.Runway )
  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "FARP Air" ), SPAWN.Takeoff.Air )

  Spawn_Heli:SpawnAtAirbase( AIRBASE:FindByName( "Carrier" ), SPAWN.Takeoff.Cold )

  Spawn_Plane:SpawnAtAirbase( AIRBASE:FindByName( AIRBASE.Caucasus.Krymsk ), SPAWN.Takeoff.Cold, nil, AIRBASE.TerminalType.OpenBig )

Spawn a group on an Wrapper.Airbase at a specific parking spot.

Defined in:

SPAWN

Parameters:

The Wrapper.Airbase where to spawn the group.

#table Spots

Table of parking spot IDs. Note that these in general are different from the numbering in the mission editor!

#SPAWN.Takeoff Takeoff

(Optional) Takeoff type, i.e. either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is Hot.

Return value:

The group that was spawned or nil when nothing was spawned.

Will spawn a group from a Coordinate in 3D space.

This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

SPAWN

Parameters:

The Coordinate coordinates where to spawn the group.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Will spawn a group from a POINT_VEC2 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning groups on the ground from air units, like vehicles. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

SPAWN

Parameters:

The PointVec2 coordinates where to spawn the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnPointVec2 = ZONE:New( ZoneName ):GetPointVec2() 

  -- Spawn at the zone center position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2 )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromPointVec2( SpawnPointVec2, 2000, 4000 )

Will spawn a group from a PointVec3 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

SPAWN

Parameters:

The PointVec3 coordinates where to spawn the group.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnPointVec3 = ZONE:New( ZoneName ):GetPointVec3( 2000 ) -- Get the center of the ZONE object at 2000 meters from the ground.

  -- Spawn at the zone center position at 2000 meters from the ground!
  SpawnAirplanes:SpawnFromPointVec3( SpawnPointVec3 )

Will spawn a group from a hosting static.

This method is mostly advisable to be used if you want to simulate spawning from buldings and structures (static buildings). You can use the returned group to further define the route to be followed.

Defined in:

SPAWN

Parameters:

The static dropping or unloading the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnStatic = STATIC:FindByName( StaticName )

  -- Spawn from the static position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromStatic( SpawnStatic )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromStatic( SpawnStatic, 2000, 4000 )

Will spawn a group from a hosting unit.

This method is mostly advisable to be used if you want to simulate spawning from air units, like helicopters, which are dropping infantry into a defined Landing Zone. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

SPAWN

Parameters:

The air or ground unit dropping or unloading the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return values:

that was spawned.

#nil:

Nothing was spawned.

Usage:


  local SpawnStatic = STATIC:FindByName( StaticName )

  -- Spawn from the static position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromUnit( SpawnStatic )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromUnit( SpawnStatic, 2000, 4000 )

Will spawn a group from a Vec2 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning groups on the ground from air units, like vehicles. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

SPAWN

Parameters:

DCS#Vec2 Vec2

The Vec2 coordinates where to spawn the group.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnVec2 = ZONE:New( ZoneName ):GetVec2()

  -- Spawn at the zone center position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnFromVec2( SpawnVec2 )

  -- Spawn from the static position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnFromVec2( SpawnVec2, 2000, 4000 )

Will spawn a group from a Vec3 in 3D space.

This method is mostly advisable to be used if you want to simulate spawning units in the air, like helicopters or airplanes. Note that each point in the route assigned to the spawning group is reset to the point of the spawn. You can use the returned group to further define the route to be followed.

Defined in:

SPAWN

Parameters:

DCS#Vec3 Vec3

The Vec3 coordinates where to spawn the group.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Will return the SpawnGroupName either with with a specific count number or without any count.

Defined in:

SPAWN

Parameter:

#number SpawnIndex

Is the number of the Group that is to be spawned.

Return value:

#string:

SpawnGroupName

Will spawn a Group within a given Core.Zone.

The Core.Zone can be of any type derived from Core.Zone#ZONE_BASE. Once the Wrapper.Group is spawned within the zone, the Wrapper.Group will continue on its route. The first waypoint (where the group is spawned) is replaced with the zone location coordinates.

Defined in:

SPAWN

Parameters:

The zone where the group is to be spawned.

#boolean RandomizeGroup

(optional) Randomization of the Wrapper.Group position in the zone.

#number MinHeight

(optional) The minimum height to spawn an airborne group into the zone.

#number MaxHeight

(optional) The maximum height to spawn an airborne group into the zone.

#number SpawnIndex

(optional) The index which group to spawn within the given zone.

Return value:

that was spawned or #nil if nothing was spawned.

Usage:


  local SpawnZone = ZONE:New( ZoneName )

  -- Spawn at the zone center position at the height specified in the ME of the group template!
  SpawnAirplanes:SpawnInZone( SpawnZone )

  -- Spawn in the zone at a random position at the height specified in the Me of the group template.
  SpawnAirplanes:SpawnInZone( SpawnZone, true )

  -- Spawn in the zone at a random position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnInZone( SpawnZone, true, 2000, 4000 )

  -- Spawn at the zone center position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnInZone( SpawnZone, false, 2000, 4000 )

  -- Spawn at the zone center position at the height randomized between 2000 and 4000 meters.
  SpawnAirplanes:SpawnInZone( SpawnZone, nil, 2000, 4000 )

Will re-start the spawning scheduler.

Note: This method is only required to be called when the schedule was stopped.

Defined in:

SPAWN

Return value:

Will stop the scheduled spawning scheduler.

Defined in:

SPAWN

Return value:

Spawns new groups at varying time intervals.

This is useful if you want to have continuity within your missions of certain (AI) groups to be present (alive) within your missions.

Defined in:

SPAWN

Parameters:

#number SpawnTime

The time interval defined in seconds between each new spawn of new groups.

#number SpawnTimeVariation

The variation to be applied on the defined time interval between each new spawn. The variation is a number between 0 and 1, representing the % of variation to be applied on the time interval.

#boolean WithDelay

Do not spawn the first group immediately, but delay the spawn as per the calculation below. Effectively the same as #InitDelayOn().

Return value:

self

Usage:

-- NATO helicopters engaging in the battle field.
-- The time interval is set to SPAWN new helicopters between each 600 seconds, with a time variation of 50%.
-- The time variation in this case will be between 450 seconds and 750 seconds.
-- This is calculated as follows:
--      Low limit:   600 * ( 1 - 0.5 / 2 ) = 450
--      High limit:  600 * ( 1 + 0.5 / 2 ) = 750
-- Between these two values, a random amount of seconds will be chosen for each new spawn of the helicopters.
Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):SpawnScheduled( 600, 0.5 )

Will spawn a group with a specified index number.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

SPAWN

Parameters:

#string SpawnIndex

The index of the group to be spawned.

NoBirth

Return value:

The group that was spawned. You can use this group for further actions.

Gets the CategoryID of the Group with the given SpawnPrefix

Defined in:

SPAWN

Parameter:

SpawnPrefix

Gets the CoalitionID of the Group with the given SpawnPrefix

Defined in:

SPAWN

Parameter:

SpawnPrefix

Gets the CountryID of the Group with the given SpawnPrefix

Defined in:

SPAWN

Parameter:

SpawnPrefix

Return the last maximum index that can be used.

Defined in:

SPAWN

Return the prefix of a SpawnUnit.

The method will search for a #-mark, and will return the text before the #-mark. It will return nil of no prefix was found.

Defined in:

SPAWN

Parameter:

Wrapper.Group#GROUP SpawnGroup

The GROUP object.

Return value:

#string:

The prefix or #nil if nothing was found.

Return the prefix of a spawned group.

The method will search for a #-mark, and will return the text before the #-mark. It will return nil of no prefix was found.

Defined in:

SPAWN

Parameter:

#string SpawnGroupName

The name of the spawned group.

Return value:

#string:

The prefix or #nil if nothing was found.

Get the next index of the groups to be spawned.

This method is complicated, as it is used at several spaces.

Defined in:

SPAWN

Parameter:

#number SpawnIndex

Spawn index.

Return value:

#number:

self.SpawnIndex

Gets the Group Template from the ME environment definition.

Note: This method uses the global _DATABASE object (an instance of Core.Database#DATABASE), which contains ALL initial and new spawned objects in MOOSE.

Defined in:

SPAWN

Parameter:

#string SpawnTemplatePrefix

Return value:

@SPAWN self

Initalize the SpawnGroups collection.

Defined in:

SPAWN

Parameter:

SpawnIndex

@param #SPAWN self @param Core.Event#EVENTDATA EventData

Defined in:

SPAWN

Parameter:

EventData

@param #SPAWN self @param Core.Event#EVENTDATA EventData

Defined in:

SPAWN

Parameter:

EventData

Will detect AIR Units shutting down their engines ...

When the event takes place, and the method #InitRepeatOnEngineShutDown was called, the spawned Group will Re-SPAWN. But only when the Unit was registered to have landed.

Defined in:

SPAWN

Parameter:

Will detect AIR Units landing...

When the event takes place, the spawned Group is registered as landed. This is needed to ensure that Re-SPAWNing is only done for landed AIR Groups.

Defined in:

SPAWN

Parameter:

Will detect AIR Units taking off...

When the event takes place, the spawned Group is registered as airborne... This is needed to ensure that Re-SPAWNing only is done for landed AIR Groups.

Defined in:

SPAWN

Parameter:

Prepares the new Group Template.

Defined in:

SPAWN

Parameters:

#string SpawnTemplatePrefix

#number SpawnIndex

Return value:

self

Private method randomizing the routes.

Defined in:

SPAWN

Parameter:

#number SpawnIndex

The index of the group to be spawned.

Return value:

Private method that randomizes the template of the group.

Defined in:

SPAWN

Parameter:

#number SpawnIndex

Return value:

self

Private method that randomizes the Core.Zones where the Group will be spawned.

Defined in:

SPAWN

Parameter:

#number SpawnIndex

Return value:

self

This function is called automatically by the Spawning scheduler.

It is the internal worker method SPAWNing new Groups on the defined time intervals.

Defined in:

SPAWN

Private method that sets the DCS#Vec2 where the Group will be spawned.

Defined in:

SPAWN

Parameter:

#number SpawnIndex

Return value:

self

Schedules the CleanUp of Groups

Defined in:

SPAWN

Return value:

#boolean:

True = Continue Scheduler

Defined in:

SPAWN

Parameters:

SpawnIndex

SpawnRootX

SpawnRootY

SpawnX

SpawnY

SpawnAngle

Field(s)

#boolean SPAWN.AIOnOff

The AI is on by default when spawning a group.

#boolean SPAWN.DelayOnOff

No initial delay when spawning the first group.

#boolean SPAWN.Repeat
#number SPAWN.SpawnCount

The internal counter of the amount of spawning the has happened since SpawnStart.

#table SPAWN.SpawnGroups

Array containing the descriptions of each Group to be Spawned.

#boolean SPAWN.SpawnInitKeepUnitNames

Overwrite unit names by default with group name.

#boolean SPAWN.SpawnInitLimit

By default, no InitLimit

#boolean SPAWN.SpawnIsScheduled

Reflects if the spawning for this SpawnTemplatePrefix is going to be scheduled or not.

#number SPAWN.SpawnMaxGroups

The maximum amount of groups that can be spawned.

#number SPAWN.SpawnMaxUnitsAlive

The maximum amount of groups that can be alive of SpawnTemplatePrefix at the same time.

#boolean SPAWN.SpawnRandomize

Sets the randomization flag of new Spawned units to false.

SPAWN.SpawnTemplate

Contains the template structure for a Group Spawn from the Mission Editor. Note that this group must have lateActivation always on!!!

#boolean SPAWN.SpawnVisible

When the first Spawn executes, all the Groups need to be made visible before start.

#table SPAWN.Takeoff

@field #SPAWN.Takeoff Takeoff

#boolean SPAWN.TweakedTemplate

Check if the user is using self made template.

#boolean SPAWN.UnControlled

When working in UnControlled mode, all planes are Spawned in UnControlled mode before the scheduler starts.

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_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 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.

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