AI Spawn Script Pack 0.90 >> Documentation

Description

I didn't find ACM from editor so I decided to do something "similar" and ended up building a pack of scripts I use in my own missions. These scripts can be called from init fields, Game Logics, triggers, almost from anywhere.

Package includes extremely simple example missions. Extract them to C:\Users\YOUR_NAME\Documents\Arma 3\missions\ and open in Editor.

NOTE: If you dont care how these scripts function or dont want to explore/modify them, it's 600% easier for you if you just use AISSP CALLING LINES App to setup calling lines.

I dont want to ask for anything, but if you find this project useful and desire to show any support, you can donate what ever you wish. Every buck if highly respected, and ensures me some extra time with Arma3 (mostly becouse my wife really hates me spending time with this stuff and keeps nagging "why do you keep doing that bullshit, are you like 13 years old, you can never earn anything with that crap") ;D

Remember to include your nick to gain some credits! If you have any ideas or questions etc, my steam nick is: fdsspun

These are the 5 main scripts of current version:

  1. AmbientCombat:
  2. Spawns random groups and vehicles around player/object and makes them patrol around it.

      You can define following things:
    1. minimum range where units spawn
    2. maximum range where units spawn
    3. minimum spawning delay
    4. maximum spawning delay
    5. how many groups there is at the same time
    6. spawning ratio for each side
    7. center unit(s) or object, which the whole ambient is centralized to
    8. skill levels of AI
    9. does AI groups communicate to each others about enemy sightings
    10. how far away (from center unit) AI units dissapear
    11. customized init commands for AI
    12. will units patrol as individual guerrilla forces, or via waypoints as military group
    13. if script is used in MP mission, there's a feature which uses all players as 'center units'
    Every vehicle is counted as one group, so if 'groups' argument is set to 2, there might spawn only 2 vehicles, eventhough vehicles spawns with 30% probability.
    Once group is dead or distance between group and center object is more than defined max distance, group will be deleted and new one is created.
    You can also tweak settings in the script file itself, for example on which odds there spawns water or air units.
    AmbientCombat can also be deleted with external script, which has it's own features to offer you different solutions.

  3. FillHouse:
  4. Fills nearest building, OR all buildings in defined range, with soldiers.

      You can define following things:
    1. where the script is targeted to (object/unit)
    2. side of units
    3. will units patrol or idle
    4. if they patrol, do they exit the building sometimes or stay only inside
    5. spawn percentage or amount of units
    6. if script is ment to fill more than one building, in how big range will it fill houses
    7. skill levels of AI
    8. will units be part of already existing group or is new group being created
    9. customized init commands for AI
    10. ID number which can be used later to delete all units created with it
    11. Supports LV_fnc_simpleCache (with that you dont need triggers, script will automatically be executed when player(s) gets close to its location, and be terminated when there's no players near).

  5. Militarize:
  6. Fills area with units.

      You can define following things:
    1. where the script is targeted to (object/unit/marker/position array)
    2. side of units
    3. how large is the area where units are being spawned
    4. will it spawn infantry
    5. will it spawn vehicles (ground vehicles only atm)
    6. will units patrol or idle
    7. men spawning ratio or amount
    8. vehicle spawning ratio or amount
    9. skill levels of AI
    10. will units be part of already existing group or is new group being created
    11. customized init commands for AI
    12. ID number which can be used later to delete all units created with it
    13. Supports LV_fnc_simpleCache (with that you dont need triggers, script will automatically be executed when player(s) gets close to its location, and be terminated when there's no players near).
    14. If units uses smokes when they get attacked, and chemlights at night time.
    15. Does they close doors behind them.

  7. ReinforcementChopper:
  8. Spawns chopper which transports infantry group where ever you like and leaves after that.

      You can define following things:
    1. where chopper will land (object/unit/marker/position array)
    2. is the landing spot accurate or will chopper find flat place somewhere near
    3. side of units
    4. which one of the selected sides chopper is it
    5. will it be captive until it lands, or not
    6. will infantry group patrol or not
    7. infantry groups target (unit/marker/array of markers/group/array of groups/patrol-vD.sqf = patrols area & buildings)
    8. in what direction chopper comes from
    9. how far it comes from
    10. is chopper going to land ASAP or will it defend itself f.ex. against other choppers
    11. if inf. groups target is array of markers, will they cycle these markers
    12. inf. groups size
    13. if there's LZ smoke, cover smokes, flares or chemlights being used on landing spot
    14. skill levels of AI
    15. will units be part of already existing group or is new group being created
    16. customized init commands for AI
    17. ID number which can be used later to delete all units created with it
    18. If 'landing spot' will automatically be one of alive non-captive players

  9. HeliParadrop:
  10. Creates snazzy AI paradrop from chopper with various options.

      You can define following things:
    1. Paradrop location
    2. Side of units
    3. Allow or disallow damage for chopper
    4. Make chopper captive
    5. Distance where the chopper comes from
    6. Direction where the chopper comes from
    7. Will it just flyby or stay still while paradrop
    8. Fly height
    9. How far from drop location the paradropping starts
    10. How many units will be paradropping
    11. Jump delay between paradroppers
    12. Height where units opens their parachutes
    13. If units uses smokes, flares or chems when they land
    14. Will infantry group patrol or not
    15. Infantry groups target (unit/marker/array of markers/group/array of groups/patrol-vD.sqf = patrols area & buildings)
    16. if inf. groups target is array of markers, will they cycle these markers
    17. skill levels of AI
    18. will units be part of already existing group or is new group being created
    19. customized init commands for AI
    20. ID number which can be used later to delete all units created with it
    21. If 'drop spot' will automatically be one of alive non-captive players

NOTE: You can also do many things via customized init commands-parameter. It runs individually for every unit, but you can still for example give global name for a group:
"MYgroupName = (group this);"
Or add event handler for every unit:
"this addEventHandler ['killed',{_this execVM 'SoldierDies.sqf'}];"


Features

    Main scripts:
  1. ambientCombat.sqf - Creates Ambient Combat
  2. militarize.sqf - Fills building or buildings in radius with patrolling soldiers
  3. fillHouse.sqf - Fills area with patrolling units
  4. reinforcementChopper.sqf - Spawns chopper which brings infantry group to stage
  5. heliParadrop.sqf - Spawns chopper which brings paradrop group to stage
    4 extremely simple patrol scripts:
  1. patrol-vD.sqf - makes infantry patrol around area, checking also buildings randomly
  2. patrol-vE.sqf - makes ground vehicles patrol around area
  3. patrol-vF.sqf - makes infantry unit patrol inside "his" building
  4. patrol-vG.sqf - same as above, but unit goes also outside sometimes
    22 simple functions:
  1. LV_fnc_ACcleanUp.sqf - removes dead groups and groups which over max distance from center of ambient combat
  2. LV_fnc_ACpatrol.sqf - makes AI patrol around center of ambient combat
  3. LV_fnc_ACskills.sqf - sets AI skills
  4. LV_fnc_AIcommunication.sqf - makes AI groups communicate amongst and inform each others about enemies
  5. LV_fnc_closeDoors.sqf - makes AI close doors behind them (used by almost all scripts via patrol-vD)
  6. LV_fnc_deleteOnDestination.sqf - deletes unit after reaching its destination
  7. LV_fnc_diveGroup.sq - creates diver group
  8. LV_fnc_findLandPosition.sqf - finds position on land
  9. LV_fnc_follow.sqf - makes unit follow its target or cycle marker array
  10. LV_fnc_fullAirVehicle.sqf - creates air vehicle
  11. LV_fnc_fullLandVehicle.sqf - creates land vehicle
  12. LV_fnc_fullWaterVehicle.sqf - creates water vehicle
  13. LV_fnc_getPlayers.sqf - returns array of all alive non-captive playableUnits
  14. LV_fnc_killAfterDelay.sqf - kills unit after random delay
  15. LV_fnc_menGroup.sqf - creates random sized group of random soldiers
  16. LV_fnc_nearestBuilding.sqf - finds near buildings (real ones with buildingPos')
  17. LV_fnc_randomSpot.sqf - picks random spot in defined range
  18. LV_fnc_removeAC.sqf - removes ambienCombat units in various ways
  19. LV_fnc_removeDead.sqf - removes dead units (will be implemented)
  20. LV_fnc_removeGroup.sqf - removes units which are created by fillHouse or militarize
  21. LV_fnc_simpleCache.sqf - caches militarize & fillhouse
  22. LV_fnc_vehicleInit.sqf - this replaces setVehicleInit command
    1 mission template: NOT INCLUDED IN THIS VERSION
  1. randomSectors1.sqf - creates "clear area" type of missions randomly in pre-placed GameLogics/Objects, and has also functionality to create random "defend area" type of mission after area is cleared first (Enemies gets air- and inf-reinforcements). Clear area -tasks uses militarize and fillhouse scripts, and additional Defend area -tasks uses reinforcementChopper and menGroup scripts.


AmbientCombat

Creates ambient combat around defined object/unit.

Calling AmbientCombat

Syntax:

nul = [] execVM "LV\ambientCombat.sqf";

Customized:

nul = [minRange,maxRange,minDelay,maxDelay,groups,side ratios,centerUnit,AIskills,communication,dissapearDistance,custom init,patrol type,MP] 
    execVM "LV\ambientCombat.sqf";
    Parameters:
  1. minRange = 1-2000 (meters, minimum range from player/centerUnit for AI to spawn) DEFAULT: 450
  2. maxRange = 1-2400 (meters, maximum range from player/centerUnit for AI to spawn) DEFAULT: 900
  3. minDelay = 0-3600 (seconds, minimum spawning delay for AI) DEFAULT: 30
  4. maxDelay = 1-3600 (seconds, maximum spawning delay for AI) DEFAULT: 300
  5. groups = 1-20 (how many AI groups can be alive at the same time) DEFAULT: 6
  6. side ratios = array ([west ratio, east ratio, ind ratio], each ratio value is number between 0.0 - 1.0) DEFAULT: [1,1,1]
  7. centerUnit = unit/array of units (unit or units which are the center of all action) DEFAULT: player
  8. Examples:
    player
    [pl1,pl2,pl3,pl4,pl5]
    
  9. AIskills = 0-1.0 or "default" (AIs skills) DEFAULT: "default"
    +NOTE: AIskills can also be defined individually with syntax:
    [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed]
  10. Examples:
    0.75					 makes all AI skill levels to 0.75 (75%)
    [0.75,0.8,0.9,1,1,1,1,1,0.9,1] 		 adjusts skill levels separately
    "default"				 leaves AI skills to default
    
  11. communication = 0 or 1 (if 1, then AI groups will communicate and informs each others about enemies, atm only BLU & OPF) DEFAULT: 0
  12. dissapearDistance = meters (distance from centerUnit where AI units/groups will dissapear) DEFAULT: 2500
    +NOTE: Make sure this is bigger than maxRange!
  13. custom init = "custom init lines" (if you want to add something in units init lines, add it here in "quotes". if you need to use quotes with some commands, use ' or "" instead of ") DEFAULT: nil
    Examples: 
    "hint format['this is custom init from unit %1',this];"
    "hint 'Spawning!'; this setCaptive true;"
    
  14. patrol type = 1 or array (1 = doMove for each unit individually, array = waypoint for group) DEFAULT: 1
    Array syntax: ["waypointBehaviour","waypointType"]
    Examples: 
    1				old way, units moves to target location kinda like guerrilla forces
    ["AWARE","SAD"]			units moves as military group to target location, behaviour is AWARE and WP type Search&Destroy
    
    WaypointBehaviour options: "CARELESS","SAFE","AWARE","COMBAT","STEALTH"
    WaypointType options: "MOVE","DESTROY","SAD"
  15. MP = true/false (true = 'center unit' will automatically be an array of alive non-captive playableUnits) DEFAULT: false

Fully customized example:

nul = [150,600,10,30,8,[0,1,.5],player,[0.2,0.3,0.1,0.55,0.25,1,1,0.25,1,1],1,800,nil,["AWARE","SAD"],false] execVM "LV\ambientCombat.sqf";
Avoid areas

You can also make markers where Ambient Combat should not spawn units and which they will try to avoid during their patrolling. This can be done by making markers (RECTANGLE & ELLIPSE). Name the first one as ACavoid and just copy it so that next ones will have name like ACavoid_1 etc, up to ACavoid_30. These can be created on the fly, and AC will notice them.

Removing AmbientCombat

To remove AmbientCombat properly, you must use custom handle when calling it, not nul, f.ex:

war = [this,150,600,10,30,8,player,"default",1,800,nil["AWARE","SAD"]] execVM "LV\ambientCombat.sqf";

After that you can remove AmbientCombat by using LV_fnc_removeAC.sqf easily for example from trigger.

Syntax:

nul = [handle,style,syncedUnit,range/delay,flee direction] execVM "LV\LV_functions\LV_fnc_removeAC.sqf";
    Parameters:
  1. handle = handle of ambientCombat, in this example: war
  2. style = 0 or 1 or 2 (0 = units dissapear straight away, 1 = units forfeit and dissapear after *range, 2 = units die after random *delay)
  3. syncedUnit = centerUnit of ambientCombat (in this example: player)
  4. range/delay = range in meters / max delay in secs (if used style 1, units will dissapear after moving *range from *syncedUnit) OR
    (if used style 2, units will die after random *delay)
  5. flee direction = 0-360 (direction where ai will forfeit if style 1 is used) DEFAULT: nil (=away from syncedUnit)

Example:

nul = [war,1,player,600,180] execVM "LV\LV_functions\LV_fnc_removeAC.sqf";


FillHouse

Fills single house or multiple buildings in defined range with soldiers.

Syntax:

nul = [this] execVM "LV\fillHouse.sqf";

Customized:

nul = [target, side, patrol, patrol type, spawn %, radius, skills, group, custom init, ID] execVM "LV\fillHouse.sqf";
    Parameters:
  1. target = center point (if called from game logic, then this, or if called from trigger and targeted to game logic, then game logics' name)
  2. side = 1 or 2 or 3 (1 = blue team, 2 = red team, 3 = green team) DEFAULT: 2
  3. patrol = true or false (if true, units will patrol) DEFAULT: true
  4. patrol type = 1 or 2 (1=only inside building, 2=also outside of building) DEFAULT: 2
  5. spawn % = 1-100 OR Array (on how many percentage of possible positions are soldiers spawned) DEFAULT: 50
    +NOTE: Array - you can also use following syntax: [amount,random amount]
    Examples:
        50			 will spawn unit into 50% of available building positions in building/area 
        [10,12]		 will spawn at least 10 units + random 1-12 units 
  6. radius = 1 or larger number (1=nearest building. if larger number, then all buildings in radius) DEFAULT: 1
  7. skills = 0-1.0 or "default" (AIs skills) DEFAULT: "default"
    +NOTE: AIskills can also be defined individually with syntax:
    [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed]
  8. Examples:
    0.75					 makes all AI skill levels to 0.75 (75%)
    [0.75,0.8,0.9,1,1,1,1,1,0.9,1] 		 adjusts skill levels separately
    "default"				 leaves AI skills to default
    
  9. group = group name OR nil (if you want units in existing group, set it here. if nil, new group is made) DEFAULT: nil
    EXAMPLE: (group player)
  10. custom init = "custom init lines" (if you want to add something in units init lines, add it here in "quotes". if you need to use quotes with some commands, use ' or "" instead of ") DEFAULT: nil
    Examples: 
    "hint format['this is custom init from unit %1',this];"
    "hint 'Spawning!'; this setCaptive true;"
    
  11. ID = number (if you want to delete units this script creates, you'll need to set ID number) DEFAULT: nil

Fully customized example:

nul = [this, 1, true, 2, 15, 150, [0.7,0.6,0.8,0.35,0.5,1,1,0.6,1,1],nil,nil,6] execVM "LV\fillHouse.sqf";
Removing fillHouse units

To remove fillHouse units, you must make sure you have set ID number when calling fillHouse.sqf. At this point it will just simply remove all units, I'll add some other options later on.

After that you can use LV_fnc_removeGroup.sqf.

Syntax:

nul = [LVgroup+ID] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf";
    Parameters:
  1. LVgroup+ID = LVgroup + ID number (For example: LVgroup6) DEFAULT: nil

Example:

nul = [LVgroup6] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf";
NOTE: You might want to use simpleCache with this!

Militarize

Militarizes area with infantry units and/or ground vehicles.

Syntax:

nul = [this] execVM "LV\militarize.sqf";

Customized:

nul = [target, side, radius, spawn men, spawn vehicles, still, men ratio, vehicle ratio, skills, group, custom init, ID] execVM "LV\militarize.sqf";
    Parameters:
  1. target = center point (object/unit/marker/position array, remember to use "quotes" with marker)
  2. side = 0 or 1 or 2 or 3 (0 = civilian, 1 = blue, 2 = red, 3 = green) DEFAULT: 2
  3. radius = meters (from center point) DEFAULT: 150
  4. spawn men = [boolean, boolean] - spawn land units, spawn water units - DEFAULT: [true,false]
  5. spawn vehicles = [boolean, boolean, boolean] - spawn land vehicles, spawn water vehicles, spawn air vehicles - DEFAULT: [true,false,false]
  6. still = true or false ( if false, then units will patrol in radius, checkin also buildings) DEFAULT: false
  7. men ratio = decimal OR Array (amount of spawning men = radius * men ratio) DEFAULT: 0.3
    +NOTE: Array - you can also use following syntax: [amount,random amount] for example:
    Examples:
        0.2			 will spawn 50 units if radius is 250 (250 * 0.2 = 50)
        [10,12]		 will spawn at least 10 units + random 1-12 units 
  8. vehicle ratio = decimal OR Array (amount of spawning vehicles = radius * vehicle ratio, ie: 250 * 0.1 = 25 vehicles) DEFAULT: 0.1
    +NOTE: Array - you can also use following syntax: [amount,random amount] just like in men ratio
  9. skills = 0-1.0 or "default" (AIs skills) DEFAULT: "default"
    NOTE: AIskills can also be defined individually with syntax:
    [aimingAccuracy,aimingShake,aimingSpeed,spotDistance,spotTime,courage,commanding,general,endurance,reloadSpeed]
  10. Examples:
    0.75					 makes all AI skill levels to 0.75 (75%)
    [0.75,0.8,0.9,1,1,1,1,1,0.9,1] 		 adjusts skill levels separately
    "default"				 leaves AI skills to default
    
  11. group = group name OR nil (if you want units in existing group, set it here. if nil, new group is made) DEFAULT: nil
    EXAMPLE: (group player)
  12. custom init = "custom init lines" (if you want to add something in units init lines, add it here in "quotes". if you need to use quotes with some commands, use ' or "" instead of ") DEFAULT: nil
    Examples: 
    "hint format['this is custom init from unit %1',this];"
    "hint 'Spawning!'; this setCaptive true;"
    
  13. ID = number (if you want to delete units this script creates, you'll need to set ID number) DEFAULT: nil

Fully customized example:

nul = [this,2,350,[true,true],[true,true,false],false,[25,25],0.1,[0.2,0.2,0.2,0.85,0.9,0.75,0.1,0.6,1,1],nil,nil,61] execVM "LV\militarize.sqf";
Removing militarize units

To remove militarize units, you must make sure you have set ID number when calling militarize.sqf. At this point it will just simply remove all units, I'll add some other options later on.

After that you can use LV_fnc_removeGroup.sqf.

Syntax:

nul = [LVgroup+ID] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf";
    Parameters:
  1. LVgroup+ID = LVgroup + ID number (For example: LVgroup6) DEFAULT: nil

Example:

nul = [LVgroup61] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf";
Extra options:

In script file itself you can find _smokesAndChems (units uses smokes and chemlights), and _doorHandling (units closes doors behind them).

NOTE: You might want to use simpleCache with this!

ReinforcementChopper

Spawns chopper which transports infantry group to stage.

Syntax:

nul = [this] execVM "LV\reinforcementChopper.sqf";

Customized:

nul = [spot,exact,side,type,captive,patrol,target,direction,distance,precise,cycle,groupSize,skills,smoke,group,custom init,ID,MP] 
    execVM "LV\reinforcementChopper.sqf";
    Parameters:
  1. spot = landing spot (object/unit/marker/position array, remember to use "quotes" with marker)
  2. exact = true or false (true = tries landing exactly on *spot, false = finds place where chopper fits) DEFAULT: true
  3. side = 1 or 2 or 3 (1 = west, 2 = east, 3 = independent) DEFAULT: 1
  4. type = number (Depends on side) DEFAULT: 1
    WEST: 1 = B_Heli_Light_01_armed_F, 2 = B_Heli_Light_01_F, 3 = B_Heli_Transport_01_F
    EAST: 1 = O_Heli_Attack_02_F, 2 = O_Heli_Attack_02_black_F, 3 = O_Heli_Light_02_F, 4 = O_Heli_Light_02_unarmed_F
    INDEPENDENT: 1 = I_Heli_Transport_02_F
  5. captive = true or false (if true, enemies wont notice chopper before it has landed) DEFAULT: false
  6. patrol = true or false (if false, units wont patrol in any way = handy if you set (group player) as *group) DEFAULT: true
  7. target = (patrol target which infantry goes after) DEFAULT: player
    Choises:
    unit					= 	units name, ex: enemyunit1
    marker 					= 	markers' name, ex: "marker01" (remember quotes with markers!)
    marker array 				= 	array of markers in desired order, ex: ["marker01","marker02","marker03"]
    group					= 	groups name, ex: (group enemy1)	OR BlueGroup17
    group array				=	ex: [(group player), (group blue2)]
    ["PATROL",center position,radius] 	= 	uses patrol-vD.sqf, ex: ["PATROL",(getPos player),150]
        						(units patrols in radius, also checking buildings)
  8. direction = "random" or 0-360 (direction where chopper comes from, use quotes with random!) DEFAULT: "random"
  9. distance = number (from how far chopper comes from) DEFAULT: 1500
  10. precise = true or false (true = heli will land even in middle of war, false = heli might have air fights etc before landing) DEFAULT: true
  11. cycle = true or false (if true and target is array of markers, unit will cycle these markers) DEFAULT: false
  12. groupSize = 1-8 (infantry groups' size) DEFAULT: 8
  13. skills = 0-1.0 or "default" (AIs skills) DEFAULT: "default"
    NOTE: AIskills can also be defined individually with syntax:
    [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed]
  14. Examples:
    0.75					 makes all AI skill levels to 0.75 (75%)
    [0.75,0.8,0.9,1,1,1,1,1,0.9,1] 		 adjusts skill levels separately
    "default"				 leaves AI skills to default
    
  15. smoke = [LZ smoke, cover smokes, flare, chemlights] (if chopper uses these on landing spot) DEFAULT: [false,false,false,false]
  16. group = group name OR nil (if you want units in existing group, set it here. if nil, new group is made) DEFAULT: nil
    EXAMPLE: (group player)
  17. custom init = "custom init lines" (if you want to add something in units init lines, add it here in "quotes". if you need to use quotes with some commands, use ' or "" instead of ") DEFAULT: nil
    Examples: 
    "hint format['this is custom init from unit %1',this];"
    "hint 'Spawning!'; this setCaptive true;"
    
  18. ID = number (if you want to delete units this script creates, you'll need to set ID number) DEFAULT: nil
  19. MP = true/false (true = 'landing spot' will automatically be an array of alive non-captive playableUnits) DEFAULT: false

Fully customized example:

nul = [this,false,1,3,false,true,["marker01","marker02","marker03"],"random",1000,true,true,5,[false,true,false,true],0.85,(group player),nil,33,false] 
    execVM "LV\reinforcementChopper.sqf";
Spawns chopper in random direction, 1000m away from game logic. It lands somewhere near game logic, uses cover smokes & chemlights, 5 infantry units joins players group, gets out and moves first to marker01, then marker02 and finally to marker03 and continues cycling them.

Additional stuff:

If you set patrol to false, units will idle (if not joined to another group), and you can extend the script and make them do some custom stuff. (I commented the location in script, line 347)

LV_fnc_follow.sqf has been changed a lot, and there's also things you can customize pretty easily. If you target inf group to go after another group or array of groups, there's maximum distance for them to action. (Gives more mission options for MP)
Max distance is defined in reinforcementChopper.sqf on lines 326 and 341 (mDis = 1000m as default), and if inf group is that far away from its target group (or target group -array), it will stay idling, and those idling positions are commented in LV_fnc_follow.sqf on lines 73 and 103. There you can add custom stuff.

Extra options:

In script file itself you can find _doorHandling (units closes doors behind them).



HeliParadrop

Spawns chopper which delivers paradrop group on stage.

Syntax:

nul = [this] execVM "LV\heliParadrop.sqf";

Customized:

nul = [spot, side, allowDamage, captive, distance, direction, flyby, fly height, jump distance, group size, jump delay, open height, smokes, flares, 
    chems, patrol, target, cycle, skills, group, custom init, ID, MP] execVM "LV\heliParadrop.sqf";
    Parameters:
  1. spot = drop spot (object/unit/marker/position array, remember to use "quotes" with marker)
  2. side = 1 or 2 or 3 (1 = west, 2 = east, 3 = independent) DEFAULT: 2
  3. allowDamage = true/false (allow or disallow damage for chopper) DEFAULT: true
  4. captive = true/false (if true, enemies wont notice chopper) DEFAULT: false
  5. distance = number (from how far chopper comes from) DEFAULT: 1500
  6. direction = "random" or 0-360 (direction where chopper comes from, use quotes with random!) DEFAULT: "random"
  7. flyby = true/false (true = chopper just flies thru target, false = stays still while dropping units) DEFAULT: true
  8. fly height = number (how high chopper flies) DEFAULT: 200
  9. jump distance = number (how many meters before target location units starts jumping out of heli) DEFAULT: 150
  10. group size = number (how many units is in para drop group) DEFAULT: 8
  11. jump delay = number (how many seconds is the delay between jumps) DEFAULT: 0.5
  12. open height = number (in which height units opens their parachutes) DEFAULT: 50
  13. smokes = true/false (will units throw cover smokes (on 10m height)) DEFAULT: false
  14. flares = true/false (will units throw flares (on 30m height)) DEFAULT: false
  15. chems = true/false (will units throw chemlights (on 30m height)) DEFAULT: false
  16. patrol = true or false (if false, units wont patrol in any way = handy if you set (group player) as *group) DEFAULT: true
  17. target = (patrol target which infantry goes after) DEFAULT: player
    Choises:
    unit					= 	units name, ex: enemyunit1
    marker 					= 	markers' name, ex: "marker01" (remember quotes with markers!)
    marker array 				= 	array of markers in desired order, ex: ["marker01","marker02","marker03"]
    group					= 	groups name, ex: (group enemy1)	OR BlueGroup17
    group array				=	ex: [(group player), (group blue2)]
    ["PATROL",center position,radius] 	= 	uses patrol-vD.sqf, ex: ["PATROL",(getPos player),150]
        						(units patrols in radius, also checking buildings)
  18. cycle = true or false (if true and target is array of markers, unit will cycle these markers) DEFAULT: false
  19. skills = 0-1.0 or "default" (AIs skills) DEFAULT: "default"
    NOTE: AIskills can also be defined individually with syntax:
    [aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed]
  20. Examples:
    0.75					 makes all AI skill levels to 0.75 (75%)
    [0.75,0.8,0.9,1,1,1,1,1,0.9,1] 		 adjusts skill levels separately
    "default"				 leaves AI skills to default
    
  21. group = group name OR nil (if you want units in existing group, set it here. if nil, new group is made) DEFAULT: nil
    EXAMPLE: (group player)
  22. custom init = "custom init lines" (if you want to add something in units init lines, add it here in "quotes". if you need to use quotes with some commands, use ' or "" instead of ") DEFAULT: nil
    Examples: 
    "hint format['this is custom init from unit %1',this];"
    "hint 'Spawning!'; this setCaptive true;"
    
  23. ID = number (if you want to delete units this script creates, you'll need to set ID number) DEFAULT: nil
  24. MP = true/false (true = 'landing spot' will automatically be an array of alive non-captive playableUnits) DEFAULT: false

Fully customized example:

nul = [player, 2, false, true, 1000, "random", true, 500, 200, 6, 1, 50, true, false, true, true, player, false, 0.75, nil, nil, 1,false] 
    execVM "LV\heliParadrop.sqf";

Extra options:

In script file itself you can find _doorHandling (units closes doors behind them).



simpleCache (for fillHouse & militarize)

Makes fillHouse and militarize -units spawn when player is near, and despawn when player is further.

Syntax:

nul = [[ID's],[players],distance,keep count,MP] execVM "LV\LV_functions\LV_fnc_simpleCache.sqf";
    Parameters:
  1. ID's = array of script ID's
  2. players = array of players (doesnt matter what you set here if you use MP mode)
  3. distance = distance between player(s) and militarize/fillHouse on where scripts will be activated
  4. keep count = true/false (true = script will count & save AI amounts, false = AI amount will be reseted on each time it activates again)
  5. MP = true/false (true = all alive non-captive playableUnits will activate scripts, false = only units in players-array)

Fully customized example:

nul = [[13,14],[playerUnit1],500,true,false] execVM "LV\LV_functions\LV_fnc_simpleCache.sqf";

Extra options:

You can find _excludeSingleHeliPilot in the script file. (true = if single player flies over area as pilot, area wont trigger (reduces lag))



Mission Templates

Misc scripts & mission templates which uses my other scripts.

randomSectors1.sqf

This is mission script which uses many of my other script files. It creates "clear area" type of missions randomly in pre-placed GameLogics/Objects, and has also functionality to create random "defend area" type of mission after area is cleared first (Enemies gets air- and inf-reinforcements). Clear area -tasks uses militarize and fillhouse scripts, and additional Defend area -tasks uses reinforcementChopper and menGroup scripts.

Example mission is very simple, this script is called from players init. I commented script file pretty accurately to make it easy to use and modify, but here's also some most important stuff to notice:

# Syntax:

nul = [radius, [game logics]] execVM "randomSectors1.sqf";
  1. radius = radius from GameLogics/Objects inside where enemies patrols
  2. [game logics] = put all GameLogics/Objects you want to use as hostile areas in this array

Example:

nul = [100, [gameLogic01,gameLogic02,gameLogic03]] execVM "randomSectors1.sqf";

# Other information:

This mission runs as loop forever, but you can stop it with (from script or trigger or anywhere):

LVSspots = nil;

After this the script ends when currently activated task has been completed.


# LINES 94-95: in SP use line 95, in MP line 94

//_players = playableUnits; //MP (takes automatically all playable units)
_players = [player]; //SP (fill this manually in SP)

#LINE 91: this defines the delay between tasks

_sleepDelay = 5+(random 2); //random sleep time before new task

#There's two radio triggers in mission. With first one (Alpha, press 0 0 1) you can toggle statistics for this script. It shows amount of units from different scripts and average fps. Second one (Bravo, press 0 0 2) just executes "LVSspots = nil;" and makes the script end after current task.


#You can also tweak a lot of settings in the actual script file, for example:

  1. "_backupPercentage" - when hostile units is only this % alive, possible reinforcements will engage area
  2. "_engagePercentage" - when hostile units is only this % alive, they will attack player group
  3. "_updateTask" - show or do not show update task -notification when reinforcements engages area
  4. allmost all parameters for other scripts!
Issues:

At the moment if there's only one unit in player group, all hostiles wont necesserely engage on "_engagePercentage" -case. (In MP this shouldnt be a problem if respawn is being used?)




FAQ

Q: Where to put script files?

When you save your mission in editor, it will be saved to C:\Users\YOUR_NAME\Documents\Arma 3\missions\MISSION_NAME\ and into that folder you should put LV folder.

Q: How to add script in Trigger?

If script's calling line goes like: nul = [this,1,50..] execVM... then usually you can just put the same line into Triggers' ON ACT -field and replace this with target objects name.
Add for example Game Logic there where you want this script to be located and name it gamelog01, and then call the script from trigger: nul = [gamelog01,1,50..] execVM.... In militarize, fillHouse and reinforcementChopper the first argument is target location/object/marker.

Q: How to execute a script only for group leader?

Custom init executes on every unit, but you can also use it to execute something only for leader, like this:

"if(this==(leader(group this)))then{nul = [this] execVM 'leaderScript.sqf'};"

Q: I'm getting error when I use markers, what to do?

Most likely you have forgotten to use quotes with marker name when you refer to it. If you name your marker as marker1, in scripts and calling lines you must use quotes: "marker1".

Q: Getting errors when using simpleCache?

Use fillHouse & militarize in gamelogics, and name the gamelogics.

Q: Getting error when targeting inf group to hunt player group?

If this happens, check if you have set the target like: (group player). If so, name the group and replace (group player) with that name.
How to name it? Set in unit's init: groupName = group this;

Q: CustomInit wont work! What to do?

Make sure you have ended every sentence to semicolon, and you have NOT used normal quotes (") inside "custom init line". Instead of " use ' or "".
For example: "hint 'this is custom init';"
If problem occurs when you try to use EventHandler -> do NOT include any conditions inside EventHandler. Use it to execVM your own script file which has the conditions inside it.




Changelog

    0.90 (22.9.13):
  1. File structure changed! Same as before, but EVERYTHING is finally inside LV-folder.
  2. Included AISSP CALLING LINES App
  3. Updated all classnames
  4. LV_fnc_nearestBuilding - building reference changed from "house" to "building" - should find more buildings now
  5. Militarize: spawn men -parameter is now [boolean, boolean] - spawn land units, spawn water units - default: [true,false]
  6. Militarize: spawn vehicles -parameter is now [boolean, boolean, boolean] - spawn land vehicles, spawn water vehicles, spawn air vehicles - default: [true,false,false]
  7. FillHouse is fixed and works at Altis (removed nearestBuilding from its patrols)
  8. AmbientCombat: You can now define areas where AC groups wont spawn and which they try to avoid during patrolling.
    This can be done by making markers (RECTANGLE & ELLIPSE). Name the first one as ACavoid and just copy it so that next ones will have name like ACavoid_1 etc, up to ACavoid_30. These can be created on the fly, and AC will notice them.
  9. Fixed vehicle positioning bug in LV_fnc_fullLandVehicle.sqf
  10. Many minor fixes like isServer -check in removeAC, expanded nearestBuilding to work better, removeDead removes empty groups, etc..
    0.80 (4.8.13):
  1. Added new main script: heliParadrop.sqf which creates AI paradrops with many features
  2. Added caching script for fillHouse and militarize
  3. New parameters in AmbientCombat: side ratio, mp
  4. Changed main functionality in AmbientCombat, includes now water units and is really MP compatible
  5. Militarize units can now close doors and use smokes & chemlights (can be disabled in militarize.sqf)
  6. CloseDoors script is binded to patrol-vD, so it can be used also within chopper scripts
  7. Militarize "center" is movable
  8. ReinforcementChopper can now use LZ smoke, cover smokes, flare and chemlights
  9. HeliParadrop & ReinforcementChopper has also MP parameter
  10. Replaced all nearestBuilding commands with custom function
  11. Many smaller changes and fixes +new files in LV_functions\
    0.50 (25.6.13):
  1. ARMA 3 Beta compatibility
  2. Fixed ambientCombat example mission (waypointType was set to RED insted of SAD)
  3. Added beta units in all scripts, subdividing normal & recon groups (support units will mix randomly to both)
  4. Changed fillHouse parameter "side": 1 or 2 or 3 (1 = blue team, 2 = red team, 3 = green team)
  5. Changed militarize parameter "side": 0 or 1 or 2 or 3 (0 = civilians, 1 = blue team, 2 = red team, 3 = green team)
  6. Changed reinforcementChopper parameter "side": 1 or 2 or 3 (1 = blue team, 2 = red team, 3 = green team)
  7. Changed reinforcementChopper parameter "type":
    If "side" = 1: 1 = B_Heli_Light_01_armed_F, 2 = B_Heli_Light_01_F, 3 = B_Heli_Transport_01_F
    If "side" = 2: 1 = O_Heli_Attack_02_F, 2 = O_Heli_Attack_02_black_F, 3 = O_Heli_Light_02_F, 4 = O_Heli_Light_02_unarmed_F
    If "side" = 3: 1 = I_Heli_Transport_02_F
    0.42 (5.6.13):
  1. added snipers and spotters in every script
  2. fixed bug in reinforcementChopper.sqf -> chopper stayed hovering in some locations
  3. added ID parameter to reinforcementChopper.sqf
  4. changed AI behaviour of infantry group in reinforcementChopper.sqf to "COMBAT" to gain some realism
  5. fillHouse.sqf can now be targeted to a marker
  6. fixed patrol-vD which had bad typo, it shouldnt give any errors anymore
  7. LV_fnc_menGroup.sqf has now also ID parameter, and group size can be set with syntax [amount,random amount]
  8. LV_fnc_randomSpot.sqf has now minimum distance and avoid array -parameters. syntax: [center pos,range,min distance,[avoid array]]
  9. fixed LV_fnc_vehicleInit -> you can now set eventhandlers to init of units (before this the script considered "_this" as "this" and therefore failed to pass information
  10. added first mission/task template: randomSectors1.sqf
    0.40 (10.5.13):
  1. fixed parameters - you dont need anymore to use all parameters
  2. replaced surfaceIsWater -loops with faster ones
  3. renamed reinforcementKA60.sqf as reinforcementChopper.sqf
    1. new parameter: type - you can now select any of the choppers in game (AH9 can also have 1 passenger)
    2. new parameter: captive - whole group is captive until chopper has landed (makes sure it wont get shot down "too early")
    3. new parameter: patrol - you can no disable infantrys patrol (handy if you want to join group to some other group)
      +commented place in script where you can easily write custom script to replace patrolling
    4. landing spot can now be: object/unit, marker, or position array
    5. patrol target can now be: unit/object, marker, array of markers, group, array of groups, or it can be directed to patrol-vD.sqf
      +new LV_fnc_follow.sqf, which has maximum patrol distance in cases of group/array of groups ("mDis0" in reinforcementChopper.sqf).
      ++there's commented places where max patrol distance fills up, so you can extend the script easily in those cases.
  4. fixed fillHouse error - when found only buildings which has no building positions
  5. new parameter in ambientCombat: patrol type - you can use the old method where units moves independently (doMove) to their target location,
    or you can make them use waypoints as group and define waypointType & waypointBehaviour.
  6. militarize.sqf: target -parameter can now be: unit/object, marker, or position array
  7. little fixes & cleanups
    0.36 (29.4.13):
  1. replaced setVehicleInit commands with execVM and LV_fnc_vehicleInit.sqf
    0.35 (21.4.13):
  1. added LV_fnc_removeGroup.sqf, which is used to remove units created via fillHouse or militarize
  2. all main scripts:
    -skills parameter can now be set to "default" when it wont touch the ai skills at all
    -custom init parameter, now you can add init commands to units
  3. fillHouse & militarize & reinforcementKA60:
    -parameter to define existing group instead of creating new one (so people can target other scripts and stuff to that group)
  4. fillHouse & militarize:
    -unit amounts can now be set also with syntax: [amount,random amount] ( [10,5] = 10+random 5 )
    -you can define ID for these now, and delete units by referring to that ID via LV_fnc_removeGroup.sqf
  5. militarize & reinforcementKA60:
    -these can now be targeted also to a marker, as long as you remember to use "quotes" with markers
  6. ambientCombat:
    -choppers spawn in air now to prevent the ai heli bug in recent A3
    -parameter to define direction where ambient will flee when terminated with style 1 in LV_fnc_removeAC.sqf
    -removed useless parameter 0
  7. militarize:
    -ground vehicles behaviour set to "SAFE" to make them drive better
  8. reinforcementKA60:
    exits script if driver or chopper is shot down
  9. all patrol scripts:
    -if unit < 2m from its waypoint, new location is added (prevents the bug where unit walks small circle around wp)
    0.32 (12.4.13):
  1. MP fix in militarize.sqf, fillHouse.sqf and reinforcementKA60.sqf
  2. added "exact" parameter into reinforcementKA60.sqf, which (when set to false) fixes the bug when KA60s stays hovering near landing spot if there's more than one chopper around
  3. updated LV_fnc_follow.sqf: now if units are targeted to another unit, in friendly-friendly case they will patrol around target unit, and in hostile case they will go straight to target units' position
  4. added LV_fnc_randomSpot.sqf, which is now required by reinforcementKA60.sqf
    0.30 (7.4.13):
  1. new main script; reinforcementKA60.sqf
  2. added function to remove ambientCombat
  3. added better patrol function for ambientCombat
  4. lots of bug fixes, optimizations and lag reduced
  5. added new parameters to every main script
    0.23 (30.3.13):
  1. fixed stuck loop in militarize.sqf
  2. fine tuning of patrol scripts


Thanks

zuff
kemor
ChrzRw79
Dirty Haz
O.K
vip3r75
JojoTheSlayer
Gambit
FocalFury
mikey74
tomturner
MeatballCB
FX2K
F2kSel
DaSkunk
psvialli
[GITS]
[1PARA]
Buster0083
Guts4401
[2RIMa]Xunga
Gary
Chris
Francois
Daniel

And everyone else who has supported and given feedback!