Class SPAWN

Dynamic spawning of Groups and Units.

Info:

  • Author: Flightcontrol

Private

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:_GetTemplate (SpawnPrefix) Gets the Group Template from the ME environment definition.
SPAWN:_Prepare (SpawnIncrement) Prepares the new Group Template before Spawning.
SPAWN:_RandomizeRoute (SpawnTemplate) Will randomize the route of the Group Template.

Events

SPAWN:OnBirth (event) Obscolete
SPAWN:OnDeadOrCrash (event) Obscolete
SPAWN:OnLand (event) Will detect AIR Units landing...
SPAWN:OnTakeOff (event) Will detect AIR Units taking off...
SPAWN:OnEngineShutDown (event) Will detect AIR Units shutting down their engines ...

Scheduled

SPAWN:_Scheduler () This function is called automatically by the Spawning scheduler.

Public

SPAWN:New (SpawnPrefix) Creates the main object to spawn a Group defined in the DCS ME.
SPAWN:RandomizeRoute (SpawnStartPoint, SpawnEndPoint, SpawnRadius) Randomizes a defined route of the Template Group in the ME when the Group is Spawned.
SPAWN:Schedule (SpawnTime, SpawnTimeVariation) SPAWNs a new Group within varying time intervals.
SPAWN:ScheduleStart () Will start the SPAWNing timers.
SPAWN:ScheduleStop () Will stop the scheduled SPAWNing activity.
SPAWN:Limit (SpawnMaxGroupsAlive, SpawnMaxGroups) Limits the Maximum amount of Units to be alive, and the maximum amount of Groups to be SPAWNed within the DCS World run-time environment.
SPAWN:RandomizeTemplate (SpawnPrefixTable) This function is rather complicated to understand.
SPAWN:Repeat () When a Group got SPAWNed, it has a life within the DCSRTE.
SPAWN:RepeatOnLanding () Same as the @{Repeat) method.
SPAWN:RepeatOnEngineShutDown () Same as the @{Repeat) method, but now the Group will respawn after its engines have shut down.
SPAWN:Spawn () Will SPAWN a Group whenever you want to do this.
SPAWN:ReSpawn (SpawnGroupName) Will Re-SPAWN a Group based on a given GroupName.
SPAWN:SpawnUncontrolled () Will SPAWN a Group whenever you want to do this, but for AIR Groups only to be applied, and will SPAWN the Group in Uncontrolled mode...
SPAWN:FromCarrier (CarrierGroup, TargetZonePrefix, NewGroupName, LateActivate) Will SPAWN a Group from a Carrier.
SPAWN:InZone (ZonePrefix) Will SPAWN a Group within a given ZoneName.


Private

SPAWN:_GetGroupCategoryID (SpawnPrefix)
Gets the CategoryID of the Group with the given SpawnPrefix

Parameters:

  • SpawnPrefix
SPAWN:_GetGroupCoalitionID (SpawnPrefix)
Gets the CoalitionID of the Group with the given SpawnPrefix

Parameters:

  • SpawnPrefix
SPAWN:_GetGroupCountryID (SpawnPrefix)
Gets the CountryID of the Group with the given SpawnPrefix

Parameters:

  • SpawnPrefix
SPAWN:_GetTemplate (SpawnPrefix)
Gets the Group Template from the ME environment definition. This method used the DATABASE object, which contains ALL initial and new SPAWNed object in MOOSE.

Parameters:

  • SpawnPrefix
SPAWN:_Prepare (SpawnIncrement)
Prepares the new Group Template before Spawning.

Parameters:

  • SpawnIncrement
SPAWN:_RandomizeRoute (SpawnTemplate)
Will randomize the route of the Group Template.

Parameters:

  • SpawnTemplate

Events

SPAWN:OnBirth (event)
Obscolete

Parameters:

  • event
SPAWN:OnDeadOrCrash (event)
Obscolete

Parameters:

  • event
SPAWN:OnLand (event)
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.

Parameters:

  • event
SPAWN:OnTakeOff (event)
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.

Parameters:

  • event
