anvil\defines.sqf BT anvil\dialogs.hpp BT anvil\fn_addActionMP.sqf BTO anvil\fn_globalHide.sqf )T anvil\fn_NOP.sqf BT anvil\framework_init.sqf BT anvil\mission\defines.sqf BT anvil\mission\fn_Mission_Assassinate.sqf T anvil\mission\fn_Mission_Capture.sqf
T anvil\mission\fn_Mission_Destroy.sqf T anvil\mission\fn_Mission_DestroyAA.sqf Tl anvil\mission\fn_Mission_DestroyAmmo.sqf T anvil\mission\fn_Mission_DestroyHelo.sqf T anvil\mission\fn_Mission_DestroyUav.sqf T anvil\mission\fn_Mission_Intel.sqf T} anvil\mission\fn_Mission_IntelHelo.sqf T anvil\mission\fn_Mission_Move.sqf T anvil\mission\fn_Mission_Transit.sqf T anvil\mission_description.sqf LSW anvil\module\defines.sqf BT anvil\module\fn_Module_activateVehicleUnlock.sqf BT anvil\module\fn_Module_setupVehicleUnlock.sqf BTe anvil\objective\defines.sqf BT anvil\objective\fn_completeObjective.sqf TZ anvil\objective\fn_doEosSpawn.sqf )T anvil\objective\fn_doSetObjectiveState.sqf TQ anvil\objective\fn_getObjectiveState.sqf BT anvil\objective\fn_setObjectiveState.sqf BTI anvil\objective\fn_spawnObjectives.sqf BT anvil\objective\fn_startObjective.sqf TD anvil\spawn\defines.sqf BT anvil\spawn\fn_createAmmobox.sqf BT anvil\spawn\fn_getRandomSpawnPosition.sqf BT anvil\spawn\fn_manageRandomPatrols.sqf BTG anvil\spawn\fn_populateAmmobox.sqf BT anvil\spawn\fn_setPatrolDestination.sqf BT anvil\spawn\fn_spawnAmmo.sqf )TZ anvil\spawn\fn_spawnSpecialWeapon.sqf BT briefing.sqf LSWC civguise.sqf pSWW cws_injury\cfgFunctionsCWS.hpp T/S cws_injury\cws_config.sqf b2TI cws_injury\cws_init.sqf T/S cws_injury\dialogs\RscTitlesCWS.hpp T/Sc cws_injury\fsm\cws.fsm T/Sy cws_injury\fsm\cws_bloodloss.fsm T/S! cws_injury\fsm\cws_marker.fsm T/S cws_injury\func\fn_carry.sqf T/S cws_injury\func\fn_checklauncher.sqf T/S cws_injury\func\fn_cleanUpActions.sqf T/Sb cws_injury\func\fn_deadcam.sqf T/S cws_injury\func\fn_delbody.sqf T/S cws_injury\func\fn_drag.sqf T/S cws_injury\func\fn_drop.sqf T/S cws_injury\func\fn_firstaid.sqf T/SD cws_injury\func\fn_getUnitDamage.sqf T/S cws_injury\func\fn_handleDamage.sqf T/S cws_injury\func\fn_handleHeal.sqf T/SS
cws_injury\func\fn_handleKeys.sqf T/S cws_injury\func\fn_injuredEffects.sqf T/S cws_injury\func\fn_isHealable.sqf T/S cws_injury\func\fn_isMedic.sqf T/SI cws_injury\func\fn_keyUnbind.sqf T/S cws_injury\func\fn_lookingForWoundedMates.sqf T/SH cws_injury\func\fn_progressBar.sqf T/S cws_injury\func\fn_progressBarInit.sqf T/S cws_injury\func\fn_quote.sqf T/S cws_injury\func\fn_sendAIHealer.sqf T/S} cws_injury\func\fn_setUnitDamage.sqf T/S cws_injury\func\fn_setupActions.sqf T/S cws_injury\func\fn_setupUnitVariables.sqf T/SS cws_injury\func\fn_showMessage.sqf T/S defines.hpp JS description.ext BlSW Engima\Civilians\Common\Common.sqf (YSW Engima\Civilians\Common\Debug.sqf (YSW Engima\Civilians\ConfigAndStart.sqf pSW Engima\Civilians\Documentation.txt (YSW Engima\Civilians\Init.sqf 8oSW Engima\Civilians\Server\ServerFunctions.sqf (YSW; eos\AI_Skill.sqf JSq eos\core\b_core.sqf JS) eos\core\b_Launch.sqf JSK eos\core\eos_core.sqf T4 eos\core\eos_launch.sqf JS
eos\core\spawn_fnc.sqf JSm eos\functions\cargo_fnc.sqf JS eos\functions\EOS_KillCounter.sqf JS< eos\functions\EOS_Markers.sqf JS eos\functions\eos_spawnVehicle.sqf JS eos\functions\findSafePos.sqf JS? eos\functions\infantry_fnc.sqf JS eos\functions\setSkill.sqf )T9 eos\functions\SHK_buildingpos.sqf JSs eos\functions\shk_patrol.sqf JS
eos\functions\shk_pos.sqf JS eos\functions\TransportUnload_fnc.sqf JS eos\OpenMe.sqf JSM eos\UnitPools.sqf JS init.sqf qSW initPlayerLocal.sqf GSW intro.jpg =NLW, Logo.jpg LW,w mission.sqm rSW mission.sqm.oldBackup VSW:3 mission_banner.paa BT+ mission_data.json JSW onPlayerRespawn.sqf SWE README.md JSg SHK_Fastrope.sqf =hLW+8 version.txt BT // Set up some macros to make life a bit easier.
// The idea for these macros was borrowed from Aerson's group_manager script
// http://forums.bistudio.com/showthread.php?163206-Group-Manager
#define EL(A,B) ((A) select (B))
#define THIS(A) EL(this,A)
#define _THIS(A) EL(_this,A)
#define APPEND(A, B) A set [count A, B]
// define some constants
#define AFW_NONE -1
#define AFW_MISSIONTYPES ["Capture", "Gather intel in", "Assassinate officer in", "Destroy tower in", "Destroy AA in", "Clear enemy from", "Destroy ammo cache in", "Destroy crashed UAV in", "Gather Crash Site Intel in", "Destroy Crashed Helo in", "Move through", "Move to"]
// easy element accessors
#define O_ID(A) EL(A, 0)
#define O_DESCRIBE(A) EL(A, 1)
#define O_MARKER(A) EL(A, 2)
#define O_R(A) EL(A, 3)
#define O_INF(A) EL(A, 4)
#define O_VEH(A) EL(A, 5)
#define O_ARM(A) EL(A, 6)
#define O_AIR(A) EL(A, 7)
#define O_STR(A) EL(A, 8)
#define O_SPAWN(A) EL(A, 9)
#define O_AMMO(A) EL(A, 10)
#define O_SPECIAL(A) EL(A, 11)
#define O_PREREQ(A) EL(A, 12)
#define O_MISSIONTYPE(A) EL(A, 13)
#define O_REWARDS(A) EL(A, 14)
#define O_RANDOMISE(A) EL(A, 15)
#define O_LPREREQ(A) EL(A, 16)
#define O_PAYLOAD(A) EL(A, 17)
// some shortcut functions for objectives
#define O_MISSIONTYPE_DESC(A) AFW_MISSIONTYPES select (O_MISSIONTYPE(A))
#define O_X(A) (O_POS(A) select 0)
#define O_Y(A) (O_POS(A) select 1)
#define O_POS(A) getMarkerPos O_MARKER(A)
#define O_SIZE(A) [ O_R(A), O_R(A) ]
#define O_EOS_NAME(A) format ["obj_%1", O_ID(A)]
#define O_OBJ_NAME(A) format ["objective_%1", O_ID(A)]
#define O_TASK_NAME(A) format ["%1_%2", O_EOS_NAME(A), O_ID(A)]
class AFW_PersistMission_dialog
{
idd=-1;
movingenable=false;
class controls
{
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by |TG| Will, v1.063, #Xicyla)
////////////////////////////////////////////////////////
class AFW_PersistMission_background: Box
{
idc = 1799;
text = ""; //--- ToDo: Localize;
x = 0.304113 * safezoneW + safezoneX;
y = 0.291 * safezoneH + safezoneY;
w = 0.381463 * safezoneW;
h = 0.374 * safezoneH;
};
class AFW_PersistMission_frame: RscFrame
{
idc = 1800;
text = "Save or Load Mission State"; //--- ToDo: Localize;
x = 0.304113 * safezoneW + safezoneX;
y = 0.291 * safezoneH + safezoneY;
w = 0.381463 * safezoneW;
h = 0.374 * safezoneH;
};
class AFW_PersistMission_textHeader: RscText
{
idc = 1000;
text = "Use this box to save or load mission state - enter text in the text box or copy the text to save"; //--- ToDo: Localize;
x = 0.314423 * safezoneW + safezoneX;
y = 0.313 * safezoneH + safezoneY;
w = 0.360844 * safezoneW;
h = 0.066 * safezoneH;
};
class AFW_PersistMission_missionDataText: RscEdit
{
idc = 1400;
x = 0.324733 * safezoneW + safezoneX;
y = 0.445 * safezoneH + safezoneY;
w = 0.350534 * safezoneW;
h = 0.033 * safezoneH;
};
class AFW_PersistMission_loadMissionButton: RscButton
{
idc = 1600;
text = "Load"; //--- ToDo: Localize;
x = 0.582479 * safezoneW + safezoneX;
y = 0.588 * safezoneH + safezoneY;
w = 0.0412393 * safezoneW;
h = 0.055 * safezoneH;
action = "closeDialog 0;";
};
class AFW_PersistMission_closeButton: RscButton
{
idc = 1601;
text = "Close"; //--- ToDo: Localize;
x = 0.634028 * safezoneW + safezoneX;
y = 0.588 * safezoneH + safezoneY;
w = 0.0412393 * safezoneW;
h = 0.055 * safezoneH;
action = "closeDialog 0;";
};
class AFW_PersistMission_saveMissionButton: RscButton
{
idc = 1602;
text = "Save"; //--- ToDo: Localize;
x = 0.530929 * safezoneW + safezoneX;
y = 0.588 * safezoneH + safezoneY;
w = 0.0412393 * safezoneW;
h = 0.055 * safezoneH;
action = "ctrlSetText [1400, format[""%1"", [] call AFW_fnc_getObjectiveState]]";
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////
};
};
/*
Author: Will Hart
Description:
Creates an addAction for all human multiplayer players
Parameter(s):
_this select 0: OBJECT, The object to apply the action to
_this select 1: STRING, The title to display for the object
_this select 2: FUNCTION, The function to call when complete
_this select 3: ARRAY or OBJECT, The arguments to pass to the function
Example:
[[_my_item, "Remove", {
deleteVehicle (_this select 3) select 0;
}, [_my_vehicle], "AFW_fnc_addActionMP", nil, false] spawn BIS_fnc_MP;
Returns:
Nothing
*/
private["_obj", "_title", "_fn","_args"];
_obj = _this select 0;
_title = _this select 1;
_fn = _this select 2;
_args = _this select 3;
// only run if the intel object is still alive
if (alive _args) then {
_obj addAction [_title, _fn, _args];
};
/*
Author: Will Hart
Description:
Runs on the server to hide an object globally
Parameter(s):
_this select 0: ARRAY, the objects to hide globally
_this select 1: BOOL, true to hide, false to show
_this select 2: INT, [optional] an objective ID which must be incomplete for this to execute
Example:
[[[vehicle_one], true], "AFW_fnc_globalHide"] spawn BIS_fnc_MP;
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_vehs", "_hide", "_id", "_execute"];
_vehs = _THIS(0);
_hide = _THIS(1);
_id = if (count _this == 2) then { -1 } else { _THIS(2) };
_execute = true;
// don't execute if the objective is given and is complete
if (_id > -1) then {
waitUntil { !isNil "completed_objectives" };
if (_id in completed_objectives) then { _execute = false; };
};
// always show the vehicle and enable simulation, but only hide it if the objective is incomplete
if (_execute || !_hide) then {
{
if (isMultiplayer) then
{
// support dedicated servers
_x hideObjectGlobal _hide;
_x enableSimulationGlobal !_hide;
_x allowDamage !_hide;
}
else
{
// support single player
_x hideObject _hide;
_x enableSimulation !_hide;
_x allowDamage !_hide;
};
} forEach _vehs;
};/*
Author: Will Hart
Description:
A simple NOP script which does absolutely nothing
Parameter(s):
None
Example:
[] call AFW_fnc_NOP;
Returns:
false
*/
false/*
Author: Will Hart
Description:
Initialises a mission using the Tactical Advance framework and defines the list of objectives that should be created
Parameter(s):
None
Example:
_nul = [] execVM "framework\framework_init.sqf";
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_handle"];
_handle = [] execVM "anvil\mission_description.sqf";
waitUntil {scriptDone _handle};
diag_log "Loaded mission description";
completed_objectives = [];
publicVariable 'completed_objectives';
current_objectives = [];
publicVariable 'current_objectives';
// record all objectives as incomplete
incomplete_objectives = [];
{
incomplete_objectives set [count incomplete_objectives, O_ID(_x)];
server setVariable [O_OBJ_NAME(_x), false, true];
} forEach objective_list;
publicVariable 'incomplete_objectives';
all_objectives_complete = false;
publicVariable 'all_objectives_complete';
// randomly assign mission order if required
if (!isNil "afw_random_objective_order") then {
if (afw_random_objective_order) then {
private ["_tmp", "_last", "_lastObj", "_curr", "_currObj", "_i"];
_tmp = [];
// copy a list of all objectives (doing it this way as no guarantee
// that objective ID == array element ID
_i = 0;
{
APPEND(_tmp, _i);
_i = _i + 1;
} forEach objective_list;
// randomly set prerequisites
_last = 0;
while {count _tmp > 0} do {
// select the next random objective
_curr = _tmp select floor random count _tmp;
_currObj = EL(objective_list, _curr);
// set the prerequisite
if (!(_last == 0)) then {
_currObj set [12, [O_ID(_lastObj)]];
};
// remove the current item from the list and save the previous items
_last = _curr;
_lastObj = _currObj;
_tmp = _tmp - [_curr];
};
};
};
publicVariable "objective_list";
// set up random patrols if enabled in the GUI
if ("AFW_NumberRandomPatrols" call BIS_fnc_getParamValue > 0) then {
_nul = [] spawn AFW_fnc_manageRandomPatrols;
};
// set up mission types - indexed by mission type, elements are
// [Mission setup function, EOS Callback function, General callback]
mission_types = [
[AFW_fnc_Mission_Capture, AFW_fnc_completeObjective, AFW_fnc_NOP], //Capture
[AFW_fnc_Mission_Intel, AFW_fnc_NOP, AFW_fnc_completeObjective], //Intel
[AFW_fnc_Mission_Assassinate, AFW_fnc_NOP, AFW_fnc_completeObjective], //Assassinate
[AFW_fnc_Mission_Destroy, AFW_fnc_NOP, AFW_fnc_completeObjective], //Destroy
[AFW_fnc_Mission_DestroyAA, AFW_fnc_NOP, AFW_fnc_completeObjective], //Destroy AA
[AFW_fnc_Mission_Capture, AFW_fnc_completeObjective, AFW_fnc_NOP], //Clear
[AFW_fnc_Mission_DestroyAmmo, AFW_fnc_NOP, AFW_fnc_completeObjective], //Destroy Ammo
[AFW_fnc_Mission_DestroyUav, AFW_fnc_NOP, AFW_fnc_completeObjective], //Destroy UAV
[AFW_fnc_Mission_IntelHelo, AFW_fnc_NOP, AFW_fnc_completeObjective], //Intel Helo
[AFW_fnc_Mission_DestroyHelo, AFW_fnc_NOP, AFW_fnc_completeObjective], //Destroy Helo
[AFW_fnc_Mission_Transit, AFW_fnc_NOP, AFW_fnc_completeObjective], //Transit
[AFW_fnc_Mission_Move, AFW_fnc_NOP, AFW_fnc_completeObjective] //Move
];
publicVariable "mission_types";
support_weapons = [
['B_UAV_01_backpack_F'],
['B_Kitbag_rgr_Exp'],
['B_Mortar_01_support_F', 'B_Mortar_01_weapon_F'],
['B_Kitbag_rgr_Exp'],
['B_HMG_01_support_F','B_HMG_01_weapon_F']
];
publicVariable "support_weapons";
// set up missions
_nul = AFW_NONE spawn AFW_fnc_spawnObjectives;
// draw respawn positions?
[true] call BIS_fnc_drawRespawnPositions;
// Set up some macros to make life a bit easier.
// The idea for these macros was borrowed from Aerson's group_manager script
// http://forums.bistudio.com/showthread.php?163206-Group-Manager
#define EL(A,B) ((A) select (B))
#define THIS(A) EL(this,A)
#define _THIS(A) EL(_this,A)
#define APPEND(A, B) A set [count A, B]
// define some constants
#define AFW_NONE -1
#define AFW_MISSIONTYPES ["Capture", "Gather intel in", "Assassinate officer in", "Destroy tower in", "Destroy AA in", "Clear enemy from", "Destroy ammo cache in", "Destroy crashed UAV in", "Gather Crash Site Intel in", "Destroy Crashed Helo in", "Move through", "Move to"]
// easy element accessors
#define O_ID(A) EL(A, 0)
#define O_DESCRIBE(A) EL(A, 1)
#define O_MARKER(A) EL(A, 2)
#define O_R(A) EL(A, 3)
#define O_INF(A) EL(A, 4)
#define O_VEH(A) EL(A, 5)
#define O_ARM(A) EL(A, 6)
#define O_AIR(A) EL(A, 7)
#define O_STR(A) EL(A, 8)
#define O_SPAWN(A) EL(A, 9)
#define O_AMMO(A) EL(A, 10)
#define O_SPECIAL(A) EL(A, 11)
#define O_PREREQ(A) EL(A, 12)
#define O_MISSIONTYPE(A) EL(A, 13)
#define O_REWARDS(A) EL(A, 14)
#define O_RANDOMISE(A) EL(A, 15)
#define O_LPREREQ(A) EL(A, 16)
#define O_PAYLOAD(A) EL(A, 17)
// some shortcut functions for objectives
#define O_MISSIONTYPE_DESC(A) AFW_MISSIONTYPES select (O_MISSIONTYPE(A))
#define O_X(A) (O_POS(A) select 0)
#define O_Y(A) (O_POS(A) select 1)
#define O_POS(A) getMarkerPos O_MARKER(A)
#define O_SIZE(A) [ O_R(A), O_R(A) ]
#define O_EOS_NAME(A) format ["obj_%1", O_ID(A)]
#define O_OBJ_NAME(A) format ["objective_%1", O_ID(A)]
#define O_TASK_NAME(A) format ["%1_%2", O_EOS_NAME(A), O_ID(A)]
/*
Author: Will Hart
Description:
Creates a new mission, where an HVT must be eliminated
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_Assassinate;
Returns:
Nothing
*/
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_veh", "_group", "_vehType"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
// spawn the occupation - callback passed should be a NOP
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
if (enemyTeam == EAST) then {
_vehType = "O_Officer_F";
} else {
if (enemyTeam == INDEPENDENT) then {
_vehType = "I_Officer_F";
} else {
_vehType = "B_Officer_F";
};
};
// spawn the officer and set them to patrol
_group = createGroup enemyTeam;
_veh = _group createUnit [_vehType, O_POS(_obj), [], 0, "FORM"];
[_group, O_POS(_obj), O_R(_obj)] call bis_fnc_taskPatrol;
// mission success when the officer dies
waitUntil { sleep 5; !alive _veh};
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where a site must be captured and cleared of enemy
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_Capture;
Returns:
Nothing
*/
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
// spawn the objective
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
waitUntil { sleep 5; server getVariable _obj_name };
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where an object must be destroyed.
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_Destroy;
Returns:
Nothing
*/
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_veh"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
// spawn the occupation - callback passed should be a NOP
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// spawn the radio tower on the marker
_pos = [_obj, "Land_TTowerSmall_1_F"] call AFW_fnc_getRandomSpawnPosition;
_veh = "Land_TTowerSmall_1_F" createVehicle _pos;
waitUntil { sleep 5; !(alive _veh)};
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where an HVT must be eliminated
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_Assassinate;
Returns:
Nothing
*/
if (!isServer) exitWith { false };
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_veh", "_group", "_vehType", "_result"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
if (enemyTeam == EAST) then {
_vehType = "O_APC_Tracked_02_AA_F";
} else {
if (enemyTeam == INDEPENDENT) then {
_vehType = "I_APC_tracked_03_cannon_F";
} else {
_vehType = "B_APC_Tracked_01_AA_F";
};
};
// spawn the occupation - callback passed should be a NOP
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// spawn the officer and set them to patrol
_pos = [_obj, _vehType] call AFW_fnc_getRandomSpawnPosition;
_group = createGroup enemyTeam;
_result = [_pos, 180, _vehType, _group] call BIS_fnc_spawnVehicle;
_veh = _result select 0;
// mission success when the officer dies
waitUntil { sleep 5; !alive _veh};
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where an ammobox must be eliminated
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_DestroyAmmo;
Returns:
Nothing
*/
if (!isServer) exitWith { false };
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_veh", "_group"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
// spawn the occupation - callback passed should be a NOP
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// spawn the officer and set them to patrol
_pos = [_obj, "Box_East_AmmoOrd_F"] call AFW_fnc_getRandomSpawnPosition;
_ammo = [_pos, 10, [], [], [["DemoCharge_Remote_Mag", 5], ["ClaymoreDirectionalMine_Remote_Mag", 5]], "Box_East_AmmoOrd_F"] call AFW_fnc_populateAmmobox;
sleep 5;
waitUntil { sleep 5; alive _ammo };
// mission success when the officer dies
waitUntil { sleep 8; !alive _ammo};
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where an HVT must be eliminated
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_DestroyHelo;
Returns:
Nothing
*/
if (!isServer) exitWith { false };
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_veh", "_group", "_vehType"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
if (friendlyTeam == EAST) then {
_vehType = "O_APC_Tracked_02_AA_F";
} else {
if (friendlyTeam == INDEPENDENT) then {
_vehType = "O_Heli_Attack_02_F";
} else {
_vehType = "B_Heli_Transport_01_camo_F";
};
};
// spawn the objective occupation
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// spawn the occupation - callback passed should be a NOP
_pos = [_obj, _vehType] call AFW_fnc_getRandomSpawnPosition;
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// spawn the officer and set them to patrol
_veh = _vehType createVehicle _pos;
_veh setDamage 0.7;
_veh setFuel 0;
_veh setFuelCargo 0;
// mission success when the officer dies
waitUntil { sleep 5; !alive _veh};
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where a damaged UAV must be destroyed
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_DestroyUav;
Returns:
Nothing
*/
if (!isServer) exitWith { false };
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_veh", "_group", "_vehType", "_pos"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
if (friendlyTeam == EAST) then {
_vehType = "O_UAV_02_F";
} else {
if (friendlyTeam == INDEPENDENT) then {
_vehType = "I_UAV_02_F";
} else {
_vehType = "B_UAV_02_F";
};
};
// spawn the objective occupation
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// spawn the occupation - callback passed should be a NOP
_pos = [_obj, _vehType] call AFW_fnc_getRandomSpawnPosition;
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// spawn the officer and set them to patrol
_group = createGroup friendlyTeam;
_veh = _vehType createVehicle _pos;
_veh setFuel 0;
_veh setDamage 0.3;
// mission success when the officer dies
waitUntil { sleep 5; !alive _veh};
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where intelligence must be recovered by the player.
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_Intel;
Returns:
Nothing
*/
if (!isServer) exitWith { false };
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_intel_var", "_intel"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
_intel_var = format ["%1_intel", _obj_name];
// spawn the objective occupation
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// create the intelligence
server setVariable [_intel_var, false];
_intel = "Land_Suitcase_F" createVehicle O_POS(_obj);
_houses = nearestObjects [O_POS(_obj), ["House"], O_R(_obj)];
if (count _houses > 0) then {
private ["_house"];
_house = _houses select (floor random count _houses);
if (format ["%1", _house buildingPos 2] != "[0,0,0]") then {
_intel setPos (_house buildingPos (floor random 3));
};
};
[[_intel, "Gather Intel", {
hint "Gathering intel";
sleep random 30;
hint "Intel gathered";
deleteVehicle _THIS(0);
}, _intel], "AFW_fnc_addActionMP", nil, true] spawn BIS_fnc_MP;
// wait until the intel is gathered
waitUntil { sleep 5; !alive _intel };
// complete the mission
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where intelligence must be recovered by the player.
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_IntelHeli;
Returns:
Nothing
*/
if (!isServer) exitWith { false };
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_intel_var", "_intel", "_pos"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
_intel_var = format ["%1_intel", _obj_name];
// spawn the objective occupation
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// create the intelligence
server setVariable [_intel_var, false];
_pos = [_obj, "Land_Wreck_Heli_Attack_01_F"] call AFW_fnc_getRandomSpawnPosition;
_intel = "Land_Wreck_Heli_Attack_01_F" createVehicle _pos;
_intel setVariable ["complete", false, true];
[[_intel, "Gather Intel", {
hint "Gathering intel";
sleep random 30;
hint "Intel gathered";
_THIS(0) setVariable ["complete", true, true];
}, _intel], "AFW_fnc_addActionMP", nil, true] spawn BIS_fnc_MP;
// wait until the intel is gathered
waitUntil { sleep 5; _intel getVariable "complete" };
// complete the mission
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where the friendly team must move to the zone
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_Move;
Returns:
Nothing
*/
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_trg", "_act"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
_trig_name = format ["%1_arrived", _obj_name];
if (friendlyTeam == EAST) then {
_act = "EAST";
} else {
if (friendlyTeam == WEST) then {
_act = "WEST";
} else {
_act = "GUER";
};
};
// spawn the occupation - callback passed should be a NOP
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// create the trigger to detect at least 5 seconds of presence
_trg = createTrigger ["EmptyDetector", O_POS(_obj)];
_trg setTriggerArea [O_R(_obj), O_R(_obj), 0, false];
_trg setTriggerActivation [_act, "PRESENT", true];
_trg setTriggerTimeout [5, 5, 5, true];
// deactivate the trigger and perform the callback
waitUntil { sleep 5; triggerActivated _trg };
_trg setTriggerStatements ["false", "", ""];
_obj spawn _CB;/*
Author: Will Hart
Description:
Creates a new mission, where the friendly team must transit through the zone
Parameter(s):
_this select 0: OBJECT, the objective being created
_this select 1: FUNCTION, the function to call when the EOS mission completes
_this select 2: FUNCTION, the function to call when the objective has been completed
Example:
[objective, AFW_fnc_NOP, AFW_fnc_NOP] call AFW_fnc_Mission_Transit;
Returns:
Nothing
*/
#include "defines.sqf"
private ["_eosCB", "_CB", "_obj", "_obj_name", "_trg", "_act"];
_obj = _THIS(0);
_eosCB = _THIS(1);
_CB = _THIS(2);
_obj_name = O_OBJ_NAME(_obj);
_trig_name = format ["%1_intel", _obj_name];
if (friendlyTeam == EAST) then {
_act = "EAST";
} else {
if (friendlyTeam == WEST) then {
_act = "WEST";
} else {
_act = "GUER";
};
};
// spawn the occupation - callback passed should be a NOP
[_obj, _eosCB] spawn AFW_fnc_doEosSpawn;
// create the trigger to detect at least 5 seconds of presence within 20m
_trg = createTrigger ["EmptyDetector", O_POS(_obj)];
_trg setTriggerArea [20, 20, 0, false];
_trg setTriggerActivation [_act, "PRESENT", true];
_trg setTriggerTimeout [5, 5, 5, true];
waitUntil { sleep 5; triggerActivated _trg };
// modify the trigger to detect no presence for 2 seconds within 10m
_trg = createTrigger ["EmptyDetector", O_POS(_obj)];
_trg setTriggerArea [10, 10, 0, false];
_trg setTriggerActivation [_act, "NOT PRESENT", true];
_trg setTriggerTimeout [2, 2, 2, true];
sleep 2;
waitUntil { sleep 2; triggerActivated _trg };
// deactivate the trigger and perform the callback
_trg setTriggerStatements ["false", "", ""];
_obj spawn _CB;/*
Author: Will Hart
Description:
Sets up the mission, defining the objectives and a few required variables.
Parameter(s):
None
Example:
_nul = [] execVM "framework\framework_init.sqf";
Returns:
Nothing
*/
#include "defines.sqf"
/*
* Set up the objectives. The format of each line is:
* [id, description, marker name, radius, infantry_strength, vehicle_strength, armour_strength, air_strength, troop_strength, new spawn point?, ammo spawn point marker, special weapons spawn marker,pre-requisites, mission type, reward description]
*/
objective_list = [
[ 0, "Therisa", "afw_obj_0", 50, 2, 0, 0, 0, 1, FALSE, "afw_ammo_0", "", [AFW_NONE], 8, "Ammo Found!", TRUE, [], []],
[ 1, "Zaros", "afw_obj_1", 50, 2, 0, 0, 0, 1, FALSE, "afw_ammo_1", "", [AFW_NONE], 8, "Bullets! Get Em!", TRUE, [], []],
[ 2, "Agios Dionysios", "afw_obj_2", 50, 2, 0, 0, 0, 1, FALSE, "afw_ammo_2", "", [AFW_NONE], 8, "Guns! We Need Em!", TRUE, [], []],
[ 3, "Neochori", "afw_obj_3", 50, 2, 0, 0, 0, 1, FALSE, "afw_ammo_3", "", [AFW_NONE], 8, "Gun Galore!", TRUE, [], []],
[ 4, "Lakka", "afw_obj_4", 50, 2, 0, 0, 0, 1, TRUE, "afw_ammo_4", "", [AFW_NONE], 8, "Supplies!", TRUE, [], []],
[ 5, "Goverment Base", "afw_obj_5", 25, 2, 0, 0, 0, 1, FALSE, "afw_ammo_5", "", [AFW_NONE], 1, "Ammo Found!", TRUE, [], []]
];
publicVariable 'objective_list';
enemyTeam = EAST;
publicVariable "enemyTeam";
friendlyTeam = INDEPENDENT;
publicVariable "friendlyTeam";
deleteTasks = 1;
publicVariable "deleteTasks";
// Set up some macros to make life a bit easier.
// The idea for these macros was borrowed from Aerson's group_manager script
// http://forums.bistudio.com/showthread.php?163206-Group-Manager
#define EL(A,B) ((A) select (B))
#define THIS(A) EL(this,A)
#define _THIS(A) EL(_this,A)
#define APPEND(A, B) A set [count A, B]
// define some constants
#define AFW_NONE -1
#define AFW_MISSIONTYPES ["Capture", "Gather intel in", "Assassinate officer in", "Destroy tower in", "Destroy AA in", "Clear enemy from", "Destroy ammo cache in", "Destroy crashed UAV in", "Gather Crash Site Intel in", "Destroy Crashed Helo in", "Move through", "Move to"]
// easy element accessors
#define O_ID(A) EL(A, 0)
#define O_DESCRIBE(A) EL(A, 1)
#define O_MARKER(A) EL(A, 2)
#define O_R(A) EL(A, 3)
#define O_INF(A) EL(A, 4)
#define O_VEH(A) EL(A, 5)
#define O_ARM(A) EL(A, 6)
#define O_AIR(A) EL(A, 7)
#define O_STR(A) EL(A, 8)
#define O_SPAWN(A) EL(A, 9)
#define O_AMMO(A) EL(A, 10)
#define O_SPECIAL(A) EL(A, 11)
#define O_PREREQ(A) EL(A, 12)
#define O_MISSIONTYPE(A) EL(A, 13)
#define O_REWARDS(A) EL(A, 14)
#define O_RANDOMISE(A) EL(A, 15)
#define O_LPREREQ(A) EL(A, 16)
#define O_PAYLOAD(A) EL(A, 17)
// some shortcut functions for objectives
#define O_MISSIONTYPE_DESC(A) AFW_MISSIONTYPES select (O_MISSIONTYPE(A))
#define O_X(A) (O_POS(A) select 0)
#define O_Y(A) (O_POS(A) select 1)
#define O_POS(A) getMarkerPos O_MARKER(A)
#define O_SIZE(A) [ O_R(A), O_R(A) ]
#define O_EOS_NAME(A) format ["obj_%1", O_ID(A)]
#define O_OBJ_NAME(A) format ["objective_%1", O_ID(A)]
#define O_TASK_NAME(A) format ["%1_%2", O_EOS_NAME(A), O_ID(A)]
/*
Author: Will Hart
Description:
ACtivates an vehicle unlockable spawn by showing alll synchronised vehicles
Parameter(s):
_this: OBJECT, the trigger to activate
Example (in activate line of the trigger):
this spawn AFW_fnc_Module_activateVehicleUnlock;
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_trigger"];
// gather some information
_trigger = _this;
[synchronizedObjects _trigger, false] spawn AFW_fnc_globalHide;/*
Author: Will Hart
Description:
Configures an unlockable vehicle respawn, by hiding all the vehicles synchronised to the
given trigger.
Parameter(s):
_this: ARRAY, the list of trigger objects to configure
Example:
[fw_module_1, fw_module_2] spawn AFW_fnc_Module_setupVehicleUnlock;
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_triggers"];
// gather some information
_triggers = _this;
{
{
[synchronizedObjects _x, true] spawn AFW_fnc_globalHide;
}
} forEach _triggers;// Set up some macros to make life a bit easier.
// The idea for these macros was borrowed from Aerson's group_manager script
// http://forums.bistudio.com/showthread.php?163206-Group-Manager
#define EL(A,B) ((A) select (B))
#define THIS(A) EL(this,A)
#define _THIS(A) EL(_this,A)
#define APPEND(A, B) A set [count A, B]
// define some constants
#define AFW_NONE -1
#define AFW_MISSIONTYPES ["Capture", "Gather intel in", "Assassinate officer in", "Destroy tower in", "Destroy AA in", "Clear enemy from", "Destroy ammo cache in", "Destroy crashed UAV in", "Gather Crash Site Intel in", "Destroy Crashed Helo in", "Move through", "Move to"]
// easy element accessors
#define O_ID(A) EL(A, 0)
#define O_DESCRIBE(A) EL(A, 1)
#define O_MARKER(A) EL(A, 2)
#define O_R(A) EL(A, 3)
#define O_INF(A) EL(A, 4)
#define O_VEH(A) EL(A, 5)
#define O_ARM(A) EL(A, 6)
#define O_AIR(A) EL(A, 7)
#define O_STR(A) EL(A, 8)
#define O_SPAWN(A) EL(A, 9)
#define O_AMMO(A) EL(A, 10)
#define O_SPECIAL(A) EL(A, 11)
#define O_PREREQ(A) EL(A, 12)
#define O_MISSIONTYPE(A) EL(A, 13)
#define O_REWARDS(A) EL(A, 14)
#define O_RANDOMISE(A) EL(A, 15)
#define O_LPREREQ(A) EL(A, 16)
#define O_PAYLOAD(A) EL(A, 17)
// some shortcut functions for objectives
#define O_MISSIONTYPE_DESC(A) AFW_MISSIONTYPES select (O_MISSIONTYPE(A))
#define O_X(A) (O_POS(A) select 0)
#define O_Y(A) (O_POS(A) select 1)
#define O_POS(A) getMarkerPos O_MARKER(A)
#define O_SIZE(A) [ O_R(A), O_R(A) ]
#define O_EOS_NAME(A) format ["obj_%1", O_ID(A)]
#define O_OBJ_NAME(A) format ["objective_%1", O_ID(A)]
#define O_TASK_NAME(A) format ["%1_%2", O_EOS_NAME(A), O_ID(A)]
/*
Author: Will Hart
Description:
Called when an objective has been completed, updates the task and global objective state
Parameter(s):
_this: ARRAY, the objective being completed
Example:
objective call AFW_fnc_completeObjective;
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_id", "_task_name", "_str", "_likely", "_ammo_mkr", "_special_mkr"];
_id = O_ID(_this);
_task_name = O_EOS_NAME(_this);
// check if we have already handled completion
if ((_id in completed_objectives) and !(_id in incomplete_objectives)) exitWith {
diag_log " Ignoring attempt to complete an objective which has already been completed";
};
// remove item from incomplete if it is still in there
if (_id in incomplete_objectives) then {
diag_log " Most likely completing a forcibly completed objective";
incomplete_objectives = incomplete_objectives - [_id];
publicVariable "incomplete_objectives";
};
// complete the task
_null = [O_TASK_NAME(_this), "SUCCEEDED", true] spawn BIS_fnc_taskSetState;
// update the marker
O_MARKER(_this) setMarkerType "mil_flag";
O_MARKER(_this) setMarkerColor "ColorGreen";
// deactivate and delete the old marker and EOS spawn area
[[O_EOS_NAME(_this)]] call EOS_Deactivate;
deleteMarker O_EOS_NAME(_this);
// update the completed and current objectives list
if (!(_id in completed_objectives)) then {
APPEND(completed_objectives, _id);
publicVariable "completed_objectives";
};
current_objectives = current_objectives - [_id];
publicVariable "current_objectives";
// enable any new objectives
_id call AFW_fnc_spawnObjectives;
// set the objective completed variable
server setVariable [O_OBJ_NAME(_this), true, true];
// check if we are spawning counterattacks
if (("AFW_RandomCounterAttacks" call BIS_fnc_getParamValue) == 1) then {
_likely = "AFW_CounterAttackLikelihood" call BIS_fnc_getParamValue;
if (_likely > random 100) then {
diag_log "Launching counter attack";
_str = "AFW_CounterAttackStrength" call BIS_fnc_getParamValue;
_nul = [[_task_name],[_str,2],[1,1],[(floor random (_str - 1))],[(floor random (_str - 1)),2],[0,1,enemyTeam],[(floor random 20),1,120,TRUE,FALSE]] call Bastion_Spawn;
} else {
diag_log "No counter attack launched";
};
};
// check if we have a new spawn point here
if (O_SPAWN(_this)) then {
// notify
[
[
"RespawnAdded",
[
"Respawn added",
format ["New respawn at %1", O_DESCRIBE(_this)],
"",
"\A3\ui_f\data\gui\cfg\Hints\tactical_view_ca.paa"
]
],
"bis_fnc_showNotification"
] spawn BIS_fnc_MP;
// create a new respawn position
[WEST, O_POS(_this)] call BIS_fnc_addRespawnPosition;
};
// check if we want to add a new ammo box here
_ammo_mkr = O_AMMO(_this);
if (_ammo_mkr != "") then {
// place the ammobox
[_ammo_mkr, "AFW_fnc_spawnAmmo", nil, true ] spawn BIS_fnc_MP;
[
[
"ArmoryGearAdded",
[
format ["Ammo spawned at %1", O_DESCRIBE(_this)],
"",
"\A3\ui_f\data\gui\cfg\Hints\ammotype_ca.paa"
]
],
"bis_fnc_showNotification"
] spawn BIS_fnc_MP;
};
// check if we want to add a special weapons box
_special_mkr = O_SPECIAL(_this);
if (_special_mkr != "") then {
[_special_mkr, "AFW_fnc_spawnSpecialWeapon", nil, true ] spawn BIS_fnc_MP;
[
[
"ArmoryGearAdded",
[
format ["Special weapons at %1", O_DESCRIBE(_this)],
"",
"\A3\ui_f\data\gui\cfg\Hints\ammotype_ca.paa"
]
],
"bis_fnc_showNotification"
] spawn BIS_fnc_MP;
};
// delete the task after a 30 second delay
if (deleteTasks == 1) then {
sleep 30;
[
[
O_TASK_NAME(_this),
friendlyTeam],
"BIS_fnc_deleteTask",
nil,
true
] spawn BIS_fnc_MP;
};
// check if we have completed all objectives
if (count completed_objectives == count objective_list) then {
[
["TaskSucceeded", ["", "All objectives completed"]],
"bis_fnc_showNotification"
] spawn BIS_fnc_MP;
all_objectives_complete = true;
publicVariable 'all_objectives_complete';
};
/*
Author: Will Hart
Description:
Performs an EOS spawn of enemy troops based on the objective description
Parameter(s):
_this select 0: ARRAY, the objective being completed
_this select 1: FUNCTION, the function to call when the EOS objective is complete
Example:
[objective, AFW_fnc_NOP] call AFW_fnc_doEosSpawn;
Returns:
Nothing
*/
#include "defines.sqf"
private ['_obj', '_callback', '_patrol_str', '_inf_str', '_all_inf_str', '_x'];
_obj = _THIS(0);
_callback = _THIS(1);
// only spawn EOS if the objective is incomplete
if (!(O_ID(_obj) in completed_objectives)) then {
_str = "AFW_EnemyStrength" call BIS_fnc_getParamValue;
// Place each unit in either patrols or occupying forces
_all_inf_str = O_INF(_obj) * _str;
_patrol_str = 0;
_inf_str = 0;
for "_x" from 1 to _all_inf_str do {
if (floor random 2 == 0) then {
_patrol_str = _patrol_str + 1;
} else {
_inf_str = _inf_str + 1;
};
};
// set up the EOS zone
_nul = [[O_EOS_NAME(_obj)],
[_inf_str , O_STR(_obj), 100], //House Groups, Size of groups, Probability
[_patrol_str , O_STR(_obj), 100], //Patrol Groups, Size of groups, Probability
[O_VEH(_obj), O_STR(_obj), 90], //Light Vehicles, Size of Cargo, Probability
[O_ARM(_obj), 70], //Armoured Vehicles, Probability
[O_VEH(_obj), 50], //Static Vehicles, Probability
[O_AIR(_obj), 0, 80], //Helicopters, Size of Cargo, Probability
[0, 1, 1000, enemyTeam, FALSE, FALSE, [_obj, _callback]]] call EOS_Spawn;
//Faction, Markertype, Distance, Side, HeightLimit, Debug
} else {
// otherwise just complete the objective
diag_log "Manually calling objective victory function";
_obj call _callback;
};/*
Author: Will Hart
Description:
Loads in a given objective state (i.e. active and completed objectives). This allows
a mission to be restarted from a previously saved point. It does not save weapons, and
it also doesn't sense check the objectives so they can potentially be completed out of
order. This function should usually be restricted to admins and MUST be called using `spawn`
Parameter(s):
_this: ARRAY, a list of objective IDs which should be considered complete
Example:
[0, 1, 2] spawn AFW_fnc_doSetObjectiveState;
Returns:
Nothing
*/
#include "defines.sqf"
//if (!isServer) exitWith {};
private ["_obj", "_mkr_name"];
diag_log "--------------------------------------------";
diag_log " Loading mission states via console:";
diag_log "--------------------------------------------";
diag_log "Passed missions: ";
diag_log _this;
{
// don't start a mission which has already been started
if (_x in incomplete_objectives) then {
// stop EOS from being spawned
APPEND(completed_objectives, _x);
waitUntil {sleep 0.5; _x in completed_objectives;};
_obj = objective_list select _x;
_mkr_name = format ["obj_%1", O_ID(_obj)];
diag_log format [" - Processing objective %1", O_ID(_obj)];
// start the objective, it should autocomplete as the ID is already in completed_objectives
if (!(_x in current_objectives)) then {
_obj spawn AFW_fnc_startObjective;
diag_log " Forcibly started mission";
};
};
} forEach _this;
sleep 2;
diag_log "--------------------------------------------";/*
Author: Will Hart
Description:
Returns a list of the currently completed objectives. Can be used in conjunction with
AFW_fnc_setObjectiveState to restart the mission at a specific point in time.
Parameter(s):
None
Example:
objectives = [] call AFW_fnc_getObjectiveState;
([] call AFW_fnc_getObjectiveState) call AFW_fnc_setObjectiveState;
Returns:
A list of completed objectives equivalent to the public variable `completed_objectives`.
*/
#include "defines.sqf"
completed_objectives/*
Author: Will Hart
Description:
Loads in a given objective state (i.e. active and completed objectives). This allows
a mission to be restarted from a previously saved point. It does not save weapons, and
it also doesn't sense check the objectives so they can potentially be completed out of
order. This function should usually be restricted to admins.
Parameter(s):
_this: ARRAY, a list of objective IDs which should be considered complete
Example:
[0, 1, 2] call AFW_fnc_setObjectiveState;
Returns:
Nothing
*/
#include "defines.sqf"
if (serverCommandAvailable "#kick") then {
[_this, "AFW_fnc_doSetObjectiveState", false] spawn BIS_fnc_MP;
} else {
diag_log format ["Player '%1' attempted to execute AFW_fnc_setObjectiveState but does not have permission", name player];
};/*
Author: Will Hart
Description:
Starts all objectives which require the given mission ID as a prerequisite. Is automatically
called when the give mission ID has just been completed.
Parameter(s):
_this: INTEGER, the Id of the mission that was just completed
Example:
_id call AFW_fnc_spawnObjectives;
3 call AFW_fnc_spawnObjectives;
Returns:
Nothing
*/
#include "defines.sqf"
private ["_obj", "_unlock", "_oid", "_pre", "_preGroup", "_all"];
if (!isServer) exitWith {};
{
_obj = _x;
_oid = O_ID(_obj);
if (_oid in completed_objectives or _oid in current_objectives) then {
// already complete, ignore
} else {
// not complete yet, check prerequisites of the objective
_pre = O_PREREQ(_x);
_unlock = false;
{
scopeName "objectiveLoop";
_preGroup = _x;
if (typeName _preGroup == "SCALAR") then {
if (_this == _preGroup) then { // handle scalar "or"
_unlock = true;
};
};
if (typeName _preGroup == "ARRAY") then { // handle "and" objective types, all elements in an array must be complete
_all = true;
{
scopeName "arrayLoop";
if (!(_x in completed_objectives)) then {
_all = false;
breakOut "arrayLoop";
};
} forEach _preGroup;
_unlock = _all;
};
// unlock if true
if (_unlock) then {
_obj call AFW_fnc_startObjective;
current_objectives set [count current_objectives, _oid];
incomplete_objectives = incomplete_objectives - [_oid];
publicVariable "current_objectives";
sleep 2;
diag_log format ["Created objective %1", _oid];
breakOut "objectiveLoop";
};
} forEach _pre;
};
} forEach objective_list;
publicVariable "incomplete_objectives";/*
Author: Will Hart
Description:
Commences an objective, creating the marker, setting up the enemy spawn and creating the user task.
If the objective is already in the completed list then EOS won't be spawned
Parameter(s):
_this: ARRAY, the objective (from objective_list) being started
or
_obj: ARRAY, contains objective details
_spawnEOS: BOOL, set flag to FALSE if EOS shoud NOT be spawned
Example:
(objective_list select 0) call AFW_fnc_startObjective; // standard with EOS spawn
[(objective_list select 0), false] call AFW_fnc_startObjective; // without involving EOS
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_mkr", "_task_name", "_desc", "_miss_type", "_obj", "_obj_title", "_obj_description", "_fns"];
// gather some information - allow for missions to be completed without involving EOS by pasing a second parameter "false"
_obj = if (count _this == 2) then { _THIS(0) } else { _this };
_spawnEOS = if (count _this == 2) then { _THIS(1) } else { true };
_task_name = O_EOS_NAME(_obj);
_desc = O_DESCRIBE(_obj);
_miss_type = O_MISSIONTYPE_DESC(_obj);
_obj_title = format ["%1 %2", _miss_type, _desc];
_obj_description = format ["%1. %2 (#%3)", _obj_title, O_REWARDS(_obj), O_ID(_obj)];
// create and format the marker
_mkr = createMarker [_task_name, O_POS(_obj)];
_mkr setMarkerSize O_SIZE(_obj);
// DEBUG:
_mkr setMarkerShape "ELLIPSE";
_mkr setMarkerColor "ColorRed";
_mkr setMarkerAlpha 0.5;
_mkr setMarkerText _obj_title;
// Set up the existing marker
O_MARKER(_obj) setMarkerText O_DESCRIBE(_obj);
O_MARKER(_obj) setMarkerType "mil_flag";
O_MARKER(_obj) setMarkerColor "ColorRed";
// add to the current player objectives
_null = [WEST, O_TASK_NAME(_obj), [_obj_description, _obj_title, _miss_type], getMarkerPos O_MARKER(_obj)] spawn BIS_fnc_taskCreate;
// check if we are spawning EOS and the objective is not complete
if (_spawnEOS) then {
// start the mission based on the specified type
// first item is setup, second item is EOS callback, third item is general callback
_fns = EL(mission_types, O_MISSIONTYPE(_obj));
[_obj, EL(_fns, 1), EL(_fns, 2)] spawn EL(_fns, 0);
} else {
diag_log " _spawnEOS set to false - EOS not being initialised";
};// Set up some macros to make life a bit easier.
// The idea for these macros was borrowed from Aerson's group_manager script
// http://forums.bistudio.com/showthread.php?163206-Group-Manager
#define EL(A,B) ((A) select (B))
#define THIS(A) EL(this,A)
#define _THIS(A) EL(_this,A)
#define APPEND(A, B) A set [count A, B]
// define some constants
#define AFW_NONE -1
#define AFW_MISSIONTYPES ["Capture", "Gather intel in", "Assassinate officer in", "Destroy tower in", "Destroy AA in", "Clear enemy from", "Destroy ammo cache in", "Destroy crashed UAV in", "Gather Crash Site Intel in", "Destroy Crashed Helo in", "Move through", "Move to"]
// easy element accessors
#define O_ID(A) EL(A, 0)
#define O_DESCRIBE(A) EL(A, 1)
#define O_MARKER(A) EL(A, 2)
#define O_R(A) EL(A, 3)
#define O_INF(A) EL(A, 4)
#define O_VEH(A) EL(A, 5)
#define O_ARM(A) EL(A, 6)
#define O_AIR(A) EL(A, 7)
#define O_STR(A) EL(A, 8)
#define O_SPAWN(A) EL(A, 9)
#define O_AMMO(A) EL(A, 10)
#define O_SPECIAL(A) EL(A, 11)
#define O_PREREQ(A) EL(A, 12)
#define O_MISSIONTYPE(A) EL(A, 13)
#define O_REWARDS(A) EL(A, 14)
#define O_RANDOMISE(A) EL(A, 15)
#define O_LPREREQ(A) EL(A, 16)
#define O_PAYLOAD(A) EL(A, 17)
// some shortcut functions for objectives
#define O_MISSIONTYPE_DESC(A) AFW_MISSIONTYPES select (O_MISSIONTYPE(A))
#define O_X(A) (O_POS(A) select 0)
#define O_Y(A) (O_POS(A) select 1)
#define O_POS(A) getMarkerPos O_MARKER(A)
#define O_SIZE(A) [ O_R(A), O_R(A) ]
#define O_EOS_NAME(A) format ["obj_%1", O_ID(A)]
#define O_OBJ_NAME(A) format ["objective_%1", O_ID(A)]
#define O_TASK_NAME(A) format ["%1_%2", O_EOS_NAME(A), O_ID(A)]
/*
Author: Will Hart
Description:
Creates an empty ammo crate and returns a handle to the caller. Returns the ammobox variable
but also sets the variable "AFW_last_user_ammobox".
Parameter(s):
_this select 0: ARRAY, the position to place the ammobox near to (a safe nearby position will be found)
_this select 1: INT, the radius within which the ammobox should be created
Example:
ammo = [position player, 10] call AFW_fnc_createAmmobox;
ammo = [position player, 10, "Box_East_AmmoOrd_F"] call AFW_fnc_createAmmobox;
Returns:
A handle to the ammobox so you can fill it up with goodies
*/
private ["_pos", "_safePos", "_radius", "_crate", "_ammoboxType"];
_pos = _this select 0;
_radius = _this select 1;
_ammoboxType = if (count _this > 2) then { _this select 2 } else { "I_SupplyCrate_F" };
// find a safe position and drop the ammobox
_safePos = _pos findEmptyPosition [0, _radius, _ammoboxType];
_crate = _ammoboxType createVehicle _safePos;
// clear the ammobox
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
// save the handle
AFW_last_user_ammobox = _crate;
publicVariable "AFW_last_user_ammobox";
// return the crate handle
_crate/*
Author: Will Hart
Description:
Finds a random spawn position suitable for the given object within the objective radius
Parameter(s):
_this select 0: ARRAY, The objective to find a spawn point for
_this select 1: STRING, The type of object to find a spawn point for
Example:
pos = [_obj, "B_Officer_F"] call AFW_fnc_getRandomSpawnPosition;
Returns:
A position to spawn the object at or the initial position if none can be found
*/
private ["_obj", "_safePos", "_radius", "_initial", "_temp", "_object", "_count"];
#include "defines.sqf"
_obj = _this select 0;
_object = _this select 1;
_radius = O_R(_obj);
_initial = O_POS(_obj);
_safePos = [];
_count = 0;
if (O_RANDOMISE(_obj)) then {
while {format ["%1", _safePos] == "[]" and _count < 10} do {
// find a random safe position
_temp = [_initial, random 360, _radius, false, 1] call SHK_pos;
_safePos = _temp findEmptyPosition [0, _radius, _object];
_count = _count + 1;
};
if (format ["%1", _safePos] == "[]") then {
_safePos = _initial;
};
} else {
_safePos = _initial;
};
// return the crate handle
_safePos/*
Author: Will Hart
Description:
Spawns, despawns and manages random patrols moving throughout the AO. The number of patrols
(if any) can be controlled through mission paramters. Updates the patrol state every 180 seconds
Parameter(s):
None
Example:
_nul = [] spawn AFW_fnc_manageRandomPatrols;
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_patrol_count", "_patrols", "_new_patrols", "_destinations", "_sources", "_grp", "_pos", "_patrol", "_markers", "_mkr_name", "_ldr", "_mkr", "_num_patrols", "_debug", "_wp", "_faction"];
// loop for the whole game, but update infrequently
_patrol_count = "AFW_NumberRandomPatrols" call BIS_fnc_getParamValue;
_patrols = [];
_markers = [];
_debug = false; // change to false for production
waitUntil { sleep 2; (count objective_list) > 0 };
// determine which units to spawn
if (enemyTeam == WEST) then {
_faction = 1;
} else {
if (enemyTeam == EAST) then {
_faction = 0;
} else {
_faction = 2;
};
};
while {true} do {
diag_log "Updating random patrols";
// start by checking if we have any patrols that can be removed
_new_patrols = [];
{
if (({alive _x} count units _x) == 0) then {
deleteGroup _x;
diag_log "Removing destroyed patrol group";
} else {
_new_patrols set [count _new_patrols, _x];
};
} forEach _patrols;
_patrols = _new_patrols;
if (_debug) then {
// update all the markers
{
deleteMarker _x;
} forEach _markers;
_markers = [];
// create a marker for each group
_i = 0;
{
_mkr_name = format ["patrol_%1", _i];
APPEND(_markers, _mkr_name);
_ldr = leader _x;
if (typeOf _ldr != typeOf objNull) then {
_mkr = createMarker [_mkr_name, getPos leader _x];
_mkr setMarkerShape "ELLIPSE";
_mkr setMarkerColor "ColorBlack";
_mkr setMarkerSize [50, 50];
_mkr setMarkerAlpha 1.0;
};
_i = _i + 1;
} forEach _patrols;
};
// check if we need to spawn a new patrol
_num_patrols = count _patrols;
diag_log format ["There are %1 patrols active on the map", _num_patrols];
if (_num_patrols < _patrol_count and (count incomplete_objectives) > 0 ) then {
diag_log format ["Adding an additional patrol on %1 side", enemyTeam];
// find all the incomplete or current objectives and select a random destination
_sources = current_objectives + incomplete_objectives;
_destinations = current_objectives + completed_objectives;
if (count _sources == 0) then {
diag_log "Unable to spawn any patrols - no source objectives available";
} else {
if (count _destinations == 0) then {
diag_log "Unable to spawn any patrols - no destination objectives available";
} else {
_src = objective_list select (_sources call BIS_fnc_selectRandom);
_dst = objective_list select (_destinations call BIS_fnc_selectRandom);
_pos = [O_POS(_src), random 360, 50, true, 1] call SHK_pos;
// get a random destination point
if (isNil "_dst") then {
diag_log "Ignoring attempt to patrol to empty destination";
} else {
diag_log format ["Creating patrol from objective %1 to objective %2", _src, _dst];
if (_debug) then {
// create a marker at the source
_mkr_name = format ["patrol_%1", _num_patrols];
_mkr = createMarker [_mkr_name, _pos];
APPEND(_markers, _mkr_name);
_mkr setMarkerShape "ELLIPSE";
_mkr setMarkerColor "ColorBlack";
_mkr setMarkerSize [20, 20];
_mkr setMarkerAlpha 1.0;
diag_log " -> created source marker";
};
// spawn a group and set it on the patrol route. When it gets to the end it will cycle
_patrol = [_pos, [floor random 3, 3], _faction, enemyTeam] call EOS_fnc_spawngroup;
diag_log " -> created patrol";
//diag_log " -> set patrol waypoints";
_wp = _patrol addWaypoint [O_POS(_dst), 0];
_wp setWaypointStatements ["true", "[group this] spawn AFW_fnc_setPatrolDestination;"];
// add the patrol to the list of patrols
APPEND(_patrols, _patrol);
};
};
};
};
diag_log "Done spawning random patrols";
if (_debug) then {
for [{_i=0}, {_i<20}, {_i=_i+1}] do
{
sleep 15;
_i = 0;
{
_mkr_name = format ["patrol_%1", _i];
_ldr = leader _x;
_mkr_name setMarkerPos (getPos _ldr);
_i = _i + 1;
} forEach _patrols;
};
} else {
sleep 300;
};
};/*
Author: Will Hart
Description:
Creates an ammo crate and populates it with the given objects. Supplied objects may be the
string class name, or an array containing [class name, quantity]. See the example. Provide an
empty array for no items.
Parameter(s):
_this select 0: ARRAY, the position to place the ammobox near to (a safe nearby position will be found)
_this select 1: INT, the radius within which the ammobox should be created
_this select 2: ARRAY, the items to add
_this select 3: ARRAY, the weapons to add
_this select 4: ARRAY, the magazines to add
Example:
ammobox = [position player, 10, ["Medikit", ["FirstAidKit", 10]], [], ["30Rnd_65x39_caseless_mag"]] call AFW_fnc_populateAmmobox;
Returns:
A handle to the ammobox so you can fill it up with goodies
*/
if (!isServer) exitWith {};
private ["_pos", "_safePos", "_radius", "_handle", "_items", "_weapons", "_magazines", "_ammoboxType"];
_pos = _this select 0;
_radius = _this select 1;
_items = _this select 2;
_weapons = _this select 3;
_magazines = _this select 4;
_ammoboxType = if (count _this > 5) then { _this select 5 } else { "I_SupplyCrate_F" };
// find a safe position and drop the ammobox
_handle = [_pos, _radius, _ammoboxType] call AFW_fnc_createAmmobox;
{
if (typeName _x == "STRING") then {
_x = [_x, 1];
};
_handle addItemCargoGlobal _x;
} forEach _items;
{
if (typeName _x == "STRING") then {
_x = [_x, 1];
};
_handle addWeaponCargoGlobal _x;
} forEach _weapons;
{
if (typeName _x == "STRING") then {
_x = [_x, 1];
};
_handle addMagazineCargoGlobal _x;
} forEach _magazines;
_handle/*
Author: Will Hart
Description:
Set a new spawn destination for the given patrol group
Parameter(s):
_this select 0 - the group to create a new waypoint for
Example:
_nul = [_group] spawn AFW_fnc_setPatrolDestination;
Returns:
Nothing
*/
#include "defines.sqf"
if (!isServer) exitWith {};
private ["_group", "_wp", "_dst", "_pos"];
_group = _this;
_dst = (current_objectives call BIS_fnc_selectRandom);
_wp = _group addWaypoint [O_POS(_dst), 0];
_wp setWaypointStatements ["true", "[group this] spawn AFW_fnc_setPatrolDestination;"];
diag_log format ["Patrol reached destination. Moved on to %1", O_POS(_dst)];/*
Author: Will Hart
Description:
Spawns an ammo box reward at the given marker. The ammobox refreshes every 10 minutes
Parameter(s):
_this select 0: STRING, the name of the marker where the ammo box should be created
Example:
"ammo_marker_0" call AFW_fnc_spawnAmmo;
Returns:
Nothing
*/
#include "defines.sqf"
// execute only on clients
if (isDedicated) exitWith {
false
};
// Creates and refreshes a custom ammo crate
private ["_pos", "_crate", "_safePos"];
_pos = getMarkerPos _this;
// set up the marker
_this setMarkerType "n_support";
// find a safe position
_safePos = _pos findEmptyPosition [0,10,"I_SupplyCrate_F"];
// update the marker to a safe position
if (count _safePos > 0) then {
_pos = _safePos;
_this setMarkerPos _pos;
};
// create and place an ammobox
_crate = "I_supplyCrate_F" createVehicleLocal _pos;
_crate setVariable ["BTC_cannot_lift", 1, true];
_crate setVariable ["BTC_cannot_drag", 1, true];
_crate setVariable ["BTC_cannot_load", 1, true];
diag_log format ["Spawned ammo crate at safe pos %1 for %2", _pos, getMarkerPos _this];
while {alive _crate} do {
// remove existing
clearMagazineCargo _crate;
clearWeaponCargo _crate;
clearItemCargo _crate;
clearBackpackCargo _crate;
// add new magazines
_crate addMagazineCargo ["30Rnd_65x39_caseless_mag", 20];
_crate addMagazineCargo ["30Rnd_65x39_caseless_mag_Tracer", 20];
_crate addMagazineCargo ["9Rnd_45ACP_Mag", 10];
_crate addMagazineCargo ["1Rnd_HE_Grenade_shell", 20];
_crate addMagazineCargo ["200Rnd_65x39_cased_Box", 10];
_crate addMagazineCargo ["200Rnd_65x39_cased_Box_Tracer", 10];
_crate addMagazineCargo ["100Rnd_65x39_caseless_mag", 10];
_crate addMagazineCargo ["100Rnd_65x39_caseless_mag_Tracer", 10];
// add some grenades
_crate addMagazineCargo ["SmokeShell", 10];
_crate addMagazineCargo ["SmokeShellRed", 10];
_crate addMagazineCargo ["SmokeShellGreen", 10];
_crate addMagazineCargo ["HandGrenade", 10];
// add some rockets
_crate addWeaponCargo ["launch_NLAW_F", 2];
_crate addWeaponCargo ["launch_B_Titan_F", 2];
_crate addWeaponCargo ["launch_B_Titan_short_F", 2];
_crate addMagazineCargo ["Titan_AT", 10];
_crate addMagazineCargo ["Titan_AA", 10];
_crate addMagazineCargo ["NLAW_F", 10];
// add some explosives
_crate addMagazineCargo ["DemoCharge_Remote_Mag", 5];
// add first aid kits
_crate addItemCargo ["FirstAidKit", 10];
// add binos etc
_crate addItemCargo ["Binocular", 5];
_crate addItemCargo ["Rangefinder", 5];
// add backpacks
_crate addBackpackCargo ["B_AssaultPack_khk", 5];
// wait
sleep 600;
diag_log format["Refreshing ammo crate at %1", _pos];
};
/*
Author: Will Hart
Description:
Spawns a special weapon rewar at the given marker. Available special weapons are defined in the `support_weapons`
variable set in the `framework_init.sqf`
Parameter(s):
_this: STRING, the name of the marker where the special weapon spawn should be created
Example:
"special_marker_0" call AFW_fnc_spawnSpecialWeapon;
Returns:
Nothing
*/
#include "defines.sqf"
// execute only on server
if (!isServer) exitWith {
false
};
private ['_weapons', '_marker', '_crate', '_pos', '_safePos'];
_pos = getMarkerPos _this;
// set up the marker
_this setMarkerType "n_support";
// find a safe position
_safePos = _pos findEmptyPosition [0,10,"I_SupplyCrate_F"];
// update the marker to a safe position
if (count _safePos > 0) then {
_pos = _safePos;
_this setMarkerPos _pos;
};
// select a reward
_weapons = support_weapons select floor random count support_weapons;
// create a crate
_crate = "B_supplyCrate_F" createVehicle _pos;
_crate setVariable ["BTC_cannot_lift",1,true];
_crate setVariable ["BTC_cannot_drag",1,true];
_crate setVariable ["BTC_cannot_load",1,true];
// remove existing
clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
// fill the crate
{
_crate addBackpackCargoGlobal [_x, 2];
} forEach _weapons;
diag_log format ["Spawned special weapon %1 at safe pos %2 for %3", _weapons, _pos, getMarkerPos _this]; waitUntil { !isNil {player} };
waitUntil { player == player };
waitUntil {!isNil "bis_fnc_init"};
_civ_clothes = ["U_C_Commoner1_1",
"U_C_Commoner1_2",
"U_C_Commoner1_3",
"U_C_Poloshirt_blue",
"U_C_Poloshirt_burgundy",
"U_C_Poloshirt_redwhite",
"U_C_Poloshirt_salmon",
"U_C_Poloshirt_stripped",
"U_C_Poloshirt_tricolour"];
_civ_hats = ["H_Cap_red", "H_Cap_blu", "H_Cap_brn_SERO"];
_vests = ["V_Rangemaster_belt",
"V_TacVest_brn",
"V_BandollierB_cbr"];
_unit = _this select 0;
// Remove original equipment
removeUniform _unit;
removeHeadgear _unit;
removeVest _unit;
removeBackpack _unit;
// Add vest and clothing
_vest_item = _vests call BIS_fnc_selectRandom;
_unit addVest _vest_item;
_cloth_item = _civ_clothes call BIS_fnc_selectRandom;
_unit addUniform _cloth_item;
// Random integer, if 1 instead of 0, add a random item from the array
if(round (random 1) == 1) then
{
_hat_item = _civ_hats call BIS_fnc_selectRandom;
_unit addHeadgear _hat_item;
};
// Random weapon loadout
switch (round(random 3)) do
{
case 0:
{
_unit addMagazines ["30Rnd_65x39_caseless_green", 5];
_unit addWeapon "arifle_Khaybar_F";
};
case 1:
{
_unit addMagazines ["30Rnd_556x45_Stanag", 5];
_unit addWeapon "arifle_TRG20_F";
};
case 2:
{
_unit addMagazines ["30Rnd_556x45_Stanag", 3];
_unit addWeapon "arifle_Mk20_plain_F";
};
case 3:
{
_unit addMagazines ["30Rnd_556x45_Stanag", 5];
_unit addWeapon "arifle_TRG20_ACO_F";
};
};
_unit addMagazine "HandGrenade";#define addf(fname) class fname {headerType = -1;}
createShortcuts = 1;
class cws_ais {
tag = "cws";
class ais {
file = "cws_injury\func";
addf(handleDamage);
addf(keyUnbind);
addf(firstAid);
addf(isHealable);
addf(progressBar);
addf(isMedic);
addf(drag);
addf(carry);
addf(drop);
addf(injuredEffects);
addf(progressBarInit);
addf(sendAIHealer);
addf(delbody);
addf(quote);
addf(deadcam);
addf(lookingForWoundedMates);
addf(checklauncher);
addf(showMessage);
addf(setUnitDamage);
addf(getUnitDamage);
addf(cleanUpActions);
addf(handleHeal);
addf(handleKeys);
addf(setupActions);
addf(setupUnitVariables);
};
};cws_ais_revive_guaranty = true; // set to true for a 100% revive chance. False, and the unit can die immediately
cws_ais_rambofactor = 3; // a higher value means more damage tolerance for the unit before the unit are unconcious ( 1== low, 2 == normal, 3 == higher, 5 == extreme)
cws_ais_random_lifetime_factor = 240; // a higher value means you got more time to heal the unit before bleeding out and die
// the time depends on the damage the unit takes before they are unconcious. The time is randomized and not exact.
cws_ais_show_injury_marker = 1; // Set value to 1 and a marker show injured units on the map. 0 means this feature is disabled.
cws_ais_show_injury_message = 1; // Set value to 1 and a message in side chat will show when a unit is injured. 0 means this feature is disabled.
cws_ais_show_3d_icons = 1; // Set value to 1 and a 3D-icon show you ingame the position of injured units within a range of 30 metres (default). 0 means this feature is disabled.
cws_ais_3d_icon_range = 100; // Max range for the 3D icons, if enabled
cws_ais_dead_dialog = 1; // Set value to 1 to enable the deadcam and the dead dialog. 0 means this feature is disabled.
cws_ais_delTime = 30; // Time in seconds until dead bodys are deleted. If zero seconds are select this feature is disabled. (only units with CWS loaded will be deleted)
cws_ais_firstaid_distance = 2; // Maximum distance between the healer and the injured to do first aid
cws_ais_allow_self_revive = true; // Enable if you want to allow the medic to self-revive using first aid while down. Key combo is Ctrl+E
cws_ais_damage_limit = 0.9; // Maximum damage a unit can have when healthy or during agony beginning delay
cws_ais_killcam_quotes = [
[(localize "STR_QUOTE_1"),(localize "STR_AUTHOR_1")],
[(localize "STR_QUOTE_2"),(localize "STR_AUTHOR_2")],
[(localize "STR_QUOTE_3"),(localize "STR_AUTHOR_3")],
[(localize "STR_QUOTE_4"),(localize "STR_AUTHOR_4")],
[(localize "STR_QUOTE_5"),(localize "STR_AUTHOR_5")],
[(localize "STR_QUOTE_6"),(localize "STR_AUTHOR_6")],
[(localize "STR_QUOTE_7"),(localize "STR_AUTHOR_7")],
[(localize "STR_QUOTE_8"),(localize "STR_AUTHOR_8")],
[(localize "STR_QUOTE_9"),(localize "STR_AUTHOR_9")],
[(localize "STR_QUOTE_10"),(localize "STR_AUTHOR_10")],
[(localize "STR_QUOTE_11"),(localize "STR_AUTHOR_11")],
[(localize "STR_QUOTE_12"),(localize "STR_AUTHOR_12")],
[(localize "STR_QUOTE_13"),(localize "STR_AUTHOR_13")],
[(localize "STR_QUOTE_14"),(localize "STR_AUTHOR_14")],
[(localize "STR_QUOTE_15"),(localize "STR_AUTHOR_15")],
[(localize "STR_QUOTE_16"),(localize "STR_AUTHOR_16")],
[(localize "STR_QUOTE_17"),(localize "STR_AUTHOR_17")],
[(localize "STR_QUOTE_18"),(localize "STR_AUTHOR_18")],
[(localize "STR_QUOTE_19"),(localize "STR_AUTHOR_19")],
[(localize "STR_QUOTE_20"),(localize "STR_AUTHOR_20")],
[(localize "STR_QUOTE_21"),(localize "STR_AUTHOR_21")],
[(localize "STR_QUOTE_22"),(localize "STR_AUTHOR_22")],
[(localize "STR_QUOTE_23"),(localize "STR_AUTHOR_23")],
[(localize "STR_QUOTE_24"),(localize "STR_AUTHOR_24")],
[(localize "STR_QUOTE_25"),(localize "STR_AUTHOR_25")],
[(localize "STR_QUOTE_26"),(localize "STR_AUTHOR_26")],
[(localize "STR_QUOTE_27"),(localize "STR_AUTHOR_27")],
[(localize "STR_QUOTE_28"),(localize "STR_AUTHOR_28")],
[(localize "STR_QUOTE_29"),(localize "STR_AUTHOR_29")],
[(localize "STR_QUOTE_30"),(localize "STR_AUTHOR_30")],
[(localize "STR_QUOTE_31"),(localize "STR_AUTHOR_31")],
[(localize "STR_QUOTE_32"),(localize "STR_AUTHOR_32")],
[(localize "STR_QUOTE_33"),(localize "STR_AUTHOR_33")],
[(localize "STR_QUOTE_34"),(localize "STR_AUTHOR_34")],
[(localize "STR_QUOTE_35"),(localize "STR_AUTHOR_35")],
[(localize "STR_QUOTE_36"),(localize "STR_AUTHOR_36")],
[(localize "STR_QUOTE_37"),(localize "STR_AUTHOR_37")],
[(localize "STR_QUOTE_38"),(localize "STR_AUTHOR_38")],
[(localize "STR_QUOTE_39"),(localize "STR_AUTHOR_39")],
[(localize "STR_QUOTE_40"),(localize "STR_AUTHOR_40")],
[(localize "STR_QUOTE_41"),(localize "STR_AUTHOR_41")],
[(localize "STR_QUOTE_42"),(localize "STR_AUTHOR_42")],
[(localize "STR_QUOTE_LAST"),(localize "STR_AUTHOR_LAST")]
];
cws_ais_debugging = true;// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
//Load the config file to get basic settings
#include "cws_config.sqf";
//Load CWS on the unit in the first parameter
CWS_Load =
{
_unit = _this select 0;
//Make sure that _unit is valid
if (isNil "_unit") exitWith {};
//If this unit is already loaded then exit
if (!isNil {_unit getVariable "cws_ais_aisInit"}) exitWith {};
_unit setVariable ["cws_ais_aisInit", true];
"cws_ais_start_heal" addPublicVariableEventHandler {
_unit = (_this select 1) select 0;
_healer = (_this select 1) select 1;
_unit setVariable ["healer", _healer, true];
};
"cws_ais_healed" addPublicVariableEventHandler {
_unit = (_this select 1) select 0;
_head = (_this select 1) select 1;
_body = (_this select 1) select 2;
_overall = (_this select 1) select 3;
_legs = (_this select 1) select 4;
_hands = (_this select 1) select 5;
_revived_counter = (_this select 1) select 6;
//Make sure that _unit is valid
if (isNil "_unit") exitWith {};
//Make sure that _unit is alive
if(!alive _unit) exitWith {};
//Make sure that _unit is local
if(!local _unit) exitWith {};
_unit setVariable ["cws_ais_headhit", _head, true];
_unit setVariable ["cws_ais_bodyhit", _body, true];
_unit setVariable ["cws_ais_overall", _overall, true];
_unit setVariable ["cws_ais_legshit", _legs, true];
_unit setVariable ["cws_ais_handshit", _hands, true];
[_unit] call cws_fnc_setUnitDamage;
if(_revived_counter > 0) then {_unit setVariable ["cws_ais_revived_counter", _revived_counter, true]};
};
//Setup the 3D icons if enabled
if (cws_ais_show_3d_icons == 1) then {
_3d = addMissionEventHandler ["Draw3D", {
_player_is_medic = player call cws_fnc_isMedic;
_playerFaction = side (group player);
{
if((side _x) == _playerFaction) then {
{
if ((_x distance player) < cws_ais_3d_icon_range && (_x getVariable "cws_ais_agony") && (alive _x)) then {
_message = format["%1 (%2m)", name _x, ceil (player distance _x)];
_icon_size = 0.5;
_text_size = 0.025;
if(_player_is_medic) then {
_life_remaining = _x getVariable "cws_ais_bleedout_time";
_message = _message + format[" (%1%2)", ceil (_life_remaining * 100), "%"];
_icon_size = 1.0;
_text_size = 0.05;
};
drawIcon3D["a3\ui_f\data\map\MapControl\hospital_ca.paa", [1,0,0,1], _x, _icon_size, _icon_size, 0, _message, 0, _text_size];
};
} forEach units _x;
};
} forEach allGroups;
}];
};
//If the body delete time is configured then add the event handler to remove the body
if (cws_ais_delTime > 0) then {
_unit addEventHandler ["killed",{[_this select 0, cws_ais_delTime] spawn cws_fnc_delbody}];
};
//Work around to ensure this damage EH is the last one that was added
_timeend = time + 2;
waitUntil {!isNil {_unit getVariable "BIS_fnc_feedback_hitArrayHandler"} || {time > _timeend}};
_unit removeAllEventHandlers "HandleDamage";
//Setup the damage handler
_unit addEventHandler ["HandleDamage", {_this call cws_fnc_handleDamage}];
//Setup the healing handler (this is for the Treat action, not the First Aid revive action)
_unit addEventHandler ["HandleHeal", {_this call cws_fnc_handleHeal}];
//Start the Finite State Machine
[_unit] execFSM ("cws_injury\fsm\cws.fsm");
//Setup an event to trigger on all KeyDown input events
if (_unit == player) then {
waitUntil {sleep 0.3; !isNull (findDisplay 46)};
(findDisplay 46) displayAddEventHandler ["KeyDown", "_this call cws_fnc_handleKeys"];
};
//Setup the death cam if enabled
if (cws_ais_dead_dialog == 1) then {
if (isNil "respawndelay") then {
_num = getNumber (missionConfigFile/"respawndelay");
if (_num != 0) then {
missionNamespace setVariable ["cws_ais_respawndelay", _num];
};
} else {
missionNamespace setVariable ["cws_ais_respawndelay", 999];
};
if (_unit == player) then {
_unit addEventHandler ["killed",{_this spawn cws_fnc_deadcam}];
};
};
//If this unit is the local player show a hint to let them know CWS is loaded
if (_unit == player) then {
hint "CWS Wounding Loaded";
};
//Message to side chat so that everyone knows when units on their side have CWS loaded
if(playerSide == (side _unit)) then {
if(isPlayer _unit) then {
[side _unit,"HQ"] sideChat format ["%1 - CWS Wounding Loaded!", name _unit];
} else {
[side _unit,"HQ"] sideChat format ["%1 (AI) - CWS Wounding Loaded!", name _unit];
};
};
if(cws_ais_debugging) then {
if(local _unit) then {
diag_log format["%1 (Local) - CWS Wounding Loaded!", _unit];
} else {
diag_log format["%1 (Remote) - CWS Wounding Loaded!", _unit];
};
};
};
//Load CWS on all playable units
CWS_Load_Players =
{
{
[_x] spawn CWS_Load;
} forEach playableUnits;
};
//Globally loads CWS Wounding on all playable units
CWS_Load_Global_Players =
{
[[], "CWS_Load_Players", true, true] spawn BIS_fnc_MP;
};
call CWS_Load_Global_Players;class RscDeadQuote {
onload = "uinamespace setvariable ['cws_title',_this select 0];";
idd = 1792;
movingEnable = false;
moving = false;
duration=10e10;
enableSimulation = true;
controlsBackground[] = {};
objects[] = {};
controls[] = {QuoteStructuredText,HeaderDeath};
class HeaderDeath {
idc = -1;
type = 13;
style = 0x00;
colorBackground[] = {1, 1, 1, 0};
colorText[] = {1, 0.0, 0.0, 1};
x = safezoneX + 0.3 * safezoneW;
y = safezoneY + 0.045 * safezoneW;
w = 1;
h = 0.6;
size = 0.08;
text = "You are dead.";
class Attributes {
font = "PuristaMedium";
color = "#CC0000";
align = "center";
valign = "middle";
shadow = false;
shadowColor = "#ff0000";
size = "1.6";
};
};
class QuoteStructuredText {
idc = 1793;
type = 13;
style = 0x00;
colorBackground[] = { 1, 1, 1, 0 };
colorText[] = {1,1,1,1};
x = safezoneX + 0.3 * safezoneW;
y = safezoneY + 0.67 * safezoneW;
w = 1;
h = 0.6;
size = 0.02;
text = "";
class Attributes {
font = "PuristaMedium";
color = "#000000";
align = "center";
valign = "middle";
shadow = false;
shadowColor = "#ff0000";
size = "1.6";
};
};
};
class ais_ProgressBar {
idd = -1;
movingEnable = 0;
objects[] = {};
duration = 1e+011;
name = "ais_ProgressBar";
onload = "_this call cws_fnc_progressBarInit;";
class controlsBackground {
class mpsf_progressbar_background {
idc = 0;
x = "0.298906 * safezoneW + safezoneX";
y = "0.082 * safezoneH + safezoneY";
w = "0.407344 * safezoneW";
h = "0.011 * safezoneH";
type = 0;
style = 0;
shadow = 0;
colorShadow[] = {0,0,0,0.5};
font = "PuristaMedium";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,0.7};
linespacing = 1;
};
};
class controls {
class mpsf_progressbar_foreground {
idc = 1;
x = "0.298906 * safezoneW + safezoneX";
y = "0.082 * safezoneH + safezoneY";
w = "0.001 * safezoneW";
h = "0.011 * safezoneH";
type = 0;
style = 0;
shadow = 0;
colorShadow[] = {0,0,0,0.5};
font = "PuristaMedium";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
colorText[] = {1,1,1,1};
colorBackground[] = {0.6784, 0.7490, 0.5137, 0.7};
linespacing = 1;
};
class mpsf_progressbar_text {
idc = 2;
type = 13;
style = 0x00;
colorBackground[] = {0,0,0,0};
x = "0.298906 * safezoneW + safezoneX";
y = "0.093 * safezoneH + safezoneY";
w = "0.407344 * safezoneW";
h = "0.022 * safezoneH";
text = "";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {0, 0, 0, 1};
class Attributes {
font = "EtelkaMonospaceProBold";
color = "#FFFFFF";
align = "left";
valign = "middle";
shadow = 1;
shadowColor = "#000000";
//size = "2.25";
};
};
};
};/*%FSM*/
/*%FSM*/
/*
item0[] = {"start",0,250,-609.394836,-334.812927,-555.514771,-300.866486,0.000000,"start"};
item1[] = {"true",8,218,-389.901001,-334.008606,-342.710327,-303.406647,0.000000,"true"};
item2[] = {"healthy",2,250,-121.197121,-346.219635,-23.077042,-290.459534,0.000000,"healthy"};
item3[] = {"fall_in_agony",4,218,-117.047508,-259.680817,-27.047356,-209.680801,0.000000,"fall in agony"};
item4[] = {"agony",2,4346,-122.805183,-25.815657,-21.444450,40.464771,0.000000,"agony"};
item5[] = {"dead",4,218,102.903969,-176.190262,207.572708,-111.208710,100.000000,"dead"};
item6[] = {"healed",4,218,-228.072388,-166.228516,-175.571960,-134.978012,50.000000,"healed"};
item7[] = {"die___clean_up",2,250,122.001694,-247.638123,188.334717,-215.044495,0.000000,"die &" \n "clean up"};
item8[] = {"is_playable",4,218,118.492813,-343.494995,190.724411,-293.914337,0.000000,"is" \n "playable"};
item9[] = {"un_anim",2,250,-390.007019,-162.277451,-341.908752,-138.116821,0.000000,"un-anim"};
item10[] = {"dragged",4,218,60.306198,153.701035,113.991310,188.337036,10.000000,"dragged"};
item11[] = {"drag_anim1",2,250,4.858387,220.769318,70.415916,248.421844,0.000000,"drag anim1"};
item12[] = {"released",4,218,-32.086323,154.401886,27.185787,179.260864,1.000000,"released"};
item13[] = {"first_aid",4,218,-276.926025,148.085205,-223.240860,182.721298,8.000000,"first aid"};
item14[] = {"fa_finish",4,218,-181.055389,154.788269,-121.783318,179.647293,1.000000,"fa finish"};
item15[] = {"first_aid__anim",2,250,-229.994186,241.969513,-183.292465,275.907227,0.000000,"first aid" \n " anim"};
item16[] = {"",7,210,-210.896317,327.294342,-202.896301,335.294342,0.000000,""};
item17[] = {"",7,210,34.191921,327.621277,42.191921,335.621277,0.000000,""};
item18[] = {"",7,210,298.303589,327.157135,306.303619,335.157135,0.000000,""};
item19[] = {"",7,210,298.978455,-148.912247,306.978424,-140.912231,0.000000,""};
item20[] = {"",7,210,-76.269318,162.487183,-68.269318,170.487183,0.000000,""};
item21[] = {"anim_left_in_err",4,218,-383.593964,225.039948,-285.661163,292.347504,0.000000,"anim" \n "left" \n "in error"};
item22[] = {"unit_in_vehicle",4,218,31.659626,-11.993446,104.132874,29.243340,1.000000,"unit in" \n "vehicle"};
item23[] = {"eject",2,250,138.266327,-4.091993,173.213654,19.137981,0.000000,"eject"};
item24[] = {"ejected",4,218,39.226345,40.609161,104.327843,75.041771,0.000000,"ejected"};
item25[] = {"wait_for_respawn",2,250,129.987915,-461.594849,180.752777,-425.861938,0.000000,"wait for" \n "respawn"};
item26[] = {"alive_again",4,218,-114.678238,-469.424042,-45.365829,-417.283844,0.000000,"alive" \n "again"};
item27[] = {"not_is_playable",4,218,237.442368,-256.145935,327.442383,-206.145935,1.000000,"not is" \n "playable"};
item28[] = {"exit",1,250,403.828094,-248.545135,448.886108,-213.525848,0.000000,"exit"};
item29[] = {"set_Entity",2,250,-397.948425,-455.662292,-335.358643,-432.311188,0.000000,"set Entity"};
item30[] = {"has_firstaidkit",4,218,-483.379700,-11.889394,-403.752716,29.232147,2.000000,"has firstaidkit"};
item31[] = {"remove_first_aid",2,250,-499.199921,62.696358,-387.581726,94.320892,0.000000,"remove first aid kits"};
item32[] = {"one_more_",4,218,-483.379700,127.547928,-403.752716,168.669464,1.000000,"one more?"};
item33[] = {"all_removed",4,218,-338.379425,58.448944,-258.752441,99.570480,0.000000,"all removed"};
item34[] = {"parachute",4,218,200.638489,-11.621874,273.939911,26.982201,1.000000,"parachute"};
item35[] = {"handle_Parachute",2,250,182.368225,58.588707,290.905640,92.199661,0.000000,"handle Parachute"};
link0[] = {0,1};
link1[] = {1,2};
link2[] = {2,3};
link3[] = {2,5};
link4[] = {3,4};
link5[] = {4,5};
link6[] = {4,6};
link7[] = {4,10};
link8[] = {4,13};
link9[] = {4,22};
link10[] = {4,30};
link11[] = {5,7};
link12[] = {6,9};
link13[] = {7,8};
link14[] = {7,27};
link15[] = {8,25};
link16[] = {9,1};
link17[] = {10,11};
link18[] = {11,12};
link19[] = {11,17};
link20[] = {12,20};
link21[] = {13,15};
link22[] = {14,20};
link23[] = {15,14};
link24[] = {15,16};
link25[] = {15,21};
link26[] = {16,17};
link27[] = {17,18};
link28[] = {18,19};
link29[] = {19,5};
link30[] = {20,4};
link31[] = {21,15};
link32[] = {22,23};
link33[] = {23,5};
link34[] = {23,24};
link35[] = {23,34};
link36[] = {24,4};
link37[] = {25,26};
link38[] = {26,29};
link39[] = {27,28};
link40[] = {29,1};
link41[] = {30,31};
link42[] = {31,32};
link43[] = {31,33};
link44[] = {32,31};
link45[] = {33,4};
link46[] = {34,35};
link47[] = {35,24};
globals[] = {0.000000,0,0,0,0,640,480,1,56,6316128,1,-652.281982,517.110352,426.921021,-567.772156,933,921,1};
window[] = {2,-1,-1,-1,-1,840,1984,3243,103,3,951};
*//*%FSM*/
class FSM
{
fsmName = "ais";
class States
{
/*%FSM*/
class start
{
name = "start";
init = /*%FSM*/"private [""_unit"", ""_side"", ""_isplayable"", ""_pos""];" \n
"" \n
"_unit = _this select 0;" \n
"_side = side _unit;" \n
"" \n
"_isplayable = if (_unit in playableUnits) then {true} else {false};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class true
{
priority = 0.000000;
to="healthy";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class healthy
{
name = "healthy";
init = /*%FSM*/"[_unit] call cws_fnc_setupUnitVariables;" \n
"" \n
"_black_in = false;" \n
"" \n
"if (_unit getVariable ""cws_ais_leader"" && {count units group _unit > 0} && {leader group _unit != _unit}) then {" \n
" (group _unit) selectLeader _unit;" \n
" [side _unit,""HQ""] sideChat format [""%1 take back the command"", name _unit];" \n
"};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class dead
{
priority = 100.000000;
to="die___clean_up";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_unit getVariable ""cws_ais_unit_died"" || {!alive _unit}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class fall_in_agony
{
priority = 0.000000;
to="agony";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_unit getVariable ""cws_ais_agony"""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class agony
{
name = "agony";
init = /*%FSM*/"if (!isNil {_dragger getVariable ""drop_action""}) then {" \n
" _dragger removeAction (_dragger getVariable ""drop_action"");" \n
" _dragger setVariable [""drop_action"",nil];" \n
"};" \n
"" \n
"if (!isNull (_unit getVariable ""dragger"")) then {" \n
" if (!isPlayer _unit) then {_unit disableAI ""ANIM""};" \n
" _unit playMove ""AinjPpneMstpSnonWrflDb_release"";" \n
"} else {" \n
" if (vehicle _unit == _unit) then {" \n
" _unit playActionNow ""agonyStart"";" \n
" if (_black_in && {_unit == player}) then {titleCut ["""",""BLACK IN"", 8]; _black_in = false};" \n
" };" \n
"};" \n
"_unit setVariable [""dragger"", ObjNull, true];" \n
"_unit setVariable [""healer"", ObjNull, true];" \n
"" \n
"if (!(_unit getVariable ""unit_is_unconscious"")) then {" \n
" _unit setVariable [""unit_is_unconscious"", true];" \n
"" \n
" _unit setHit [""hands"",0.9];" \n
" _unit setHit [""legs"",0.9];" \n
" _unit setCaptive true;" \n
"" \n
" if (_unit == player) then {" \n
" showHud false;" \n
" _unit switchCamera ""INTERNAL"";" \n
" };" \n
"" \n
" //Start the bloodloss system as long as the unit is local" \n
" if(local _unit) then {" \n
" _unit execFSM (""cws_injury\fsm\cws_bloodloss.fsm"");" \n
" };" \n
" " \n
" //If there are fewer than 3 players not in agony in the group then send an AI to come help" \n
" if ({isPlayer _x && !(_x getVariable ""cws_ais_agony"")} count (units group _unit) < 3) then {" \n
" [_unit] spawn cws_fnc_sendAIHealer;" \n
" };" \n
"" \n
" //If the unit is not the local/current player setup the actions" \n
" if(_unit != player) then {" \n
" [_unit] call cws_fnc_setupActions;" \n
" };" \n
"" \n
" //If the unit is an AI turn off most of the AI" \n
" if (!isPlayer _unit) then {" \n
" _unit stop true;" \n
" _unit disableAI ""MOVE"";" \n
" _unit disableAI ""TARGET"";" \n
" _unit disableAI ""AUTOTARGET"";" \n
" _unit disableAI ""ANIM"";" \n
" };" \n
"" \n
" //If the unit is the leader of the group then start the leader handoff process" \n
" if (_unit == leader group _unit) then {" \n
" _unit setVariable [""cws_ais_leader"", true];" \n
" _grp = units group _unit;" \n
" _grp = _grp - [_unit];" \n
" " \n
" if (count _grp > 0) then {" \n
" _pLeader = objNull;" \n
" {if (isPlayer _x) exitWith {_pLeader = _x}} forEach _grp;" \n
" " \n
" if (!isNull _pLeader) then {" \n
" (group _unit) selectLeader _pLeader;" \n
" } else {" \n
" _ranAI = _grp select (floor (random (count _grp)));" \n
" (group _unit) selectLeader _ranAI;" \n
" };" \n
" };" \n
" } else {" \n
" if (_unit getVariable ""cws_ais_leader"") then {" \n
" _unit setVariable [""cws_ais_leader"", false];" \n
" };" \n
" };" \n
"" \n
" //Setup the handler to cancel the captive state if the unit fires a weapon" \n
" _unit addEventHandler [""fired"",{(_this select 0) setCaptive false}];" \n
"" \n
" if (sunOrMoon == 0) then {" \n
" _unit action [""nvGogglesOff"",_unit];" \n
" };" \n
"" \n
" //Send out a chat message if the unit is on the same side as the local/current player" \n
" _side = _unit getVariable ""cws_ais_side"";" \n
" if(cws_ais_show_injury_message == 1) then {" \n
" [_side,""HQ""] sideChat format [""%1 is down and needs help at %2"", name _unit, mapGridPosition _unit];" \n
" };" \n
"" \n
" //Put up the map marker if the unit is on the same side as the local/current player" \n
" if (playerSide == _side) then {" \n
" [_unit] execFSM (""cws_injury\fsm\cws_marker.fsm"");" \n
" };" \n
"};" \n
"" \n
"//If the unit went into agony in the water, kill them" \n
"//TODO: Find a better way to handle agony in the water" \n
"if (surfaceIsWater [getPos _unit select 0, getPos _unit select 1]) then {" \n
" //_unit setDamage 1;" \n
"};" \n
"" \n
"disableUserInput false;"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class dead
{
priority = 100.000000;
to="die___clean_up";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_unit getVariable ""cws_ais_unit_died"" || {!alive _unit}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class healed
{
priority = 50.000000;
to="un_anim";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"!(_unit getVariable ""cws_ais_agony"")"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class dragged
{
priority = 10.000000;
to="drag_anim1";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"!isNull(_unit getVariable ""dragger"")"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class first_aid
{
priority = 8.000000;
to="first_aid__anim";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"!isNull (_unit getVariable ""healer"")"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class has_firstaidkit
{
priority = 2.000000;
to="remove_first_aid";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"(!isPlayer _unit) && (local _unit) && (" \n
"(items _unit) find ""FirstAidKit"" >= 0 ||" \n
"(items _unit) find ""Medikit"" >= 0)"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class unit_in_vehicle
{
priority = 1.000000;
to="eject";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"vehicle _unit != _unit"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class die___clean_up
{
name = "die___clean_up";
init = /*%FSM*/"//Make sure the unit is fully dead" \n
"if (alive _unit) then {_unit setDamage 1};" \n
"" \n
"//If the unit is a player re-enable user input and the HUD" \n
"if (_unit == player) then {" \n
" disableUserInput false;" \n
" showHud true;" \n
"};" \n
"" \n
"//Clean up any actions attached to the unit" \n
"[_unit] call cws_fnc_cleanUpActions;" \n
"" \n
"//If the unit isn't a player re-enable the AI" \n
"if (!isPlayer _unit) then {" \n
" _unit stop false;" \n
" _unit enableAI ""MOVE"";" \n
" _unit enableAI ""TARGET"";" \n
" _unit enableAI ""AUTOTARGET"";" \n
" _unit enableAI ""ANIM"";" \n
"};" \n
"" \n
"detach _unit;" \n
"" \n
"_unit setCaptive false;" \n
"_unit_is_in_vehicle = false;" \n
"" \n
"//Restore the unit's inventory" \n
"if(local _unit) then {" \n
" _store = _unit getVariable ""cws_ais_itemStorage"";" \n
" if ((_store select 0) > 0) then {" \n
" for ""_i"" from 1 to (_store select 0) do {_unit addItem ""FirstAidKit""};" \n
" };" \n
" if ((_store select 1) > 0) then {" \n
" for ""_j"" from 1 to (_store select 1) do {_unit addItem ""Medikit""};" \n
" };" \n
" _unit setVariable [""cws_ais_itemStorage"", [0,0]];" \n
"};" \n
"" \n
"_unit setVariable [""cws_ais_side"", _side, true];" \n
"_unit setVariable [""cws_ais_itemStorage"", [0,0]];" \n
"" \n
"_unit setVariable [""cws_ais_bodyhit"",0];" \n
"_unit setVariable [""cws_ais_headhit"",0];" \n
"_unit setVariable [""cws_ais_overall"",0];" \n
"_unit setVariable [""cws_ais_legshit"",0];" \n
"_unit setVariable [""cws_ais_handshit"",0];" \n
"" \n
"_unit setVariable [""cws_ais_agony"", false];" \n
"_unit setVariable [""cws_ais_unit_died"", false];" \n
"_unit setVariable [""unit_is_unconscious"", false];" \n
"_unit setVariable [""cws_ais_leader"", false];" \n
"" \n
"_unit setVariable [""dragger"", ObjNull];" \n
"_unit setVariable [""healer"", ObjNull];" \n
"" \n
"_unit setVariable [""cws_ais_bleedout_time"", 0];" \n
"_unit setVariable [""cws_ais_revived_counter"", 0];"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class not_is_playable
{
priority = 1.000000;
to="exit";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"not _isplayable"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class is_playable
{
priority = 0.000000;
to="wait_for_respawn";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_isplayable"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class un_anim
{
name = "un_anim";
init = /*%FSM*/"disableUserInput false;" \n
"_unit playActionNow ""agonyStop"";" \n
"" \n
"[_unit] call cws_fnc_cleanUpActions;" \n
"" \n
"detach _unit;" \n
"_unit setCaptive false;" \n
"if (_unit == player) then {showHud true};" \n
"" \n
"if(local _unit) then {" \n
" _store = _unit getVariable ""cws_ais_itemStorage"";" \n
" if ((_store select 0) > 0) then {" \n
" for ""_i"" from 1 to (_store select 0) do {_unit addItem ""FirstAidKit""};" \n
" };" \n
" if ((_store select 1) > 0) then {" \n
" for ""_j"" from 1 to (_store select 1) do {_unit addItem ""Medikit""};" \n
" };" \n
" _unit setVariable [""cws_ais_itemStorage"", [0,0]];" \n
"};" \n
"" \n
"if (!isPlayer _unit) then {" \n
" _unit enableAI ""MOVE"";" \n
" _unit enableAI ""TARGET"";" \n
" _unit enableAI ""AUTOTARGET"";" \n
" _unit enableAI ""ANIM"";" \n
" _unit stop false;" \n
" _unit doMove (position (leader group _unit));" \n
"" \n
" if ({isPlayer _x} count (units group _unit) <= 2) then {" \n
" [_unit] spawn cws_fnc_lookingForWoundedMates;" \n
" };" \n
"};" \n
"" \n
"_unit setVariable [""cws_ais_agony"", false];" \n
"_unit setVariable [""cws_ais_unit_died"", false];" \n
"_unit setVariable [""unit_is_unconscious"", false];" \n
"" \n
"_unit setVariable [""dragger"", ObjNull];" \n
"_unit setVariable [""healer"", ObjNull];" \n
"" \n
"_unit setVariable [""cws_ais_bleedout_time"", 0];" \n
"" \n
"_unit setCaptive false;"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class true
{
priority = 0.000000;
to="healthy";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class drag_anim1
{
name = "drag_anim1";
init = /*%FSM*/"//diag_log format [""drag block in fsm - %1"", _unit];" \n
"" \n
"//if (!isPlayer _unit) then {_unit enableAI ""ANIM""};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class dead
{
priority = 100.000000;
to="die___clean_up";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_unit getVariable ""cws_ais_unit_died"" || {!alive _unit}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class released
{
priority = 1.000000;
to="agony";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_dragger = _unit getVariable ""dragger"";" \n
"" \n
"isNull _dragger" \n
"" \n
"||" \n
"" \n
"{!alive _dragger}" \n
""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class first_aid__anim
{
name = "first_aid__anim";
init = /*%FSM*/"_unit playMove ""AinjPpneMstpSnonWrflDnon_rolltoback"";" \n
"//disableUserInput true; <--- command disabled from BIS cause stupid 3.0"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class dead
{
priority = 100.000000;
to="die___clean_up";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_unit getVariable ""cws_ais_unit_died"" || {!alive _unit}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class fa_finish
{
priority = 1.000000;
to="agony";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_healer = _unit getVariable ""healer"";" \n
"" \n
"isNull _healer" \n
"" \n
"||" \n
"" \n
"{!alive _healer}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class anim_left_in_err
{
priority = 0.000000;
to="first_aid__anim";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"animationState _unit != ""ainjppnemstpsnonwrfldnon"" &&" \n
"animationState _unit != ""ainjppnemstpsnonwrfldnon_rolltoback"" &&" \n
"_unit getVariable ""cws_ais_agony"""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class eject
{
name = "eject";
init = /*%FSM*/"if (typeOf vehicle _unit == ""Steerable_Parachute_F"") then {" \n
" _parachute = true;" \n
" unAssignVehicle _unit;" \n
" _unit action [""eject"", vehicle _unit];" \n
" if (_unit == player) then {titleCut ["""",""BLACK OUT"", 2]};" \n
"} else {" \n
" _parachute = false;" \n
" unAssignVehicle _unit;" \n
" _unit action [""eject"", vehicle _unit];" \n
" _random_damage = ((damage _unit) max (0.5 + random 0.4));" \n
" _unit setVariable [""cws_ais_headhit"", _random_damage];" \n
" _unit setVariable [""cws_ais_bodyhit"", _random_damage];" \n
" _unit setVariable [""cws_ais_overall"", _random_damage];" \n
" _sleep2 = time + 2;" \n
"};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class dead
{
priority = 100.000000;
to="die___clean_up";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_unit getVariable ""cws_ais_unit_died"" || {!alive _unit}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class parachute
{
priority = 1.000000;
to="handle_Parachute";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"vehicle _unit == _unit"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class ejected
{
priority = 0.000000;
to="agony";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"vehicle _unit == _unit && {time > _sleep2} && {!_parachute}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class wait_for_respawn
{
name = "wait_for_respawn";
init = /*%FSM*/"_name_unit = name _unit;"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class alive_again
{
priority = 0.000000;
to="set_Entity";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"{_name_unit == name _x && alive _x} count playableUnits > 0"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class exit
{
name = "exit";
init = /*%FSM*/""/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
};
};
/*%FSM*/
/*%FSM*/
class set_Entity
{
name = "set_Entity";
init = /*%FSM*/"{" \n
" if (name _x == _name_unit) exitWith {_unit = _x};" \n
"} foreach playableUnits;"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class true
{
priority = 0.000000;
to="healthy";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class remove_first_aid
{
name = "remove_first_aid";
init = /*%FSM*/"if ((items _unit) find ""FirstAidKit"" >= 0) then {" \n
" _store = _unit getVariable ""cws_ais_itemStorage"";" \n
" _fak = _store select 0;" \n
" _fak = _fak + 1;" \n
" _unit setVariable [""cws_ais_itemStorage"", [_fak,_store select 1]];" \n
" _unit removeItem ""FirstAidKit"";" \n
"};" \n
"if ((items _unit) find ""Medikit"" >= 0) then {" \n
" _store = _unit getVariable ""cws_ais_itemStorage"";" \n
" _mk = _store select 1;" \n
" _mk = _mk + 1;" \n
" _unit setVariable [""cws_ais_itemStorage"", [_store select 0, _mk]];" \n
" _unit removeItem ""Medikit"";" \n
"};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class one_more_
{
priority = 1.000000;
to="remove_first_aid";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"(items _unit) find ""FirstAidKit"" >= 0 ||" \n
"(items _unit) find ""Medikit"" >= 0"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class all_removed
{
priority = 0.000000;
to="agony";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"(items _unit) find ""FirstAidKit"" == -1 ||" \n
"(items _unit) find ""Medikit"" == -1"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class handle_Parachute
{
name = "handle_Parachute";
init = /*%FSM*/"_random_damage = ((damage _unit) max (0.5 + random 0.4));" \n
"_unit setVariable [""cws_ais_headhit"", _random_damage];" \n
"_unit setVariable [""cws_ais_bodyhit"", _random_damage];" \n
"_unit setVariable [""cws_ais_overall"", _random_damage];" \n
"" \n
"_parachute = false;" \n
"_sleep2 = time + 6.5;" \n
"_black_in = true;"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class ejected
{
priority = 0.000000;
to="agony";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"vehicle _unit == _unit && {time > _sleep2} && {!_parachute}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
};
initState="start";
finalStates[] =
{
"exit",
};
};
/*%FSM*//*%FSM*/
/*%FSM*/
/*
item0[] = {"start",0,250,-386.841858,-274.763580,-321.196259,-237.337494,0.000000,"start"};
item1[] = {"true",8,218,-294.160950,-276.279480,-222.604858,-237.345810,0.000000,"true"};
item2[] = {"Effects2",2,4346,-58.868343,-188.520935,-3.639973,-147.885513,0.000000,"Effects2"};
item3[] = {"sleep",4,218,-64.407600,-100.484978,1.512154,-59.180626,0.000000,"sleep"};
item4[] = {"healed___died",4,218,116.722412,-113.377907,206.722412,-63.377907,1.000000,"healed /" \n "died"};
item5[] = {"bleed_of_death",4,218,-259.866211,-120.066917,-155.819397,-75.418060,2.000000,"bleed of death"};
item6[] = {"death",1,250,-234.448166,16.387945,-181.906342,46.989937,0.000000,"death"};
item7[] = {"end",1,250,136.211731,6.727341,186.337524,40.571522,0.000000,"end"};
item8[] = {"Effects1",2,250,-187.445648,-275.000092,-128.734100,-237.515472,0.000000,"Effects1"};
item9[] = {"true",8,218,-65.256653,-275.840057,3.623799,-235.226547,0.000000,"true"};
item10[] = {"__isPlayer__isIn",4,218,-399.323578,-115.627823,-309.323578,-49.417061,0.000000,"!isPlayer" \n "!isInAgony"};
item11[] = {"exit",1,250,-379.510406,14.058210,-327.335480,46.046249,0.000000,"exit"};
link0[] = {0,1};
link1[] = {0,10};
link2[] = {1,8};
link3[] = {2,3};
link4[] = {2,4};
link5[] = {2,5};
link6[] = {3,2};
link7[] = {4,7};
link8[] = {5,6};
link9[] = {8,9};
link10[] = {9,2};
link11[] = {10,11};
globals[] = {0.000000,0,0,0,0,640,480,1,22,6316128,1,-438.949554,227.492523,183.215668,-406.520813,740,911,1};
window[] = {2,-1,-1,-1,-1,986,250,1510,250,3,758};
*//*%FSM*/
class FSM
{
fsmName = "bloodloss";
class States
{
/*%FSM*/
class start
{
name = "start";
init = /*%FSM*/"private [""_passed_time"",""_average_damage""];" \n
"" \n
"_unit = _this;" \n
"" \n
"_randomfactor = cws_ais_random_lifetime_factor + random 30;" \n
"_time_of_agony = time;" \n
"_passed_time = 0;" \n
"_timeleft = 999;" \n
"" \n
"_ppEff = [];" \n
"if (isPlayer _unit && player == _unit) then {" \n
" addCamShake [15, 999, 0.7];" \n
" _ppEff = ppEffectCreate [[""radialblur"", 17091], [""colorcorrections"", 1580]];" \n
" {_x ppEffectEnable true} forEach _ppEff;" \n
"};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class __isPlayer__isIn
{
priority = 0.000000;
to="exit";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"(isPlayer _unit && player != _unit) || !(_unit getVariable ""cws_ais_agony"")"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class true
{
priority = 0.000000;
to="Effects1";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class Effects2
{
name = "Effects2";
init = /*%FSM*/"_blinkduration = 0.7 + (random 0.4);" \n
"" \n
"//Pause the bleedout timer by pushing the initial agony time forward by the blink time" \n
"if(!isNull(_unit getVariable [""healer"", objNull])) then {" \n
" _time_of_agony = _time_of_agony + _blinkduration;" \n
"};" \n
"" \n
"_passed_time = time - _time_of_agony;" \n
"_average_damage = [_unit] call cws_fnc_getUnitDamage;" \n
"_damage_inverse = 1 - _average_damage;" \n
"_bleed_time = (_damage_inverse * _randomfactor) + 60;" \n
"_timeleft = (_bleed_time - _passed_time) - _blinkduration;" \n
"_timeleft_normalized = 1 - (_passed_time / _bleed_time);" \n
"_txt = format [""%1 Seconds"", floor _timeleft];" \n
"" \n
"_unit setFatigue 1;" \n
"_unit setBleedingRemaining 2;" \n
"_unit setVariable [""cws_ais_bleedout_time"", _timeleft_normalized, true];" \n
"" \n
"_timenow = time;" \n
"" \n
"if(isPlayer _unit && player == _unit) then {" \n
" if (_timeleft > 3) then {" \n
" titleText [_txt, ""PLAIN DOWN"", 0.2];" \n
" } else {" \n
" titleText [""It's too late for you..."", ""PLAIN DOWN"", 0.5];" \n
" };" \n
"" \n
" (_ppEff select 1) ppEffectAdjust [_timeleft_normalized, 1.0, 0.0, random 0.75, 0.0, 0.0, random 0.75, 0.0, 0.0, 1.0, 1.0, 0.199, 0.587, 0.114, 1.0]; " \n
" (_ppEff select 1) ppEffectCommit 0.5;" \n
"};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class bleed_of_death
{
priority = 2.000000;
to="death";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"_timeleft <= 0"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class healed___died
{
priority = 1.000000;
to="end";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"!(_unit getVariable ""cws_ais_agony"") || {!alive _unit}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class sleep
{
priority = 0.000000;
to="Effects2";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"time - _timenow > _blinkduration"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class death
{
name = "death";
init = /*%FSM*/"if (alive _unit) then {_unit setDamage 1};" \n
"" \n
"if(isPlayer _unit && player == _unit) then {" \n
" {_x ppEffectEnable false} forEach _ppEff;" \n
" ppEffectDestroy _ppEff;" \n
" resetCamShake;" \n
"};" \n
"" \n
"_unit setVariable [""cws_ais_bleedout_time"", 0, true];"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
};
};
/*%FSM*/
/*%FSM*/
class end
{
name = "end";
init = /*%FSM*/"if(isPlayer _unit && player == _unit) then {" \n
" {_x ppEffectEnable false} forEach _ppEff;" \n
" ppEffectDestroy _ppEff;" \n
" resetCamShake;" \n
"};" \n
"" \n
"_unit setFatigue 0.5;" \n
"_unit setBleedingRemaining 60;" \n
"_unit setVariable [""cws_ais_bleedout_time"", 0, true];"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
};
};
/*%FSM*/
/*%FSM*/
class Effects1
{
name = "Effects1";
init = /*%FSM*/"[_unit] spawn cws_fnc_injuredEffects;"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class true
{
priority = 0.000000;
to="Effects2";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class exit
{
name = "exit";
init = /*%FSM*/""/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
};
};
/*%FSM*/
};
initState="start";
finalStates[] =
{
"death",
"end",
"exit",
};
};
/*%FSM*//*%FSM*/
/*%FSM*/
/*
item0[] = {"start",0,250,-252.023544,-271.488312,-208.177261,-241.555161,0.000000,"start"};
item1[] = {"show___hide",4,218,-273.913025,-184.949829,-185.919754,-134.949829,1.000000,"show / hide"};
item2[] = {"exit",1,250,-250.501648,-85.953194,-209.331085,-54.682304,0.000000,"exit"};
item3[] = {"_",8,218,-124.749207,-267.892914,-92.943192,-245.317688,0.000000,""};
item4[] = {"create_Marker",2,250,22.408033,-272.575195,74.280960,-239.966568,0.000000,"create" \n "Marker"};
item5[] = {"unit_healed___di",4,4314,6.354519,-109.364563,93.010071,-34.615402,1.000000,"unit" \n "healed" \n "/ died"};
item6[] = {"setPos_marker",2,250,25.083622,-178.260880,76.287674,-140.301010,0.000000,"setPos" \n "marker"};
item7[] = {"sleep_5",4,218,153.511703,-182.274261,226.789291,-130.267578,0.000000,"sleep 5"};
item8[] = {"_",8,218,36.454853,-215.719070,60.903004,-199.832779,0.000000,""};
link0[] = {0,1};
link1[] = {0,3};
link2[] = {1,2};
link3[] = {3,4};
link4[] = {4,8};
link5[] = {5,2};
link6[] = {6,5};
link7[] = {6,7};
link8[] = {7,6};
link9[] = {8,6};
globals[] = {0.000000,0,0,0,0,640,480,1,10,6316128,1,-323.255829,276.744171,302.325623,-297.674377,1212,911,1};
window[] = {2,-1,-1,-1,-1,912,175,1435,175,3,1230};
*//*%FSM*/
class FSM
{
fsmName = "ais_marker";
class States
{
/*%FSM*/
class start
{
name = "start";
init = /*%FSM*/""/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class show___hide
{
priority = 1.000000;
to="exit";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"cws_ais_show_injury_marker == 0"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class _
{
priority = 0.000000;
to="create_Marker";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class exit
{
name = "exit";
init = /*%FSM*/"if (!isNil ""_ais_marker"") then {" \n
" deleteMarker _ais_marker;" \n
"};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
};
};
/*%FSM*/
/*%FSM*/
class create_Marker
{
name = "create_Marker";
init = /*%FSM*/"private [""_ais_marker""];" \n
"" \n
"_unit = _this select 0;" \n
"_isplayer = isPlayer _unit;" \n
"" \n
"if (!surfaceIsWater (position _unit)) then {" \n
" _ais_marker = createMarkerLocal [format [""%1"",name _unit], position _unit];" \n
" _ais_marker setMarkerTypeLocal ""loc_Hospital"";" \n
" _ais_marker setMarkerSizeLocal [0.7,0.7];" \n
" _ais_marker setMarkerTextLocal format ["" %1 down"", name _unit];" \n
" _ais_marker setMarkerColorLocal ""Color1_FD_F"";" \n
"};"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class _
{
priority = 0.000000;
to="setPos_marker";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/""/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
/*%FSM*/
class setPos_marker
{
name = "setPos_marker";
init = /*%FSM*/"if (!isNil ""_ais_marker"") then {" \n
" _ais_marker setMarkerPosLocal getPos _unit;" \n
"};" \n
"" \n
"_timenow = time;"/*%FSM*/;
precondition = /*%FSM*/""/*%FSM*/;
class Links
{
/*%FSM*/
class unit_healed___di
{
priority = 1.000000;
to="exit";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"isNull _unit ||" \n
"{!alive _unit} ||" \n
"{!(_unit getVariable ""cws_ais_agony"")} ||" \n
"{(_isplayer && !isPlayer _unit)}"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
/*%FSM*/
class sleep_5
{
priority = 0.000000;
to="setPos_marker";
precondition = /*%FSM*/""/*%FSM*/;
condition=/*%FSM*/"time - _timenow > 5"/*%FSM*/;
action=/*%FSM*/""/*%FSM*/;
};
/*%FSM*/
};
};
/*%FSM*/
};
initState="start";
finalStates[] =
{
"exit",
};
};
/*%FSM*/// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private["_dragger","_injuredperson"];
_dragger = _this select 1;
_injuredperson = _this select 3;
if (_injuredperson distance _dragger > 3) exitWith {
[format ["%1 is too far away to be dragged.", name _injuredperson]] spawn cws_fnc_showMessage;
};
if (!alive _injuredperson) exitWith {
[format ["R.I.P. %1", name _injuredperson]] spawn cws_fnc_showMessage;
};
if (_dragger call cws_fnc_checklauncher) exitWith {
[format ["You cant carry others during you wear a launcher on your back."]] spawn cws_fnc_showMessage;
};
if (!isNil "carryaction") then {
_dragger removeAction carryaction;
carryaction = nil;
};
detach _dragger;
detach _injuredperson;
_pos = _dragger ModelToWorld [0,1.9,0];
_injuredperson setPos _pos;
_injuredperson playActionNow "grabCarried";
sleep 2;
if (!isPlayer _injuredperson) then {_injuredperson disableAI "ANIM"};
_dragger playAction "grabCarry";
_timenow = time;
waitUntil {!alive _injuredperson || {!alive _dragger} || {(_dragger getVariable "cws_ais_agony")} || {time > _timenow + 16}};
if (!alive _injuredperson || {!alive _dragger} || {(_dragger getVariable "cws_ais_agony")}) then {
if (alive _injuredperson) then {
_injuredperson playActionNow "agonyStart";
} else {
if (!isNil {_dragger getVariable "drop_action"}) then {
_dragger removeAction (_dragger getVariable "drop_action");
_dragger setVariable ["drop_action",nil];
};
};
if (alive _dragger && {!(_dragger getVariable "cws_ais_agony")}) then {
_dragger playMoveNow "amovpknlmstpsraswrfldnon";
};
} else {
_injuredperson attachTo [_dragger, [-0.6, 0.28, -0.05]];
};// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
_ret = if (SecondaryWeapon _this != "") then {true} else {false};
_ret// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ['_unit'];
_unit = _this select 0;
_unit removeAction (_unit getVariable "fa_action");
_unit removeAction (_unit getVariable "drag_action");
_unit setVariable ["fa_action",nil];
_unit setVariable ["drag_action",nil];
if (!isNil {_unit getVariable "drag_action"}) then {
_unit removeAction (_unit getVariable "drop_action");
_unit setVariable ["drop_action",nil];
};
if (!isNil {_unit getVariable "carry_action"}) then {
_unit removeAction (_unit getVariable "carry_action");
_unit setVariable ["carry_action",nil];
};// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_victim","_killer","_pos","_deadcam"];
if (!isDedicated && {!hasInterface}) exitWith {};
_victim = _this select 0;
_killer = _this select 1;
_pos = [(getPosATL _victim select 0)-(vectorDir _victim select 0)*3,(getPosATL _victim select 1)-(vectorDir _victim select 1)*3,(getPosATL _victim select 2)+1];
titleCut ["","BLACK IN",1];
_deadcam = "Camera" camCreate (position _victim);
_deadcam cameraEffect ["internal","back"];
showCinemaBorder true;
_deadcam camPrepareTarget _victim;
_deadcam camPreparePos _pos;
_deadcam camPrepareFOV 0.7;
_deadcam camCommitPrepared 0;
_quote = cws_ais_killcam_quotes select (floor (random (count cws_ais_killcam_quotes)));
_handle = [_quote select 0, _quote select 1, ((missionNameSpace getVariable "cws_ais_respawndelay") - 1)] spawn cws_fnc_quote;
waitUntil {camCommitted _deadcam};
if ((_killer == player) or (!alive _killer) or (isNull _killer)) then {
_deadcam camPrepareTarget _victim;
_deadcam camsetrelpos [-3, 20, 10];
_deadcam camPrepareFOV 0.474;
_deadcam camCommitPrepared 20;
waitUntil {alive player};
player cameraEffect ["terminate","back"];
camDestroy _deadcam;
} else {
sleep 1;
_deadcam camCommand "inertia on";
_deadcam camPrepareTarget (vehicle _killer);
_deadcam camsetrelpos [-3, 20, 10];
_deadcam camPrepareFOV 1;
_deadcam camCommitPrepared 10;
waitUntil {alive player};
showCinemaBorder false;
player cameraEffect ["terminate","back"];
camDestroy _deadcam;
};// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
_body = _this select 0;
_delay = _this select 1;
if (_delay <= 0) exitWith {};
sleep (_delay + (random 20));
deleteVehicle _body;// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private["_injuredperson","_dragger"];
_injuredperson = _this select 0;
_dragger = _this select 1;
if (!isNull(_injuredperson getVariable "healer") || {!isNull(_injuredperson getVariable "dragger")}) exitWith {
[format ["%1 is being assisted.", name _injuredperson]] spawn cws_fnc_showMessage;
};
if (_injuredperson distance _dragger > 3) exitWith {
[format ["%1 is too far away to be dragged.", name _injuredperson]] spawn cws_fnc_showMessage;
};
if (!alive _injuredperson) exitWith {
[format ["R.I.P. %1", name _injuredperson]] spawn cws_fnc_showMessage;
};
_injuredperson setVariable ["dragger", _dragger, true];
_injuredperson attachTo [_dragger, [0, 1, 0.08]];
_injuredperson setDir 180;
_injuredperson switchMove "AinjPpneMrunSnonWnonDb";
_dragger playAction "grabDrag";
sleep 1;
dropaction = _dragger addAction [format["Drop %1",name _injuredperson], {_this spawn cws_fnc_drop},_injuredperson, 0, false, true];
carryaction = _dragger addAction [format["Carry %1",name _injuredperson], {_this spawn cws_fnc_carry},_injuredperson, 0, false, true];
_dragger setVariable ["drop_action", dropaction];
_dragger setVariable ["carry_action", carryaction];// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private["_dragee","_dragger"];
_dragger = _this select 1;
_dragee = _this select 3;
detach _dragger;
detach _dragee;
_dragee setVariable ["dragger", ObjNull, true];
_dragee playMove "AinjPpneMstpSnonWrflDb_release";
_dragger playMove "amovpknlmstpsraswrfldnon";
if (!isNil {_dragger getVariable "drop_action"}) then {
_dragger removeAction (_dragger getVariable "drop_action");
_dragger setVariable ["drop_action",nil];
};
if (!isNil {_dragger getVariable "carry_action"}) then {
_dragger removeAction (_dragger getVariable "carry_action");
_dragger setVariable ["carry_action",nil];
};// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_unit","_healer","_self_revive","_behaviour","_timenow","_relpos","_dir","_offset","_time","_damage","_heal_time","_isMedic","_animChangeEVH","_has_medikit","_has_firstaidkit","_revived_counter"];
_unit = _this select 0;
_healer = _this select 1;
//Capture some details about the healer
_behaviour = behaviour _healer;
_has_medikit = ((items _healer) find "Medikit" > -1);
_has_firstaidkit = ((items _healer) find "FirstAidKit" >= 0);
_isMedic = _healer call cws_fnc_isMedic;
//If the unit and the healer are the same and it's the player then we are self-reviving
//This should ONLY ever happen from the medic's special key binding while in agony
_self_revive = (_unit == _healer) && (_unit == player) && _isMedic && (_has_medikit || _has_firstaidkit) && cws_ais_allow_self_revive;
//If the healer is also in agony then leave here
if (_healer getVariable "cws_ais_agony" && !_self_revive) exitWith {};
//If the healer is AI move them until they're within range of the injured
if (!isPlayer _healer && {_healer distance _unit > cws_ais_firstaid_distance}) then {
_healer setBehaviour "AWARE";
_healer doMove (position _unit);
_timenow = time;
WaitUntil {
_healer distance _unit <= cws_ais_firstaid_distance ||
{!alive _unit} ||
{!(_unit getVariable "cws_ais_agony")} ||
{!alive _healer} ||
{_healer getVariable "cws_ais_agony"} ||
{_timenow + 120 < time}
};
};
//If the healer is also in agony by the time they get to the injured then leave here
if (_healer getVariable "cws_ais_agony" && !_self_revive) exitWith {};
//Stop the healing if the injured died before the healer arrived
if (!alive _unit) exitWith {
_healer setBehaviour _behaviour;
if (isPlayer _healer) then {["It's already too late for this guy."] spawn cws_fnc_showMessage};
};
//Stop the healing if the healer is too far away
if (_healer distance _unit > cws_ais_firstaid_distance) exitWith {
_healer setBehaviour _behaviour;
if (isPlayer _healer) then {[format ["%1 is too far away to be healed.", name _unit]] spawn cws_fnc_showMessage};
};
//Stop the healing if the healer doesn't have enough supplies
if(!(_has_medikit && _isMedic) && !_has_firstaidkit) exitWith {
_healer setBehaviour _behaviour;
if (isPlayer _healer) then {[format ["%1 cannot be healed. No first aid available.", name _unit]] spawn cws_fnc_showMessage};
};
//Make sure the unit is healable
rtn = call cws_fnc_isHealable;
if (!rtn) exitWith {};
//Add the healer to the unit
cws_ais_start_heal = [_unit, _healer];
publicVariable "cws_ais_start_heal";
cws_healerStopped = false;
_healer selectWeapon primaryWeapon _healer;
sleep 1;
cws_animDelay = time + 2;
//Start the medic animation as long as this isn't a self-revive
if(!_self_revive) then {
_healer playAction "medicStart";
};
//If the healer is an AI then stop all other AI tasks
if (!isPlayer _healer) then {
_healer stop true;
_healer disableAI "MOVE";
_healer disableAI "TARGET";
_healer disableAI "AUTOTARGET";
_healer disableAI "ANIM";
};
//If the healer is a player then run through the healing animations
if (isPlayer _healer) then {
_animChangeEVH = _healer addEventhandler ["AnimChanged", {
private ["_anim","_healer"];
_healer = _this select 0;
_anim = _this select 1;
if (primaryWeapon _healer != "") then {
if (time >= cws_animDelay) then {cws_healerStopped = true};
} else {
if (_anim in ["amovpknlmstpsnonwnondnon","amovpknlmstpsraswlnrdnon"]) then {
_healer playAction "medicStart";
} else {
if (!(_anim in ["ainvpknlmstpsnonwnondnon_medic0s","ainvpknlmstpsnonwnondnon_medic"])) then {
if (time >= cws_animDelay) then {cws_healerStopped = true};
};
};
};
}];
};
//Attach the injured to the healer
_offset = [0,0,0]; _dir = 0;
_relpos = _healer worldToModel position _unit;
if((_relpos select 0) < 0) then{_offset=[-0.2,0.7,0]; _dir=90} else{_offset=[0.2,0.7,0]; _dir=270};
_unit attachTo [_healer, _offset];
_unit setDir _dir;
//Get some values for the first aid timer/progress
_time = time;
_damage = damage _unit;
if(isNil {_unit getVariable "cws_ais_revived_counter"}) then {_unit setVariable ["cws_ais_revived_counter",0]};
_revived_counter = _unit getVariable "cws_ais_revived_counter";
//Calculate the healing time in seconds
//Base is up to 60 seconds plus the healed counter penalty
//The healed counter penalty is 5 seconds for every revive the unit has undergone
//There is also a minimum time of 10 seconds regardless of the damage or healed counter
_heal_time = _damage * 60 + _revived_counter * 5;
if(_heal_time < 10) then {_heal_time = 10};
//Run the healing progress bar
sleep 1;
while {
time - _time < _heal_time
&& {alive _healer}
&& {alive _unit}
&& {(_healer distance _unit) < cws_ais_firstaid_distance}
&& {!cws_healerStopped}
} do {
sleep 0.5;
//If the healer is a player then run the progress bar on-screen
if (isPlayer _healer) then {["Applying First Aid", ((time - _time) / (_heal_time)) min 1] spawn cws_fnc_progressbar};
//if the healer goes into agony but this isn't a self-revive then interrupt the process
if(_healer getVariable "cws_ais_agony" && !_self_revive) then {cws_healerStopped = true};
//Refresh first aid checks in case the items are removed during the first aid process
_has_medikit = ((items _healer) find "Medikit" > -1);
_has_firstaidkit = ((items _healer) find "FirstAidKit" >= 0);
if(!(_has_medikit && _isMedic) && !_has_firstaidkit) then {cws_healerStopped = true};
};
if (isPlayer _healer) then {_healer removeEventHandler ["AnimChanged", _animChangeEVH]};
//Detach the injured from the healer
detach _healer;
detach _unit;
//Clear the healer from the unit
cws_ais_start_heal = [_unit, ObjNull];
publicVariable "cws_ais_start_heal";
//If the healer is an AI then start up all other AI tasks
if (!isPlayer _healer) then {
_healer stop false;
_healer enableAI "MOVE";
_healer enableAI "TARGET";
_healer enableAI "AUTOTARGET";
_healer enableAI "ANIM";
};
//If the healer is still healthy and this isn't a self-revive then stop animations and restore behaviour
if (alive _healer && {!(_healer getVariable "cws_ais_agony")} && !_self_revive) then {
_healer playAction "medicStop";
_healer setBehaviour _behaviour;
};
//If either the healer or the injured died during the healing, bail out
if (!alive _healer) exitWith {};
if (!alive _unit) exitWith {["It's already too late for this guy."] spawn cws_fnc_showMessage};
//Do the actual unit healing as long as the process wasn't interrupted
if (!cws_healerStopped) then {
//Increment the revived counter
_unit setVariable ["cws_ais_revived_counter", _revived_counter + 1];
//Do the healing
[_unit, _healer] call cws_fnc_handleHeal;
//Broadcast unit agony state
_unit setVariable ["cws_ais_agony", false, true];
} else {
if (isPlayer _healer) then {["You have stopped the healing process."] spawn cws_fnc_showMessage};
};// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_unit","_current_head_damage","_current_body_damage","_current_overall_damage","_current_legs_damage","_current_hands_damage","_average_damage"];
_unit = _this select 0;
if(!local _unit) exitWith {
if(cws_ais_debugging) then {
//diag_log format["Unit was remote - %1 damage: %2", _unit, damage _unit];
};
damage _unit
};
if(isNil {_unit getVariable "cws_ais_bodyhit"}) then {_unit setVariable ["cws_ais_bodyhit",0]};
if(isNil {_unit getVariable "cws_ais_headhit"}) then {_unit setVariable ["cws_ais_headhit",0]};
if(isNil {_unit getVariable "cws_ais_overall"}) then {_unit setVariable ["cws_ais_overall",0]};
if(isNil {_unit getVariable "cws_ais_legshit"}) then {_unit setVariable ["cws_ais_legshit",0]};
if(isNil {_unit getVariable "cws_ais_handshit"}) then {_unit setVariable ["cws_ais_handshit",0]};
_current_head_damage = _unit getVariable "cws_ais_headhit";
_current_body_damage = _unit getVariable "cws_ais_bodyhit";
_current_overall_damage = _unit getVariable "cws_ais_overall";
_current_legs_damage = _unit getVariable "cws_ais_legshit";
_current_hands_damage = _unit getVariable "cws_ais_handshit";
_average_damage = _current_head_damage * 0.25 + _current_body_damage * 0.25 + _current_overall_damage * 0.25 + _current_legs_damage * 0.125 + _current_hands_damage * 0.125;
if(isNil "_average_damage") exitWith {
if(cws_ais_debugging) then {
diag_log format["Average was nil - %1 damage: %2", _unit, damage _unit];
};
damage _unit
};
if(_average_damage <= 0) exitWith {
if(cws_ais_debugging) then {
diag_log format["Average was 0 - %1 damage: %2", _unit, damage _unit];
};
damage _unit
};
_average_damage// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ['_unit','_bodypart','_damage','_source','_ammo','_scaled_damage','_agony','_part_total_damage','_scale','_delay','_can_die'];
_unit = _this select 0;
_bodypart = _this select 1;
_damage = _this select 2;
_source = _this select 3;
_ammo = _this select 4;
_scaled_damage = _damage / (cws_ais_rambofactor max 1);
_agony = false;
if(cws_ais_debugging) then {
//diag_log format["%1 took %2 damage in the %3 from %4", _unit, _scaled_damage, _bodypart, _source];
};
//Stop any damage that doesn't have a source defined
//This is a known bug with HandleDamage EVH
if(isNull _source) exitWith {0};
//Skip over the unit if it's not local
if(!local _unit) exitWith {0};
//If the unit is no longer alive flag them has having died and exit
if (!alive _unit) exitWith {
_unit setVariable ["cws_ais_unit_died", true];
0
};
if(cws_ais_debugging) then {
//diag_log format["%1 has %2 AIS damage and %3 vanilla damage", _unit, [_unit] call cws_fnc_getUnitDamage, damage _unit];
};
if(isNil {_unit getVariable "cws_ais_bodyhit"}) then {_unit setVariable ["cws_ais_bodyhit",0]};
if(isNil {_unit getVariable "cws_ais_headhit"}) then {_unit setVariable ["cws_ais_headhit",0]};
if(isNil {_unit getVariable "cws_ais_overall"}) then {_unit setVariable ["cws_ais_overall",0]};
if(isNil {_unit getVariable "cws_ais_legshit"}) then {_unit setVariable ["cws_ais_legshit",0]};
if(isNil {_unit getVariable "cws_ais_handshit"}) then {_unit setVariable ["cws_ais_handshit",0]};
if(cws_ais_debugging) then {
//diag_log format["%1 has %2 AIS damage and %3 vanilla damage", _unit, [_unit] call cws_fnc_getUnitDamage, damage _unit];
};
switch _bodypart do {
case "body" : {
_part_total_damage = (_unit getVariable "cws_ais_bodyhit") + _scaled_damage;
_unit setVariable ["cws_ais_bodyhit", _part_total_damage];
if (_part_total_damage >= 0.9) then {
_agony = true;
} else {
_unit setHit ["body", _part_total_damage];
};
};
case "head" : {
_part_total_damage = (_unit getVariable "cws_ais_headhit") + _scaled_damage * 2;
_unit setVariable ["cws_ais_headhit", _part_total_damage];
if (_part_total_damage >= 0.9) then {
_agony = true;
} else {
_unit setHit ["head", _part_total_damage];
};
};
case "legs" : {
_part_total_damage = (_unit getVariable "cws_ais_legshit") + _scaled_damage;
_unit setVariable ["cws_ais_legshit", _part_total_damage];
if (_part_total_damage >= 1.8) then {
_agony = true;
} else {
_unit setHit ["legs", _part_total_damage];
};
};
case "legs_l" : {
_part_total_damage = (_unit getVariable "cws_ais_legshit") + _scaled_damage;
_unit setVariable ["cws_ais_legshit", _part_total_damage];
if (_part_total_damage >= 1.8) then {
_agony = true;
} else {
_unit setHit ["legs", _part_total_damage];
};
};
case "legs_r" : {
_part_total_damage = (_unit getVariable "cws_ais_legshit") + _scaled_damage;
_unit setVariable ["cws_ais_legshit", _part_total_damage];
if (_part_total_damage >= 1.8) then {
_agony = true;
} else {
_unit setHit ["legs", _part_total_damage];
};
};
case "hands" : {
_part_total_damage = (_unit getVariable "cws_ais_handshit") + _scaled_damage;
_unit setVariable ["cws_ais_handshit", _part_total_damage];
if (_part_total_damage >= 2.3) then {
_agony = true;
} else {
_unit setHit ["hands", _part_total_damage];
};
};
case "hands_l" : {
_part_total_damage = (_unit getVariable "cws_ais_handshit") + _scaled_damage;
_unit setVariable ["cws_ais_handshit", _part_total_damage];
if (_part_total_damage >= 2.3) then {
_agony = true;
} else {
_unit setHit ["hands", _part_total_damage];
};
};
case "hands_r" : {
_part_total_damage = (_unit getVariable "cws_ais_handshit") + _scaled_damage;
_unit setVariable ["cws_ais_handshit", _part_total_damage];
if (_part_total_damage >= 2.3) then {
_agony = true;
} else {
_unit setHit ["hands", _part_total_damage];
};
};
default {
_part_total_damage = (_unit getVariable "cws_ais_overall") + _scaled_damage;
_unit setVariable ["cws_ais_overall", _part_total_damage];
if (_part_total_damage >= 0.9) then {
_agony = true;
};
};
};
//If the agony request flag is set and the unit isn't already in agony, put the unit into agony
if (_agony && !(_unit getVariable "cws_ais_agony")) then {
//Set the invulnerability timer so the unit can't die when first going into agony
_delay = time + 10;
_unit setVariable ["cws_ais_fall_in_agony_time_delay", _delay];
//Set the agony state
_unit setVariable ["cws_ais_agony", true, true];
};
//Determine if the unit can die from this damage
_can_die = if((_unit getVariable "cws_ais_agony") && (time > (_unit getVariable "cws_ais_fall_in_agony_time_delay"))) then {true} else {false};
//If revive guaranty is turned off then force enable _can_die
if(!cws_ais_revive_guaranty) then {
_can_die = true;
};
//If the unit can die make sure that we don't scale the damage at all
//Otherwise scale down the damage
if(_can_die) then {
_scale = 1.0;
} else {
_scale = cws_ais_damage_limit / (([_unit] call cws_fnc_getUnitDamage) max cws_ais_damage_limit);
};
if(cws_ais_debugging) then {
//diag_log format["%1 Damaged: AIS=%2, Vanilla=%3, CanDie=%4", _unit, [_unit] call cws_fnc_getUnitDamage, damage _unit, _can_die];
};
_unit setVariable ["cws_ais_headhit", (_unit getVariable "cws_ais_headhit") * _scale, true];
_unit setVariable ["cws_ais_bodyhit", (_unit getVariable "cws_ais_bodyhit") * _scale, true];
_unit setVariable ["cws_ais_overall", (_unit getVariable "cws_ais_overall") * _scale, true];
_unit setVariable ["cws_ais_legshit", (_unit getVariable "cws_ais_legshit") * _scale, true];
_unit setVariable ["cws_ais_handshit", (_unit getVariable "cws_ais_handshit") * _scale, true];
[_unit, _can_die] call cws_fnc_setUnitDamage;
if(cws_ais_debugging) then {
//diag_log format["%1 Damaged: AIS=%2, Vanilla=%3, CanDie=%4", _unit, [_unit] call cws_fnc_getUnitDamage, damage _unit, _can_die];
};
0// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ['_unit','_healer','_has_medikit','_has_firstaidkit','_isMedic'];
_unit = _this select 0;
_healer = _this select 1;
_has_medikit = ((items _healer) find "Medikit" > -1);
_has_firstaidkit = ((items _healer) find "FirstAidKit" >= 0);
_isMedic = _healer call cws_fnc_isMedic;
if(!(_isMedic && _has_medikit) && !_has_firstaidkit) exitWith {false};
_current_headhit = _unit getVariable "cws_ais_headhit";
_current_bodyhit = _unit getVariable "cws_ais_bodyhit";
_current_overall = _unit getVariable "cws_ais_overall";
_current_legshit = _unit getVariable "cws_ais_legshit";
_current_handshit = _unit getVariable "cws_ais_handshit";
_revived_counter = _unit getVariable "cws_ais_revived_counter";
_core_healed = 1;
_extremeties_healed = 1;
switch (true) do {
//Medic: Yes, Medikit: Yes - Free and heal 99% of damage
case (_isMedic && _has_medikit) : {
_core_healed = 0.01;
_extremeties_healed = 0.01;
};
//Medic: Yes, FirstAid: Yes - Consume FirstAid and heal 75% of most damage and 50% of legs and hands
case (_isMedic && _has_firstaidkit) : {
_healer removeItem "FirstAidKit";
_core_healed = 0.25;
_extremeties_healed = 0.5;
};
//Medic: No, FirstAid: Yes - Consume FirstAid and heal 50% of damage of damage and 10% of legs and hands
case (!_isMedic && _has_firstaidkit) : {
_healer removeItem "FirstAidKit";
_core_healed = 0.5;
_extremeties_healed = 0.9;
};
};
if(local _unit) then {
_unit setVariable ["cws_ais_headhit", _core_healed * _current_headhit, true];
_unit setVariable ["cws_ais_bodyhit", _core_healed * _current_bodyhit, true];
_unit setVariable ["cws_ais_overall", _core_healed * _current_overall, true];
_unit setVariable ["cws_ais_legshit", _extremeties_healed * _current_legshit, true];
_unit setVariable ["cws_ais_handshit", _extremeties_healed * _current_handshit, true];
[_unit] call cws_fnc_setUnitDamage;
} else {
_unit setVariable ["cws_ais_headhit", _core_healed * _current_headhit];
_unit setVariable ["cws_ais_bodyhit", _core_healed * _current_bodyhit];
_unit setVariable ["cws_ais_overall", _core_healed * _current_overall];
_unit setVariable ["cws_ais_legshit", _extremeties_healed * _current_legshit];
_unit setVariable ["cws_ais_handshit", _extremeties_healed * _current_handshit];
[_unit] call cws_fnc_setUnitDamage;
cws_ais_healed = [_unit, _core_healed * _current_headhit, _core_healed * _current_bodyhit, _core_healed * _current_overall, _extremeties_healed * _current_legshit, _extremeties_healed * _current_handshit, _revived_counter];
publicVariable "cws_ais_healed";
};
false// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_key","_shift_state","_ctrl_state","_return","_isMedic"];
_key = _this select 1;
_shift_state = _this select 2;
_ctrl_state = _this select 3;
_return = _this call cws_fnc_keyUnbind;
//If one of the unbindings triggered then leave here
if(_return) exitWith {true};
//Check for self-revive key binding (Ctrl+E)
//The First Aid function checks that the player is a medic and has supplies, no need to check it here
if(_ctrl_state && {_key in [18]} && (player getVariable 'unit_is_unconscious') && cws_ais_allow_self_revive) then {
[player, player, true] spawn cws_fnc_firstaid;
};
false// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_unit","_display", "_texLower", "_texMiddle", "_texUpper", "_x", "_y", "_w", "_h"];
_unit = _this select 0;
if (_unit != player) exitWith {};
disableSerialization;
if (isnil {uinamespace getvariable "RscHealthTextures"}) then {uinamespace setvariable ["RscHealthTextures",displaynull]};
if (isnull (uinamespace getvariable "RscHealthTextures")) then {(["HealthPP_blood"] call bis_fnc_rscLayer) cutrsc ["RscHealthTextures","plain"]};
_display = uinamespace getvariable "RscHealthTextures";
_texLower = _display displayctrl 1211;
_texLower ctrlsetfade 1;
_texLower ctrlcommit 0;
_texMiddle = _display displayctrl 1212;
_texMiddle ctrlsetfade 1;
_texMiddle ctrlcommit 0;
_texUpper = _display displayctrl 1213;
_texUpper ctrlsetfade 1;
_texUpper ctrlcommit 0;
_x = ((0 * safezoneW) + safezoneX) + ((safezoneW - (2.125 * safezoneW * 3/4)) / 2);
_y = (-0.0625 * safezoneH) + safezoneY;
_w = 2.125 * safezoneW * 3/4;
_h = 1.125 * safezoneH;
_texLower ctrlsetposition [_x, _y, _w, _h];
_texMiddle ctrlsetposition [_x, _y, _w, _h];
_texUpper ctrlsetposition [_x, _y, _w, _h];
_texLower ctrlcommit 0;
_texMiddle ctrlcommit 0;
_texUpper ctrlcommit 0;
_texLower ctrlsetfade 0.2;
_texMiddle ctrlsetfade 0.7;
_texUpper ctrlsetfade 0.7;
_texLower ctrlcommit 0.2;
_texMiddle ctrlcommit 0.2;
_texUpper ctrlcommit 0.2;
waituntil {ctrlcommitted _texUpper};
waitUntil {!(_unit getVariable "cws_ais_agony") || {!alive _unit}};
sleep 0.5;
_texLower ctrlsetfade 1;
_texMiddle ctrlsetfade 1;
_texUpper ctrlsetfade 1;
_texUpper ctrlcommit 1.5;
sleep 1;
_texMiddle ctrlcommit 1;
sleep 0.5;
_texLower ctrlcommit 0.8;// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private["_injured","_return"];
_injured = _this select 0;
//Return true if the injured is alive, doesn't have a dragger, and doesn't already have a healer
_return = if (alive _injured && {isNull(_injured getVariable ["dragger",objNull])} && {isNull(_injured getVariable ["healer", objNull])}) then {true} else {false};
_return// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_healer","_isMedic"];
_healer = _this;
//Check if the class of the healer contains the attendant attribute
_isMedic = if (getNumber (configFile >> "CfgVehicles" >> (typeOf _healer) >> "attendant") == 1) then {true} else {false};
_isMedic// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_key","_return"];
_key = _this select 1;
_return = false;
_return = if ((player getVariable 'unit_is_unconscious') && {_key in [34]}) then {true} else {false}; // throw grenade
{
if ((player getVariable 'unit_is_unconscious') && {_key in (actionkeys _x)}) then {
_return = (_key == (actionkeys _x) select 0);
};
} forEach ['ReloadMagazine','Gear','SwitchWeapon','Diary'];
_return// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
#define __includedMates (units group _unit - [_unit])
private ["_unit","_need_help","_help_him"];
_unit = _this select 0;
_need_help = false;
_help_him = objNull;
{
if (_x getVariable "cws_ais_agony") then {_need_help = true};
if (_need_help) exitWith {_help_him = _x}
} forEach __includedMates;
if(cws_ais_debugging) then {
diag_log format["%1 is going to help %2", _unit, _help_him];
};
if (_need_help) then {
if (!isNull _help_him) then {
[_help_him, _unit] spawn cws_fnc_sendAIHealer;
};
};// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
#define MPSF_PROGBAR_BG (uiNamespace getVariable "mpsf_ProgressBar_gui_bg")
#define MPSF_PROGBAR_FG (uiNamespace getVariable "mpsf_ProgressBar_gui_fg")
#define MPSF_PROGBAR_TXT (uiNamespace getVariable "mpsf_ProgressBar_gui_txt")
disableSerialization;
_display = uinamespace getvariable ["mpsf_ProgressBar_gui",objNull];
if(isNull _display) then {
if (isnil "mpsf_hudtext_n") then { mpsf_hudtext_n = 2733;};
mpsf_hudtext_n cutRsc ["ais_ProgressBar","plain"];
mpsf_hudtext_n = mpsf_hudtext_n + 1;
_display = uinamespace getvariable ["mpsf_ProgressBar_gui",objNull];
};
_title = if(count _this > 0) then { _this select 0 }else{ "Progress" };
_value = if(count _this > 1) then { _this select 1 }else{ _this select 0 };
_sitrepArray = toarray format[" .....%1",str(round(_value * 100))+"%"];
{_sitrepArray set [_foreachindex,tostring [_x]]} foreach _sitrepArray;
_sitrep = "";
_sitrepFormat = "" + _title + ":%1";
_pos = ctrlPosition MPSF_PROGBAR_FG;
_maxWidth = ctrlPosition MPSF_PROGBAR_BG select 2;
_newval = (_maxWidth * (_value min 1) ) max 0.02;
_pos set [2, _newval];
MPSF_PROGBAR_BG ctrlSetFade 0.3;
MPSF_PROGBAR_BG ctrlCommit 0;
MPSF_PROGBAR_FG ctrlSetPosition _pos;
MPSF_PROGBAR_FG ctrlSetFade 0.3;
MPSF_PROGBAR_FG ctrlCommit 1;
MPSF_PROGBAR_TXT ctrlSetFade 0.0;
MPSF_PROGBAR_TXT ctrlCommit 0;
for "_i" from 0 to (count _sitrepArray - 1) do {
_letter = _sitrepArray select _i;
_delay = if ( _letter == "|" ) then { _letter = "
"; 1 } else { 0.01 };
_sitrep = _sitrep + _letter;
MPSF_PROGBAR_TXT ctrlsetstructuredtext parsetext format [_sitrepFormat,_sitrep + "_"];
sleep _delay;
};
if(isNil "mpsf_progressBar_sleepTimer") then {
mpsf_progressBar_sleepTimer = 5;
[] spawn {
waitUntil{ sleep 1;
mpsf_progressBar_sleepTimer = mpsf_progressBar_sleepTimer - 1;
mpsf_progressBar_sleepTimer <= 0
};
_pos = ctrlPosition MPSF_PROGBAR_FG;
_pos set [2,0.02];
MPSF_PROGBAR_BG ctrlSetFade 1;
MPSF_PROGBAR_BG ctrlCommit 1;
MPSF_PROGBAR_FG ctrlSetFade 1;
MPSF_PROGBAR_FG ctrlSetPosition _pos;
MPSF_PROGBAR_FG ctrlCommit 1;
MPSF_PROGBAR_TXT ctrlSetFade 1;
MPSF_PROGBAR_TXT ctrlCommit 1;
mpsf_progressBar_sleepTimer = nil;
};
};
mpsf_progressBar_sleepTimer = 5;// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
uinamespace setvariable ['mpsf_ProgressBar_gui', (_this select 0)];
uinamespace setvariable ['mpsf_ProgressBar_gui_bg', (_this select 0) displayCtrl 0];
uinamespace setvariable ['mpsf_ProgressBar_gui_fg', (_this select 0) displayCtrl 1];
uinamespace setvariable ['mpsf_ProgressBar_gui_txt', (_this select 0) displayCtrl 2];// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
/*
* Show a quote on screen, with the Quote in the center and author in the middle
*
* _this select 0: Quote
* _this select 1: Author of quote
* _this select 2: (optional) time to display (default 10)
*/
disableSerialization;
if (!isDedicated && {!hasInterface}) exitWith {};
if (!isNil {uinamespace getvariable "cws_title"}) exitWith {};
_quote = _this select 0;
_author = _this select 1;
_duration = if (count _this > 2) then {_this select 2} else {10};
disableSerialization;
_layer = "cwsDeadLayer" call BIS_fnc_rscLayer;
_layer cutRsc ["RscDeadQuote", "PLAIN"];
sleep 1;
_time = time;
waitUntil {
_xxx = uinamespace getvariable "cws_title";
!isNil "_xxx" || {_time + 1 > time}
};
_display = uinamespace getvariable "cws_title";
if (isNil "_display") exitWith {};
if (str (_display) != "no display") then {
_myText = format ["%1
%2", _quote, _author];
_text = parseText _myText;
_cntrl = _display displayCtrl 1793;
_cntrl ctrlSetStructuredText _text;
_cntrl ctrlCommit 0;
sleep _duration;
};
_layer cutfadeout 0;// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_unit","_closestsquadmate","_min_distance","_distance"];
_unit = _this select 0;
_closestsquadmate = if (count _this > 1) then {_this select 1} else {nil};
//If the unit needing aid is no longer alive or is no longer in agony, exit
if(!alive _unit || !(_unit getVariable "cws_ais_agony")) exitWith {};
sleep 5;
//If we got a closest squadmate in the function call but they are dead or in agony, remove them from the check
if (!isNil "_closestsquadmate") then {
if (!alive _closestsquadmate || {_closestsquadmate getVariable "cws_ais_agony"}) then {
_closestsquadmate = Nil;
};
};
//First loop through group check conditions:
//1. Must be closer than last unit
//2. Must NOT be a player
//3. Must be a medic
//4. Must have medical supplies
//5. Must be alive
//6. Must not be in agony
if (isNil "_closestsquadmate") then {
_min_distance = 100000;
{
_has_medikit = ((items _x) find "Medikit" > -1);
_has_firstaidkit = ((items _x) find "FirstAidKit" >= 0);
_isMedic = _x call cws_fnc_isMedic;
_distance = _unit distance _x;
if (_distance < _min_distance && {!isPlayer _x} && _isMedic && (_has_medikit || _has_firstaidkit) && alive _x && !(_x getVariable "cws_ais_agony")) then {
_min_distance = _distance;
_closestsquadmate = _x;
};
} foreach (units group _unit - [_unit]);
};
//Second loop through group check conditions:
//1. Must be closer than last unit
//2. Must NOT be a player
//3. Must have a first aid kit
//4. Must be alive
//5. Must not be in agony
if (isNil "_closestsquadmate") then {
_min_distance = 100000;
{
_has_firstaidkit = ((items _x) find "FirstAidKit" >= 0);
_distance = _unit distance _x;
if (_distance < _min_distance && {!isPlayer _x} && _has_firstaidkit && alive _x && !(_x getVariable "cws_ais_agony")) then {
_min_distance = _distance;
_closestsquadmate = _x;
};
} foreach (units group _unit - [_unit]);
};
//First loop through faction check conditions:
//1. Must be within 500 meters
//2. Must be on the same side as _unit
//3. Must be closer than last unit
//4. Must NOT be a player
//5. Must have medical supplies
//6. Must be alive
//7. Must NOT be in agony
if (isNil "_closestsquadmate") then {
_min_distance = 500;
_playerFaction = side (group _unit);
{
//Ensure that the group we're checking is on the same side as the injured unit
if((side _x) == _playerFaction) then {
{
_has_medikit = ((items _x) find "Medikit" > -1);
_has_firstaidkit = ((items _x) find "FirstAidKit" >= 0);
_isMedic = _x call cws_fnc_isMedic;
_distance = _unit distance _x;
if (_distance < _min_distance && {!isPlayer _x} && ((_isMedic && _has_medikit) || _has_firstaidkit) && alive _x && !(_x getVariable "cws_ais_agony")) then {
_min_distance = _distance;
_closestsquadmate = _x;
};
} foreach units _x;
};
} forEach allGroups;
};
//If the closest squadmate is still nil then wait a bit, calculate a new closest squadmate, and exit
if (isNil "_closestsquadmate") exitWith {
sleep 15;
[_unit] spawn cws_fnc_sendAIHealer;
};
//Main wait loop to get the closest squadmate to the unit
_closestsquadmate setBehaviour "AWARE";
_closestsquadmate doMove (position _unit);
WaitUntil {
_closestsquadmate distance _unit <= cws_ais_firstaid_distance ||
{!alive _unit} ||
{!(_unit getVariable "cws_ais_agony")} ||
{!alive _closestsquadmate} ||
{_closestsquadmate getVariable "cws_ais_agony"}
};
//If the closest squadmate goes down by the time they get to the injured unit then wait a bit, calculate a new closest squadmate, and exit
if (!alive _closestsquadmate || {_closestsquadmate getVariable "cws_ais_agony"}) exitWith {
sleep 15;
[_unit] spawn cws_fnc_sendAIHealer;
};
//If the injured unit is still viable start the first aid
if (alive _unit && {_unit getVariable "cws_ais_agony"}) then {
[_unit, _closestsquadmate] spawn cws_fnc_firstAid;
};// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ["_unit","_average_damage"];
_unit = _this select 0;
_allow_critical_damage = if (count _this > 1) then {_this select 1} else {false};
_average_damage = [_unit] call cws_fnc_getUnitDamage;
//Critical damage prevention
if ((_average_damage >= cws_ais_damage_limit) && !(_allow_critical_damage)) then {
_average_damage = cws_ais_damage_limit;
};
_unit setDamage _average_damage;// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private ['_unit','_fa_action','_drag_action'];
_unit = _this select 0;
//Add the First Aid and Drag actions to the unit
_fa_action = _unit addAction [
format["First Aid to %1", name _unit],
{_this spawn cws_fnc_firstAid}, _unit, 100, false, true, "",
"{not isNull (_target getVariable _x)} count ['healer','dragger'] == 0 && alive _target && vehicle _target == _target"
];
_drag_action = _unit addAction [
format["Drag %1", name _unit],
{_this spawn cws_fnc_drag}, _unit, 100, false, true, "",
"{not isNull (_target getVariable _x)} count ['healer','dragger'] == 0 && alive _target && vehicle _target == _target"
];
//Save the action handles so that we can easily clean up later
_unit setVariable ["fa_action", _fa_action, false];
_unit setVariable ["drag_action", _drag_action, false];// Authored by chessmaster42
// Based on 'A3 Wounding System' by Psychobastard
private["_unit"];
_unit = _this select 0;
_unit setVariable ["cws_ais_side", _side, true];
_unit setVariable ["cws_ais_itemStorage", [0,0]];
_unit setVariable ["cws_ais_unit_died", false];
if(isNil {_unit getVariable "cws_ais_bodyhit"}) then {_unit setVariable ["cws_ais_bodyhit",0]};
if(isNil {_unit getVariable "cws_ais_headhit"}) then {_unit setVariable ["cws_ais_headhit",0]};
if(isNil {_unit getVariable "cws_ais_overall"}) then {_unit setVariable ["cws_ais_overall",0]};
if(isNil {_unit getVariable "cws_ais_legshit"}) then {_unit setVariable ["cws_ais_legshit",0]};
if(isNil {_unit getVariable "cws_ais_handshit"}) then {_unit setVariable ["cws_ais_handshit",0]};
if(isNil {_unit getVariable "cws_ais_agony"}) then {_unit setVariable ["cws_ais_agony", false]};
if(isNil {_unit getVariable "unit_is_unconscious"}) then {_unit setVariable ["unit_is_unconscious", false]};
if(isNil {_unit getVariable "cws_ais_leader"}) then {_unit setVariable ["cws_ais_leader", false]};
if(isNil {_unit getVariable "dragger"}) then {_unit setVariable ["dragger", ObjNull]};
if(isNil {_unit getVariable "healer"}) then {_unit setVariable ["healer", ObjNull]};
if(isNil {_unit getVariable "cws_ais_fall_in_agony_time_delay"}) then {_unit setVariable ["cws_ais_fall_in_agony_time_delay", 0]};// Authored by chessmaster42
private["_message"];
_message = _this select 0;
[_message, 0, 0.035 * safezoneH + safezoneY, 5, 0.3] spawn BIS_fnc_dynamicText;// Control types
#define CT_STATIC 0
#define CT_BUTTON 1
#define CT_EDIT 2
#define CT_SLIDER 3
#define CT_COMBO 4
#define CT_LISTBOX 5
#define CT_TOOLBOX 6
#define CT_CHECKBOXES 7
#define CT_PROGRESS 8
#define CT_HTML 9
#define CT_STATIC_SKEW 10
#define CT_ACTIVETEXT 11
#define CT_TREE 12
#define CT_STRUCTURED_TEXT 13
#define CT_CONTEXT_MENU 14
#define CT_CONTROLS_GROUP 15
#define CT_SHORTCUTBUTTON 16
#define CT_XKEYDESC 40
#define CT_XBUTTON 41
#define CT_XLISTBOX 42
#define CT_XSLIDER 43
#define CT_XCOMBO 44
#define CT_ANIMATED_TEXTURE 45
#define CT_OBJECT 80
#define CT_OBJECT_ZOOM 81
#define CT_OBJECT_CONTAINER 82
#define CT_OBJECT_CONT_ANIM 83
#define CT_LINEBREAK 98
#define CT_USER 99
#define CT_MAP 100
#define CT_MAP_MAIN 101
#define CT_LISTNBOX 102
// Static styles
#define ST_POS 0x0F
#define ST_HPOS 0x03
#define ST_VPOS 0x0C
#define ST_LEFT 0x00
#define ST_RIGHT 0x01
#define ST_CENTER 0x02
#define ST_DOWN 0x04
#define ST_UP 0x08
#define ST_VCENTER 0x0C
#define ST_GROUP_BOX 96
#define ST_GROUP_BOX2 112
#define ST_ROUNDED_CORNER ST_GROUP_BOX + ST_CENTER
#define ST_ROUNDED_CORNER2 ST_GROUP_BOX2 + ST_CENTER
#define ST_TYPE 0xF0
#define ST_SINGLE 0x00
#define ST_MULTI 0x10
#define ST_TITLE_BAR 0x20
#define ST_PICTURE 0x30
#define ST_FRAME 0x40
#define ST_BACKGROUND 0x50
#define ST_GROUP_BOX 0x60
#define ST_GROUP_BOX2 0x70
#define ST_HUD_BACKGROUND 0x80
#define ST_TILE_PICTURE 0x90
#define ST_WITH_RECT 0xA0
#define ST_LINE 0xB0
#define ST_SHADOW 0x100
#define ST_NO_RECT 0x200
#define ST_KEEP_ASPECT_RATIO 0x800
#define ST_TITLE ST_TITLE_BAR + ST_CENTER
// Slider styles
#define SL_DIR 0x400
#define SL_VERT 0
#define SL_HORZ 0x400
#define SL_TEXTURES 0x10
// progress bar
#define ST_VERTICAL 0x01
#define ST_HORIZONTAL 0
// Listbox styles
#define LB_TEXTURES 0x10
#define LB_MULTI 0x20
// Tree styles
#define TR_SHOWROOT 1
#define TR_AUTOCOLLAPSE 2
// MessageBox styles
#define MB_BUTTON_OK 1
#define MB_BUTTON_CANCEL 2
#define MB_BUTTON_USER 4
////////////////
//Base Classes//
////////////////
class RscText
{
access = 0;
idc = -1;
type = CT_STATIC;
style = ST_MULTI;
linespacing = 1;
colorBackground[] = {0,0,0,0};
colorBorder[] = {0,0,0,0};
colorText[] = {1,1,1,1};
colorFocused[] = {0,0,0,0};
text = "";
shadow = 0;
font = "EtelkaNarrowMediumPro";
SizeEx = 0.03;
fixedWidth = 0;
x = 0;
y = 0;
h = 0;
w = 0;
};
class RscPicture
{
access = 0;
idc = -1;
type = CT_STATIC;
style = ST_PICTURE;
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
font = "PuristaLight";
sizeEx = 0;
lineSpacing = 0;
text = "";
fixedWidth = 0;
shadow = 0;
x = 0;
y = 0;
w = 0.2;
h = 0.15;
};
class RscEdit
{
//access = 0;
type = CT_EDIT;
x = 0;
y = 0;
h = 0.04;
w = 0.2;
colorBackground[] = {0.2,0.2,0.2,0.9};
colorBorder[] = {0,0,0,0};
colorDisabled[] = {0.4,0.4,0.4,0};
colorSelection[] = {0.8784,0.8471,0.651,1};
colorText[] = {0.95,0.95,0.95,1};
lineSpacing = 0.1;
autocomplete = "";
text = "";
size = 0.2;
style = ST_SINGLE;//"0x00 + 0x40";
font = "PuristaLight";
shadow = 2;
sizeEx = 0.03921;
};
class RscButton
{
access = 0;
type = CT_BUTTON;
text = "";
colorText[] = {1,1,1,.9};
colorDisabled[] = {0.4,0.4,0.4,0};
colorBackground[] = {0.75,0.75,0.75,0.8};
colorBackgroundDisabled[] = {0,0.0,0};
colorBackgroundActive[] = {0.75,0.75,0.75,1};
colorFocused[] = {0.75,0.75,0.75,.5};
colorShadow[] = {0.023529,0,0.0313725,1};
colorBorder[] = {0.023529,0,0.0313725,1};
soundEnter[] = {"\ca\ui\data\sound\onover",0.09,1};
soundPush[] = {"\ca\ui\data\sound\new1",0,0};
soundClick[] = {"\ca\ui\data\sound\onclick",0.07,1};
soundEscape[] = {"\ca\ui\data\sound\onescape",0.09,1};
style = 2;
x = 0;
y = 0;
w = 0.055589;
h = 0.039216;
shadow = 2;
font = "PuristaLight";
sizeEx = 0.03921;
offsetX = 0.003;
offsetY = 0.003;
offsetPressedX = 0.002;
offsetPressedY = 0.002;
borderSize = 0;
};
class RscFrame
{
type = CT_STATIC;
idc = -1;
style = ST_FRAME;
shadow = 2;
colorBackground[] = {1,1,1,1};
colorText[] = {1,1,1,0.9};
font = "PuristaLight";
sizeEx = 0.03;
text = "";
};
class Box
{
type = CT_STATIC;
idc = -1;
style = ST_CENTER;
shadow = 2;
colorBackground[] = { 0.2,0.2,0.2,0.9};
colorText[] = {1,1,1,0.9};
font = "PuristaLight";
sizeEx = 0.03;
text = "";
};author = "-PhysiksFPS-";
OnLoadName = "=CIVIL UNDEAD=";
OnLoadMission = "Grab your Best Squad and Collect The Intel! Fight of the UNDEAD PHENOMENON!";
loadScreen = "intro.jpg";
onLoadIntroTime = 1;
saving = 1; // disable saving
disableChannels[]={6};
disabledAi = 1;
enableDebugConsole = 0;
respawn = "BASE";
respawndelay = 15;
respawnDialog = 1;
respawnTemplates[] = {"MenuInventory", "MenuPosition"};
respawnOnStart = 1;
class Header
{
gameType = Coop;
minPlayers = 1;
maxPlayers = 40;
};
#include "defines.hpp"
#include "anvil\dialogs.hpp"
class CfgFunctions
{
#include "cws_injury\cfgFunctionsCWS.hpp"
class AFW
{
class anvil
{
file = "anvil";
// Spawn functions
class getRandomSpawnPosition
{
recompile = 1;
file = "anvil\spawn\fn_getRandomSpawnPosition.sqf";
};
class spawnAmmo
{
recompile = 1;
file = "anvil\spawn\fn_spawnAmmo.sqf";
};
class spawnSpecialWeapon
{
recompile = 1;
file = "anvil\spawn\fn_spawnSpecialWeapon.sqf";
};
class manageRandomPatrols
{
recompile = 1;
file = "anvil\spawn\fn_manageRandomPatrols.sqf";
};
class setPatrolDestination
{
recompile = 1;
file = "anvil\spawn\fn_setPatrolDestination.sqf";
};
class createAmmobox
{
recompile = 1;
file = "anvil\spawn\fn_createAmmobox.sqf";
};
class populateAmmobox
{
recompile = 1;
file = "anvil\spawn\fn_populateAmmobox.sqf";
};
// Objective functions
class completeObjective
{
recompile = 1;
file = "anvil\objective\fn_completeObjective.sqf";
};
class startObjective
{
recompile = 1;
file = "anvil\objective\fn_startObjective.sqf";
};
class spawnObjectives
{
recompile = 1;
file = "anvil\objective\fn_spawnObjectives.sqf";
};
class doEosSpawn
{
recompile = 1;
file = "anvil\objective\fn_doEosSpawn.sqf";
};
class doSetObjectiveState
{
recompile = 1;
file = "anvil\objective\fn_doSetObjectiveState.sqf";
};
class getObjectiveState
{
recompile = 1;
file = "anvil\objective\fn_getObjectiveState.sqf";
};
class setObjectiveState
{
recompile = 1;
file = "anvil\objective\fn_setObjectiveState.sqf";
};
// Utility functions
class NOP { recompile = 0; };
class addActionMP { recompile = 1; };
class globalHide { recompile = 1; };
// Mission functions
class Mission_Assassinate
{
recompile = 1;
file = "anvil\mission\fn_Mission_Assassinate.sqf";
};
class Mission_Capture
{
recompile = 1;
file = "anvil\mission\fn_Mission_Capture.sqf";
};
class Mission_Destroy
{
recompile = 1;
file = "anvil\mission\fn_Mission_Destroy.sqf";
};
class Mission_DestroyAmmo
{
recompile = 1;
file = "anvil\mission\fn_Mission_DestroyAmmo.sqf";
};
class Mission_DestroyHelo
{
recompile = 1;
file = "anvil\mission\fn_Mission_DestroyHelo.sqf";
};
class Mission_DestroyUav
{
recompile = 1;
file = "anvil\mission\fn_Mission_DestroyUav.sqf";
};
class Mission_DestroyAA
{
recompile = 1;
file = "anvil\mission\fn_Mission_DestroyAA.sqf";
};
class Mission_Intel
{
recompile = 1;
file = "anvil\mission\fn_Mission_Intel.sqf";
};
class Mission_IntelHelo
{
recompile = 1;
file = "anvil\mission\fn_Mission_IntelHelo.sqf";
};
class Mission_Move
{
recompile = 1;
file = "anvil\mission\fn_Mission_Move.sqf";
};
class Mission_Transit
{
recompile = 1;
file = "anvil\mission\fn_Mission_Transit.sqf";
};
// Module functions
class Module_setupVehicleUnlock
{
recompile = 1;
file = "anvil\module\fn_Module_setupVehicleUnlock.sqf";
};
class Module_activateVehicleUnlock
{
recompile = 1;
file = "anvil\module\fn_Module_activateVehicleUnlock.sqf";
};
};
};
};
class RscTitles
{
#include "cws_injury\dialogs\RscTitlesCWS.hpp"
};
class Params
{
class AFW_RandomCounterAttacks
{
title = "Random counter attacks when objectives captured";
values[] = {0, 1};
texts[] = {$STR_DISABLED,$STR_ENABLED};
default = 0;
};
class AFW_CounterAttackStrength
{
title = "Strength of counter attacks at each objective";
values[] = {1, 2, 3, 4};
texts[] = {"Weak", "Standard", "Heavy", "Insane"};
default = 1;
};
class AFW_CounterAttackLikelihood
{
title = "Likelihood of counter attacks at each objective";
values[] = {10, 25, 50, 75};
texts[] = {"Unlikely", "Possible", "Even Chance", "Likely"};
default = 25;
};
class AFW_EnemyStrength
{
title = "Enemy strength multiplier";
values[] = {1, 2, 3, 4};
texts[] = {"Weak", "Standard", "Heavy", "Insane"};
default = 1;
};
class AFW_NumberRandomPatrols
{
title = "The number of random patrols on the map";
values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
texts[] = {"0 (Disabled)", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
default = 0;
};
class CuratorUnlock
{
title = "God mode (Zeus starts with everything unlocked)"; //--- ToDo: Localize
values[] = {0,1};
texts[] = {$STR_DISABLED,$STR_ENABLED}; //--- ToDo: Localize
default = 1;
};
class CuratorModeratorRights
{
title = "Game Moderator rights"; //--- ToDo: Localize
values[] = {0,1,2};
texts[] = {"Cannot create objects (only editing is allowed)","Can create all objects","Can create only modules"}; //--- ToDo: Localize
default = 1;
};
};
ENGIMA_CIVILIANS_SilentDebugMode = false;
ENGIMA_CIVILIANS_DebugTextEventArgs = []; // Empty
ENGIMA_CIVILIANS_DebugMarkerEventArgs = []; // [name, position, size, direction, shape ("RECTANGLE" or "ELLIPSE"), markerColor, markerText (optional)] or alternatively [name, position, type, markerColor (optional), markerText (optional)]
ENGIMA_CIVILIANS_DeleteDebugMarkerEventArgs = []; // [name]
"ENGIMA_CIVILIANS_DebugTextEventArgs" addPublicVariableEventHandler {
ENGIMA_CIVILIANS_DebugTextEventArgs call ENGIMA_CIVILIANS_ShowDebugTextLocal;
};
"ENGIMA_CIVILIANS_DebugMarkerEventArgs" addPublicVariableEventHandler {
ENGIMA_CIVILIANS_DebugMarkerEventArgs call ENGIMA_CIVILIANS_SetDebugMarkerLocal;
};
"ENGIMA_CIVILIANS_DeleteDebugMarkerEventArgs" addPublicVariableEventHandler {
ENGIMA_CIVILIANS_DeleteDebugMarkerEventArgs call ENGIMA_CIVILIANS_DeleteDebugMarkerLocal;
};
/*
* Summary: Checks if a marker exists.
* Arguments:
* _marker: Marker name of marker to test.
* Returns: true if marker exists, else false.
*/
ENGIMA_CIVILIANS_MarkerExists = {
private ["_exists", "_marker"];
_marker = _this select 0;
_exists = false;
if (((getMarkerPos _marker) select 0) != 0 || ((getMarkerPos _marker) select 1 != 0)) then {
_exists = true;
};
_exists
};
/*
* Summary: Shows debug text on all clients.
* Remarks:
* if global variable "dre_var_CL_SilentDebugMode" is set to true, debug text will only be written to RTF-file and not shown on screen.
* Arguments:
* _text: Debug text.
*/
ENGIMA_CIVILIANS_ShowDebugTextAllClients = {
ENGIMA_CIVILIANS_DebugTextEventArgs = _this;
publicVariable "ENGIMA_CIVILIANS_DebugTextEventArgs";
ENGIMA_CIVILIANS_DebugTextEventArgs call ENGIMA_CIVILIANS_ShowDebugTextLocal;
};
/*
* Summary: Shows debug text on local client.
* Remarks:
* if global variable "dre_var_CL_SilentDebugMode" is set to true, debug text will only be written to RTF-file and not shown on screen.
* Arguments:
* _text: Debug text.
*/
ENGIMA_CIVILIANS_ShowDebugTextLocal = {
private ["_minutes", "_seconds"];
if (!isNull player) then {
if (!ENGIMA_CIVILIANS_SilentDebugMode) then {
player sideChat (_this select 0);
};
};
_minutes = floor (time / 60);
_seconds = floor (time - (_minutes * 60));
diag_log ((str _minutes + ":" + str _seconds) + " Debug: " + (_this select 0));
};
/*
* Summary: Shows debug marker on local client.
* Remarks:
* if global variable "dre_var_CL_SilentDebugMode" is set to true, debug marker will not shown.
* Arguments alternative #1 (Marker representing an area):
* _markerName: Marker's name. (must be global unique).
* _position: Marker's position.
* _size: Marker's size on array format [x, y].
* _direction: Marker's direction.
* _shape: "RECTANGLE" or "ELLIPSE".
* _markerColor: Marker's color ("Default", "ColorRed", "ColorYellow" etc.).
* [_markerText]: Optional. Marker's text.
* Arguments alternative #2 (Marker representing an icon).
* _markerName: Marker's name. (must be global unique).
* _position: Marker's position.
* _type: Markers icon type (applies to icons in cfgIcons, like "Warning", "Dot" etc.).
* [_markerColor]: Optional. Marker's color ("Default", "ColorRed", "ColorYellow" etc.).
* [_markerText]. Optional. Marker's text.
*/
ENGIMA_CIVILIANS_SetDebugMarkerLocal = {
private ["_markerName", "_position", "_size", "_direction", "_type", "_shape", "_markerColor", "_markerText"];
private ["_marker"];
if (!isNull player) then {
if (!ENGIMA_CIVILIANS_SilentDebugMode) then {
_markerName = _this select 0;
_position = _this select 1;
_markerColor = "Default";
_markerText = "";
if (count _this == 6) then {
_size = _this select 2;
_direction = _this select 3;
_shape = _this select 4;
_markerColor = _this select 5;
};
if (count _this == 7) then {
_size = _this select 2;
_direction = _this select 3;
_shape = _this select 4;
_markerColor = _this select 5;
_markerText = _this select 6;
};
if (count _this == 3) then {
_type = _this select 2;
_shape = "ICON";
};
if (count _this == 4) then {
_type = _this select 2;
_shape = "ICON";
_markerColor = _this select 3;
};
if (count _this == 5) then {
_type = _this select 2;
_shape = "ICON";
_markerColor = _this select 3;
_markerText = _this select 4;
};
// Delete old marker
if ([_markerName] call ENGIMA_CIVILIANS_MarkerExists) then {
deleteMarkerLocal _markerName;
};
// Set new marker
_marker = createMarkerLocal [_markerName, _position];
_marker setMarkerShapeLocal _shape;
_marker setMarkerColorLocal _markerColor;
_marker setMarkerTextLocal _markerText;
if (count _this == 6 || count _this == 7) then {
_marker setMarkerSizeLocal _size;
_marker setMarkerDirLocal _direction;
};
if (count _this == 3 || count _this == 4 || count _this == 5) then {
_marker setMarkerTypeLocal _type;
};
};
};
};
/*
* Summary: Shows debug marker on all clients.
* Remarks:
* if global variable "dre_var_CL_SilentDebugMode" is set to true, debug marker will not shown.
* Arguments alternative #1 (Marker representing an area):
* _markerName: Marker's name. (must be global unique).
* _position: Marker's position.
* _size: Marker's size on array format [x, y].
* _direction: Marker's direction.
* _shape: "RECTANGLE" or "ELLIPSE".
* _markerColor: Marker's color ("Default", "ColorRed", "ColorYellow" etc.).
* [_markerText]: Optional. Marker's text.
* Arguments alternative #2 (Marker representing an icon).
* _markerName: Marker's name. (must be global unique).
* _position: Marker's position.
* _type: Markers icon type (applies to icons in cfgIcons, like "Warning", "Dot" etc.).
* [_markerColor]: Optional. Marker's color ("Default", "ColorRed", "ColorYellow" etc.).
* [_markerText]. Optional. Marker's text.
*/
ENGIMA_CIVILIANS_SetDebugMarkerAllClients = {
ENGIMA_CIVILIANS_DebugMarkerEventArgs = _this;
publicVariable "ENGIMA_CIVILIANS_DebugMarkerEventArgs";
ENGIMA_CIVILIANS_DebugMarkerEventArgs call ENGIMA_CIVILIANS_SetDebugMarkerLocal;
};
/*
* Summary: Deletes a debug marker on local client.
* Arguments:
* _markerName: Name of marker to delete.
*/
ENGIMA_CIVILIANS_DeleteDebugMarkerLocal = {
private ["_markerName"];
_markerName = _this select 0;
deleteMarkerLocal _markerName;
};
/*
* Summary: Deletes a debug marker on all clients.
* Arguments:
* _markerName: Name of marker to delete.
*/
ENGIMA_CIVILIANS_DeleteDebugMarkerAllClients = {
ENGIMA_CIVILIANS_DeleteDebugMarkerEventArgs = _this;
publicVariable "ENGIMA_CIVILIANS_DeleteDebugMarkerEventArgs";
ENGIMA_CIVILIANS_DeleteDebugMarkerEventArgs call ENGIMA_CIVILIANS_DeleteDebugMarkerLocal;
};
/*
* This file contains config parameters and a function call to start the civilian script.
* The parameters in this file may be edited by the mission developer.
*
* See file Engima\Civilians\Documentation.txt for documentation and a full reference of
* how to customize and use Engima's Civilians.
*/
private ["_parameters"];
// Set civilian parameters.
_parameters = [
["UNIT_CLASSES", ["B_G_Soldier_AR_F", "B_G_Soldier_M_F", "C_man_1", "C_man_1_1_F", "C_man_1_2_F", "C_man_1_3_F", "C_man_polo_1_F", "C_man_polo_1_F_afro", "C_man_polo_1_F_euro", "C_man_polo_1_F_asia", "C_man_polo_2_F", "C_man_polo_2_F_afro", "C_man_polo_2_F_euro", "C_man_polo_2_F_asia", "C_man_polo_3_F", "C_man_polo_3_F_afro", "C_man_polo_3_F_euro", "C_man_polo_3_F_asia", "C_man_polo_4_F", "C_man_polo_4_F_afro", "C_man_polo_4_F_euro", "C_man_polo_4_F_asia", "C_man_polo_5_F", "C_man_polo_5_F_afro", "C_man_polo_5_F_euro", "C_man_polo_5_F_asia", "C_man_polo_6_F", "C_man_polo_6_F_afro", "C_man_polo_6_F_euro", "C_man_polo_6_F_asia", "C_man_p_fugitive_F", "C_man_p_fugitive_F_afro", "C_man_p_fugitive_F_euro", "C_man_p_fugitive_F_asia", "C_man_p_beggar_F", "C_man_p_beggar_F_afro", "C_man_p_beggar_F_euro", "C_man_p_beggar_F_asia", "C_man_w_worker_F", "C_scientist_F", "C_man_hunter_1_F", "C_man_p_shorts_1_F", "C_man_p_shorts_1_F_afro", "C_man_p_shorts_1_F_euro", "C_man_p_shorts_1_F_asia", "C_man_shorts_1_F", "C_man_shorts_1_F_afro", "C_man_shorts_1_F_euro", "C_man_shorts_1_F_asia", "C_man_shorts_2_F", "C_man_shorts_2_F_afro", "C_man_shorts_2_F_euro", "C_man_shorts_2_F_asia", "C_man_shorts_3_F", "C_man_shorts_3_F_afro", "C_man_shorts_3_F_euro", "C_man_shorts_3_F_asia", "C_man_shorts_4_F", "C_man_shorts_4_F_afro", "C_man_shorts_4_F_euro", "C_man_shorts_4_F_asia", "C_journalist_F", "C_Orestes", "C_Nikos", "C_Nikos_aged"]],
["UNITS_PER_BUILDING", 0.2],
["MAX_GROUPS_COUNT", 8],
["MIN_SPAWN_DISTANCE", 50],
["MAX_SPAWN_DISTANCE", 200],
["BLACKLIST_MARKERS", []],
["HIDE_BLACKLIST_MARKERS", true],
["ON_UNIT_SPAWNED_CALLBACK", {}],
["ON_UNIT_REMOVE_CALLBACK", { true }],
["DEBUG", false]
];
// Start the script
_parameters spawn ENGIMA_CIVILIANS_StartCivilians;
--- ENGIMA'S CIVILIANS (VER 1.00) ---
Engima's Civilians is a script that adds dynamic civilians to an Arma 3 mission. Civilians spawn near player(s) and are removed again when they are far away. Works on maps with enterable buildings.
You can customize how many civilians there will be, civilian units classes, the maximum number of groups to use, minimum spawn
distance, maximum spawn distance, and blacklist markers to define areas where no civilians will be. You also add callbacks if
you want to do something when units spawn or being removed.
Script works in singleplayer, multiplayer, hosted, dedicated, for JIPs, and on any map with enterable buildings.
--- CUSTOMIZATION ---
Customize the script by editing the startup parameters. The startup parameters list is an array of key value pairs. A key value
pair is a small array where the key object is a string with the name of the parameter setting and the value object is the actual
value to be used.
Here is the simplest example that starts the civilian script with all default parameters. This code are to
be put in Engima\Civilians\ConfigAndStart.sqf.
[] spawn ENGIMA_CIVILIANS_StartCivilians;
Here is an example that uses all parameters and first saves them in a variable named "_parameters". The function call (or spawn)
that starts the civilian script is beneath. This code are to be put in Engima\Civilians\ConfigAndStart.sqf.
// Set civilian parameters.
_parameters = [
["UNIT_CLASSES", ["C_man_1", "C_man_1_1_F", "C_man_1_2_F", "C_man_1_3_F", "C_man_polo_1_F", "C_man_polo_1_F_afro", "C_man_polo_1_F_euro", "C_man_polo_1_F_asia", "C_man_polo_2_F", "C_man_polo_2_F_afro", "C_man_polo_2_F_euro", "C_man_polo_2_F_asia", "C_man_polo_3_F", "C_man_polo_3_F_afro", "C_man_polo_3_F_euro", "C_man_polo_3_F_asia", "C_man_polo_4_F", "C_man_polo_4_F_afro", "C_man_polo_4_F_euro", "C_man_polo_4_F_asia", "C_man_polo_5_F", "C_man_polo_5_F_afro", "C_man_polo_5_F_euro", "C_man_polo_5_F_asia", "C_man_polo_6_F", "C_man_polo_6_F_afro", "C_man_polo_6_F_euro", "C_man_polo_6_F_asia", "C_man_p_fugitive_F", "C_man_p_fugitive_F_afro", "C_man_p_fugitive_F_euro", "C_man_p_fugitive_F_asia", "C_man_p_beggar_F", "C_man_p_beggar_F_afro", "C_man_p_beggar_F_euro", "C_man_p_beggar_F_asia", "C_man_w_worker_F", "C_scientist_F", "C_man_hunter_1_F", "C_man_p_shorts_1_F", "C_man_p_shorts_1_F_afro", "C_man_p_shorts_1_F_euro", "C_man_p_shorts_1_F_asia", "C_man_shorts_1_F", "C_man_shorts_1_F_afro", "C_man_shorts_1_F_euro", "C_man_shorts_1_F_asia", "C_man_shorts_2_F", "C_man_shorts_2_F_afro", "C_man_shorts_2_F_euro", "C_man_shorts_2_F_asia", "C_man_shorts_3_F", "C_man_shorts_3_F_afro", "C_man_shorts_3_F_euro", "C_man_shorts_3_F_asia", "C_man_shorts_4_F", "C_man_shorts_4_F_afro", "C_man_shorts_4_F_euro", "C_man_shorts_4_F_asia", "C_journalist_F", "C_Orestes", "C_Nikos", "C_Nikos_aged"]],
["UNITS_PER_BUILDING", 0.1],
["MAX_GROUPS_COUNT", 100],
["MIN_SPAWN_DISTANCE", 50],
["MAX_SPAWN_DISTANCE", 500],
["BLACKLIST_MARKERS", []],
["HIDE_BLACKLIST_MARKERS", true],
["ON_UNIT_SPAWNED_CALLBACK", {}],
["ON_UNIT_REMOVE_CALLBACK", { true }],
["DEBUG", true]
];
// Start the civilian script
_parameters spawn ENGIMA_CIVILIANS_StartCivilians;
Here is a complete list of the parameters and what they do:
* UNIT_CLASSES (Array): Array of unit classes that may be spawned. If you want to see more of one unit class than another,
then have it occur a couple of more often (or more seldom) in the array:
Example: ["C_man_1", "C_man_1", "C_man_1", "C_man_polo_1_F_asia"]
* UNITS_PER_BUILDING (Number): Number of units that are spawned. Since we want to see a lot more civilians per area unit in a
city compared to the country side, the number is set as "number of units per building". Default value is 0.1 which means
that if you have 50 buildings near you, you will have 5 civilians near you. A building or a civilian is regarded as "near"
if they are within the MAX_SPAWN_DISTANCE of any player.
Example: 0.1
* MAX_GROUPS_COUNT (Number): The maximum number of groups in Arma 3 is 144, and each civilian is most often put in a separate
group. This options is to prevent that too many groups are being spawned. E.g. if your mission make use of 30 groups except
for the groups created by Engima's Civilians, a good value here would be 110.
Example: 100
* MIN_SPAWN_DISTANCE (Number): Minimum spawn distance in meters from nearest human player on the map. Civilian units always
spawn inside buildings, so this option may be quite small. It should be at least 100 meters less than MAX_SPAWN_DISTANCE.
Example: 50
* MAX_SPAWN_DISTANCE (Number): Maximum spawn distance in meters from nearest human player on the map. Civilians more far away
than this number of meters are deleted. It should be at least 100 meters greater than MAX_SPAWN_DISTANCE.
Example: 500
* BLACKLIST_MARKERS (Array): An array of marker hames for markers where no civilians are allowed to be. Civilians will not
spawn nor have destination position inside any of these markers. However, a unit may spawn on one side of it and get a
destination on the other, and then the civ will probably walk the shortest way and cross the area. To make sure that no
civilians are inside these markers, set them to be greater than MAX_SPAWN_DISTANCE in radious.
Example: ["MilitaryAreaMarker", "NoCivsHereMarker"]
* HIDE_BLACKLIST_MARKERS (Boolean): Wether the area markers will be hidden or not. If true then the markers will be hidden on
the map for the players, otherwise it will be visible. Default value is true.
* ON_UNIT_SPAWNED_CALLBACK (Code): Code that is executed when a unit has spawned. Parameter _this is an array: 0: created
unit (Object). Note that this is executed with the "spawn" command.
Example: { hint ("A unit named " + vehicleVarName (_this select 0) + " created!")
* ON_UNIT_REMOVE_CALLBACK (Code): Code that is executed just before a unit is removed. Parameter _this is an array: 0: unit
that will be removed. Note that this is executed with the "call" command. Default value is { true }. If you return false
then the unit will not be deleted.
Example: { hint "Vehicle of type " + typename (_this select 0) + " will not be removed!"; false }
* DEBUG (Boolean): Whether script is running in debug mode or not. In debug mode all civilians are marked as dots on the map.
Can be true or false. Default value is false.
- USING MORE THAN ONE INSTANCE -
Script cannot run in more than one instance.
call compile preprocessFileLineNumbers "Engima\Civilians\Common\Common.sqf";
call compile preprocessFileLineNumbers "Engima\Civilians\Common\Debug.sqf";
// The following constants may be used to tweak behaviour
ENGIMA_CIVILIANS_SIDE = civilian; // If you for some reason want the units to spawn into another side.
ENGIMA_CIVILIANS_MINSKILL = 0.4; // If you spawn something other than civilians, you may want to set another skill level of the spawned units.
ENGIMA_CIVILIANS_MAXSKILL = 0.6; // If you spawn something other than civilians, you may want to set another skill level of the spawned units.
ENGIMA_CIVILIANS_MAXWAITINGTIME = 75; // Maximum standing still time in seconds
ENGIMA_CIVILIANS_RUNNINGCHANCE = 0.50; // Chance of running instead of walking
// Civilian personalities
ENGIMA_CIVILIANS_BEHAVIOURS = [
["CITIZEN", 100] // Default citizen with ordinary behaviour. Spawns in a house and walks to another house, and so on...
];
// Do not edit anything beneath this line!
ENGIMA_CIVILIANS_INSTANCE_NO = 0;
if (isServer) then {
call compile preprocessFileLineNumbers "Engima\Civilians\Server\ServerFunctions.sqf";
call compile preprocessFileLineNumbers "Engima\Civilians\ConfigAndStart.sqf";
};
ENGIMA_CIVILIANS_GetParamValue = {
private ["_params", "_key"];
private ["_value"];
_params = _this select 0;
_key = _this select 1;
_value = if (count _this > 2) then { _this select 2 } else { objNull };
{
if (_x select 0 == _key) then {
_value = _x select 1;
};
} foreach (_params);
_value
};
/*
* Summary: Checks if a position is inside a marker.
* Remarks: Marker can be of shape "RECTANGLE" or "ELLIPSE" and at any angle.
* Arguments:
* _markerName: Name of current marker.
* _pos: Position to test.
* Returns: true if position is inside marker. Else false.
*/
ENGIMA_CIVILIANS_PositionIsInsideMarker = {
private ["_markerName", "_pos"];
private ["_isInside", "_px", "_py", "_mpx", "_mpy", "_msx", "_msy", "_ma", "_xmin", "_xmax", "_ymin", "_ymax", "_rpx", "_rpy", "_res"];
_pos = _this select 0;
_markerName = _this select 1;
_px = _pos select 0;
_py = _pos select 1;
_mpx = (getMarkerPos _markerName) select 0;
_mpy = (getMarkerPos _markerName) select 1;
_msx = (getMarkerSize _markerName) select 0;
_msy = (getMarkerSize _markerName) select 1;
_ma = -(markerDir _markerName);
_xmin = _mpx - _msx;
_xmax = _mpx + _msx;
_ymin = _mpy - _msy;
_ymax = _mpy + _msy;
//Now, rotate point to investigate around markers center in order to check against a nonrotated marker
_rpx = ( (_px - _mpx) * cos(_ma) ) + ( (_py - _mpy) * sin(_ma) ) + _mpx;
_rpy = (-(_px - _mpx) * sin(_ma) ) + ( (_py - _mpy) * cos(_ma) ) + _mpy;
_isInside = false;
if (markerShape _markerName == "RECTANGLE") then {
if (((_rpx > _xmin) && (_rpx < _xmax)) && ((_rpy > _ymin) && (_rpy < _ymax))) then
{
_isInside = true;
};
};
if (markerShape _markerName == "ELLIPSE") then {
_res = (((_rpx-_mpx)^2)/(_msx^2)) + (((_rpy-_mpy)^2)/(_msy^2));
if ( _res < 1 ) then
{
_isInside = true;
};
};
_isInside
};
ENGIMA_CIVILIANS_GetAllPlayersPositions = {
private ["_playerPositions"];
_playerPositions = [];
if (isMultiplayer) then {
{
if (isPlayer _x) then {
_playerPositions pushBack (position vehicle _x);
};
} foreach (playableUnits);
}
else {
if (player == player) then {
_playerPositions = [position vehicle player];
};
};
// testing
//_playerPositions = [p1, p2];
_playerPositions
};
ENGIMA_CIVILIANS_CountPositionsInBuilding = {
private ["_building"];
private ["_count"];
_building = _this select 0;
_count = 0;
while { format ["%1", _building buildingPos _count] != "[0,0,0]" } do {
_count = _count + 1;
};
_count
};
ENGIMA_CIVILIANS_FindSpawnPosition = {
private ["_minSpawnDistance", "_playerBuildings", "_blackListMarkers"];
private ["_playerPositions", "_tries", "_positionFound", "_foundPosition", "_buildingPosCount", "_building", "_tooClose", "_buildingPosNo", "_playerBuilding"];
_minSpawnDistance = _this select 0;
_playerBuildings = _this select 1;
_blackListMarkers = _this select 2;
_playerPositions = call ENGIMA_CIVILIANS_GetAllPlayersPositions;
_tries = 0;
_positionFound = false;
_foundPosition = [];
while { count _playerBuildings > 0 && !_positionFound && _tries < 10 } do {
_tries = _tries + 1;
_playerBuilding = _playerBuildings select floor random count _playerBuildings;
_building = _playerBuilding select 0;
_buildingPosCount = _playerBuilding select 1;
//_buildingPosCount = [_building] call ENGIMA_CIVILIANS_CountPositionsInBuilding;
if (_buildingPosCount > 0) then {
_buildingPosNo = floor random _buildingPosCount;
_tooClose = false;
if (time > 5) then {
{
if (_x distance _building < _minSpawnDistance) then {
_tooClose = true;
};
} foreach _playerPositions;
};
if (!_tooClose) then {
if (!([getPos _building, _blackListMarkers] call ENGIMA_CIVILIANS_PositionInsideBlackMarker)) then {
_foundPosition = _building buildingPos _buildingPosNo;
_positionFound = true;
};
};
};
};
_foundPosition
};
ENGIMA_CIVILIANS_PositionInsideBlackMarker = {
private ["_pos", "_blackListMarkers"];
private ["_isInsideMarker"];
_pos = _this select 0;
_blackListMarkers = _this select 1;
_isInsideMarker = false;
{
if ([_pos, _x] call ENGIMA_CIVILIANS_PositionIsInsideMarker) then {
_isInsideMarker = true;
};
} foreach _blackListMarkers;
_isInsideMarker
};
ENGIMA_CIVILIANS_FindDestinationPosition = {
private ["_civilian", "_blackListMarkers", "_maxSpawnDistance"];
private ["_tries", "_positionFound", "_foundPosition", "_buildingPosCount", "_buildings", "_building", "_buildingPosNo", "_unitPos"];
_civilian = _this select 0;
_blackListMarkers = _this select 1;
_maxSpawnDistance = _this select 2;
_foundPosition = [];
_tries = 0;
_positionFound = false;
_unitPos = getPosAtl _civilian;
if (random 100 > 50) then {
// Pick a building
_buildings = nearestObjects [_unitPos, ["house"], _maxSpawnDistance];
while { count _buildings > 0 && !_positionFound && _tries < 10 } do {
_tries = _tries + 1;
_building = _buildings select floor random count _buildings;
_buildingPosCount = [_building] call ENGIMA_CIVILIANS_CountPositionsInBuilding;
if (_buildingPosCount > 0) then {
if (!([getPos _building, _blackListMarkers] call ENGIMA_CIVILIANS_PositionInsideBlackMarker)) then {
_buildingPosNo = floor random _buildingPosCount;
_foundPosition = _building buildingPos _buildingPosNo;
_positionFound = true;
};
};
};
}
else {
private ["_distance", "_angle", "_x", "_y", "_pos"];
while { !_positionFound && _tries < 10 } do {
_tries = _tries + 1;
_distance = random 200;
_angle = random 360;
_x = _distance * cos _angle;
_y = _distance * sin _angle;
_pos = [(_unitPos select 0) + _x, (_unitPos select 1) + _y];
if (!isOnRoad _pos && !surfaceIsWater _pos && !([_pos, _blackListMarkers] call ENGIMA_CIVILIANS_PositionInsideBlackMarker)) then {
_foundPosition = _pos;
_positionFound = true;
};
};
};
_foundPosition
};
ENGIMA_CIVILIANS_GetPlayerBuildings = {
private ["_allPlayerPositions", "_maxSpawnDistance", "_blackListMarkers"];
private ["_playerBuildings", "_buildings", "_playerBuildingsTemp", "_buildingPosCount"];
_allPlayerPositions = _this select 0;
_maxSpawnDistance = _this select 1;
_blackListMarkers = _this select 2;
_playerBuildings = [];
_allPlayerPositions = call ENGIMA_CIVILIANS_GetAllPlayersPositions;
{
_buildings = nearestObjects [_x, ["house"], _maxSpawnDistance];
sleep 0.01;
_buildings = _buildings - _playerBuildings;
sleep 0.01;
_playerBuildings = _playerBuildings + _buildings;
sleep 0.01;
} foreach _allPlayerPositions;
// Remove all buildings that have no positions or are inside blacklist markers
_playerBuildingsTemp = [];
{
_buildingPosCount = [_x] call ENGIMA_CIVILIANS_CountPositionsInBuilding;
if (_buildingPosCount > 0) then {
if (!([getPos _x, _blackListMarkers] call ENGIMA_CIVILIANS_PositionInsideBlackMarker)) then {
_playerBuildingsTemp pushBack [_x, _buildingPosCount];
};
}
} foreach _playerBuildings;
// hint str count _playerBuildingsTemp;
// {
// [str getPos (_x select 0), getPos (_x select 0), "mil_dot", "ColorYellow", ""] call ENGIMA_CIVILIANS_SetDebugMarkerAllClients;
// } foreach _playerBuildingsTemp;
_playerBuildingsTemp
};
ENGIMA_CIVILIANS_StartCivilians = {
private ["_unitClasses", "_unitsPerBuilding", "_maxGroupsCount", "_minSpawnDistance", "_maxSpawnDistance", "_blackListMarkers", "_hideBlacklistMarkers", "_fnc_OnSpawnCallback", "_fnc_OnRemoveCallback", "_debug"];
private ["_side", "_minSkill", "_maxSkill", "_unit", "_unitsCount"];
private ["_civilianItems", "_civilianItemsTemp"];
private ["_spawnUnit", "_allPlayerPositions", "_playerBuildings"];
_unitClasses = [_this, "UNIT_CLASSES", ["C_man_1", "C_man_1_1_F", "C_man_1_2_F", "C_man_1_3_F", "C_man_polo_1_F", "C_man_polo_1_F_afro", "C_man_polo_1_F_euro", "C_man_polo_1_F_asia", "C_man_polo_2_F", "C_man_polo_2_F_afro", "C_man_polo_2_F_euro", "C_man_polo_2_F_asia", "C_man_polo_3_F", "C_man_polo_3_F_afro", "C_man_polo_3_F_euro", "C_man_polo_3_F_asia", "C_man_polo_4_F", "C_man_polo_4_F_afro", "C_man_polo_4_F_euro", "C_man_polo_4_F_asia", "C_man_polo_5_F", "C_man_polo_5_F_afro", "C_man_polo_5_F_euro", "C_man_polo_5_F_asia", "C_man_polo_6_F", "C_man_polo_6_F_afro", "C_man_polo_6_F_euro", "C_man_polo_6_F_asia", "C_man_p_fugitive_F", "C_man_p_fugitive_F_afro", "C_man_p_fugitive_F_euro", "C_man_p_fugitive_F_asia", "C_man_p_beggar_F", "C_man_p_beggar_F_afro", "C_man_p_beggar_F_euro", "C_man_p_beggar_F_asia", "C_man_w_worker_F", "C_scientist_F", "C_man_hunter_1_F", "C_man_p_shorts_1_F", "C_man_p_shorts_1_F_afro", "C_man_p_shorts_1_F_euro", "C_man_p_shorts_1_F_asia", "C_man_shorts_1_F", "C_man_shorts_1_F_afro", "C_man_shorts_1_F_euro", "C_man_shorts_1_F_asia", "C_man_shorts_2_F", "C_man_shorts_2_F_afro", "C_man_shorts_2_F_euro", "C_man_shorts_2_F_asia", "C_man_shorts_3_F", "C_man_shorts_3_F_afro", "C_man_shorts_3_F_euro", "C_man_shorts_3_F_asia", "C_man_shorts_4_F", "C_man_shorts_4_F_afro", "C_man_shorts_4_F_euro", "C_man_shorts_4_F_asia", "C_Orestes", "C_Nikos", "C_Nikos_aged"]] call ENGIMA_CIVILIANS_GetParamValue;
_unitsPerBuilding = [_this, "UNITS_PER_BUILDING", 0.1] call ENGIMA_CIVILIANS_GetParamValue;
_maxGroupsCount = [_this, "MAX_GROUPS_COUNT", 100] call ENGIMA_CIVILIANS_GetParamValue;
_minSpawnDistance = [_this, "MIN_SPAWN_DISTANCE", 100] call ENGIMA_CIVILIANS_GetParamValue;
_maxSpawnDistance = [_this, "MAX_SPAWN_DISTANCE", 500] call ENGIMA_CIVILIANS_GetParamValue;
_blackListMarkers = [_this, "BLACKLIST_MARKERS", []] call ENGIMA_CIVILIANS_GetParamValue;
_hideBlacklistMarkers = [_this, "HIDE_BLACKLIST_MARKERS", true] call ENGIMA_CIVILIANS_GetParamValue;
_fnc_OnSpawnCallback = [_this, "ON_UNIT_SPAWNED_CALLBACK", {}] call ENGIMA_CIVILIANS_GetParamValue;
_fnc_OnRemoveCallback = [_this, "ON_UNIT_REMOVE_CALLBACK", { true }] call ENGIMA_CIVILIANS_GetParamValue;
_debug = [_this, "DEBUG", false] call ENGIMA_CIVILIANS_GetParamValue;
if (_hideBlacklistMarkers) then {
{
_x setMarkerAlpha 0;
} foreach _blackListMarkers;
};
_side = ENGIMA_CIVILIANS_SIDE;
_minSkill = ENGIMA_CIVILIANS_MINSKILL;
_maxSkill = ENGIMA_CIVILIANS_MAXSKILL;
_spawnUnit = {
private ["_side", "_minSpawnDistance", "_unitClasses", "_playerBuildings", "_blackListMarkers", "_fnc_OnSpawnCallback"];
private ["_pos", "_unit", "_group"];
_side = _this select 0;
_minSpawnDistance = _this select 1;
_unitClasses = _this select 2;
_playerBuildings = _this select 3;
_blackListMarkers = _this select 4;
_fnc_OnSpawnCallback = _this select 5;
_pos = [_minSpawnDistance, _playerBuildings, _blackListMarkers] call ENGIMA_CIVILIANS_FindSpawnPosition;
_unit = objNull;
if (count _pos > 0) then {
_group = createGroup _side;
_unit = _group createUnit [_unitClasses select floor random count _unitClasses, [0, 0, 100], [], random 360, "FORM"];
ENGIMA_CIVILIANS_INSTANCE_NO = ENGIMA_CIVILIANS_INSTANCE_NO + 1;
_unit setVehicleVarName "ENGIMA_CIVILIAN_UNIT_" + str ENGIMA_CIVILIANS_INSTANCE_NO;
doStop _unit;
_unit setPos _pos;
[_unit] spawn _fnc_OnSpawnCallback;
};
_unit
};
sleep 0.5;
_civilianItems = []; // Items of type [unit, behaviour, destination pos, last pos, isMoving, nextActionTime, isRunning].
while { true } do {
_allPlayerPositions = call ENGIMA_CIVILIANS_GetAllPlayersPositions;
_playerBuildings = [_allPlayerPositions, _maxSpawnDistance, _blackListMarkers] call ENGIMA_CIVILIANS_GetPlayerBuildings;
_unitsCount = ceil (_unitsPerBuilding * count _playerBuildings);
if (_unitsCount > _maxGroupsCount) then {
_unitsCount = _maxGroupsCount;
};
if (count _civilianItems < _unitsCount) then {
_unit = [_side, _minSpawnDistance, _unitClasses, _playerBuildings, _blackListMarkers, _fnc_OnSpawnCallback] call _spawnUnit;
if (!isNull _unit) then {
_unit setSkill _minSkill + random (_maxSkill - _minSkill);
_civilianItems pushBack [_unit, "CITIZEN", [], getPos _unit, false, time, random 1 < ENGIMA_CIVILIANS_RUNNINGCHANCE];
};
sleep 0.1;
};
_civilianItemsTemp = [];
{
private ["_civilian"];
private ["_tooClose", "_removeUnit", "_group"];
_civilian = _x select 0;
_tooClose = false;
{
if (_x distance _civilian < _maxSpawnDistance) then {
_tooClose = true;
};
} foreach _allPlayerPositions;
if (_tooClose) then {
_civilianItemsTemp pushBack _x;
}
else {
_removeUnit = [_civilian] call _fnc_OnRemoveCallback;
if (isNil "_removeUnit") then {
_removeUnit = true;
};
if (typeName _removeUnit != "BOOL") then {
_removeUnit = true;
};
if (!_removeUnit) then {
_civilianItemsTemp pushBack _x;
}
else {
_group = group _civilian;
[vehicleVarName _civilian] call ENGIMA_CIVILIANS_DeleteDebugMarkerAllClients;
deleteVehicle _civilian;
deleteGroup _group;
};
};
sleep 0.01;
} foreach _civilianItems;
_civilianItems = _civilianItemsTemp;
{
private ["_unit", "_behaviour", "_destinationPos", "_lastPos", "_isMoving", "_nextActionTime", "_isRunning"];
private ["_destPos"];
_unit = _x select 0;
_behaviour = _x select 1;
_destinationPos = _x select 2;
_lastPos = _x select 3;
_isMoving = _x select 4;
_nextActionTime = _x select 5;
_isRunning = _x select 6;
// If civilian has reached its destination
if (_isMoving && _lastPos distance getPos _unit < 1) then {
_isMoving = false;
_nextActionTime = time + random ENGIMA_CIVILIANS_MAXWAITINGTIME;
_x set [4, _isMoving]; // Set isMoving = false
_x set [5, _nextActionTime]; // Next action time
(group _unit) setFormDir random 360;
};
// If it is time for civilian to move
if (!_isMoving && time > _nextActionTime) then {
_destPos = [_unit, _blackListMarkers, _maxSpawnDistance] call ENGIMA_CIVILIANS_FindDestinationPosition;
if (count _destPos > 0) then {
_unit doMove _destPos;
_unit setBehaviour "SAFE";
_destinationPos = _destPos;
_isMoving = true;
_isRunning = random 1 < ENGIMA_CIVILIANS_RUNNINGCHANCE;
_x set [3, _destinationPos]; // Set destinationPos
_x set [4, _isMoving]; // Set isMoving
_x set [6, _isRunning]; // Set isRunning
};
};
if (_isRunning) then {
_unit setSpeedMode "NORMAL";
}
else {
_unit setSpeedMode "LIMITED";
};
_x set [3, getPos _unit];
if (_debug) then {
[vehicleVarName _unit, getPos _unit, "mil_dot", "ColorWhite", "Civ"] call ENGIMA_CIVILIANS_SetDebugMarkerAllClients;
};
} foreach _civilianItems;
sleep 3;
};
};
// INFANTRY SKILL
_InfskillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.6, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
1, // courage
1, // reloadSpeed
1, // commanding
1 // general
];
// ARMOUR SKILL
_ArmSkillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.6, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
1, // courage
1, // reloadSpeed
1, // commanding
1 // general
];
// LIGHT VEHICLE skill
_LigSkillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.6, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
1, // courage
1, // reloadSpeed
1, // commanding
1 // general
];
// HELICOPTER SKILL
_AIRskillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.6, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
1, // courage
1, // reloadSpeed
1, // commanding
1 // general
];
// STATIC SKILL
_STAskillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.6, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
1, // courage
1, // reloadSpeed
1, // commanding
1 // general
];
server setvariable ["INFskill",_InfskillSet];
server setvariable ["ARMskill",_ArmSkillSet];
server setvariable ["LIGskill",_LigSkillSet];
server setvariable ["AIRskill",_AIRskillSet];
server setvariable ["STAskill",_STAskillSet];if (!isServer) exitWith {};
private ["_fGroup","_cargoType","_vehType","_CHside","_mkrAgl","_initialLaunch","_pause","_eosZone","_hints","_waves","_aGroup","_side","_actCond","_enemyFaction","_mAH","_mAN","_distance","_grp","_cGroup","_bGroup","_CHType","_time","_timeout","_faction"];
_mkr=(_this select 0);_mPos=markerpos(_this select 0);_mkrX=getMarkerSize _mkr select 0;_mkrY=getMarkerSize _mkr select 1;_mkrAgl=markerDir _mkr;
_infantry=(_this select 1);_PApatrols=_infantry select 0;_PAgroupSize=_infantry select 1;
_LVeh=(_this select 2);_LVehGroups=_LVeh select 0;_LVgroupSize=_LVeh select 1;
_AVeh=(_this select 3);_AVehGroups=_AVeh select 0;
_SVeh=(_this select 4);_CHGroups=_SVeh select 0;_fSize=_SVeh select 1;
_settings=(_this select 5);_faction=_settings select 0;_mA=_settings select 1;_side=_settings select 2;
_heightLimit=if (count _settings > 4) then {_settings select 4} else {false};
_debug=if (count _settings > 5) then {_settings select 5} else {false};
_basSettings=(_this select 6);
_pause=_basSettings select 0;
_waves=_basSettings select 1;
_timeout=_basSettings select 2;
_eosZone=_basSettings select 3;
_hints=_basSettings select 4;
_initialLaunch= if (count _this > 7) then {_this select 7} else {false};
_Placement=(_mkrX + 500);
if (_mA==0) then {_mAH = 1;_mAN = 0.5;};
if (_mA==1) then {_mAH = 0;_mAN = 0;};
if (_mA==2) then {_mAH = 0.5;_mAN = 0.5;};
if (_side==EAST) then {_enemyFaction="east";};
if (_side==WEST) then {_enemyFaction="west";};
if (_side==INDEPENDENT) then {_enemyFaction="GUER";};
if (_side==CIVILIAN) then {_enemyFaction="civ";};
if ismultiplayer then {
if (_heightLimit) then
{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count playableunits > 0";
}else
{_actCond="{vehicle _x in thisList && isplayer _x} count playableunits > 0";
};}else{
if (_heightLimit) then
{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count allUnits > 0";
}else
{_actCond="{vehicle _x in thisList && isplayer _x} count allUnits > 0";};};
_basActivated = createTrigger ["EmptyDetector",_mPos];
_basActivated setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE];
_basActivated setTriggerActivation ["ANY","PRESENT",true];
_basActivated setTriggerStatements [_actCond,"",""];
_mkr setmarkercolor bastionColor;
_mkr setmarkeralpha _mAN;
waituntil {triggeractivated _basActivated};
_mkr setmarkercolor bastionColor;
_mkr setmarkeralpha _mAH;
_bastActive = createTrigger ["EmptyDetector",_mPos];
_bastActive setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE];
_bastActive setTriggerActivation ["any","PRESENT",true];
_bastActive setTriggerTimeout [1, 1, 1, true];
_bastActive setTriggerStatements [_actCond,"",""];
_bastClear = createTrigger ["EmptyDetector",_mPos];
_bastClear setTriggerArea [(_mkrX+(_Placement*0.3)),(_mkrY+(_Placement*0.3)),_mkrAgl,FALSE];
_bastClear setTriggerActivation [_enemyFaction,"NOT PRESENT",true];
_bastClear setTriggerStatements ["this","",""];
// PAUSE IF REQUESTED
if (_pause > 0 and !_initialLaunch) then {
for "_counter" from 1 to _pause do {
if (_hints) then {hint format ["Attack ETA : %1",(_pause - _counter)];};
sleep 1;};
};
// SPAWN PATROLS
_aGroup=[];
for "_counter" from 1 to _PApatrols do {
_pos = [_mPos, _Placement, random 360] call BIS_fnc_relPos;
_grp=[_pos,_PAgroupSize,_faction,_side] call EOS_fnc_spawngroup;
_aGroup set [count _aGroup,_grp];
if (_debug) then {PLAYER SIDECHAT (format ["Spawned Patrol: %1",_counter]);0= [_mkr,_counter,"patrol",getpos (leader _grp)] call EOS_debug};
};
//SPAWN LIGHT VEHICLES
_bGrp=[];
for "_counter" from 1 to _LVehGroups do {
_newpos = [_mPos, (_Placement +200), random 360] call BIS_fnc_relPos;
if (surfaceiswater _newpos) then {_vehType=8;_cargoType=10;}else{_vehType=7;_cargoType=9;};
_bGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
if ((_LVgroupSize select 0) > 0) then{
0=[(_bGroup select 0),_LVgroupSize,(_bGroup select 2),_faction,_cargoType] call eos_fnc_setcargo;
};
0=[(_bGroup select 2),"LIGskill"] call eos_fnc_grouphandlers;
_bGrp set [count _bGrp,_bGroup];
if (_debug) then {player sidechat format ["Light Vehicle:%1 - r%2",_counter,_LVehGroups];0= [_mkr,_counter,"Light Veh",(getpos leader (_bGroup select 2))] call EOS_debug};
};
//SPAWN ARMOURED VEHICLES
_cGrp=[];
for "_counter" from 1 to _AVehGroups do {
_newpos = [_mPos, _Placement, random 360] call BIS_fnc_relPos;
if (surfaceiswater _newpos) then {_vehType=8;}else{_vehType=2;};
_cGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
0=[(_cGroup select 2),"ARMskill"] call eos_fnc_grouphandlers;
_cGrp set [count _cGrp,_cGroup];
if (_debug) then {player sidechat format ["Armoured:%1 - r%2",_counter,_AVehGroups];0= [_mkr,_counter,"Armour",(getpos leader (_cGroup select 2))] call EOS_debug};
};
//SPAWN HELICOPTERS
_fGrp=[];
for "_counter" from 1 to _CHGroups do {
if ((_fSize select 0) > 0) then {_vehType=4}else{_vehType=3};
_newpos = [(markerpos _mkr), 1500, random 360] call BIS_fnc_relPos;
_fGroup=[_newpos,_side,_faction,_vehType,"fly"]call EOS_fnc_spawnvehicle;
_CHside=_side;
_fGrp set [count _fGrp,_fGroup];
if ((_fSize select 0) > 0) then {
_cargoGrp = createGroup _side;
0=[(_fGroup select 0),_fSize,_cargoGrp,_faction,9] call eos_fnc_setcargo;
0=[_cargoGrp,"INFskill"] call eos_fnc_grouphandlers;
_fGroup set [count _fGroup,_cargoGrp];
null = [_mkr,_fGroup,_counter] execvm "eos\functions\TransportUnload_fnc.sqf";
}else{
_wp1 = (_fGroup select 2) addWaypoint [(markerpos _mkr), 0];
_wp1 setWaypointSpeed "FULL";
_wp1 setWaypointType "SAD";};
if (_debug) then {player sidechat format ["Chopper:%1",_counter];0= [_mkr,_counter,"Chopper",(getpos leader (_fGroup select 2))] call EOS_debug};
};
// ADD WAYPOINTS
{
_getToMarker = _x addWaypoint [_mPos, 0];
_getToMarker setWaypointType "SAD";
_getToMarker setWaypointSpeed "NORMAL";
_getToMarker setWaypointBehaviour "AWARE";
_getToMarker setWaypointFormation "NO CHANGE";
}foreach _aGroup;
{
_getToMarker = (_x select 2) addWaypoint [_mPos, 0];
_getToMarker setWaypointType "SAD";
_getToMarker setWaypointSpeed "NORMAL";
_getToMarker setWaypointBehaviour "AWARE";
_getToMarker setWaypointFormation "NO CHANGE";
}foreach _cGrp;
{
_pos = [_mPos, (_mkrX + 50), random 360] call BIS_fnc_relPos;
_getToMarker = (_x select 2) addWaypoint [_pos, 0];
_getToMarker setWaypointType "UNLOAD";
_getToMarker setWaypointSpeed "NORMAL";
_getToMarker setWaypointBehaviour "AWARE";
_getToMarker setWaypointFormation "NO CHANGE";
_wp = (_x select 2) addWaypoint [_mPos, 1];
_wp setWaypointType "SAD";
_wp setWaypointSpeed "NORMAL";
_wp setWaypointBehaviour "AWARE";
_wp setWaypointFormation "NO CHANGE";
}foreach _bGrp;
waituntil {triggeractivated _bastActive};
for "_counter" from 1 to _timeout do {
if (_hints) then {
if (_waves > 1) then {hint format ["Next wave ETA : %1",(_timeout - _counter)];};};
sleep 1;
if (!triggeractivated _bastActive || getmarkercolor _mkr == "colorblack") exitwith
{
hint "Zone lost. You must re-capture it";
_mkr setmarkercolor hostileColor;
_mkr setmarkeralpha _mAN;
if (_eosZone) then {
null = [_mkr,[_PApatrols,_PAgroupSize],[_PApatrols,_PAgroupSize],[_LVehGroups,_LVgroupSize],[_AVehGroups,0,0,0],[_faction,_mA,350,_CHside]] execVM "eos\core\EOS_Core.sqf";
};
_waves=0;
};
};
_waves=(_waves - 1);
if (triggeractivated _bastActive and triggeractivated _bastClear and (_waves < 1) ) then
{
if (_hints) then {hint "Waves complete";};
_mkr setmarkercolor VictoryColor;
_mkr setmarkeralpha _mAN;
}else{
if (_waves >= 1) then {
if (_hints) then {hint "Reinforcements inbound";};
null = [_mkr,[_PApatrols,_PAgroupSize],[_LVehGroups,_LVgroupSize],[_AVehGroups],[_CHGroups,_fSize],_settings,[_pause,_waves,_timeout,_eosZone,_hints],true] execVM "eos\core\b_core.sqf";
};};
waituntil {getmarkercolor _mkr == "colorblack" OR getmarkercolor _mkr == VictoryColor OR getmarkercolor _mkr == hostileColor or !triggeractivated _bastActive};
if (_debug) then {player sidechat "delete units";};
{
{deleteVehicle _x} foreach units _x;
}foreach _aGroup;
if (count _cGrp > 0) then
{
{ _vehicle = _x select 0;
_crew = _x select 1;
_grp = _x select 2;
{deleteVehicle _x} forEach (_crew);
if (!(vehicle player == _vehicle)) then
{{deleteVehicle _x} forEach[_vehicle];};
{deleteVehicle _x} foreach units _grp;
deleteGroup _grp;
}foreach _cGrp;
};
if (count _bGrp > 0) then
{
{ _vehicle = _x select 0;
_crew = _x select 1;
_grp = _x select 2;
{deleteVehicle _x} forEach (_crew);
if (!(vehicle player == _vehicle)) then
{{deleteVehicle _x} forEach[_vehicle];};
{deleteVehicle _x} foreach units _grp;
deleteGroup _grp;
}foreach _bGrp;
};
// CACHE HELICOPTER TRANSPORT
if (count _fGrp > 0) then
{
{ _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2; _cargoGrp = _x select 3;
{deleteVehicle _x} forEach (_crew);
if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};
{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
{deleteVehicle _x} foreach units _cargoGrp;deleteGroup _cargoGrp;
}foreach _fGrp;};
deletevehicle _bastActive;deletevehicle _bastClear;deletevehicle _basActivated;
if (getmarkercolor _mkr == "colorblack") then {_mkr setmarkeralpha 0;};if (isServer) then {
private ["_CHgroupArray","_LVgroupArray","_PAgroupArray","_CHGroups","_AVehGroups","_LVehGroups","_PApatrols"];
_JIPmkr=(_this select 0);
_infantry=(_this select 1);
_PApatrols=_infantry select 0;
_PAgroupSize=_infantry select 1;
_LVeh=(_this select 2);
_LVehGroups=_LVeh select 0;
_LVgroupSize=_LVeh select 1;
_AVeh=(_this select 3);
_AVehGroups=_AVeh select 0;
_SVeh=(_this select 4);
_CHGroups=_SVeh select 0;
_CHgroupSize=_SVeh select 1;
_settings=(_this select 5);
_basSettings=(_this select 6);
if (_PAgroupSize==0) then {_PAgroupArray=[1,1]};
if (_PAgroupSize==1) then {_PAgroupArray=[2,4]};
if (_PAgroupSize==2) then {_PAgroupArray=[4,8]};
if (_PAgroupSize==3) then {_PAgroupArray=[8,12]};
if (_PAgroupSize==4) then {_PAgroupArray=[12,16]};
if (_PAgroupSize==5) then {_PAgroupArray=[16,20]};
if (_LVgroupSize==0) then {_LVgroupArray=[1,1]};
if (_LVgroupSize==1) then {_LVgroupArray=[2,4]};
if (_LVgroupSize==2) then {_LVgroupArray=[4,8]};
if (_LVgroupSize==3) then {_LVgroupArray=[8,12]};
if (_LVgroupSize==4) then {_LVgroupArray=[12,16]};
if (_LVgroupSize==5) then {_LVgroupArray=[16,20]};
if (_CHgroupSize==0) then {_CHgroupArray=[0,0]};
if (_CHgroupSize==1) then {_CHgroupArray=[2,4]};
if (_CHgroupSize==2) then {_CHgroupArray=[4,8]};
if (_CHgroupSize==3) then {_CHgroupArray=[8,12]};
if (_CHgroupSize==4) then {_CHgroupArray=[12,16]};
if (_CHgroupSize==5) then {_CHgroupArray=[16,20]};
{
_eosMarkers=server getvariable "EOSmarkers";
if (isnil "_eosMarkers") then {_eosMarkers=[];};
_eosMarkers set [count _eosMarkers,_x];
server setvariable ["EOSmarkers",_eosMarkers,true];
null = [_x,[_PApatrols,_PAgroupArray],[_LVehGroups,_LVgroupArray],[_AVehGroups],[_CHGroups,_CHgroupArray],_settings,_basSettings] execVM "eos\core\b_core.sqf";
}foreach _JIPmkr;
};if (!isServer) exitWith {};
private ["_newpos","_cargoType","_vehType","_dGrp","_mkrAgl","_side","_bGroup","_civZone","_fGrp","_fSize","_fGrps","_eGrp","_eGrps","_dGrps","_aMin","_aSize","_aGrps","_aGrp","_bMin","_units","_bSize","_bGrps","_bGrp","_trig","_cache","_grp","_crew","_vehicle","_actCond","_mAN","_mAH","_distance","_mA","_settings","_cGrp","_cSize","_cGrps","_taken","_clear","_enemyFaction","_faction","_n","_eosAct","_eosActivated","_debug","_mkr","_mPos","_mkrX","_mkrY","_callback"];
_mkr=(_this select 0);_mPos=markerpos(_this select 0);
_mkrX=getMarkerSize _mkr select 0;
_mkrY=getMarkerSize _mkr select 1;
_mkrAgl=markerDir _mkr;
_a=(_this select 1);_aGrps=_a select 0;_aSize=_a select 1;_aMin=_aSize select 0;
_b=(_this select 2);_bGrps=_b select 0;_bSize=_b select 1;_bMin=_bSize select 0;
_c=(_this select 3);_cGrps=_c select 0;_cSize=_c select 1;
_d=(_this select 4);_dGrps=_d select 0;_eGrps=_d select 1;_fGrps=_d select 2;_fSize=_d select 3;
_settings=(_this select 5);_faction=_settings select 0;_mA=_settings select 1;_distance=_settings select 2;_side=_settings select 3;
_heightLimit=if (count _settings > 4) then {_settings select 4} else {false};
_debug=if (count _settings > 5) then {_settings select 5} else {false};
_callback = if (count _settings > 6) then {_settings select 6} else {[]};
_cache= if (count _this > 6) then {_this select 6} else {false};
if (_side==EAST) then {_enemyFaction="east";_civZone=false;};
if (_side==WEST) then {_enemyFaction="west";_civZone=false;};
if (_side==INDEPENDENT) then {_enemyFaction="GUER";_civZone=false;};
if (_side==CIVILIAN) then {_enemyFaction="civ";_civZone=true;};
if (_mA==0) then {_mAH = 1;_mAN = 0.5;};
if (_mA==1) then {_mAH = 0;_mAN = 0;};
if (_mA==2) then {_mAH = 0.5;_mAN = 0.5;};
// INITIATE ZONE
_trig=format ["EOSTrigger%1",_mkr];
if (!_cache) then {
if ismultiplayer then {
if (_heightLimit) then
{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count playableunits > 0";
}else
{_actCond="{vehicle _x in thisList && isplayer _x} count playableunits > 0";
};}else{
if (_heightLimit) then
{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count allUnits > 0";
}else
{_actCond="{vehicle _x in thisList && isplayer _x} count allUnits > 0";};};
_eosActivated = createTrigger ["EmptyDetector",_mPos];
_eosActivated setTriggerArea [(_distance+_mkrX),(_distance+_mkrY),_mkrAgl,FALSE];
_eosActivated setTriggerActivation ["ANY","PRESENT",true];
_eosActivated setTriggerTimeout [1, 1, 1, true];
_eosActivated setTriggerStatements [_actCond,"",""];
server setvariable [_trig,_eosActivated];
}else{
_eosActivated=server getvariable _trig;
};
_mkr setmarkerAlpha _mAN;
if (!(getmarkercolor _mkr == VictoryColor)) then //IF MARKER IS GREEN DO NOT CHANGE COLOUR
{
_mkr setmarkercolor hostileColor;
};
waituntil {triggeractivated _eosActivated}; //WAIT UNTIL PLAYERS IN ZONE
if (!(getmarkercolor _mkr == "colorblack"))then {
if (!(getmarkercolor _mkr == VictoryColor)) then {_mkr setmarkerAlpha _mAH;};
// SPAWN HOUSE PATROLS
for "_counter" from 1 to _aGrps do {
if (isnil "_aGrp") then {_aGrp=[];};
if (_cache) then {
_cacheGrp=format ["HP%1",_counter];
_units=_eosActivated getvariable _cacheGrp;
_aSize=[_units,_units];
_aMin=_aSize select 0;
if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
};
if (_aMin > 0) then {
_aGroup=[_mPos,_aSize,_faction,_side] call EOS_fnc_spawngroup;
if (!surfaceiswater _mPos) then {
0=[_mPos,units _aGroup,_mkrX,0,[0,20],true,true] call shk_fnc_fillhouse;
}else{
0 = [_aGroup,_mkr] call EOS_fnc_taskpatrol;
};
_aGrp set [count _aGrp,_aGroup];
0=[_aGroup,"INFskill"] call eos_fnc_grouphandlers;
if (_debug) then {PLAYER SIDECHAT (format ["Spawned House Patrol: %1",_counter]);0= [_mkr,_counter,"House Patrol",getpos (leader _aGroup)] call EOS_debug};
};
};
// SPAWN PATROLS
for "_counter" from 1 to _bGrps do {
if (isnil "_bGrp") then {_bGrp=[];};
if (_cache) then {
_cacheGrp=format ["PA%1",_counter];
_units=_eosActivated getvariable _cacheGrp;
_bSize=[_units,_units];
_bMin=_bSize select 0;
if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
};
if (_bMin > 0) then {
_pos = [_mkr,true] call SHK_pos;
_bGroup=[_pos,_bSize,_faction,_side] call EOS_fnc_spawngroup;
0 = [_bGroup,_mkr] call EOS_fnc_taskpatrol;
_bGrp set [count _bGrp,_bGroup];
0=[_bGroup,"INFskill"] call eos_fnc_grouphandlers;
if (_debug) then {PLAYER SIDECHAT (format ["Spawned Patrol: %1",_counter]);0= [_mkr,_counter,"patrol",getpos (leader _bGroup)] call EOS_debug};
};
};
//SPAWN LIGHT VEHICLES
for "_counter" from 1 to _cGrps do {
if (isnil "_cGrp") then {_cGrp=[];};
_newpos=[_mkr,50] call EOS_fnc_findSafePos;
if (surfaceiswater _newpos) then {_vehType=8;_cargoType=10;}else{_vehType=7;_cargoType=9;};
_cGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
if ((_cSize select 0) > 0) then{
0=[(_cGroup select 0),_cSize,(_cGroup select 2),_faction,_cargoType] call eos_fnc_setcargo;
};
0=[(_cGroup select 2),"LIGskill"] call eos_fnc_grouphandlers;
0 = [(_cGroup select 2),_mkr] call EOS_fnc_taskpatrol;
_cGrp set [count _cGrp,_cGroup];
if (_debug) then {player sidechat format ["Light Vehicle:%1 - r%2",_counter,_cGrps];0= [_mkr,_counter,"Light Veh",(getpos leader (_cGroup select 2))] call EOS_debug};
};
//SPAWN ARMOURED VEHICLES
for "_counter" from 1 to _dGrps do {
if (isnil "_dGrp") then {_dGrp=[];};
_newpos=[_mkr,50] call EOS_fnc_findSafePos;
if (surfaceiswater _newpos) then {_vehType=8;}else{_vehType=2;};
_dGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
0=[(_dGroup select 2),"ARMskill"] call eos_fnc_grouphandlers;
0 = [(_dGroup select 2),_mkr] call EOS_fnc_taskpatrol;
_dGrp set [count _dGrp,_dGroup];
if (_debug) then {player sidechat format ["Armoured:%1 - r%2",_counter,_dGrps];0= [_mkr,_counter,"Armour",(getpos leader (_dGroup select 2))] call EOS_debug};
};
//SPAWN STATIC PLACEMENTS
for "_counter" from 1 to _eGrps do {
if (surfaceiswater _mPos) exitwith {};
if (isnil "_eGrp") then {_eGrp=[];};
_newpos=[_mkr,50] call EOS_fnc_findSafePos;
_eGroup=[_newpos,_side,_faction,5]call EOS_fnc_spawnvehicle;
0=[(_eGroup select 2),"STAskill"] call eos_fnc_grouphandlers;
_eGrp set [count _eGrp,_eGroup];
if (_debug) then {player sidechat format ["Static:%1",_counter];0= [_mkr,_counter,"Static",(getpos leader (_eGroup select 2))] call EOS_debug};
};
//SPAWN CHOPPER
for "_counter" from 1 to _fGrps do {
if (isnil "_fGrp") then {_fGrp=[];};
if ((_fSize select 0) > 0) then {_vehType=4}else{_vehType=3};
_newpos = [(markerpos _mkr), 1500, random 360] call BIS_fnc_relPos;
_fGroup=[_newpos,_side,_faction,_vehType,"fly"]call EOS_fnc_spawnvehicle;
_fGrp set [count _fGrp,_fGroup];
if ((_fSize select 0) > 0) then {
_cargoGrp = createGroup _side;
0=[(_fGroup select 0),_fSize,_cargoGrp,_faction,9] call eos_fnc_setcargo;
0=[_cargoGrp,"INFskill"] call eos_fnc_grouphandlers;
_fGroup set [count _fGroup,_cargoGrp];
null = [_mkr,_fGroup,_counter] execvm "eos\functions\TransportUnload_fnc.sqf";
}else{
_wp1 = (_fGroup select 2) addWaypoint [(markerpos _mkr), 0];
_wp1 setWaypointSpeed "FULL";
_wp1 setWaypointType "SAD";};
0=[(_fGroup select 2),"AIRskill"] call eos_fnc_grouphandlers;
if (_debug) then {player sidechat format ["Chopper:%1",_counter];0= [_mkr,_counter,"Chopper",(getpos leader (_fGroup select 2))] call EOS_debug};
};
//SPAWN ALT TRIGGERS
_clear = createTrigger ["EmptyDetector",_mPos];
_clear setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE];
_clear setTriggerActivation [_enemyFaction,"NOT PRESENT",true];
_clear setTriggerStatements ["this","",""];
_taken = createTrigger ["EmptyDetector",_mPos];
_taken setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE];
_taken setTriggerActivation ["ANY","PRESENT",true];
_taken setTriggerStatements ["{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count allUnits > 0","",""];
_eosAct=true;
while {_eosAct} do
{
// IF PLAYER LEAVES THE AREA OR ZONE DEACTIVATED
if (!triggeractivated _eosActivated || getmarkercolor _mkr == "colorblack") exitwith
{
if (_debug) then {if (!(getmarkercolor _mkr == "colorblack")) then {hint "Restarting Zone AND deleting units";}else{hint "EOS zone deactivated";};};
//CACHE LIGHT VEHICLES
if (!isnil "_cGrp") then
{
{ _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
if (!alive _vehicle || {!alive _x} foreach _crew) then { _cGrps= _cGrps - 1;};
{deleteVehicle _x} forEach (_crew);
if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};
{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
}foreach _cGrp;
if (_debug) then {player sidechat format ["ID:c%1",_cGrps];};};
// CACHE ARMOURED VEHICLES
if (!isnil "_dGrp") then
{
{ _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
if (!alive _vehicle || {!alive _x} foreach _crew) then {_dGrps= _dGrps - 1;};
{deleteVehicle _x} forEach (_crew);
if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};
{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
}foreach _dGrp;
if (_debug) then {player sidechat format ["ID:c%1",_dGrps];};};
// CACHE PATROL INFANTRY
if (!isnil "_bGrp") then
{ _n=0;
{ _n=_n+1;_units={alive _x} count units _x;_cacheGrp=format ["PA%1",_n];
if (_debug) then{player sidechat format ["ID:%1,cache - %2",_cacheGrp,_units];};
_eosActivated setvariable [_cacheGrp,_units];
{deleteVehicle _x} foreach units _x;deleteGroup _x;
}foreach _bGrp;
};
// CACHE HOUSE INFANTRY
if (!isnil "_aGrp") then
{ _n=0;
{ _n=_n+1;_units={alive _x} count units _x;_cacheGrp=format ["HP%1",_n];
if (_debug) then{player sidechat format ["ID:%1,cache - %2",_cacheGrp,_units];};
_eosActivated setvariable [_cacheGrp,_units];
{deleteVehicle _x} foreach units _x;deleteGroup _x;
}foreach _aGrp;
};
// CACHE MORTARS
if (!isnil "_eGrp") then
{
{ _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
if (!alive _vehicle || {!alive _x} foreach _crew) then {_eGrps= _eGrps - 1;};
{deleteVehicle _x} forEach (_crew);
if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};
{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
}foreach _eGrp;};
// CACHE HELICOPTER TRANSPORT
if (!isnil "_fGrp") then
{
{ _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2; _cargoGrp = _x select 3;
if (!alive _vehicle || {!alive _x} foreach _crew) then {_fGrps= _fGrps - 1;};
{deleteVehicle _x} forEach (_crew);
if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};
{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
if (!isnil "_cargoGrp") then {
{deleteVehicle _x} foreach units _cargoGrp;deleteGroup _cargoGrp;};
}foreach _fGrp;};
_eosAct=false;
if (_debug) then {hint "Zone Cached";};
};
if (triggeractivated _clear and triggeractivated _taken and !_civZone)exitwith
{// IF ZONE CAPTURED BEGIN CHECKING FOR ENEMIES
_cGrps=0;_aGrps=0;_bGrps=0;_dGrps=0;_eGrps=0;_fGrps=0;
while {triggeractivated _eosActivated AND !(getmarkercolor _mkr == "colorblack")} do {
if (!triggeractivated _clear) then
{
_mkr setmarkercolor hostileColor;
_mkr setmarkerAlpha _mAH;
if (_debug) then {
hint "Zone Lost";
};
} else {
_mkr setmarkercolor VictoryColor;
_mkr setmarkerAlpha _mAN;
if (_debug) then {hint "Zone Captured";};
if (count _callback == 2) then {
diag_log "EOS Objective Complete - calling victory function";
(_callback select 0) call (_callback select 1);
_callback = [];
if (true) exitWith { diag_log "Stopping EOS"; };
};
};
sleep 1;
};
// PLAYER LEFT ZONE
_eosAct=false;
};
sleep 0.5;
};
deletevehicle _clear;deletevehicle _taken;
if (!(getmarkercolor _mkr == "colorblack")) then {
null = [_mkr,[_aGrps,_aSize],[_bGrps,_bSize],[_cGrps,_cSize],[_dGrps,_eGrps,_fGrps,_fSize],_settings,true] execVM "eos\core\eos_core.sqf";
}else{_Mkr setmarkeralpha 0;};
};if (isServer) then {
private ["_HPpatrols","_HPgroupProbability","_CHgroupArray","_LVgroupArray","_HPgroupArray","_PAgroupArray","_CHgroupSize","_CHGroups","_SVehGroups","_AVgroupSize","_AVehGroups","_LVehGroups","_LVgroupSize","_PAgroupSize","_PApatrols","_HPpatrols","_HPgroupSize"];
_JIPmkr=(_this select 0);
_HouseInfantry=(_this select 1);
_HPpatrols=_HouseInfantry select 0;
_HPgroupSize=_HouseInfantry select 1;
_HPgroupProbability=if (count _HouseInfantry > 2) then {_HouseInfantry select 2} else {100};
_infantry=(_this select 2);
_PApatrols=_infantry select 0;
_PAgroupSize=_infantry select 1;
_PAgroupProbability=if (count _infantry > 2) then {_infantry select 2} else {100};
_LVeh=(_this select 3);
_LVehGroups=_LVeh select 0;
_LVgroupSize=_LVeh select 1;
_LVgroupProbability=if (count _LVeh > 2) then {_LVeh select 2} else {100};
_AVgrp=(_this select 4);
_AVehGroups=_AVgrp select 0;
_AVgroupProbability=if (count _AVgrp > 1) then {_AVgrp select 1} else {100};
_SVgrp=(_this select 5);
_SVehGroups=_SVgrp select 0;
_SVgroupProbability=if (count _SVgrp > 1) then {_SVgrp select 1} else {100};
_CHGrp=(_this select 6);
_CHGroups=_CHGrp select 0;
_CHgroupSize=_CHGrp select 1;
_CHgroupProbability=if (count _CHGrp > 2) then {_CHGrp select 2} else {100};
_settings=(_this select 7);
if (_HPgroupProbability > floor random 100) then {
if (_HPgroupSize==0) then {_HPgroupArray=[1,1]};
if (_HPgroupSize==1) then {_HPgroupArray=[2,4]};
if (_HPgroupSize==2) then {_HPgroupArray=[4,8]};
if (_HPgroupSize==3) then {_HPgroupArray=[8,12]};
if (_HPgroupSize==4) then {_HPgroupArray=[12,16]};
if (_HPgroupSize==5) then {_HPgroupArray=[16,20]};
}else{_HPpatrols=0;_HPgroupArray=[1,1];};
if (_PAgroupProbability > floor random 100) then {
if (_PAgroupSize==0) then {_PAgroupArray=[1,1]};
if (_PAgroupSize==1) then {_PAgroupArray=[2,4]};
if (_PAgroupSize==2) then {_PAgroupArray=[4,8]};
if (_PAgroupSize==3) then {_PAgroupArray=[8,12]};
if (_PAgroupSize==4) then {_PAgroupArray=[12,16]};
if (_PAgroupSize==5) then {_PAgroupArray=[16,20]};
}else{_PApatrols=0;_PAgroupArray=[1,1];};
if (_LVgroupProbability > floor random 100) then {
if (_LVgroupSize==0) then {_LVgroupArray=[0,0]};
if (_LVgroupSize==1) then {_LVgroupArray=[2,4]};
if (_LVgroupSize==2) then {_LVgroupArray=[4,8]};
if (_LVgroupSize==3) then {_LVgroupArray=[8,12]};
if (_LVgroupSize==4) then {_LVgroupArray=[12,16]};
if (_LVgroupSize==5) then {_LVgroupArray=[16,20]};
}else{_LVehGroups=0;_LVgroupArray=[0,0];};
if (_AVgroupProbability > floor random 100) then {
}else{_AVehGroups=0;};
if (_SVgroupProbability > floor random 100) then {
}else{_SVehGroups=0;};
if (_CHgroupProbability > floor random 100) then {
if (_CHgroupSize==0) then {_CHgroupArray=[0,0]};
if (_CHgroupSize==1) then {_CHgroupArray=[2,4]};
if (_CHgroupSize==2) then {_CHgroupArray=[4,8]};
if (_CHgroupSize==3) then {_CHgroupArray=[8,12]};
if (_CHgroupSize==4) then {_CHgroupArray=[12,16]};
if (_CHgroupSize==5) then {_CHgroupArray=[16,20]};
}else{_CHGroups=0;_CHgroupArray=[0,0]};
{
_eosMarkers=server getvariable "EOSmarkers";
if (isnil "_eosMarkers") then {_eosMarkers=[];};
_eosMarkers set [count _eosMarkers,_x];
server setvariable ["EOSmarkers",_eosMarkers,true];
null = [_x,[_HPpatrols,_HPgroupArray],[_PApatrols,_PAgroupArray],[_LVehGroups,_LVgroupArray],[_AVehGroups,_SVehGroups,_CHGroups,_CHgroupArray],_settings] execVM "eos\core\EOS_Core.sqf";
}foreach _JIPmkr;
};
IF (isnil "server")then{hint "YOU MUST PLACE A GAME LOGIC NAMED SERVER!";};
eos_fnc_spawnvehicle=compile preprocessfilelinenumbers "eos\functions\eos_SpawnVehicle.sqf";
eos_fnc_grouphandlers=compile preprocessfilelinenumbers "eos\functions\setSkill.sqf";
eos_fnc_findsafepos=compile preprocessfilelinenumbers "eos\functions\findSafePos.sqf";
eos_fnc_spawngroup= compile preprocessfile "eos\functions\infantry_fnc.sqf";
eos_fnc_setcargo = compile preprocessfile "eos\functions\cargo_fnc.sqf";
eos_fnc_taskpatrol= compile preprocessfile "eos\functions\shk_patrol.sqf";
SHK_pos= compile preprocessfile "eos\functions\shk_pos.sqf";
shk_fnc_fillhouse = compile preprocessFileLineNumbers "eos\Functions\SHK_buildingpos.sqf";
eos_fnc_getunitpool= compile preprocessfilelinenumbers "eos\UnitPools.sqf";
call compile preprocessfilelinenumbers "eos\AI_Skill.sqf";
EOS_Deactivate = {
private ["_mkr"];
_mkr=(_this select 0);
{
_x setmarkercolor "colorblack";
_x setmarkerAlpha 0;
}foreach _mkr;
};
EOS_debug = {
private ["_note"];
_mkr=(_this select 0);
_n=(_this select 1);
_note=(_this select 2);
_pos=(_this select 3);
_mkrID=format ["%3:%1,%2",_mkr,_n,_note];
deletemarker _mkrID;
_debugMkr = createMarker[_mkrID,_pos];
_mkrID setMarkerType "Mil_dot";
_mkrID setMarkercolor "colorBlue";
_mkrID setMarkerText _mkrID;
_mkrID setMarkerAlpha 0.5;
};if (!isServer) exitWith {};
private ["_cargoPool","_emptySeats","_vehicle","_debug","_grp","_grpSize"];
_vehicle=(_this select 0);
_grpSize=(_this select 1);
_grp=(_this select 2);
_faction=(_this select 3);
_cargoType=(_this select 4);
_debug=false;
_cargoPool=[_faction,_cargoType] call eos_fnc_getunitpool;
_side=side (leader _grp);
// FILL EMPTY SEATS
_emptySeats=_vehicle emptyPositions "cargo";
if (_debug) then {hint format ["%1",_emptySeats];};
//GET MIN MAX GROUP
_grpMin=_grpSize select 0;
_grpMax=_grpSize select 1;
_d=_grpMax-_grpMin;
_r=floor(random _d);
_grpSize=_r+_grpMin;
// IF VEHICLE HAS SEATS
if (_emptySeats > 0) then {
// LIMIT SEATS TO FILL TO GROUP SIZE
if (_grpSize > _emptySeats) then {_grpSize = _emptySeats};
if (_debug) then {hint format ["Seats Filled : %1",_grpSize];};
for "_x" from 1 to _grpSize do {
_unit=_cargoPool select (floor(random(count _cargoPool)));
_unit=_unit createUnit [GETPOS _vehicle, _grp];
};
{_x moveincargo _vehicle}foreach units _grp;
};
private ["_eosKills"];
_eosKills=server getvariable "EOSkillCounter";
if (isnil "_eosKills") then {_eosKills=0;}else{
_eosKills=server getvariable "EOSkillCounter";
};
_eosKills=_eosKills + 1;
server setvariable ["EOSkillCounter",_eosKills,true];
hint format ["Units Killed: %1",_eosKills];_eosMarkers = server getvariable ["EOSmarkers", []];
{
_x setMarkerAlpha (MarkerAlpha _x);
_x setMarkercolor (getMarkercolor _x);
} foreach _eosMarkers;
_position=(_this select 0);
_side=(_this select 1);
_faction=(_this select 2);
_type=(_this select 3);
_special = if (count _this > 4) then {_this select 4} else {"CAN_COLLIDE"};
_vehicleType=[_faction,_type] call eos_fnc_getunitpool;
_grp = createGroup _side;
_vehPositions=[(_vehicleType select 0)] call BIS_fnc_vehicleRoles;
_vehicle = createVehicle [(_vehicleType select 0), _position, [], 0, _special];
// Added by |TG| Will for elite cookoff effect
_vehicle addEventHandler ["Killed", {_nul = [_this select 0] execVM "cookoff.sqf";}];
_vehCrew=[];
{
_currentPosition=_x;
if (_currentPosition select 0 == "driver")then {
_unit = _grp createUnit [(_vehicleType select 1), _position, [], 0, "CAN_COLLIDE"];
_unit assignAsDriver _vehicle;
_unit moveInDriver _vehicle;
_vehCrew set [count _vehCrew,_unit];
};
if (_currentPosition select 0 == "turret")then {
_unit = _grp createUnit [(_vehicleType select 1), _position, [], 0, "CAN_COLLIDE"];
_unit assignAsGunner _vehicle;
_unit MoveInTurret [_vehicle,_currentPosition select 1];
_vehCrew set [count _vehCrew,_unit];
};
}foreach _vehPositions;
_return=[_vehicle,_vehCrew,_grp];
_return_mrk=(_this select 0);
_radveh =(_this select 1);
_pos = [_mkr,true] call SHK_pos;
for "_counter" from 0 to 20 do {
_newpos = [_pos,0,_radveh,5,1,20,0] call BIS_fnc_findSafePos;
if ((_pos distance _newpos) < (_radveh + 5))
exitWith {
_pos = _newpos;
};
};
_newposif (!isServer) exitWith {};
// SINGLE INFANTRY GROUP
private ["_grp","_unit","_pool","_pos","_faction"];
_pos=(_this select 0);
_grpSize=(_this select 1);
_faction=(_this select 2);
_side=(_this select 3);
_grpMin=_grpSize select 0;
_grpMax=_grpSize select 1;
_d=_grpMax-_grpMin;
_r=floor(random _d);
_grpSize=_r+_grpMin;
if (surfaceiswater _pos) then {_pool=[_faction,1] call eos_fnc_getunitpool;}else{_pool=[_faction,0] call eos_fnc_getunitpool;};
_grp=createGroup _side;
for "_x" from 1 to _grpSize do {
_unitType=_pool select (floor(random(count _pool)));
_unit = _grp createUnit [_unitType, _pos, [], 6, "FORM"];
};
_grp//_grp=(_this select 0);
//_skillArray=(_this select 1);
//
// _skillset = server getvariable _skillArray;
// {
// _unit = _x;
// {
// _skillvalue = (_skillset select _forEachIndex) + (random 0.2) - (random 0.2);
// _unit setSkill [_x,_skillvalue];
// } forEach ['aimingAccuracy','aimingShake','aimingSpeed','spotDistance','spotTime','courage','reloadSpeed','commanding','general'];
//
// if (EOS_DAMAGE_MULTIPLIER != 1) then {_unit removeAllEventHandlers "HandleDamage";_unit addEventHandler ["HandleDamage",{_damage = (_this select 2)*EOS_DAMAGE_MULTIPLIER;_damage}];};
// if (EOS_KILLCOUNTER) then {_unit addEventHandler ["killed", "null=[] execVM ""eos\functions\EOS_KillCounter.sqf"""]};
// // ADD CUSTOM SCRIPTS TO UNIT HERE
// } forEach (units _grp); /*
SHK_buildingpos.sqf
Shuko of LDD Kyllikki (kyllikki.fi)
IRC: shuko @ quakenet
Version: 0.12
Syntax:
nul = [position,unitList,radius,priority,height,disableMove,stance,hide] execvm "shk_buildingpos.sqf"
Required Parameters:
Origo Position Position from where building positions are searched for.
Units Array Units to be moved.
Optional Parameters:
Radius Integer Range from the origo to look for building positions. Default is 20.
Priority Integer Building position priority.
0: Random, default value.
1: Ground floor has highest prio, roof positions are last to be filled.
2: Roof has top prio, ground level lowest.
Height Array Filter for positions.
[min,max] Minimum and maximum height from ground for valid positions.
DisableMove Boolean Issues disableai "move" to all units.
Stance Boolean Issues setunitpos "up" to all units.
Hide Array Hiding does not prevent the units from detecting and engaging enemies.
It's only meant to be used for preventing the units being detected from far away.
Portition Amount of units to be hidden. Valid values between 0 and 1;
Condition Condition to reveal the hidden units.
Examples:
nul = [getpos hq,[man1,man2,man3]] execvm "shk_buildingpos.sqf"
nul = [getpos house,[sniper1,sniper2],20,2] execvm "shk_buildingpos.sqf"
nul = [getpos house,units grpAlpha,30,0,[1,4]] execvm "shk_buildingpos.sqf"
nul = [getpos house,bmen1,20,0,[],true,true,[0.5,"SHK_revealHouseUnits"]] execvm "shk_buildingpos.sqf"
Todo:
Patrol (switch positions)
Change prio (for example lower level units moves to roof)
Position
object: take pos and dir
array: [[x,y,z],dir]
Multiple unit groups per script. [[parameters],[parameters2],[parameters]]
Goal is to get all units into one _men array.
*/
private "_men";
if isserver then {
private "_sortArray";
_sortArray = {
private "_sort";
_sort = {
private ["_h","_i","_j","_a","_lo","_hi","_x","_id"];
_a = _this select 0; //array to be sorted
_id = _this select 1; //array item index to be compared
_lo = _this select 2; //lower index to sort from
_hi = _this select 3; //upper index to sort to
_h = nil; //used to make a do-while loop below
_i = _lo;
_j = _hi;
if (count _a == 0) exitWith {};
_x = (_a select ((_lo+_hi)/2)) select _id;
while {isnil "_h" || _i <= _j} do {
while {(_a select _i) select _id < _x} do {_i=_i+1};
while {(_a select _j) select _id > _x} do {_j=_j-1};
if (_i<=_j) then {
_h = _a select _i;
_a set [_i, _a select _j];
_a set [_j, _h];
_i=_i+1;
_j=_j-1;
};
};
if (_lo<_j) then {[_a, _id, _lo, _j] call _sort};
if (_i<_hi) then {[_a, _id, _i, _hi] call _sort};
};
[_this select 0, _this select 1, 0, 0 max ((count (_this select 0))-1)] call _sort;
_this select 0
};
private ["_opos","_rad","_bpos"];
_opos = _this select 0;
if (typename _opos == typename objNull) then {_opos = getpos _opos};
_men = _this select 1;
_rad = if (count _this > 2) then { _this select 2 } else { 20 };
_bpos = [];
{
private ["_i","_p"];
for [{_i = 0;_p = _x buildingpos _i},{str _p != "[0,0,0]"},{_i = _i + 1;_p = _x buildingpos _i}] do {
_bpos set [count _bpos,_p];
};
} foreach (nearestObjects [_opos, ["Building"], _rad]);
// Priority
private "_prio";
if (count _this > 3) then {
_prio = _this select 3;
_bpos = [_bpos,2] call _sortArray;
} else {
_prio = 0;
};
// Height
if (count _this > 4) then {
if (count (_this select 4) > 0) then {
private ["_tmp","_min","_max","_h"];
_tmp = [];
_min = (_this select 4) select 0;
_max = (_this select 4) select 1;
{
_h = _x select 2;
if (_h >= _min && _h <= _max) then { _tmp set [count _tmp,_x] };
} foreach _bpos;
_bpos = _tmp;
};
};
// DisableMove
private "_disableMove";
_disableMove = if (count _this > 5) then { _this select 5 } else { false };
// Stance
private "_stance";
_stance = if (count _this > 6) then { _this select 6 } else { false };
private ["_taken","_ind","_pos","_dir"];
_taken = [];
{
while {count _taken < count _bpos} do {
switch _prio do {
case 0: { _ind = floor(random count _bpos) }; // random
case 1: { _ind = count _taken }; // ground floor first
case 2: { _ind = count _bpos - count _taken - 1 }; // roof first
};
if !(_ind in _taken) exitwith {
_taken set [count _taken,_ind];
_pos = _bpos select _ind;
_dir = ((_pos select 0) - (_opos select 0)) atan2 ((_pos select 1) - (_opos select 1));
if (_dir < 0) then {_dir = _dir + 360};
_x setpos _pos;
_x setformdir _dir;
if _disableMove then { doStop _x; };
if _stance then { _x setunitpos "UP" };
};
};
} foreach _men;
}; //isserver
// Hide
if (count _this > 7) then {
if (isnil "SHK_BuildingPos_init") then {
SHK_BuildingPos_fnc = {
private ["_act","_arr"];
_act = _this select 0;
_arr = _this select 1;
{ _x hideobject _act } foreach _arr;
};
"SHK_BuildingPos_EH" addpublicvariableeventhandler {
private ["_act","_arr"];
_arr = _this select 1;
_act = _arr select 0;
_arr = _arr select 1;
[_act,_arr] call SHK_BuildingPos_fnc;
};
SHK_BuildingPos_init = true;
};
if isserver then {
private ["_hide","_portition","_condition","_hidden","_u","_i"];
_hide = _this select 7;
_portition = _hide select 0;
_portition = round (_portition * (count _men));
_condition = _hide select 1;
_hidden = [];
for "_i" from 0 to (_portition - 1) do {
_u = _men select _i;
_hidden set [count _hidden, _u];
};
SHK_BuildingPos_EH = [true,_hidden];
publicvariable "SHK_BuildingPos_EH";
if !isdedicated then { [true,_hidden] call SHK_BuildingPos_fnc };
waituntil {(call compile _condition)};
SHK_BuildingPos_EH = [false,_hidden];
publicvariable "SHK_BuildingPos_EH";
if !isdedicated then { [false,_hidden] call SHK_BuildingPos_fnc };
};
};
/*
SHK_patrol
Based on BIN_taskPatrol by Binesi
Version 0.22
Author: Shuko (shuko@quakenet, miika@miikajarvinen.fi)
http://forums.bistudio.com/showthread.php?163496-SHK_Patrol
Modified for EOS by Bangabob
Requires SHK_POS.sqf
Required Parameters:
0 Object or Group The patrolling unit
1 Marker Name
*/
DEBUG = false;
if !isserver exitwith {};
// Handle parameters
private ["_grp","_dst","_marker"];
_dst = 250;
switch (typename _this) do {
case (typename grpNull): { _grp = _this };
case (typename objNull): { _grp = group _this };
case (typename []): {
_grp = _this select 0;
if (typename _grp == typename objNull) then {_grp = group _grp};
if (count _this > 1) then {_marker = _this select 1};
};
};
_grp setBehaviour "SAFE";
_grp setSpeedMode "LIMITED";
_grp setCombatMode "YELLOW";
_grp setFormation (["STAG COLUMN", "WEDGE", "ECH LEFT", "ECH RIGHT", "VEE", "DIAMOND"] call BIS_fnc_selectRandom);
private ["_cnt","_wps","_slack"];
_cnt = 4 + (floor random 3) + (floor (_dst / 100)); // number of waypoints
_wps = [];
_slack = _dst / 5.5;
if (_slack < 20) then {_slack = 20};
// Find positions for waypoints
private ["_a","_p"];
while {count _wps < _cnt} do {
if (surfaceiswater (getpos(leader _grp)) ) then {
_p = [_mkr,true] call SHK_pos;}else{_p = [_mkr,true] call SHK_pos;
};
_wps set [count _wps, _p];
};
// Create waypoints
private ["_cur","_wp"];
for "_i" from 1 to (_cnt - 1) do {
_cur = (_wps select _i);
_wp = _grp addWaypoint [_cur, 0];
_wp setWaypointType "MOVE";
_wp setWaypointCompletionRadius (5 + _slack);
[_grp,_i] setWaypointTimeout [0,2,16];
// When completing waypoint have 33% chance to choose a random next wp
[_grp,_i] setWaypointStatements ["true", "if ((random 3) > 2) then { group this setCurrentWaypoint [(group this), (floor (random (count (waypoints (group this)))))];};"];
if (DEBUG) then {
private "_m";
_m = createMarker [format["SHK_patrol_WP%1%2",(floor(_cur select 0)),(floor(_cur select 1))],_cur];
_m setMarkerShape "Ellipse";
_m setMarkerSize [20,20];
_m setmarkerColor "ColorRed";
};
};
// Cycle in case we reach the end
private "_wp1";
_wp1 = _grp addWaypoint [(_wps select 1), 0];
_wp1 setWaypointType "CYCLE";
_wp1 setWaypointCompletionRadius 50;
if (DEBUG) then {
while {sleep 5; {alive _x} count (units _grp) > 0} do {
private ["_m","_p"];
_p = getpos leader _grp;
_m = createMarker [format["SHK_patrol_%1%2%3",(floor(_p select 0)),(floor(_p select 1)),floor time],_p];
_m setMarkerShape "Icon";
_m setMarkerType "mil_dot";
_m setmarkerColor "ColorBlue";
};
};/*
SHK_pos - Random position generator for Arma 2
Author: Shuko (IRC: shuko@quakenet, Email: miika@miikajarvinen.fi)
Version: 0.1
Parameters for marker area based position:
Area String Marker to define area from which the position is taken.
Water Boolean Allow position on water? Optional, default is false.
Usage examples:
myPos = ["markerName"] execvm "SHK_pos.sqf";
myPos = ["myMarker1",true] execvm "SHK_pos.sqf";
Parameters for relative position:
Point of Origin Position array The position from which direction and distance is calculated from.
Direction Number Compass direction (0-359) from Point of Origin.
Array Array can be used to give minimum and maximum directions.
Distance Number Distance in meters from Point of Origin.
Array Array can be used to give minimum and maximum distance.
Water Boolean Allow position on water? Optional, default is false.
Water solution Integer Water positions not allowed, what to do?
0: Do nothing, do not return any position. An empty array is returned.
1: Find closest land. Search is done with increasing radius until land is found, thus the resulting
position might not be exactly in the given direction and distance.
2: Decrease distance until land is found. Direction is kept the same.
3: Increase distance until land is found. Direction is kept the same.
4: Decrease direction (counter clock-wise) until land is found. Distance is kept the same.
5: Increase direction (clock-wise) until land is found. Distance is kept the same.
If no integer is given, solution 1 is used by default.
Usage examples:
myPos = [getpos player,random 360,200,true] execvm "SHK_pos.sqf";
myPos = [getmarkerpos "myMarker",125,random 500] execvm "SHK_pos.sqf";
myPos = [getpos player,random 360,[200,500],false,2] execvm "SHK_pos.sqf";
Example of creating multiple positions:
SHK_pos = compile preprocessfile "SHK_pos.sqf";
for "_i" from 0 to 500 do {
_p = [getpos player,random 360,random 1000] call SHK_pos;
if (count _p > 0) then {
call compile format ["
_m%1 = createMarker[""mySpot%1"",[_p select 0,_p select 1]];
_m%1 setMarkerShape ""ICON"";
_m%1 setMarkerType ""DOT"";
_m%1 setmarkercolor ""colorred"";
",_i];
};
};
*/
private "_getpos";
_getpos = {
private ["_origo","_dir","_dist"];
_origo = _this select 0;
_dir = _this select 1;
_dist = _this select 2;
if (typename _dir == typename []) then {
if ((_dir select 0) > (_dir select 1)) then { _dir set [1,((_dir select 1) + 360)] };
_dir = ((_dir select 0) + random((_dir select 1)-(_dir select 0)))
};
if (typename _dist == typename []) then {
_dist = ((_dist select 0) + random((_dist select 1)-(_dist select 0)));
};
[((_origo select 0) + (_dist * sin _dir)),((_origo select 1) + (_dist * cos _dir)),0];
};
private "_water";
if (typename (_this select 0) == typename "") then {
private ["_pos","_area","_cp","_cx","_cy","_as","_rx","_ry","_ad","_cd","_sd","_xo","_yo","_loop"];
_area = _this select 0;
if (count _this > 1) then {_water = _this select 1} else {_water = false};
_cp = getMarkerPos _area;
_cx = abs(_cp select 0);
_cy = abs(_cp select 1);
_as = getMarkerSize _area;
_rx = _as select 0;
_ry = _as select 1;
_ad = (markerDir _area) * -1;
_cd = cos _ad;
_sd = sin _ad;
_loop = true;
while {_loop} do {
_tx = (random (_rx*2))-_rx;
_ty = (random (_ry*2))-_ry;
_xo = if (_ad!=0) then {_cx+ (_cd*_tx - _sd*_ty)} else {_cx+_tx};
_yo = if (_ad!=0) then {_cy+ (_sd*_tx + _cd*_ty)} else {_cy+_ty};
_pos = [_xo,_yo,0];
if (_water) then {
_loop = false;
} else {
if (!surfaceIsWater [_pos select 0,_pos select 1]) then {_loop = false};
};
};
_pos
} else {
private ["_origo","_dir","_dist","_pos","_loop","_watersolution"];
_origo = _this select 0;
_dir = _this select 1;
_dist = _this select 2;
if (count _this > 3) then {_water = _this select 3} else {_water = false};
if (count _this > 4) then {_watersolution = _this select 4} else {_watersolution = 1};
_pos = [_origo,_dir,_dist] call _getpos;
if (!_water) then {
private ["_d","_l","_p"];
_l = true;
switch _watersolution do {
case 0: {
if (surfaceIsWater [_pos select 0,_pos select 1]) then {
_pos = +[];
};
};
case 1: {
_d = 10; _l = true;
while {_l} do {
for "_i" from 0 to 350 do {
_p = [_pos,_i,_d] call _getpos;
if (!surfaceIsWater [_p select 0,_p select 1]) exitwith {_l = false};
};
_d = _d + 10;
};
_pos = _p;
};
case 2: {
_d = _pos distance _origo;
while {_d = _d - 10; _l} do {
_pos = [_pos,_dir,_d] call _getpos;
if (!surfaceIsWater [_pos select 0,_pos select 1]) then {_l = false};
if (_d < 10) then {_l = false; _pos = + []};
};
};
case 3: {
_d = _pos distance _origo;
while {_d = _d + 10; _l} do {
_pos = [_pos,_dir,_d] call _getpos;
if (!surfaceIsWater [_pos select 0,_pos select 1]) then {_l = false};
if (_d > 10000) then {_l = false; _pos = + []};
};
};
case 4: {
if (typename _dir == typename []) then {
_d = _dir select 0;
_dir = _dir select 0;
} else {
_d = _dir;
};
while {_l} do {
_p = [_pos,_d,_dist] call _getpos;
if (!surfaceIsWater [_p select 0,_p select 1]) exitwith {_l = false};
if (_d < (_dir - 360)) then {_l = false};
_d = _d - 10;
};
_pos = _p;
};
case 5: {
if (typename _dir == typename []) then {
_d = _dir select 1;
_dir = _dir select 1;
} else {
_d = _dir;
};
while {_l} do {
_p = [_pos,_d,_dist] call _getpos;
if (!surfaceIsWater [_p select 0,_p select 1]) exitwith {_l = false};
if (_d > (_dir + 360)) then {_l = false};
_d = _d + 10;
};
_pos = _p;
};
};
};
_pos
};private ["_pad","_getToMarker","_cargoGrp","_vehicle"];
_mkr=(_this select 0);
_veh=(_this select 1);
_counter=(_this select 2);
_debug=false;
_vehicle = _veh select 0;
_grp = _veh select 2;
_cargoGrp= _veh select 3;
_pos = [_mkr,false] call SHK_pos;
_pad = createVehicle ["Land_HelipadEmpty_F", _pos, [], 0, "NONE"];
if (_debug) then {0= [_mkr,_counter,"Unload Pad",(getpos _pad)] call EOS_debug;};
{_x allowFleeing 0} forEach units _grp;
{_x allowFleeing 0} forEach units _cargoGrp;
_wp1 = _grp addWaypoint [_pos, 0];
_wp1 setWaypointSpeed "FULL";
_wp1 setWaypointType "UNLOAD";
_wp1 setWaypointStatements ["true", "(vehicle this) LAND 'GET IN';"];
waituntil {_vehicle distance _pad < 30};
_cargoGrp leaveVehicle _vehicle;
waitUntil{sleep 0.2; {_x in _vehicle} count units _cargoGrp == 0};
if (_debug) then {hint "Transport unloaded";};
0 = [_cargoGrp,_mkr] call eos_fnc_taskpatrol;
_wp2 = _grp addWaypoint [[0,0,0], 0];
_wp2 setWaypointSpeed "FULL";
_wp2 setWaypointType "MOVE";
_wp2 setWaypointStatements ["true", "{deleteVehicle _x} forEach crew (vehicle this) + [vehicle this];"];
deletevehicle _pad;EOS_Spawn = compile preprocessfilelinenumbers "eos\core\eos_launch.sqf";
Bastion_Spawn=compile preprocessfilelinenumbers "eos\core\b_launch.sqf";
null=[] execVM "eos\core\spawn_fnc.sqf";
onplayerConnected {[] execVM "eos\Functions\EOS_Markers.sqf";};
/* EOS 1.98 by BangaBob
GROUP SIZES
0 = 1
1 = 2,4
2 = 4,8
3 = 8,12
4 = 12,16
5 = 16,20
EXAMPLE CALL - EOS
null = [["MARKERNAME","MARKERNAME2"],[2,1,70],[0,1],[1,2,30],[2,60],[2],[1,0,10],[1,0,250,WEST]] call EOS_Spawn;
null=[["M1","M2","M3"],[HOUSE GROUPS,SIZE OF GROUPS,PROBABILITY],[PATROL GROUPS,SIZE OF GROUPS,PROBABILITY],[LIGHT VEHICLES,SIZE OF CARGO,PROBABILITY],[ARMOURED VEHICLES,PROBABILITY], [STATIC VEHICLES,PROBABILITY],[HELICOPTERS,SIZE OF HELICOPTER CARGO,PROBABILITY],[FACTION,MARKERTYPE,DISTANCE,SIDE,HEIGHTLIMIT,DEBUG]] call EOS_Spawn;
EXAMPLE CALL - BASTION
null = [["BAS_zone_1"],[3,1],[2,1],[2],[0,0],[0,0,EAST,false,false],[10,2,120,TRUE,TRUE]] call Bastion_Spawn;
null=[["M1","M2","M3"],[PATROL GROUPS,SIZE OF GROUPS],[LIGHT VEHICLES,SIZE OF CARGO],[ARMOURED VEHICLES],[HELICOPTERS,SIZE OF HELICOPTER CARGO],[FACTION,MARKERTYPE,SIDE,HEIGHTLIMIT,DEBUG],[INITIAL PAUSE, NUMBER OF WAVES, DELAY BETWEEN WAVES, INTEGRATE EOS, SHOW HINTS]] call Bastion_Spawn;
*/
VictoryColor="colorGreen"; // Colour of marker after completion
hostileColor="colorRed"; // Default colour when enemies active
bastionColor="colorOrange"; // Colour for bastion marker
EOS_DAMAGE_MULTIPLIER=1; // 1 is default
EOS_KILLCOUNTER=false; // Counts killed units
//null = [["EOSinf_1","EOSinf_2"],[3,1],[2,3,75],[0,0],[0],[0],[0,0],[0,0,350,EAST,TRUE]] call EOS_Spawn;
//null = [["EOSmot_1","EOSmot_2"],[0,0],[0,0],[3,1,90],[2,60],[0],[1,0,90],[0,0,350,EAST,FALSE]] call EOS_Spawn;
//null = [["BAS_zone_1"],[0,1],[0,2],[0],[1,2],[0,0,EAST,TRUE],[0,2,120,TRUE,FALSE]] call Bastion_Spawn;private ["_tempArray","_InfPool","_MotPool","_ACHPool","_CHPool","_uavPool","_stPool","_shipPool","_diverPool","_crewPool","_heliCrew","_ArmPool"];
_faction=(_this select 0);
_type=(_this select 1);
_tempArray=[];
// EAST CSAT FACTION
if (_faction==0) then {
_InfPool= ["O_SoldierU_SL_F","O_soldierU_repair_F","O_soldierU_medic_F","O_sniper_F","O_Soldier_A_F","O_Soldier_AA_F","O_Soldier_AAA_F","O_Soldier_AAR_F","O_Soldier_AAT_F","O_Soldier_AR_F","O_Soldier_AT_F","O_soldier_exp_F","O_Soldier_F","O_engineer_F","O_engineer_U_F","O_medic_F","O_recon_exp_F","O_recon_F","O_recon_JTAC_F","O_recon_LAT_F","O_recon_M_F","O_recon_medic_F","O_recon_TL_F"];
_ArmPool= ["O_APC_Tracked_02_AA_F","O_APC_Tracked_02_cannon_F","O_APC_Wheeled_02_rcws_F","O_MBT_02_arty_F","O_MBT_02_cannon_F"];
_MotPool= ["O_Truck_02_covered_F","O_Truck_02_transport_F","O_MRAP_02_F","O_MRAP_02_gmg_F","O_MRAP_02_hmg_F","O_Truck_02_medical_F"];
_ACHPool= ["O_Heli_Attack_02_black_F","O_Heli_Attack_02_F"];
_CHPool= ["O_Heli_Light_02_F","O_Heli_Light_02_unarmed_F"];
_uavPool= ["O_UAV_01_F","O_UAV_02_CAS_F","O_UGV_01_rcws_F"];
_stPool= ["O_Mortar_01_F","O_static_AT_F","O_static_AA_F"];
_shipPool= ["O_Boat_Armed_01_hmg_F","O_Boat_Transport_01_F"];
_diverPool= ["O_diver_exp_F","O_diver_F","O_diver_TL_F"];
_crewPool= ["O_crew_F"];
_heliCrew= ["O_helicrew_F","O_helipilot_F"];
};
// WEST NATO FACTION
if (_faction==1) then {
_InfPool= ["B_sniper_F","B_Soldier_A_F","B_Soldier_AA_F","B_Soldier_AAA_F","B_Soldier_AAR_F","B_Soldier_AAT_F","B_Soldier_AR_F","B_Soldier_AT_F","B_soldier_exp_F","B_Soldier_F","B_engineer_F","B_medic_F","B_recon_exp_F","B_recon_F","B_recon_JTAC_F","B_recon_LAT_F","B_recon_M_F","B_recon_medic_F","B_recon_TL_F"];
_ArmPool= ["B_MBT_01_arty_F","B_MBT_01_cannon_F","B_MBT_01_mlrs_F","B_APC_Tracked_01_AA_F","B_APC_Tracked_01_CRV_F","B_APC_Tracked_01_rcws_F","B_APC_Wheeled_01_cannon_F","B_MBT_02_cannon_F"];
_MotPool= ["B_Truck_01_covered_F","B_Truck_01_transport_F","B_MRAP_01_F","B_MRAP_01_gmg_F","B_MRAP_01_hmg_F","B_Truck_01_medical_F"];
_ACHPool= ["B_Heli_Attack_01_F","B_Heli_Light_01_armed_F"];
_CHPool= ["B_Heli_Light_01_F","B_Heli_Transport_01_camo_F","B_Heli_Transport_01_F"];
_uavPool= ["B_UAV_01_F","B_UAV_01_CAS_F","B_UGV_01_rcws_F"];
_stPool= ["B_Mortar_01_F","B_static_AT_F","B_static_AA_F"];
_shipPool= ["B_Boat_Armed_01_minigun_F","B_Boat_Transport_01_F"];
_diverPool= ["B_diver_exp_F","B_diver_F","B_diver_TL_F"];
_crewPool= ["B_crew_F"];
_heliCrew= ["B_helicrew_F","B_helipilot_F"];
};
// INDEPENDENT AAF FACTION
if (_faction==2) then {
_InfPool= ["I_engineer_F","I_Soldier_A_F","I_Soldier_AA_F","I_Soldier_AAA_F","I_Soldier_AAR_F","I_Soldier_AAT_F","I_Soldier_AR_F","I_Soldier_AT_F","I_Soldier_exp_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_repair_F"];
_ArmPool= ["I_APC_Wheeled_03_cannon_F"];
_MotPool= ["I_MRAP_03_F","I_MRAP_03_gmg_F","I_MRAP_03_hmg_F","I_Truck_02_medical_F"];
_ACHPool= [];
_CHPool= ["I_Heli_Transport_02_F","B_Heli_Light_02_unarmed_F"];
_uavPool= ["I_UAV_01_F","I_UAV_02_CAS_F","I_UGV_01_rcws_F"];
_stPool= ["I_Mortar_01_F"];
_shipPool= ["I_Boat_Transport_01_F","I_G_Boat_Transport_01_F","I_Boat_Armed_01_minigun_F"];
_diverPool= ["I_diver_exp_F","I_diver_F","I_diver_TL_F"];
_crewPool= ["I_crew_F"];
_heliCrew= ["I_helicrew_F","I_helipilot_F"];
};
// CIVILIAN
if (_faction==3) then {
_InfPool= ["C_man_1","C_man_1_1_F","C_man_1_2_F","C_man_1_3_F","C_man_hunter_1_F","C_man_p_beggar_F","C_man_p_beggar_F_afro","C_man_p_fugitive_F","C_man_p_shorts_1_F","C_man_pilot_F","C_man_polo_1_F","C_man_polo_2_F","C_man_polo_3_F","C_man_polo_4_F","C_man_polo_5_F","C_man_polo_6_F","C_man_shorts_1_F","C_man_shorts_2_F","C_man_shorts_3_F","C_man_shorts_4_F","C_man_w_worker_F"];
_ArmPool= ["C_Hatchback_01_F","C_Hatchback_01_sport_F","C_Quadbike_01_F","C_SUV_01_F","C_Van_01_transport_F","C_Van_01_box_F"];
_MotPool= ["C_Hatchback_01_F","C_Hatchback_01_sport_F","C_Quadbike_01_F","C_SUV_01_F","C_Van_01_transport_F","C_Van_01_box_F"];
_ACHPool= [];
_CHPool= [];
_uavPool= [];
_stPool= [];
_shipPool= ["C_Boat_Civil_01_F","C_Boat_Civil_01_rescue_F","C_Boat_Civil_04_F","C_Rubberboat"];
_diverPool= [];
_crewPool= ["C_man_1"];
_heliCrew= ["C_man_1","C_man_1"];
};
// WEST FIA FACTION
if (_faction==4) then {
_InfPool= ["B_G_engineer_F","B_G_medic_F","B_G_officer_F","B_G_Soldier_A_F","B_G_Soldier_AR_F","B_G_Soldier_exp_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_LAT_F","B_G_Soldier_lite_F","B_G_Soldier_M_F","B_G_Soldier_SL_F","B_G_Soldier_TL_F"];
_ArmPool= [];
_MotPool= ["B_G_Offroad_01_F","B_G_Offroad_01_armed_F","B_G_Van_01_transport_F","B_G_Van_01_fuel_F"];
_ACHPool= [];
_CHPool= [];
_uavPool= [];
_stPool= ["B_G_Mortar_01_F"];
_shipPool= ["B_G_Boat_Transport_01_F"];
_diverPool= [];
_crewPool= [];
_heliCrew= [];
};
// ADD CLASSNAMES
if (_faction==5) then {
_InfPool= [];
_ArmPool= [];
_MotPool= [];
_ACHPool= [];
_CHPool= [];
_uavPool= [];
_stPool= [];
_shipPool= [];
_diverPool= [];
_crewPool= [];
_heliCrew= [];
};
// ADD CLASSNAMES
if (_faction==6) then {
_InfPool= [];
_ArmPool= [];
_MotPool= [];
_ACHPool= [];
_CHPool= [];
_uavPool= [];
_stPool= [];
_shipPool= [];
_diverPool= [];
_crewPool= [];
_heliCrew= [];};
// ADD CLASSNAMES
if (_faction==7) then {
_InfPool= [];
_ArmPool= [];
_MotPool= [];
_ACHPool= [];
_CHPool= [];
_uavPool= [];
_stPool= [];
_shipPool= [];
_diverPool= [];
_crewPool= [];
_heliCrew= [];};
////////////////////////////////////////////////////////////////////////////////////////
if (_type==0) then {
for "_i" from 0 to 5 do{
_unit=_InfPool select (floor(random(count _InfPool)));
_tempArray set [count _tempArray,_unit];};
};
if (_type==1) then {_tempArray=_diverPool};
// CREATE ARMOUR & CREW
if (_type==2) then {
_tempUnit=_ArmPool select (floor(random(count _ArmPool)));
_temparray set [count _temparray,_tempUnit];
_crew=_crewPool select (floor(random(count _crewPool)));
_temparray set [count _temparray,_crew];
};
// CREATE ATTACK CHOPPER & CREW
if (_type==3) then {
_tempUnit=_ACHPool select (floor(random(count _ACHPool)));
_temparray set [count _temparray,_tempUnit];
_crew=_heliCrew select (floor(random(count _heliCrew)));
_temparray set [count _temparray,_crew];
};
// CREATE TRANSPORT CHOPPER & CREW
if (_type==4) then {
_tempUnit=_CHPool select (floor(random(count _CHPool)));
_temparray set [count _temparray,_tempUnit];
_crew=_heliCrew select (floor(random(count _heliCrew)));
_temparray set [count _temparray,_crew];
};
// CREATE STATIC & CREW
if (_type==5) then {
_tempUnit=_stPool select (floor(random(count _stPool)));
_temparray set [count _temparray,_tempUnit];
_crew=_crewPool select (floor(random(count _crewPool)));
_temparray set [count _temparray,_crew];
};
if (_type==6) then {_tempArray=_uavPool select (floor(random(count _uavPool)));};
// CREATE TRANSPORT & CREW
if (_type==7) then {
_tempUnit=_MotPool select (floor(random(count _MotPool)));
_temparray set [count _temparray,_tempUnit];
_crew=_crewPool select (floor(random(count _crewPool)));
_temparray set [count _temparray,_crew];
};
// CREATE BOAT & DIVER CREW
if (_type==8) then {
_tempUnit=_shipPool select (floor(random(count _shipPool)));
_temparray set [count _temparray,_tempUnit];
_crew=_diverPool select (floor(random(count _diverPool)));
_temparray set [count _temparray,_crew];
};
// CREATE CARGO
if (_type==9) then {
for "_i" from 0 to 4 do{
_unit=_InfPool select (floor(random(count _InfPool)));
_temparray set [count _temparray,_unit];
};
};
// CREATE DIVER CARGO
if (_type==10) then {
for "_i" from 0 to 4 do{
_unit=_diverPool select (floor(random(count _diverPool)));
_temparray set [count _temparray,_unit];
};
};
//hint format ["%1",_tempArray];
_tempArraycall compile preprocessFile "cws_injury\cws_init.sqf";
call compile preprocessFileLineNumbers "Engima\Civilians\Init.sqf";
if(isServer) then { {if (side _x == Civilian) then {nil = [_x] execVM "civguise.sqf"}} forEach allUnits };
player enableFatigue true;//IMPORTANT, FATIGUE IS ALREDY DISABLED IN AN OTHER SCRIPT!
// load up the briefing
_nul = [] execVM "briefing.sqf";
diag_log "Executed briefing";
// setup the required scripts
_nul = [] execVM "eos\OpenMe.sqf";
diag_log "Set up required scripts";
// start up the mission framework
sleep 20;
_nul = [] execVM "anvil\framework_init.sqf";
diag_log "Started mission framework";
enableRadio false; enableSentences false;
#include "SHK_Fastrope.sqf"
if (local player) then {
player enableFatigue false;
player addMPEventhandler ["MPRespawn", {player enableFatigue false}];
};
JFIF ` ` C
C "
} !1AQa"q2#BR$3br
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
w !1AQaq"2B #3Rbr
$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ? sFw}t^[tbMY}g<,<}Vmld T rwGOW5Xn? o!TwxyW6\ O]7%Z|Zf=ev"]v$:o ujǽiʿ{ zwF>FyO{=͚| m3:~^j]F*; og[-OE%E6&w_o_ϒ$Vv;tfuΟM?gt}Y}RDM' @%{3O\>ttO+}ܫ:_iE}|>y(5A)yuM;K} ; %fN6VUq
+i[+fݏ@E N'?V$r *q