Author: spunFIN
Author Website:

Requirements: No addons required

Version: 1.0

Short description: At the moment this pack does 3 things; adds Ambient Combat, adds AI to buildings, creates patrols.

Date: 2017-03-19 17:36

Comments: (26)


AI Spawn Script Pack


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. Package includes instructions and example missions for everything.

At the moment this pack contains 5 main scripts:
  • ambientCombat.sqf
    Spawns random groups and vehicles around player/object and makes them patrol around it. You can define how many groups there is at the same time, how far they spawn, spawning delay, AI skill levels, do AI groups communicate, how far from "defined center" they dissapear, and other stuff.
    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. Groups will spawn equally for all teams.
    AmbientCombat can also be deleted with external script, which has it's own features to offer you different solutions.
  • militarize.sqf
    Fills area with units. You can define the area size, units side, does soldiers or ground vehicles or both spawn, will they stay still or patrol inside area, how much there will spawn units, AI skill levels, and other stuff.
  • fillHouse.sqf
    Fills nearest building, OR all buildings in defined range, with soldiers. You can define side of soldiers, will they patrol or not, how will they patrol (only inside of building or also outside), spawning percentage, area radius, AI skill levels, and other stuff.
  • reinforcementChopper.sqf
    Spawns chopper which transports infantry group where ever you like and leaves after that. You can define side, does chopper land exactly on target or will it find suitable place, how far chopper comes from, from what direction it comes from, will it unload infantry group straight away or will it react against possible threats before that.
    And for infantry group you can choose its target, which can either be a single marker, array of markers (if so, you can set it also to cycle these markers), or unit/object, group size, AI skill levels, and other stuff.
  • heliParadrop.sqf
    Creates snazzy AI paradrop from chopper with various options, for example distance, direction, flyheight, drop distance, parachute open height, target, and many more!
4 extremely simple patrol scripts:
  • patrol-vD.sqf - makes infantry patrol around area, checking also buildings randomly
  • patrol-vE.sqf - makes ground vehicles patrol around area
  • patrol-vF.sqf - makes infantry unit patrol inside "his" building
  • patrol-vG.sqf - same as above, but unit goes also outside sometimes
And 20+ functions which these scripts uses.

1 mission template:
  • 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.
More precise information in documentation.

See the included documentations.

Package includes instructions and example missions for everything. Documentation also online here: HERE.
Here is a Flash App which makes it whole lot easier for normal users to set up all calling lines!

If you dont use all parameters while calling script, extra errors will appear in .rpt. To avoid this, set all parameters you dont need to their default values.


Sloppy video of v0.19:

Version 0.90 notes:
Includes now also Flash App which makes it whole lot easier for normal users to set up all calling lines!

Version 0.80 notes:
I left randomSector1 out of the 0.80 version since it needs some redesign to fit with the recent scripts & to get the tasks functional in mp. However, you can still use it with the 0.50 files which can be found here: AI Spawn Script Pack 0.50.
- New parameters, so double check your calling lines!

Credits & Thanks:
Dirty Harry

So many changes and improvements that I can't even list them up for you!
Special thanks to Haz for pushing me into using .hpp's!

- File structure changed! Same as before, but EVERYTHING is finally inside LV-folder.
- Updated all classnames
- LV_fnc_nearestBuilding - building reference changed from "house" to "building" - should find more buildings now
- Militarize: spawn men -parameter is now [boolean, boolean] - spawn land units, spawn water units - default: [true,false]
- Militarize: spawn vehicles -parameter is now [boolean, boolean, boolean] - spawn land vehicles, spawn water vehicles, spawn air vehicles - default: [true,false,false]
- FillHouse is fixed and works at Altis (removed nearestBuilding from its patrols)
- 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.
- Fixed vehicle positioning bug in LV_fnc_fullLandVehicle.sqf
- Many minor fixes like isServer -check in removeAC, expanded nearestBuilding to work better, removeDead removes empty groups, etc.

