From 3a572cb7fb35b713da5af2cc0d7b7db9ae1076b2 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Sat, 21 Oct 2023 12:11:58 -0400 Subject: [PATCH 1/7] Initial Commit Fixed infantry battlegroups to not "lose" members, enable lambs reinforcements on them, change "reset" listener to server event --- Missionframework/CfgFunctions.hpp | 1 + .../fn_LAMBS_enableReinforcements.sqf | 27 ++++++++ .../scripts/server/ai/battlegroup_ai.sqf | 61 +++++++------------ .../server/battlegroup/spawn_battlegroup.sqf | 20 +++--- .../scripts/server/init_server.sqf | 8 +++ .../sector_liberated_remote_call.sqf | 2 +- .../server/sector/attack_in_progress_fob.sqf | 2 +- .../sector/attack_in_progress_sector.sqf | 2 +- 8 files changed, 70 insertions(+), 53 deletions(-) create mode 100644 Missionframework/functions/fn_LAMBS_enableReinforcements.sqf diff --git a/Missionframework/CfgFunctions.hpp b/Missionframework/CfgFunctions.hpp index 546eab183..2749daa07 100644 --- a/Missionframework/CfgFunctions.hpp +++ b/Missionframework/CfgFunctions.hpp @@ -65,6 +65,7 @@ class KPLIB { class isCapitalActive {}; class isClassUAV {}; class isRadio {}; + class lambs_enableReinforcements{}; class log {}; class potatoScan {}; class protectObject {}; diff --git a/Missionframework/functions/fn_LAMBS_enableReinforcements.sqf b/Missionframework/functions/fn_LAMBS_enableReinforcements.sqf new file mode 100644 index 000000000..330861ff6 --- /dev/null +++ b/Missionframework/functions/fn_LAMBS_enableReinforcements.sqf @@ -0,0 +1,27 @@ +/* + File: fn_LAMBS_enableReinforcements.sqf + Author: Jenna + Date: 2023-10-21 + Last Update: 2023-10-21 + License: MIT License - http://www.opensource.org/licenses/MIT + + Description: + Enables LAMBS reinforcements + radio on a given group + + Parameter(s): + _grp - Group to enable features on [Group, defaults to grpNull] + + Returns: + Nothing +*/ + +params [ + ["_grp", grpNull, [grpNull]] +]; + +if (isNull _grp) exitwith { + ["Attempted to set LAMBS Reinforcements on null group.", "ERROR"] remoteExecCall ["KPLIB_fnc_log", 2]; +}; + +(leader _grp) setVariable ["lambs_danger_dangerRadio", true,true]; +_grp setVariable ["lambs_danger_enableGroupReinforce", true, true]; diff --git a/Missionframework/scripts/server/ai/battlegroup_ai.sqf b/Missionframework/scripts/server/ai/battlegroup_ai.sqf index ef4fef587..9f56c10ca 100644 --- a/Missionframework/scripts/server/ai/battlegroup_ai.sqf +++ b/Missionframework/scripts/server/ai/battlegroup_ai.sqf @@ -3,9 +3,6 @@ params [ ]; if (isNull _grp) exitWith {}; -if (isNil "reset_battlegroups_ai") then {reset_battlegroups_ai = false}; - -sleep (5 + (random 5)); private _objPos = [getPos (leader _grp)] call KPLIB_fnc_getNearestBluforObjective; @@ -13,41 +10,25 @@ private _objPos = [getPos (leader _grp)] call KPLIB_fnc_getNearestBluforObjectiv private _startpos = getPos (leader _grp); + private _waypoint = []; -while {((getPos (leader _grp)) distance _startpos) < 100} do { - - while {!((waypoints _grp) isEqualTo [])} do {deleteWaypoint ((waypoints _grp) select 0);}; - {_x doFollow leader _grp} forEach units _grp; - - _startpos = getPos (leader _grp); - - _waypoint = _grp addWaypoint [_objPos, 100]; - _waypoint setWaypointType "MOVE"; - _waypoint setWaypointSpeed "NORMAL"; - _waypoint setWaypointBehaviour "AWARE"; - _waypoint setWaypointCombatMode "YELLOW"; - _waypoint setWaypointCompletionRadius 30; - - _waypoint = _grp addWaypoint [_objPos, 100]; - _waypoint setWaypointType "SAD"; - _waypoint = _grp addWaypoint [_objPos, 100]; - _waypoint setWaypointType "SAD"; - _waypoint = _grp addWaypoint [_objPos, 100]; - _waypoint setWaypointType "SAD"; - _waypoint = _grp addWaypoint [_objPos, 100]; - _waypoint setWaypointType "CYCLE"; - - sleep 90; -}; - -waitUntil { - sleep 5; - (((units _grp) select {alive _x}) isEqualTo []) || reset_battlegroups_ai -}; - -sleep (5 + (random 5)); -reset_battlegroups_ai = false; - -if (!((units _grp) isEqualTo []) && (KPLIB_endgame == 0)) then { - [_grp] spawn battlegroup_ai; -}; +{ deleteWaypoint _x } forEachReversed waypoints _grp; +{_x doFollow leader _grp} forEach units _grp; + +_startpos = getPos (leader _grp); + +_waypoint = _grp addWaypoint [_objPos, 100]; +_waypoint setWaypointType "MOVE"; +_waypoint setWaypointSpeed "NORMAL"; +_waypoint setWaypointBehaviour "AWARE"; +_waypoint setWaypointCombatMode "YELLOW"; +_waypoint setWaypointCompletionRadius 30; + +_waypoint = _grp addWaypoint [_objPos, 100]; +_waypoint setWaypointType "SAD"; +_waypoint = _grp addWaypoint [_objPos, 100]; +_waypoint setWaypointType "SAD"; +_waypoint = _grp addWaypoint [_objPos, 100]; +_waypoint setWaypointType "SAD"; +_waypoint = _grp addWaypoint [_objPos, 100]; +_waypoint setWaypointType "CYCLE"; diff --git a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf index c4e2ef9d5..4ae2912be 100644 --- a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf +++ b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf @@ -28,18 +28,18 @@ if !(_spawn_marker isEqualTo "") then { // Adjust target size for infantry _target_size = 12 max (_target_size * 4); + private _squadNumber = round (_target_size/8); + for "_i" from 1 to _squadNumber do { // Create infantry groups with up to 8 units per squad - private _grp = createGroup [KPLIB_side_enemy, true]; - for "_i" from 0 to (_target_size - 1) do { - if (_i > 0 && {(_i % 8) isEqualTo 0}) then { - _bg_groups pushBack _grp; - _grp = createGroup [KPLIB_side_enemy, true]; - }; + private _grp = createGroup [kplib_side_enemy, true]; + for "_i" from 0 to 7 do { [selectRandom _infClasses, markerPos _spawn_marker, _grp] call KPLIB_fnc_createManagedUnit; }; - [_grp] spawn battlegroup_ai; - _bg_groups pushBack _grp; + [_grp] call KPLIB_fnc_LAMBS_enableReinforcements; + [_grp] call battlegroup_ai; + _grp setVariable ["KPLIB_isBattleGroup",true]; + }; } else { private _vehicle_pool = [KPLIB_o_battleGrpVehicles, KPLIB_o_battleGrpVehiclesLight] select (KPLIB_enemyReadiness < 50); @@ -55,8 +55,8 @@ if !(_spawn_marker isEqualTo "") then { sleep 0.5; (crew _vehicle) joinSilent _nextgrp; - [_nextgrp] spawn battlegroup_ai; - _bg_groups pushback _nextgrp; + [_nextgrp] call battlegroup_ai; + _nextgrp setVariable ["KPLIB_isBattleGroup",true]; if ((_x in KPLIB_o_troopTransports) && ([] call KPLIB_fnc_getOpforCap < KPLIB_cap_battlegroup)) then { if (_vehicle isKindOf "Air") then { diff --git a/Missionframework/scripts/server/init_server.sqf b/Missionframework/scripts/server/init_server.sqf index b4644d92d..f03c8d65f 100644 --- a/Missionframework/scripts/server/init_server.sqf +++ b/Missionframework/scripts/server/init_server.sqf @@ -126,3 +126,11 @@ execVM "scripts\server\offloading\group_diag.sqf"; if (KPLIB_param_restart > 0) then { execVM "scripts\server\game\server_restart.sqf"; }; + +["KPLIB_ResetBattleGroups", { + { + if (_x getVariable ["KPLIB_isBattleGroup",false]) then { + [_x] call battlegroup_ai; + } + } foreach allGroups; +}] call CBA_fnc_addEventHandler; diff --git a/Missionframework/scripts/server/remotecall/sector_liberated_remote_call.sqf b/Missionframework/scripts/server/remotecall/sector_liberated_remote_call.sqf index 1996640e6..d3ebaf38d 100644 --- a/Missionframework/scripts/server/remotecall/sector_liberated_remote_call.sqf +++ b/Missionframework/scripts/server/remotecall/sector_liberated_remote_call.sqf @@ -17,7 +17,7 @@ stats_readiness_earned = stats_readiness_earned + _KPLIB_enemyReadiness_increase KPLIB_sectors_player pushback _liberated_sector; publicVariable "KPLIB_sectors_player"; stats_sectors_liberated = stats_sectors_liberated + 1; -reset_battlegroups_ai = true; publicVariable "reset_battlegroups_ai"; +["KPLIB_ResetBattleGroups"] call CBA_fnc_serverEvent; if (_liberated_sector in KPLIB_sectors_factory) then { { diff --git a/Missionframework/scripts/server/sector/attack_in_progress_fob.sqf b/Missionframework/scripts/server/sector/attack_in_progress_fob.sqf index e0485c6aa..72bc4f80a 100644 --- a/Missionframework/scripts/server/sector/attack_in_progress_fob.sqf +++ b/Missionframework/scripts/server/sector/attack_in_progress_fob.sqf @@ -49,7 +49,7 @@ if ( KPLIB_endgame == 0 ) then { sleep 3; KPLIB_sectors_fob = KPLIB_sectors_fob - [_thispos]; publicVariable "KPLIB_sectors_fob"; - reset_battlegroups_ai = true; + ["KPLIB_ResetBattleGroups"] call CBA_fnc_serverEvent; [_thispos] call KPLIB_fnc_destroyFob; [] spawn KPLIB_fnc_doSave; stats_fobs_lost = stats_fobs_lost + 1; diff --git a/Missionframework/scripts/server/sector/attack_in_progress_sector.sqf b/Missionframework/scripts/server/sector/attack_in_progress_sector.sqf index 1a158bc2d..f10d2b254 100644 --- a/Missionframework/scripts/server/sector/attack_in_progress_sector.sqf +++ b/Missionframework/scripts/server/sector/attack_in_progress_sector.sqf @@ -50,7 +50,7 @@ if ( KPLIB_endgame == 0 ) then { KPLIB_sectors_player = KPLIB_sectors_player - [ _sector ]; publicVariable "KPLIB_sectors_player"; [_sector, 2] remoteExec ["remote_call_sector"]; - reset_battlegroups_ai = true; + ["KPLIB_ResetBattleGroups"] call CBA_fnc_serverEvent; [] spawn KPLIB_fnc_doSave; stats_sectors_lost = stats_sectors_lost + 1; { From 677e127a37ea2eeb078c0ede4bd7e9c22d5dc369 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Mon, 23 Oct 2023 21:23:38 -0400 Subject: [PATCH 2/7] fixed spawnvehicle, which was breaking spawn battlegroup spawn returns a script handle, not a vehicle, meaning vehicle battlegroups lose track of their spawned vehicles --- Missionframework/functions/fn_spawnVehicle.sqf | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Missionframework/functions/fn_spawnVehicle.sqf b/Missionframework/functions/fn_spawnVehicle.sqf index e572ebfd1..e1273a6cf 100644 --- a/Missionframework/functions/fn_spawnVehicle.sqf +++ b/Missionframework/functions/fn_spawnVehicle.sqf @@ -27,7 +27,7 @@ params [ if (_pos isEqualTo [0, 0, 0]) exitWith {["No or zero pos given"] call BIS_fnc_error; objNull}; if (_classname isEqualTo "") exitWith {["Empty string given"] call BIS_fnc_error; objNull}; -if (!canSuspend) exitWith {_this spawn KPLIB_fnc_spawnVehicle}; + private _newvehicle = objNull; private _spawnpos = []; @@ -41,7 +41,7 @@ if (_precise) then { while {_spawnPos isEqualTo []} do { _i = _i + 1; _spawnpos = (_pos getPos [random 150, random 360]) findEmptyPosition [10, 100, _classname]; - if (_i isEqualTo 10) exitWith {}; + if (_i isEqualTo 10) exitWith {_spawnPos = zeroPos}; }; }; @@ -83,13 +83,11 @@ if (_classname in KPLIB_o_militiaVehicles) then { private _grp = createGroup [KPLIB_side_enemy, true]; private _crew = units (createVehicleCrew _newvehicle); _crew joinSilent _grp; - sleep 0.1; {_x addMPEventHandler ["MPKilled", {_this spawn kill_manager}];} forEach _crew; }; // Add MPKilled and GetIn EHs and enable damage again _newvehicle addMPEventHandler ["MPKilled", {_this spawn kill_manager}]; -sleep 0.1; _newvehicle allowDamage true; _newvehicle setDamage 0; From 0ad5bcb876a9509488be612b279e979debd1ca3c Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 14 Mar 2024 22:57:09 +0100 Subject: [PATCH 3/7] Apply suggestions from code review --- .../functions/fn_LAMBS_enableReinforcements.sqf | 2 +- Missionframework/functions/fn_spawnVehicle.sqf | 11 ++++------- Missionframework/scripts/server/ai/battlegroup_ai.sqf | 2 -- .../scripts/server/battlegroup/spawn_battlegroup.sqf | 10 +++++----- Missionframework/scripts/server/init_server.sqf | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Missionframework/functions/fn_LAMBS_enableReinforcements.sqf b/Missionframework/functions/fn_LAMBS_enableReinforcements.sqf index 330861ff6..598ea740b 100644 --- a/Missionframework/functions/fn_LAMBS_enableReinforcements.sqf +++ b/Missionframework/functions/fn_LAMBS_enableReinforcements.sqf @@ -23,5 +23,5 @@ if (isNull _grp) exitwith { ["Attempted to set LAMBS Reinforcements on null group.", "ERROR"] remoteExecCall ["KPLIB_fnc_log", 2]; }; -(leader _grp) setVariable ["lambs_danger_dangerRadio", true,true]; +(leader _grp) setVariable ["lambs_danger_dangerRadio", true, true]; _grp setVariable ["lambs_danger_enableGroupReinforce", true, true]; diff --git a/Missionframework/functions/fn_spawnVehicle.sqf b/Missionframework/functions/fn_spawnVehicle.sqf index 20d3c5fa8..6c9454703 100644 --- a/Missionframework/functions/fn_spawnVehicle.sqf +++ b/Missionframework/functions/fn_spawnVehicle.sqf @@ -84,15 +84,12 @@ if (_classname in KPLIB_o_militiaVehicles) then { private _crew = units (createVehicleCrew _newvehicle); _crew joinSilent _grp; { - _x addEventHandler ["Killed", { - params ["_unit", "_killer", "_instigator", "_useEffects"]; - - ["KPLIB_manageKills", [_unit,_killer]] call CBA_fnc_serverEvent; - }]; - + _x addMPEventHandler ["MPKilled", { + params ["_unit", "_killer"]; + ["KPLIB_manageKills", [_unit, _killer]] call CBA_fnc_localEvent; + }]; } forEach _crew; }; -}; // Add Killed and GetIn EHs and enable damage again _newvehicle addMPEventHandler ["MPKilled", { diff --git a/Missionframework/scripts/server/ai/battlegroup_ai.sqf b/Missionframework/scripts/server/ai/battlegroup_ai.sqf index 9f56c10ca..6fe39d6a2 100644 --- a/Missionframework/scripts/server/ai/battlegroup_ai.sqf +++ b/Missionframework/scripts/server/ai/battlegroup_ai.sqf @@ -15,8 +15,6 @@ private _waypoint = []; { deleteWaypoint _x } forEachReversed waypoints _grp; {_x doFollow leader _grp} forEach units _grp; -_startpos = getPos (leader _grp); - _waypoint = _grp addWaypoint [_objPos, 100]; _waypoint setWaypointType "MOVE"; _waypoint setWaypointSpeed "NORMAL"; diff --git a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf index 4ae2912be..4759e2623 100644 --- a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf +++ b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf @@ -32,13 +32,13 @@ if !(_spawn_marker isEqualTo "") then { for "_i" from 1 to _squadNumber do { // Create infantry groups with up to 8 units per squad - private _grp = createGroup [kplib_side_enemy, true]; + private _grp = createGroup [KPLIB_side_enemy, true]; for "_i" from 0 to 7 do { [selectRandom _infClasses, markerPos _spawn_marker, _grp] call KPLIB_fnc_createManagedUnit; }; - [_grp] call KPLIB_fnc_LAMBS_enableReinforcements; - [_grp] call battlegroup_ai; - _grp setVariable ["KPLIB_isBattleGroup",true]; + [_grp] call KPLIB_fnc_LAMBS_enableReinforcements; + [_grp] call battlegroup_ai; + _grp setVariable ["KPLIB_isBattleGroup",true]; }; } else { private _vehicle_pool = [KPLIB_o_battleGrpVehicles, KPLIB_o_battleGrpVehiclesLight] select (KPLIB_enemyReadiness < 50); @@ -56,7 +56,7 @@ if !(_spawn_marker isEqualTo "") then { (crew _vehicle) joinSilent _nextgrp; [_nextgrp] call battlegroup_ai; - _nextgrp setVariable ["KPLIB_isBattleGroup",true]; + _nextgrp setVariable ["KPLIB_isBattleGroup", true]; if ((_x in KPLIB_o_troopTransports) && ([] call KPLIB_fnc_getOpforCap < KPLIB_cap_battlegroup)) then { if (_vehicle isKindOf "Air") then { diff --git a/Missionframework/scripts/server/init_server.sqf b/Missionframework/scripts/server/init_server.sqf index 9090c5131..693e9b134 100644 --- a/Missionframework/scripts/server/init_server.sqf +++ b/Missionframework/scripts/server/init_server.sqf @@ -136,7 +136,7 @@ if (KPLIB_param_restart > 0) then { ["KPLIB_ResetBattleGroups", { { - if (_x getVariable ["KPLIB_isBattleGroup",false]) then { + if (_x getVariable ["KPLIB_isBattleGroup", false]) then { [_x] call battlegroup_ai; } } foreach allGroups; From 9f939f387c8e9ea694e974bf13ecf3d20b0e04ef Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 14 Mar 2024 22:59:58 +0100 Subject: [PATCH 4/7] Update Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf --- .../scripts/server/battlegroup/spawn_battlegroup.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf index 4759e2623..6ae17ff8f 100644 --- a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf +++ b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf @@ -33,9 +33,9 @@ if !(_spawn_marker isEqualTo "") then { for "_i" from 1 to _squadNumber do { // Create infantry groups with up to 8 units per squad private _grp = createGroup [KPLIB_side_enemy, true]; - for "_i" from 0 to 7 do { - [selectRandom _infClasses, markerPos _spawn_marker, _grp] call KPLIB_fnc_createManagedUnit; - }; + for "_i" from 0 to 7 do { + [selectRandom _infClasses, markerPos _spawn_marker, _grp] call KPLIB_fnc_createManagedUnit; + }; [_grp] call KPLIB_fnc_LAMBS_enableReinforcements; [_grp] call battlegroup_ai; _grp setVariable ["KPLIB_isBattleGroup",true]; From b121f66a038315fe85e0a3d7a375791229366849 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 14 Mar 2024 23:03:15 +0100 Subject: [PATCH 5/7] Update Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf --- .../scripts/server/battlegroup/spawn_battlegroup.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf index 6ae17ff8f..70a947a4e 100644 --- a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf +++ b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf @@ -31,8 +31,8 @@ if !(_spawn_marker isEqualTo "") then { private _squadNumber = round (_target_size/8); for "_i" from 1 to _squadNumber do { - // Create infantry groups with up to 8 units per squad - private _grp = createGroup [KPLIB_side_enemy, true]; + // Create infantry groups with up to 8 units per squad + private _grp = createGroup [KPLIB_side_enemy, true]; for "_i" from 0 to 7 do { [selectRandom _infClasses, markerPos _spawn_marker, _grp] call KPLIB_fnc_createManagedUnit; }; From b44cd41643767b64cc4772c78eaccb59adb244f8 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:10:32 -0400 Subject: [PATCH 6/7] Update Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf Co-authored-by: Filip Maciejewski --- .../scripts/server/battlegroup/spawn_battlegroup.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf index 70a947a4e..cf13eba21 100644 --- a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf +++ b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf @@ -57,6 +57,7 @@ if !(_spawn_marker isEqualTo "") then { (crew _vehicle) joinSilent _nextgrp; [_nextgrp] call battlegroup_ai; _nextgrp setVariable ["KPLIB_isBattleGroup", true]; +_bg_groups pushback _nextgrp; if ((_x in KPLIB_o_troopTransports) && ([] call KPLIB_fnc_getOpforCap < KPLIB_cap_battlegroup)) then { if (_vehicle isKindOf "Air") then { From 79ab7fd3f58a2192a27856d883274e823b374a83 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 14 Mar 2024 23:12:35 +0100 Subject: [PATCH 7/7] Fix indent My bad --- .../scripts/server/battlegroup/spawn_battlegroup.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf index cf13eba21..fe5a573de 100644 --- a/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf +++ b/Missionframework/scripts/server/battlegroup/spawn_battlegroup.sqf @@ -57,7 +57,7 @@ if !(_spawn_marker isEqualTo "") then { (crew _vehicle) joinSilent _nextgrp; [_nextgrp] call battlegroup_ai; _nextgrp setVariable ["KPLIB_isBattleGroup", true]; -_bg_groups pushback _nextgrp; + _bg_groups pushback _nextgrp; if ((_x in KPLIB_o_troopTransports) && ([] call KPLIB_fnc_getOpforCap < KPLIB_cap_battlegroup)) then { if (_vehicle isKindOf "Air") then {