SPAWN:OnEngineShutDown (event)
Will detect AIR Units shutting down their engines ... When the event takes place, and the method RepeatOnEngineShutDown was called, the SPAWNed Group will Re-SPAWN. But only when the Unit was registered to have landed.

Parameters:

  • event

See also:

Scheduled

SPAWN:_Scheduler ()
This function is called automatically by the Spawning scheduler. It is the internal worker method SPAWNing new Groups on the defined time intervals.

Public

SPAWN:New (SpawnPrefix)

Creates the main object to spawn a Group defined in the DCS ME. Spawned Groups and Units will follow the following naming convention within the DCS World run-time environment:

   Groups will have the name SpawnPrefix#ggg, where ggg is a counter from 0 to 999 for each new spawned Group.
   Units will have the name SpawnPrefix#ggg-uu, where uu is a counter from 0 to 99 for each new spawned Unit belonging to that Group.

Parameters:

  • SpawnPrefix string is the name of the Group in the ME that defines the Template. That Group must have the flag "Late Activation" set. Note that this SpawnPrefix name should not contain any # character.

Returns:

    SPAWN

Usage:

     -- NATO helicopters engaging in the battle field.
     Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' )
SPAWN:RandomizeRoute (SpawnStartPoint, SpawnEndPoint, SpawnRadius)
Randomizes a defined route of the Template Group in the ME when the Group is Spawned. This is very useful to define extra variation in the DCS World run-time environment of the behaviour of Groups like Ground Units, Ships, Planes, Helicopters.

Parameters:

  • SpawnStartPoint number is the waypoint where the randomization begins. Note that the StartPoint = 0 equals the point where the Group is Spawned. This parameter is useful to avoid randomization to start from the first waypoint, but a bit further down the route...
  • SpawnEndPoint number is the waypoint where the randomization ends. this parameter is useful to avoid randomization to end at a waypoint earlier than the last waypoint on the route.
  • SpawnRadius number is the radius in meters, that defines the concentric circle in which the randomization of the new waypoint will take place, with the original waypoint located in the middle...

Returns:

    SPAWN

Usage:

     -- NATO helicopters engaging in the battle field.
     -- The KA-50 has waypoints SP, 1, 2, 3, 4, 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 diameter of 4000 meters.
     Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):RandomizeRoute( 2, 2, 2000 )
SPAWN:Schedule (SpawnTime, SpawnTimeVariation)
SPAWNs a new Group within 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.

Parameters:

  • SpawnTime number is the time interval defined in seconds between each new SPAWN of new Groups.
  • SpawnTimeVariation number is the variation to be applied on the defined time interval between each new SPAWN. The variation is defined as a value between 0 and 1, which expresses the %-tage of variation to be applied as the low and high time interval boundaries. Between these boundaries a new time interval will be applied. See usage.

Returns:

    SPAWN

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 choosen for each new SPAWN of the helicopters.
     Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
SPAWN:ScheduleStart ()
Will start the SPAWNing timers. This function is called automatically when Schedule is called.
SPAWN:ScheduleStop ()
Will stop the scheduled SPAWNing activity.
SPAWN:Limit (SpawnMaxGroupsAlive, SpawnMaxGroups)
Limits the Maximum amount of Units to be alive, and the maximum amount of Groups to be SPAWNed within the DCS World run-time environment. Note that this method is exceptionally important to balance the amount of Units alive within the DCSRTE and 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 function should be used...

Parameters:

  • SpawnMaxGroupsAlive number is the Maximum amount of Units to be alive. When there are more Units alive in the DCSRTE of SpawnPrefix, then no new SPAWN will happen of the Group, until some of these Units will be destroyed.
  • SpawnMaxGroups number

    is the Maximum amount of Groups that can be SPAWNed from SpawnPrefix. When there are more Groups alive in the DCSRTE of SpawnPrefix, then no more 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 expresses no Group count limits.
    

Returns:

    SPAWN

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' ):Limit( 2, 24 )
SPAWN:RandomizeTemplate (SpawnPrefixTable)
This function is rather complicated to understand. But I'll try to explain... This function becomes useful when you need to SPAWN random types of Groups defined within the ME, but they all need to follow the same Template route and have the same SpawnPrefix name, then this method becomes very useful.