- Added new main script: heliParadrop.sqf which creates AI paradrops with many features
- Added caching script for fillHouse and militarize
- New parameters in AmbientCombat: side ratio, mp
- Changed main functionality in AmbientCombat, includes now water units and is really MP compatible
- Militarize units can now close doors and use smokes & chemlights (can be disabled in militarize.sqf)
- CloseDoors script is binded to patrol-vD, so it can be used also within chopper scripts
- Militarize "center" is movable
- ReinforcementChopper can now use LZ smoke, cover smokes, flare and chemlights
- HeliParadrop & ReinforcementChopper has also MP parameter
- Replaced all nearestBuilding commands with custom function
- Many smaller changes and fixes +new files in LV_functions\

- ARMA 3 Beta compatibility
- Fixed ambientCombat example mission (waypointType was set to RED insted of SAD)
- Added beta units in all scripts, subdividing normal & recon groups (support units will mix randomly to both)
- Changed fillHouse parameter "side": 1 or 2 or 3 (1 = blue team, 2 = red team, 3 = green team)
- Changed militarize parameter "side": 0 or 1 or 2 or 3 (0 = civilians, 1 = blue team, 2 = red team, 3 = green team)
- Changed reinforcementChopper parameter "side": 1 or 2 or 3 (1 = blue team, 2 = red team, 3 = green team)
- 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

- added snipers and spotters in every script
- fixed bug in reinforcementChopper.sqf -> chopper stayed hovering in some locations
- added ID parameter to reinforcementChopper.sqf
- changed AI behaviour of infantry group in reinforcementChopper.sqf to "COMBAT" to gain some realism
- fillHouse.sqf can now be targeted to a marker
- fixed patrol-vD which had bad typo, it shouldnt give any errors anymore
- LV_fnc_menGroup.sqf has now also ID parameter, and group size can be set with syntax [amount,random amount]
- LV_fnc_randomSpot.sqf has now minimum distance and avoid array -parameters. syntax: [center pos,range,min distance,[avoid array]]
- 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
- added first mission/task template: randomSectors1.sqf

- fixed parameters - you dont need anymore to use all parameters
- replaced surfaceIsWater -loops with faster ones
- renamed reinforcementKA60.sqf as reinforcementChopper.sqf
    - new parameter: type - you can now select any of the choppers in game (AH9 can also have 1 passenger)
    - new parameter: captive - whole group is captive until chopper has landed (makes sure it wont get shot down "too early")
    - 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
    - landing spot can now be: object/unit, marker, or position array
    - 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.
- fixed fillHouse error - when found only buildings which has no building positions
- 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.
- militarize.sqf: target -parameter can now be: unit/object, marker, or position array
- little fixes & cleanups

- replaced setVehicleInit commands with execVM and LV_fnc_vehicleInit.sqf

added LV_fnc_removeGroup.sqf, which is used to remove units created via fillHouse or militarize
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
fillHouse & militarize & reinforcementKA60:
    - parameter to define existing group instead of creating new one (so people can target other scripts and stuff to that group)
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
militarize & reinforcementKA60:
    - these can now be targeted also to a marker, as long as you remember to use "quotes" with markers
    - 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
    - ground vehicles behaviour set to "SAFE" to make them drive better
    - exits script if driver or chopper is shot down
all patrol scripts:
    - if unit < 2m from its waypoint, new location is added (prevents the bug where unit walks small circle around wp)

- MP fix in militarize.sqf, fillHouse.sqf and reinforcementKA60.sqf
- 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
- 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
- added LV_fnc_randomSpot.sqf, which is now required by reinforcementKA60.sqf

- new main script; reinforcementKA60.sqf
- added function to remove ambientCombat properly
- added better patrol function for ambientCombat
- lots of bug fixes, optimizations and lag reduced
- added new parameters to every main script

- fixed stuck loop in militarize.sqf and adjusted patrol scripts

Forum topic:
- BI forums
- Armaholic forums

Enable javascript to be able to download from Armaholic please!

Tags: Ambient,   Buildings,   Enhace,   Military,   Scripts,   Spawn