initial files
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
params ["_informant"];
|
||||
|
||||
if (isServer && alive _informant) then {
|
||||
resources_intel = resources_intel + KP_liberation_civinfo_intel;
|
||||
[2] spawn F_cr_changeCR;
|
||||
[1] remoteExec ["civinfo_notifications"];
|
||||
|
||||
sleep 6;
|
||||
|
||||
if ((random 100) <= KP_liberation_civinfo_task_chance) then {
|
||||
private _hc = [] call KPLIB_fnc_getLessLoadedHC;
|
||||
|
||||
if (isNull _hc) then {
|
||||
[] spawn civinfo_task;
|
||||
} else {
|
||||
[] remoteExec ["civinfo_task", _hc];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
waitUntil {sleep 10; ({_x in sectors_capture || _x in sectors_bigtown} count blufor_sectors) > 0};
|
||||
|
||||
if (KP_liberation_civinfo_debug > 0) then {[format ["Loop spawned on: %1", debug_source], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
while {true} do {
|
||||
uiSleep (KP_liberation_civinfo_min + round (random (KP_liberation_civinfo_max - KP_liberation_civinfo_min)));
|
||||
|
||||
if (KP_liberation_civinfo_debug > 0) then {["Informant sleep passed", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
waitUntil {
|
||||
sleep 10;
|
||||
({_x in sectors_capture || _x in sectors_bigtown} count blufor_sectors) > 0 &&
|
||||
KP_liberation_civ_rep >= 25
|
||||
};
|
||||
|
||||
if (KP_liberation_civinfo_debug > 0) then {["Informant waitUntil passed", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
if ((KP_liberation_civinfo_chance >= (random 100)) && GRLIB_endgame == 0) then {
|
||||
private _sector = selectRandom (blufor_sectors select {_x in sectors_capture || _x in sectors_bigtown});
|
||||
private _house = (nearestObjects [[((markerPos _sector select 0) - 100 + (random 200)), ((markerPos _sector select 1) - 100 + (random 200))],["House", "Building"], 100]) select 0;
|
||||
|
||||
private _grp = createGroup [GRLIB_side_civilian, true];
|
||||
private _informant = [selectRandom civilians, markerPos _sector, _grp] call KPLIB_fnc_createManagedUnit;
|
||||
private _waiting_time = KP_liberation_civinfo_duration;
|
||||
|
||||
_informant setPos (selectRandom (_house buildingPos -1));
|
||||
_informant setUnitPos "UP";
|
||||
sleep 1;
|
||||
if (KP_liberation_ace) then {
|
||||
["ace_captives_setSurrendered", [_informant, true], _informant] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
_informant disableAI "ANIM";
|
||||
_informant disableAI "MOVE";
|
||||
_informant playmove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
|
||||
sleep 2;
|
||||
_informant setCaptive true;
|
||||
};
|
||||
|
||||
if (KP_liberation_civinfo_debug > 0) then {[format ["Informant %1 spawned on: %2 - Position: %3", name _informant, debug_source, getPos _informant], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
[0, [((((getPos _informant) select 0) + 200) - random 400),((((getPos _informant) select 1) + 200) - random 400),0]] remoteExec ["civinfo_notifications"];
|
||||
|
||||
while {alive _informant && ((side (group _informant)) == GRLIB_side_civilian) && _waiting_time > 0} do {
|
||||
uiSleep 1;
|
||||
private _player_near = false;
|
||||
{
|
||||
if (((_x distance _informant) < 150) && (alive _x)) exitWith {_player_near = true};
|
||||
} foreach allPlayers;
|
||||
|
||||
if !(_player_near) then {
|
||||
_waiting_time = _waiting_time - 1;
|
||||
};
|
||||
|
||||
if ((KP_liberation_civinfo_debug > 0) && ((_waiting_time % 60) == 0)) then {[format ["Informant will despawn in %1 minutes", round (_waiting_time / 60)], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
};
|
||||
|
||||
if (_waiting_time > 0) then {
|
||||
if (alive _informant) then {
|
||||
if (KP_liberation_ace) then {
|
||||
["ace_captives_setSurrendered", [_informant, false], _informant] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
_informant enableAI "ANIM";
|
||||
_informant enableAI "MOVE";
|
||||
};
|
||||
sleep 1;
|
||||
[_informant] remoteExec ["civinfo_escort"];
|
||||
} else {
|
||||
if (KP_liberation_civinfo_debug > 0) then {["Informant is dead", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
[3] remoteExec ["civinfo_notifications"];
|
||||
};
|
||||
} else {
|
||||
deleteVehicle _informant;
|
||||
if (KP_liberation_civinfo_debug > 0) then {["Informant despawned", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
[2] remoteExec ["civinfo_notifications"];
|
||||
};
|
||||
} else {
|
||||
if (KP_liberation_civinfo_debug > 0) then {["Informant spawn chance missed", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
// Scripts
|
||||
// Task selection and spawning
|
||||
civinfo_task = compileFinal preprocessFileLineNumbers "scripts\server\civinformant\tasks\civinfo_task.sqf";
|
||||
|
||||
// Start spawn loop
|
||||
execVM "scripts\server\civinformant\civinfo_loop.sqf";
|
||||
@@ -0,0 +1,76 @@
|
||||
if (KP_liberation_civinfo_debug > 0) then {[format ["civinfo_task.sqf spawned on: %1", debug_source], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
private _spawn_marker = [2000,999999,false] call KPLIB_fnc_getOpforSpawnPoint;
|
||||
private _roadObj = [markerPos _spawn_marker, 400, []] call BIS_fnc_nearestRoad;
|
||||
|
||||
if (isNull _roadObj) exitWith {if (KP_liberation_civinfo_debug > 0) then {["civinfo_task.sqf -> no road found", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};};
|
||||
|
||||
private _veh = createVehicle [opfor_mrap, getPos _roadObj, [], 0, "NONE"];
|
||||
_veh setDir (getDir _roadObj);
|
||||
{
|
||||
if ((_x find "FWheel") != -1) then {
|
||||
_veh setHitPointDamage [_x, 1];
|
||||
};
|
||||
} forEach ((getAllHitPointsDamage _veh) select 0);
|
||||
|
||||
private _grp = createGroup [GRLIB_side_enemy, true];
|
||||
private _hvt = [opfor_officer, getPos _roadObj, _grp, "CAPTAIN", 30] call KPLIB_fnc_createManagedUnit;
|
||||
|
||||
for "_i" from 1 to 4 do {
|
||||
[selectRandom militia_squad, _grp, _grp] call KPLIB_fnc_createManagedUnit;
|
||||
sleep 0.1;
|
||||
};
|
||||
|
||||
private _waypoint = _grp addWaypoint [getPos _roadObj, 100];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointBehaviour "SAFE";
|
||||
_waypoint setWaypointCombatMode "YELLOW";
|
||||
_waypoint setWaypointSpeed "LIMITED";
|
||||
_waypoint setWaypointCompletionRadius 10;
|
||||
|
||||
_waypoint = _grp addWaypoint [getPos _roadObj, 100];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint = _grp addWaypoint [getPos _roadObj, 100];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint = _grp addWaypoint [getPos _roadObj, 100];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
|
||||
_waypoint = _grp addWaypoint [getPos _roadObj, 100];
|
||||
_waypoint setWaypointType "CYCLE";
|
||||
|
||||
if (KP_liberation_civinfo_debug > 0) then {[format ["civinfo_task.sqf -> vehicle and group created on: %1", debug_source], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
private _marker_pos = [((((getPos _roadObj) select 0) + 200) - random 400),((((getPos _roadObj) select 1) + 200) - random 400),0];
|
||||
|
||||
[4, _marker_pos] remoteExec ["civinfo_notifications"];
|
||||
|
||||
private _time_remaining = KP_liberation_civinfo_task_duration;
|
||||
|
||||
while {(alive _hvt) && _time_remaining > 0} do {
|
||||
uiSleep 1;
|
||||
private _player_near = false;
|
||||
{
|
||||
if (((_x distance _veh) < 1000) && (alive _x)) exitWith {_player_near = true};
|
||||
} foreach allPlayers;
|
||||
|
||||
if !(_player_near) then {
|
||||
_time_remaining = _time_remaining - 1;
|
||||
};
|
||||
if ((KP_liberation_civinfo_debug > 0) && ((_time_remaining % 60) == 0)) then {[format ["civinfo_task.sqf -> Task will despawn in %1 minutes", round (_time_remaining / 60)], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
};
|
||||
|
||||
if (KP_liberation_civinfo_debug > 0) then {[format ["civinfo_task.sqf -> loop exited on: %1", debug_source], "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
|
||||
if (alive _hvt) then {
|
||||
deleteVehicle _veh;
|
||||
{deleteVehicle _x} forEach (units _grp);
|
||||
[6] remoteExec ["civinfo_notifications"];
|
||||
if (KP_liberation_civinfo_debug > 0) then {["civinfo_task.sqf -> Task despawned", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
} else {
|
||||
combat_readiness = round (combat_readiness * 0.6);
|
||||
if (!isServer) then {
|
||||
publicVariableServer "combat_readiness";
|
||||
};
|
||||
[5] remoteExec ["civinfo_notifications"];
|
||||
if (KP_liberation_civinfo_debug > 0) then {["civinfo_task.sqf -> Task ended with success", "CIVINFO"] remoteExecCall ["KPLIB_fnc_log", 2];};
|
||||
};
|
||||
Reference in New Issue
Block a user