initial files
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
private _grp = _this select 0;
|
||||
private _basepos = getpos (leader _grp);
|
||||
|
||||
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0);};
|
||||
{_x doFollow leader _grp} foreach units _grp;
|
||||
|
||||
private _wpPositions = [
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360]
|
||||
];
|
||||
|
||||
private _waypoint = _grp addWaypoint [_wpPositions select 0, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCombatMode "BLUE";
|
||||
_waypoint setWaypointCompletionRadius 5;
|
||||
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 1, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCombatMode "BLUE";
|
||||
_waypoint setWaypointCompletionRadius 5;
|
||||
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 2, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCombatMode "BLUE";
|
||||
_waypoint setWaypointCompletionRadius 5;
|
||||
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 3, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCombatMode "BLUE";
|
||||
_waypoint setWaypointCompletionRadius 5;
|
||||
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 4, 10];
|
||||
_waypoint setWaypointType "CYCLE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCombatMode "BLUE";
|
||||
_waypoint setWaypointCompletionRadius 5;
|
||||
@@ -0,0 +1,85 @@
|
||||
private _grp = _this select 0;
|
||||
private _flagpos = _this select 1;
|
||||
private _basepos = getpos (leader _grp);
|
||||
private _is_infantry = false;
|
||||
private _wpPositions = [];
|
||||
private _waypoint = [];
|
||||
if (vehicle (leader _grp) == (leader _grp)) then {_is_infantry = true;};
|
||||
|
||||
sleep 5;
|
||||
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0);};
|
||||
sleep 1;
|
||||
{_x doFollow leader _grp} foreach units _grp;
|
||||
sleep 1;
|
||||
|
||||
if (_is_infantry) then {
|
||||
_wpPositions = [
|
||||
_flagpos getPos [random 150, random 360],
|
||||
_flagpos getPos [random 150, random 360],
|
||||
_flagpos getPos [random 150, random 360],
|
||||
_flagpos getPos [random 150, random 360],
|
||||
_flagpos getPos [random 150, random 360]
|
||||
];
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 0, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointCombatMode "YELLOW";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCompletionRadius 10;
|
||||
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 1, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 2, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 3, 10];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 4, 10];
|
||||
_waypoint setWaypointType "CYCLE";
|
||||
} else {
|
||||
_waypoint = _grp addWaypoint [_basepos, 1];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointCombatMode "YELLOW";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCompletionRadius 30;
|
||||
};
|
||||
|
||||
_grp setCurrentWaypoint [_grp, 0];
|
||||
|
||||
waitUntil {
|
||||
sleep 10;
|
||||
({alive _x} count (units _grp) == 0) || !(isNull ((leader _grp) findNearestEnemy (leader _grp)))
|
||||
};
|
||||
|
||||
if ({alive _x} count (units _grp) > 0) then {
|
||||
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0)};
|
||||
sleep 1;
|
||||
{_x doFollow leader _grp} foreach units _grp;
|
||||
sleep 1;
|
||||
_wpPositions = [
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360],
|
||||
_basepos getPos [random 150, random 360]
|
||||
];
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 0, 10];
|
||||
_waypoint setWaypointType "SAD";
|
||||
_waypoint setWaypointBehaviour "COMBAT";
|
||||
_waypoint setWaypointCombatMode "YELLOW";
|
||||
if (_is_infantry) then {
|
||||
_waypoint setWaypointSpeed "NORMAL";
|
||||
} else {
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
};
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 1, 10];
|
||||
_waypoint setWaypointType "SAD";
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 2, 10];
|
||||
_waypoint setWaypointType "SAD";
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 3, 10];
|
||||
_waypoint setWaypointType "SAD";
|
||||
_waypoint = _grp addWaypoint [_wpPositions select 4, 10];
|
||||
_waypoint setWaypointType "CYCLE";
|
||||
_grp setCurrentWaypoint [_grp, 0];
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
params [
|
||||
["_grp", grpNull, [grpNull]]
|
||||
];
|
||||
|
||||
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;
|
||||
|
||||
[_objPos] remoteExec ["remote_call_incoming"];
|
||||
|
||||
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 []) && (GRLIB_endgame == 0)) then {
|
||||
[_grp] spawn battlegroup_ai;
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
params ["_unit", ["_sector", ""]];
|
||||
|
||||
_unit setUnitPos "UP";
|
||||
_unit disableAI "PATH";
|
||||
private _move_is_disabled = true;
|
||||
private _hostiles = 0;
|
||||
private _ratio = 0.4;
|
||||
private _range = 40;
|
||||
|
||||
while {_move_is_disabled && local _unit && alive _unit && !(captive _unit)} do {
|
||||
|
||||
if !(_sector isEqualTo "") then {
|
||||
_ratio = [_sector] call KPLIB_fnc_getBluforRatio;
|
||||
};
|
||||
|
||||
_range = floor (linearConversion [0, 1, _ratio, 0, GRLIB_capture_size / 3 * 2, true]);
|
||||
|
||||
_hostiles = ((getPos _unit) nearEntities [["Man"], _range]) select {side _x == GRLIB_side_friendly};
|
||||
|
||||
if (_move_is_disabled &&
|
||||
{
|
||||
(_sector in blufor_sectors) ||
|
||||
{!(_hostiles isEqualTo [])} ||
|
||||
{damage _unit > 0.25}
|
||||
}
|
||||
) then {
|
||||
_move_is_disabled = false;
|
||||
_unit enableAI "PATH";
|
||||
_unit setUnitPos "AUTO";
|
||||
};
|
||||
|
||||
if (_move_is_disabled) then {
|
||||
private _target = assignedTarget _unit;
|
||||
if(!(isnull _target)) then {
|
||||
private _vd = (getPosASL _target) vectorDiff (getpos _unit);
|
||||
private _newdir = (_vd select 0) atan2 (_vd select 1);
|
||||
if (_newdir < 0) then {_dir = 360 + _newdir};
|
||||
_unit setdir (_newdir);
|
||||
};
|
||||
};
|
||||
sleep 5;
|
||||
};
|
||||
60
kp_liberation.brf_sumava/scripts/server/ai/patrol_ai.sqf
Normal file
60
kp_liberation.brf_sumava/scripts/server/ai/patrol_ai.sqf
Normal file
@@ -0,0 +1,60 @@
|
||||
private _grp = _this select 0;
|
||||
private _waypoint = [];
|
||||
if ( isNil "reinforcements_sector_under_attack" ) then { reinforcements_sector_under_attack = "" };
|
||||
|
||||
while { count (units _grp) > 0 } do {
|
||||
|
||||
if ( reinforcements_sector_under_attack != "" ) then {
|
||||
|
||||
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0);};
|
||||
{_x doFollow leader _grp} foreach units _grp;
|
||||
|
||||
_waypoint = _grp addWaypoint [markerpos reinforcements_sector_under_attack, 50];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointSpeed "FULL";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointCombatMode "YELLOW";
|
||||
_waypoint setWaypointCompletionRadius 30;
|
||||
_waypoint = _grp addWaypoint [markerpos reinforcements_sector_under_attack, 50];
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointType "SAD";
|
||||
_waypoint = _grp addWaypoint [markerpos reinforcements_sector_under_attack, 50];
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointType "SAD";
|
||||
_waypoint = _grp addWaypoint [markerpos reinforcements_sector_under_attack, 50];
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointType "CYCLE";
|
||||
|
||||
sleep 300;
|
||||
};
|
||||
|
||||
if ( reinforcements_sector_under_attack == "" ) then {
|
||||
private _sectors_patrol = [];
|
||||
private _patrol_startpos = getpos (leader _grp);
|
||||
{
|
||||
if ( _patrol_startpos distance (markerpos _x) < 2500) then {
|
||||
_sectors_patrol pushBack _x;
|
||||
};
|
||||
} foreach (sectors_allSectors - blufor_sectors);
|
||||
|
||||
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0);};
|
||||
{_x doFollow leader _grp} foreach units _grp;
|
||||
|
||||
{
|
||||
_waypoint = _grp addWaypoint [markerpos _x, 300];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointSpeed "NORMAL";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointCombatMode "YELLOW";
|
||||
_waypoint setWaypointCompletionRadius 30;
|
||||
} foreach _sectors_patrol;
|
||||
|
||||
_waypoint = _grp addWaypoint [_patrol_startpos, 300];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointCompletionRadius 100;
|
||||
_waypoint = _grp addWaypoint [_patrol_startpos , 300];
|
||||
_waypoint setWaypointType "CYCLE";
|
||||
};
|
||||
|
||||
waitUntil { sleep 5;(count (units _grp) == 0) || (reinforcements_sector_under_attack != "") };
|
||||
};
|
||||
52
kp_liberation.brf_sumava/scripts/server/ai/prisonner_ai.sqf
Normal file
52
kp_liberation.brf_sumava/scripts/server/ai/prisonner_ai.sqf
Normal file
@@ -0,0 +1,52 @@
|
||||
params ["_unit", ["_force_surrender", false]];
|
||||
|
||||
if ((!_force_surrender) && ((random 100) > GRLIB_surrender_chance)) exitWith {};
|
||||
|
||||
if ((_unit isKindOf "Man") && (alive _unit) && (side group _unit == GRLIB_side_enemy)) then {
|
||||
|
||||
if (vehicle _unit != _unit) then {deleteVehicle _unit};
|
||||
|
||||
sleep (random 5);
|
||||
|
||||
if (alive _unit) then {
|
||||
|
||||
removeAllWeapons _unit;
|
||||
if (typeof _unit != pilot_classname) then {
|
||||
removeHeadgear _unit;
|
||||
};
|
||||
removeBackpack _unit;
|
||||
removeVest _unit;
|
||||
_unit unassignItem "NVGoggles_OPFOR";
|
||||
_unit removeItem "NVGoggles_OPFOR";
|
||||
_unit unassignItem "NVGoggles_INDEP";
|
||||
_unit removeItem "NVGoggles_INDEP";
|
||||
_unit setUnitPos "UP";
|
||||
sleep 1;
|
||||
private _grp = createGroup [GRLIB_side_civilian, true];
|
||||
[_unit] joinSilent _grp;
|
||||
if (KP_liberation_ace) then {
|
||||
["ace_captives_setSurrendered", [_unit, true], _unit] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
_unit disableAI "ANIM";
|
||||
_unit disableAI "MOVE";
|
||||
_unit playmove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
|
||||
sleep 2;
|
||||
_unit setCaptive true;
|
||||
};
|
||||
waitUntil {sleep 1;
|
||||
!alive _unit || side group _unit == GRLIB_side_friendly
|
||||
};
|
||||
|
||||
if (alive _unit) then {
|
||||
if (KP_liberation_ace) then {
|
||||
["ace_captives_setSurrendered", [_unit, false], _unit] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
_unit enableAI "ANIM";
|
||||
_unit enableAI "MOVE";
|
||||
_unit setCaptive false;
|
||||
};
|
||||
sleep 1;
|
||||
[_unit] remoteExec ["remote_call_prisonner", _unit];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,74 @@
|
||||
params [
|
||||
["_transVeh", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (isNull _transVeh) exitWith {};
|
||||
sleep 1;
|
||||
|
||||
private _transGrp = (group (driver _transVeh));
|
||||
private _start_pos = getpos _transVeh;
|
||||
private _objPos = [getpos _transVeh] call KPLIB_fnc_getNearestBluforObjective;
|
||||
private _unload_distance = 500;
|
||||
private _crewcount = count crew _transVeh;
|
||||
|
||||
waitUntil {
|
||||
sleep 0.2;
|
||||
!(alive _transVeh) ||
|
||||
!(alive (driver _transVeh)) ||
|
||||
(((_transVeh distance _objPos) < _unload_distance) && !(surfaceIsWater (getpos _transVeh)))
|
||||
};
|
||||
|
||||
if ((alive _transVeh) && (alive (driver _transVeh))) then {
|
||||
_infGrp = createGroup [GRLIB_side_enemy, true];
|
||||
|
||||
{
|
||||
[_x, _start_pos, _infGrp, "PRIVATE", 0.5] call KPLIB_fnc_createManagedUnit;
|
||||
} foreach ([] call KPLIB_fnc_getSquadComp);
|
||||
|
||||
{_x moveInCargo _transVeh} forEach (units _infGrp);
|
||||
|
||||
while {(count (waypoints _infGrp)) != 0} do {deleteWaypoint ((waypoints _infGrp) select 0);};
|
||||
|
||||
sleep 3;
|
||||
|
||||
private _transVehWp = _transGrp addWaypoint [getpos _transVeh, 0,0];
|
||||
_transVehWp setWaypointType "TR UNLOAD";
|
||||
_transVehWp setWaypointCompletionRadius 200;
|
||||
|
||||
private _infWp = _infGrp addWaypoint [getpos _transVeh, 0];
|
||||
_infWp setWaypointType "GETOUT";
|
||||
_infWp setWaypointCompletionRadius 200;
|
||||
|
||||
_infWp synchronizeWaypoint [_transVehWp];
|
||||
|
||||
{unassignVehicle _transVeh} forEach (units _infGrp);
|
||||
_infGrp leaveVehicle _transVeh;
|
||||
(units _infGrp) allowGetIn false;
|
||||
|
||||
private _infWp_2 = _infGrp addWaypoint [getpos _transVeh, 250];
|
||||
_infWp_2 setWaypointType "MOVE";
|
||||
_infWp_2 setWaypointCompletionRadius 5;
|
||||
|
||||
waitUntil {sleep 0.5; _crewcount >= count crew _transVeh};
|
||||
|
||||
sleep 5;
|
||||
|
||||
while {(count (waypoints _transGrp)) != 0} do {deleteWaypoint ((waypoints _transGrp) select 0);};
|
||||
|
||||
_transVehWp = _transGrp addWaypoint [_objPos, 100];
|
||||
_transVehWp setWaypointType "SAD";
|
||||
_transVehWp setWaypointSpeed "NORMAL";
|
||||
_transVehWp setWaypointBehaviour "COMBAT";
|
||||
_transVehWp setWaypointCombatMode "RED";
|
||||
_transVehWp setWaypointCompletionRadius 30;
|
||||
|
||||
_transVehWp = _transGrp addWaypoint [_objPos, 100];
|
||||
_transVehWp setWaypointType "SAD";
|
||||
|
||||
_transVehWp = _transGrp addWaypoint [_objPos, 100];
|
||||
_transVehWp setWaypointType "CYCLE";
|
||||
|
||||
sleep 10;
|
||||
|
||||
[_infGrp] spawn battlegroup_ai;
|
||||
};
|
||||
Reference in New Issue
Block a user