waitUntil {((player distance getMarkerPos "Task_7") <= 100)};
/*
	File: "sts_tanks.sqf";
	Author: Phantom
	visit: http://www.24th-sts.eu
			
	e.g.
	[[position,number of units,radius] execvm "sts_tanks";
	
	sts_tanks = compile preprocessFile "fn_tanks.sqf"; // call from init.sqf
	[[position,number of units,radius] call sts_unitspawn;
	
	terms of use: feel free to use and modify
*/

if (!isServer) exitWith {};

private ["_pos","_num","_unitpool","_unitspawn","_grp","_type","_behaviourpool","_behaviour"];

_pos = _this select 0;
_num = _this select 1;
_rad = _this select 2;

_anz = 4;

_units = ["rhs_t90_tv", "rhs_t90a_tv", "rhs_t80", "rhs_t80a", "rhs_t72bc_tv", "rhs_zsu234_aa", "CUP_O_ZSU23_SLA", "CUP_O_ZSU23_TK"];

_group = createGroup east;
_type = _units call bis_fnc_selectRandom;
_vehicle = _type createVehicle (_pos);



for "_unitspawn" from 1 to _anz do
{
    _unit = _group createUnit ["O_Soldier_F", _pos, [], 0, "FORM"];
    _unit moveInCargo _vehicle;
	[_unit,2 + floor(random 3)] call sts_unitskill;
	[_unit,_pos,_rad] call cba_fnc_taskPatrol;
	_behaviourpool = ["careless","safe","aware"];
	_behaviour = _behaviourpool call bis_fnc_selectRandom;
	_unit setBehaviour _behaviour;
	_unit setspeedmode "limited";
	{_x addmpeventhandler ["mpkilled", {_this execvm "scripts\deletebody.sqf"}]} forEach units _group;
};
_unit1 = _group createUnit ["O_Soldier_F", _pos, [], 0, "FORM"];
_unit1 moveInDriver _vehicle;

_unit2 = _group createUnit ["O_Soldier_F", _pos, [], 0, "FORM"];
_unit2 moveInGunner _vehicle;