initial files

This commit is contained in:
Samuele Lorefice
2025-05-24 16:17:33 +02:00
commit 9e023649ac
477 changed files with 118566 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
if (isNil "infantry_weight") then {infantry_weight = 33;};
if (isNil "armor_weight") then {armor_weight = 33;};
if (isNil "air_weight") then {air_weight = 33;};
sleep 1800;
private _sleeptime = 0;
private _target_player = objNull;
private _target_pos = "";
while {GRLIB_csat_aggressivity >= 0.9 && GRLIB_endgame == 0} do {
_sleeptime = (1800 + (random 1800)) / (([] call KPLIB_fnc_getOpforFactor) * GRLIB_csat_aggressivity);
if (combat_readiness >= 80) then {_sleeptime = _sleeptime * 0.75;};
if (combat_readiness >= 90) then {_sleeptime = _sleeptime * 0.75;};
if (combat_readiness >= 95) then {_sleeptime = _sleeptime * 0.75;};
sleep _sleeptime;
waitUntil {sleep 5;
combat_readiness >= 70 && {armor_weight >= 50 || air_weight >= 50}
};
_target_player = objNull;
{
if (
(armor_weight >= 50 && {(objectParent _x) isKindOf "Tank"})
|| (air_weight >= 50 && {(objectParent _x) isKindOf "Air"})
) exitWith {
_target_player = _x;
};
} forEach (allPlayers - entities "HeadlessClient_F");
if (!isNull _target_player) then {
_target_pos = [99999, getPos _target_player] call KPLIB_fnc_getNearestSector;
if !(_target_pos isEqualTo "") then {
[_target_pos] spawn spawn_air;
};
};
};

View File

@@ -0,0 +1,27 @@
sleep (900 / GRLIB_csat_aggressivity);
private _sleeptime = 0;
while {GRLIB_csat_aggressivity > 0.9 && GRLIB_endgame == 0} do {
_sleeptime = (1800 + (random 1800)) / (([] call KPLIB_fnc_getOpforFactor) * GRLIB_csat_aggressivity);
if (combat_readiness >= 80) then {_sleeptime = _sleeptime * 0.75;};
if (combat_readiness >= 90) then {_sleeptime = _sleeptime * 0.75;};
if (combat_readiness >= 95) then {_sleeptime = _sleeptime * 0.75;};
sleep _sleeptime;
if (!isNil "GRLIB_last_battlegroup_time") then {
waitUntil {
sleep 5;
diag_tickTime > (GRLIB_last_battlegroup_time + (2100 / GRLIB_csat_aggressivity))
};
};
if (
(count (allPlayers - entities "HeadlessClient_F") >= (6 / GRLIB_csat_aggressivity))
&& {combat_readiness >= (60 - (5 * GRLIB_csat_aggressivity))}
&& {[] call KPLIB_fnc_getOpforCap < GRLIB_battlegroup_cap}
&& {diag_fps > 15.0}
) then {
["", (random 100) < 45] spawn spawn_battlegroup;
};
};

View File

@@ -0,0 +1,19 @@
waitUntil {!isNil "save_is_loaded" && {save_is_loaded}};
while {true} do {
if ((count blufor_sectors) >= ((count sectors_allSectors) * 0.9)) then {
if (combat_readiness > 0) then {
combat_readiness = combat_readiness - 0.25;
};
} else {
if (
(combat_readiness < ((count blufor_sectors) * 2) && combat_readiness < 35)
|| (combat_readiness < ((count blufor_sectors) * 1.25) && combat_readiness < 60)
) then {
combat_readiness = combat_readiness + 0.25;
stats_readiness_earned = stats_readiness_earned + 0.25;
};
};
if (combat_readiness > 100.0 && GRLIB_difficulty_modifier < 2) then {combat_readiness = 100.0};
sleep (180 + random (180));
};

View File