Parameters:

  • SpawnPrefixTable table{string,...} is a table with the names of the Groups defined within the ME (with late activatio on), from which on a new SPAWN of SpawnPrefix (the main Group name), a NEW Group will be choosen as the Group to be SPAWNed. In other words, this method randomizes between a defined set of Groups the Group to be SPAWNed for each new SPAWN.

Returns:

    SPAWN

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' SpawnPrefixes.
     -- 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 simulteneously  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' ):Limit( 12, 150 ):Schedule( 200, 0.4 ):RandomizeTemplate( Spawn_US_Platoon ):RandomizeRoute( 3, 3, 2000 )
     Spawn_US_Platoon_Middle = SPAWN:New( 'US Tank Platoon Middle' ):Limit( 12, 150 ):Schedule( 200, 0.4 ):RandomizeTemplate( Spawn_US_Platoon ):RandomizeRoute( 3, 3, 2000 )
     Spawn_US_Platoon_Right = SPAWN:New( 'US Tank Platoon Right' ):Limit( 12, 150 ):Schedule( 200, 0.4 ):RandomizeTemplate( Spawn_US_Platoon ):RandomizeRoute( 3, 3, 2000 )
SPAWN:Repeat ()
When a Group got SPAWNed, it has a life within the DCSRTE. For planes and helicopters, when these Units 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 DCSRTE. This function is used to Re-Spawn automatically (so no extra call is needed anymore) the same Group after it 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 ReSpawn at the original airbase where it took off. So ensure that the paths for Groups that ReSpawn, always return to the orignal airbase.

Returns:

    SPAWN

Usage:

     -- RU Su-34 - AI Ship Attack
     -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically.
     SpawnRU_SU34 = SPAWN:New( 'TF1 RU Su-34 Krymsk@AI - Attack Ships' ):Schedule( 2, 3, 1800, 0.4 ):SpawnUncontrolled():RandomizeRoute( 1, 1, 3000 ):RepeatOnEngineShutDown()
SPAWN:RepeatOnLanding ()
Same as the @{Repeat) method.

Returns:

    SPAWN

See also:

SPAWN:RepeatOnEngineShutDown ()
Same as the @{Repeat) method, but now the Group will respawn after its engines have shut down.

Returns:

    SPAWN

See also:

SPAWN:Spawn ()
Will SPAWN a Group whenever you want to do this. Note that the configuration with the above functions will apply when calling this method: Maxima, Randomization of routes, Scheduler, ... Uses DATABASE global object defined in MOOSE.

Returns:

    SPAWN
SPAWN:ReSpawn (SpawnGroupName)
Will Re-SPAWN a Group based on a given GroupName. The GroupName must be a group that is already alive within the DCSRTE and should have a Group Template defined in the ME (with Late Activation flag on). Note that the configuration with the above functions will apply when calling this method: Maxima, Randomization of routes, Scheduler, ...

Parameters:

Returns:

    SPAWN Uses _Database global object defined in MOOSE.
SPAWN:SpawnUncontrolled ()
Will SPAWN a Group whenever you want to do this, but for AIR Groups only to be applied, and will SPAWN the Group in Uncontrolled mode... This will be similar to the Uncontrolled flag setting in the ME.

Returns:

    SPAWN
SPAWN:FromCarrier (CarrierGroup, TargetZonePrefix, NewGroupName, LateActivate)
Will SPAWN a Group from a Carrier. This function 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.

Parameters:

  • CarrierGroup Group is the Group of the AIR unit or GROUND unit dropping or unloading other units.
  • TargetZonePrefix string is the Prefix of the Zone defined in the ME where the Group should be moving to after drop.
  • NewGroupName string (forgot this).
  • LateActivate bool (optional) does the SPAWNing with Lateactivation on.
SPAWN:InZone (ZonePrefix)
Will SPAWN a Group within a given ZoneName.

Parameters:

  • ZonePrefix string is the name of the zone where the Group is to be SPAWNed.

Returns:

    SpawnTemplate
generated by LDoc 1.4.3 Last updated 2015-01-29 21:06:10