@@ -0,0 +1,59 @@
params ["_first_objective"];
if (opfor_air isEqualTo []) exitWith {false};
private _planes_number = ((floor linearConversion [40, 100, combat_readiness, 1, 3]) min 3) max 0;
if (_planes_number < 1) exitWith {};
private _class = selectRandom opfor_air;
private _spawnPoint = ([sectors_airspawn, [_first_objective], {(markerPos _x) distance _input0}, "ASCEND"] call BIS_fnc_sortBy) select 0;
private _spawnPos = [];
private _plane = objNull;
private _grp = createGroup [GRLIB_side_enemy, true];
for "_i" from 1 to _planes_number do {
_spawnPos = markerPos _spawnPoint;
_spawnPos = [(((_spawnPos select 0) + 500) - random 1000), (((_spawnPos select 1) + 500) - random 1000), 200];
_plane = createVehicle [_class, _spawnPos, [], 0, "FLY"];
createVehicleCrew _plane;
_plane flyInHeight (120 + (random 180));
_plane addMPEventHandler ["MPKilled", {_this spawn kill_manager}];
[_plane] call KPLIB_fnc_addObjectInit;
{_x addMPEventHandler ["MPKilled", {_this spawn kill_manager}];} forEach (crew _plane);
(crew _plane) joinSilent _grp;
sleep 1;
};
while {!((waypoints _grp) isEqualTo [])} do {deleteWaypoint ((waypoints _grp) select 0);};
sleep 1;
{_x doFollow leader _grp} forEach (units _grp);
sleep 1;
private _waypoint = _grp addWaypoint [_first_objective, 500];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointSpeed "FULL";
_waypoint setWaypointBehaviour "AWARE";
_waypoint setWaypointCombatMode "RED";
_waypoint = _grp addWaypoint [_first_objective, 500];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointSpeed "FULL";
_waypoint setWaypointBehaviour "AWARE";
_waypoint setWaypointCombatMode "RED";
_waypoint = _grp addWaypoint [_first_objective, 500];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointSpeed "FULL";
_waypoint setWaypointBehaviour "AWARE";
_waypoint setWaypointCombatMode "RED";
for "_i" from 1 to 6 do {
_waypoint = _grp addWaypoint [_first_objective, 500];
_waypoint setWaypointType "SAD";
};
_waypoint = _grp addWaypoint [_first_objective, 500];
_waypoint setWaypointType "CYCLE";
_grp setCurrentWaypoint [_grp, 2];

View File

@@ -0,0 +1,89 @@
// TODO Refactor and create function
params [
["_spawn_marker", "", [""]],
["_infOnly", false, [false]]
];
if (GRLIB_endgame == 1) exitWith {};
_spawn_marker = [[2000, 1000] select _infOnly, 3000, false, markerPos _spawn_marker] call KPLIB_fnc_getOpforSpawnPoint;
if !(_spawn_marker isEqualTo "") then {
GRLIB_last_battlegroup_time = diag_tickTime;
private _bg_groups = [];
private _selected_opfor_battlegroup = [];
private _target_size = (round (GRLIB_battlegroup_size * ([] call KPLIB_fnc_getOpforFactor) * (sqrt GRLIB_csat_aggressivity))) min 16;
if (combat_readiness < 60) then {_target_size = round (_target_size * 0.65);};
[_spawn_marker] remoteExec ["remote_call_battlegroup"];
if (worldName in KP_liberation_battlegroup_clearance) then {
[markerPos _spawn_marker, 15] call KPLIB_fnc_createClearance;
};
if (_infOnly) then {
// Infantry units to choose from
private _infClasses = [KPLIB_o_inf_classes, militia_squad] select (combat_readiness < 50);
// Adjust target size for infantry
_target_size = 12 max (_target_size * 4);
// Create infantry groups with up to 8 units per squad
private _grp = createGroup [GRLIB_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 [GRLIB_side_enemy, true];
};
[selectRandom _infClasses, markerPos _spawn_marker, _grp] call KPLIB_fnc_createManagedUnit;
};
[_grp] spawn battlegroup_ai;
_bg_groups pushBack _grp;
} else {
private _vehicle_pool = [opfor_battlegroup_vehicles, opfor_battlegroup_vehicles_low_intensity] select (combat_readiness < 50);
while {count _selected_opfor_battlegroup < _target_size} do {
_selected_opfor_battlegroup pushback (selectRandom _vehicle_pool);
};
private ["_nextgrp", "_vehicle"];
{
_nextgrp = createGroup [GRLIB_side_enemy, true];
_vehicle = [markerpos _spawn_marker, _x] call KPLIB_fnc_spawnVehicle;
sleep 0.5;
(crew _vehicle) joinSilent _nextgrp;
[_nextgrp] spawn battlegroup_ai;
_bg_groups pushback _nextgrp;
if ((_x in opfor_troup_transports) && ([] call KPLIB_fnc_getOpforCap < GRLIB_battlegroup_cap)) then {
if (_vehicle isKindOf "Air") then {
[[markerPos _spawn_marker] call KPLIB_fnc_getNearestBluforObjective, _vehicle] spawn send_paratroopers;
} else {
[_vehicle] spawn troup_transport;
};
};
} forEach _selected_opfor_battlegroup;
if (GRLIB_csat_aggressivity > 0.9) then {
[[markerPos _spawn_marker] call KPLIB_fnc_getNearestBluforObjective] spawn spawn_air;
};
};
sleep 3;
combat_readiness = (combat_readiness - (round ((count _bg_groups) + (random (count _bg_groups))))) max 0;
stats_hostile_battlegroups = stats_hostile_battlegroups + 1;
{
if (local _x) then {
_headless_client = [] call KPLIB_fnc_getLessLoadedHC;
if (!isNull _headless_client) then {
_x setGroupOwner (owner _headless_client);
};
};
sleep 1;
} forEach _bg_groups;
};