3rdView Restrictions.sqf !$W2 ADV_zeus.sqf tT description.ext xW eos\AI_Skill.sqf 9U eos\core\b_core.sqf R) eos\core\b_Launch.sqf NRK eos\core\eos_core.sqf bR3 eos\core\eos_launch.sqf R
eos\core\spawn_fnc.sqf ܍Rm eos\functions\cargo_fnc.sqf R eos\functions\EOS_KillCounter.sqf 8R< eos\functions\EOS_Markers.sqf Q eos\functions\eos_spawnVehicle.sqf JRG eos\functions\findSafePos.sqf R? eos\functions\infantry_fnc.sqf R eos\functions\setSkill.sqf T eos\functions\SHK_buildingpos.sqf &Rs eos\functions\shk_patrol.sqf xsR
eos\functions\shk_pos.sqf FXR eos\functions\TransportUnload_fnc.sqf vR eos\OpenMe.sqf bW
eos\UnitPools.sqf !U init.sqf `W initPlayerLocal.sqf ƨ9V initServer.sqf aWU+ INS_revive\cfgfunctions.hpp MR INS_revive\cfgsounds.hpp *5S INS_revive\config.hpp sW INS_revive\config.sqf S INS_revive\description.hpp nMR INS_revive\loadout\fnc_get_loadout.sqf S! INS_revive\loadout\fnc_set_loadout.sqf S. INS_revive\loadout\Loadout_functions_get3.4_set4.3.txt ?Q INS_revive\loadout\loadoutSave.sqf pdQ^ INS_revive\params.hpp MR: INS_revive\README.txt
5S{' INS_revive\revive\act_cancel_revive.sqf Q INS_revive\revive\act_carry_body.sqf FSR INS_revive\revive\act_drag_body.sqf Q INS_revive\revive\act_drag_body_prone.sqf ̀Q1 INS_revive\revive\act_load_body.sqf ^Q
INS_revive\revive\act_release_body.sqf Q INS_revive\revive\act_revive.sqf Q INS_revive\revive\act_teleportToTeam.sqf ]Q INS_revive\revive\act_unload_body.sqf ņQ: INS_revive\revive\en_strings_lang.sqf Q$ INS_revive\revive\functions.sqf MR< INS_revive\revive\functions_a2oa.sqf Xi}Q INS_revive\revive\functions_a3.sqf li}Q- INS_revive\revive\init_ace.sqf !*R/ INS_revive\revive\init_vanilla.sqf MR INS_revive\revive\rsctitles.hpp hQ INS_revive\revive_init.sqf MR( INS_revive\rsctitles.hpp MRc INS_revive\validate_cfg.sqf ]MR( JWC_CASFS\_readme.txt 8bR JWC_CASFS\addAction.sqf #0bR JWC_CASFS\cantDo.ogg |Q JWC_CASFS\CAS.sqf UK JWC_CASFS\cascall.ogg U JWC_CASFS\casDefine.hpp XR: JWC_CASFS\casMenu.hpp 'aR6 JWC_CASFS\casMenu.sqf 6bR- JWC_CASFS\initCAS.sqf
bR JWC_CASFS\missleaway.ogg Un JWC_CASFS\snap.sqf aR# JWC_CASFS\track.sqf MRo Katherine.jpg 8 U:n loadloadout.sqf SbW mission.sqm PX mission.sqm.oldBackup :pV onPlayerKilled.sqf -W: onPlayerRespawn.sqf -W randomfire.sqf W[ repetitive_cleanup.sqf 0T` Saveloadout.sqf IQ Scripts\Quotes.sqf _W sound\Intro.ogg bUD sound\Outro.ogg WϛS
4 stringtable.xml !yRK; tpld.sqf :V) tpld2.sqf BV) VABoxinit.sqf S# VAS\cfgfunctions.hpp >SG VAS\common.hpp KS$v VAS\config.sqf \oWU- VAS\functions\fn_accList.sqf bOS VAS\functions\fn_accPrompt.sqf RSBR@ VAS\functions\fn_accType.sqf ,R% VAS\functions\fn_addGear.sqf >R VAS\functions\fn_buildConfig.sqf cKS VAS\functions\fn_closeDetails.sqf :ZRW VAS\functions\fn_deleteGear.sqf @R VAS\functions\fn_details.sqf vOS
VAS\functions\fn_fetchCfg.sqf 0OSY VAS\functions\fn_fetchCfgDetails.sqf "&vR
VAS\functions\fn_fetchPlayerGear.sqf 0
R VAS\functions\fn_filter.sqf @Rv VAS\functions\fn_filterMenu.sqf KS
VAS\functions\fn_filterShow.sqf HQ VAS\functions\fn_handleItem.sqf $OS3 VAS\functions\fn_KRON_StrLeft.sqf wQ. VAS\functions\fn_KRON_StrToArray.sqf wQ VAS\functions\fn_loadGear.sqf TTR5 VAS\functions\fn_loadoutInfo.sqf y@R$ VAS\functions\fn_mainDisplay.sqf KS VAS\functions\fn_mainInit.sqf @R
VAS\functions\fn_onRespawn.sqf CR] VAS\functions\fn_openDetails.sqf QU VAS\functions\fn_playerDisplay.sqf =R
VAS\functions\fn_qRemoveItem.sqf tQ& VAS\functions\fn_quickAddDrag.sqf 'OSf VAS\functions\fn_quickAttachment.sqf ZR VAS\functions\fn_quickItem.sqf tQo VAS\functions\fn_quickMag.sqf ,4vR VAS\functions\fn_removeGear.sqf xR VAS\functions\fn_saveGear.sqf KyRS
VAS\functions\fn_SaveLoad.sqf =EQ VAS\functions\fn_Startview.sqf WBS% VAS\functions\fn_Stopview.sqf "S VAS\functions\fn_StopviewEsc.sqf :DSG VAS\functions\fn_test.sqf #S: VAS\functions\fn_transferAction.sqf -yR VAS\functions\fn_transferMenu.sqf )yR VAS\functions\fn_transferNetwork.sqf /yR VAS\functions\fn_transferSaveGear.sqf ~OyR VAS\functions\fn_transferSaveMenu.sqf LyR VAS\functions\fn_updateLoad.sqf xxR VAS\functions\fn_VASP.sqf `R: VAS\functions\macro.sqf 0ZR VAS\functions\misc_functions.sqf #Q4 VAS\menu.hpp Sk VAS\open.sqf (OS; wbbloadsc.jpg IS) if (!isDedicated) then {
waitUntil {!isNull (findDisplay 46)};
if( (difficultyOption "thirdPersonView")isEqualTo 1) then
{
while {true} do {
waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
if (((vehicle player) == player) && (speed ( player)) >= -40) then {
player switchCamera "INTERNAL";
};
sleep 0.1;
if (((vehicle player)isKindOf "LandVehicle") && (speed (vehicle player)) >= 1000) then {
(vehicle player) switchCamera "Internal";
};
sleep 0.1;
if (( vehicle player) isKindOf "Helicopter" && (getPosVisual (vehicle player) select 2) > 1000) then {
(vehicle player) switchCamera "Internal";
};
sleep 0.1;
if ((vehicle player) isKindOf "Plane" && (speed (vehicle player)) >= 1000) then {
(vehicle player) switchCamera "Internal";
};
sleep 0.1;
if (((vehicle player)isKindOf "Ship") && (speed (vehicle player)) >= 1000) then {
(vehicle player) switchCamera "Internal";
};
sleep 0.1;
};
};
};/*
ADV_zeus script by Belbo
Makes most units placed in the editor and playable units editable by Zeus.
Call from init.sqf via:
if (isServer) then {[CURATORMODULENAME,true] execVM "ADV_zeus.sqf";};
*/
private ["_curator","_addCivilians"];
_curator = _this select 0;
_addCivilians = _this select 1;
//adds objects placed in editor:
_curator addCuratorEditableObjects [vehicles,true];
_curator addCuratorEditableObjects [(allMissionObjects "Man"),true];//false
_curator addCuratorEditableObjects [(allMissionObjects "Air"),true];
_curator addCuratorEditableObjects [(allMissionObjects "Ammo"),true];//false
//makes all units continuously available to Zeus (for respawning players and AI that's being spawned by a script.)
while {true} do {
_toAdd = if (!_addCivilians && {(side _x) == civilian}) then {false} else {true};
{
if (_toAdd) then {_curator addCuratorEditableObjects [[_x], true];};
} forEach allUnits;
_curator addCuratorEditableObjects [vehicles, true];
sleep 10;
};
if (true) exitWith {};author = FlyingFish;
onLoadName = "WBB Gamegroup";
loadScreen = "wbbloadsc.jpg";
overviewPicture = "Katherine.jpg";
OnLoadMission = "[WBB]Operation Katherine";
overviewText = "Operation Katherine";
disabledAI = 1;
Respawn = "INSTANT";
respawnButton = 0;
RespawnDelay = 2;
respawnOnStart=-1;
RespawnDialog = 1;
joinUnassigned = false; // auto assign
enableDebugConsole = 1; // Debug Console
#include "INS_revive\description.hpp"
#include "VAS\menu.hpp"
#include "JWC_CASFS\casDefine.hpp"
#include "JWC_CASFS\casMenu.hpp"
class Params
{
// Example Parameter
class EmtpyLine0 {
title = ":: Mission Settings";
values[]={0,0};
texts[]={ "",""};
default = 0;
};
//// Respawn Script - Start ////
#include "INS_revive\params.hpp"
//// Respawn Script - End ////
};
class RscTitles
{
//// Respawn Script - Start ////
#include "INS_revive\rsctitles.hpp"
//// Respawn Script - End ////
};
class CfgFunctions
{
#include "INS_revive\cfgfunctions.hpp"
#include "VAS\cfgfunctions.hpp"
};
class CfgSounds {
//// Respawn Script - Start ////
#include "INS_revive\cfgsounds.hpp"
//// Respawn Script - End ////
class cantDo
{
name="cantDo";
sound[]={"JWC_CASFS\cantDo.ogg",1.0,1.0};
titles[]={};
};
class cascall
{
name="cascall";
sound[]={"JWC_CASFS\cascall.ogg",1.0,1.0};
titles[]={};
};
class missleaway
{
name="missleaway";
sound[]={"JWC_CASFS\missleaway.ogg",1.0,1.0};
titles[]={};
};
}
class CfgMusic {
tracks[]={
Intro, Outro
};
class Intro {
name="Intro";
sound[]={"Sound\Intro.ogg", db+8, 1.0};
};
class Outro {
name="Outro";
sound[]={"Sound\Outro.ogg", db+10, 1.0};
};
};
class Extended_PreInit_EventHandlers {
// Replace mission_name with name of your mission
class mission_name {
// If has ace mode, enable ace wound system
serverInit = "ace_sys_wounds_enabled = true; publicVariable 'ace_sys_wounds_enabled';";
};
};// INFANTRY SKILL
_InfskillSet = [
0.15, // aimingAccuracy
0.15, // aimingShake
0.15, // aimingSpeed
0.3, // spotDistance
0.3, // spotTime
0.3, // courage
0.3, // reloadSpeed
0.7, // commanding
0.3 // general
];
// ARMOUR SKILL
_ArmSkillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.3, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
0.5, // courage
0.7, // reloadSpeed
0.7, // commanding
0.7 // general
];
// LIGHT VEHICLE skill
_LigSkillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.6, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
0.7, // courage
0.7, // reloadSpeed
0.7, // commanding
0.7 // general
];
// HELICOPTER SKILL
_AIRskillSet = [
0.25, // aimingAccuracy
0.45, // aimingShake
0.5, // aimingSpeed
0.5, // spotDistance
0.5, // spotTime
1, // courage
1, // reloadSpeed
1, // commanding
1 // general
];
// STATIC SKILL
_STAskillSet = [
0.25, // aimingAccuracy
0.25, // aimingShake
0.3, // aimingSpeed
0.4, // spotDistance
0.4, // spotTime
0.6, // courage
0.3, // reloadSpeed
0.5, // commanding
0.5 // 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"];
_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};
_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";};
};
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];
_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.1) - (random 0.1);
_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=2; // 1 is default
EOS_KILLCOUNTER=false; // Counts killed units
null = [["EOS_T1Base_1"],[7,0],[1,1,60],[0,0],[0],[0],[0,0],[0,1,300,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_T1Base_2"],[3,0],[1,1,65],[0,0],[0],[0],[0,0],[0,1,500,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A1Base_1"],[0,0],[2,1,70],[0,0],[0],[0],[0,0],[0,1,500,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A1Base_2"],[0,0],[2,2,60],[0,0],[0],[0],[0,0],[0,1,500,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A1Base_3"],[3,0],[0,0],[0,0],[0],[0],[0,0],[0,1,300,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A1Base_4"],[2,0],[0,0],[0,0],[0],[0],[0,0],[0,1,300,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A1Base_5"],[2,0],[0,0],[0,0],[0],[0],[0,0],[0,1,300,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A1Base_6"],[5,0],[0,0],[0,0],[0],[0],[0,0],[0,1,300,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A2Base_1"],[4,0],[1,1,70],[0,0],[0],[0],[0,0],[0,1,200,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A3Base_1"],[5,0],[2,1,70],[0,0],[0],[0],[0,0],[0,1,250,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A4Base_1"],[4,0],[2,1,70],[0,0],[0],[0],[0,0],[0,1,200,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A5Base_1"],[0,0],[2,1,80],[0,0],[0],[0],[0,0],[0,1,200,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A5Base_2"],[0,0],[2,2,90],[0,0],[0],[0],[0,0],[0,1,200,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A5Base_3"],[3,0],[0,0],[0,0],[0],[0],[0,0],[0,1,200,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_A5Base_4"],[5,0],[0,0],[0,0],[0],[0],[0,0],[0,1,200,EAST,FALSE]] call EOS_Spawn;
null = [["EOS_Pat01","EOS_Pat02","EOS_Pat03","EOS_Pat04","EOS_Pat05","EOS_Pat06","EOS_Pat07","EOS_Pat08","EOS_Pat09","EOS_Pat10","EOS_Pat11","EOS_Pat12","EOS_Pat13","EOS_Pat14","EOS_Pat15","EOS_Pat16","EOS_Pat17","EOS_Pat18","EOS_Pat19","EOS_Pat20","EOS_Pat21","EOS_Pat22","EOS_Pat23","EOS_Pat24","EOS_Pat25","EOS_Pat26","EOS_Pat27","EOS_Pat28"],[0,0],[1,1,90],[0,0],[0],[0],[0,0],[0,1,380,EAST,FALSE]] call EOS_Spawn;
null = [["BAS_T1Base_1"],[2,1],[0,0],[0],[0,0],[0,1,EAST],[180,3,600,FALSE,FALSE]] call Bastion_Spawn;
null = [["BAS_T2Base_1"],[3,1],[0,0],[0],[0,0],[0,1,EAST],[380,3,600,FALSE,FALSE]] call Bastion_Spawn;
null = [["BAS_T2Base_2"],[3,1],[0,0],[0],[0,0],[0,1,EAST],[380,3,600,FALSE,FALSE]] call Bastion_Spawn;
null = [["BAS_T2Base_3"],[3,1],[0,0],[0],[1,2],[0,1,EAST],[300,3,600,FALSE,FALSE]] call Bastion_Spawn;
null = [["BAS_T2Base_4"],[3,1],[0,0],[0],[1,2],[0,1,EAST],[380,3,600,FALSE,FALSE]] call Bastion_Spawn;
null = [["BAS_T2Base_5"],[3,1],[0,0],[0],[1,3],[0,1,EAST],[300,3,600,FALSE,FALSE]] call Bastion_Spawn;
null = [["BAS_T2Base_6"],[0,0],[0,0],[0],[1,0],[0,1,EAST],[380,2,380,FALSE,FALSE]] call Bastion_Spawn;
null = [["EOS_Depot"],[6,0],[3,2],[0,0],[2],[2],[0,0],[0,1,900,EAST,FALSE]] call EOS_Spawn;
null = [["BAS_DEPOT"],[0,0],[2,2],[0],[2,2],[0,1,EAST],[180,2,380,FALSE,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_soldier_exp_F","O_Soldier_A_F","O_soldierU_AR_F","O_Soldier_LAT_F","O_soldier_M_F","O_medic_F","O_Soldier_TL_F"];
_ArmPool= ["O_APC_Tracked_02_AA_F","O_APC_Tracked_02_cannon_F","O_APC_Tracked_02_AA_F","O_APC_Tracked_02_AA_F","O_APC_Tracked_02_AA_F"];
_MotPool= ["O_Truck_02_covered_F","O_G_Offroad_01_armed_F","O_MRAP_02_F","O_G_Offroad_01_armed_F","O_MRAP_02_hmg_F","O_G_Offroad_01_armed_F"];
_ACHPool= ["O_Heli_Attack_02_black_F","O_Heli_Attack_02_F"];
_CHPool= ["O_Heli_Transport_04_covered_F","O_Heli_Transport_04_covered_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];
_tempArrayif (!isServer && isNull player) then {isJIP=true;} else {isJIP=false;};
if (!isDedicated) then {waitUntil {!isNull player && isPlayer player};};
[]execVM "INS_revive\revive_init.sqf";
[]execVM "eos\OpenMe.sqf";
[]execVM "initPlayerLocal.sqf";
[]execVM "JWC_CASFS\initCAS.sqf";
[CuratorModule,true] execVM "ADV_zeus.sqf";
waitUntil {!isNil "INS_REV_FNCT_init_completed"};
["\A3\Missions_F_EPA\video\A_m01_quotation.ogv", "STR_A3_Campaign_Quote_8"] call BIS_fnc_quotations;
waitUntil {BIS_fnc_quotations_playing || !(isNil "BIS_fnc_quotations_skip")};
[
180, // seconds to delete dead bodies (0 means don't delete)
10*60, // seconds to delete dead vehicles (0 means don't delete)
0, // seconds to delete immobile vehicles (0 means don't delete)
3*60, // seconds to delete dropped weapons (0 means don't delete)
10*60, // seconds to deleted planted explosives (0 means don't delete)
3*60 // seconds to delete dropped smokes/chemlights (0 means don't delete)
] execVM 'repetitive_cleanup.sqf';
if (isServer) then
{
[CuratorModule,true] execVM "ADV_zeus.sqf";
};
[] spawn {
while{not isnull A1} do {"A1_marker" setmarkerpos getpos A1; sleep 1;};
};
[] spawn {
while{not isnull B1} do {"B1_marker" setmarkerpos getpos B1; sleep 1;};
};
[] execVM "3rdView Restrictions.sqf";
player enableFatigue false;
player addMPEventhandler ["MPRespawn", {player enableFatigue false}];
["InitializePlayer", [player]] call BIS_fnc_dynamicGroups; ["Initialize"] call BIS_fnc_dynamicGroups; // Allow Revive
// values ={ 0,1,2 };
// texts ={ "Everyone","Medic only","Pre-Defined"};
#define INS_REV_DEF_allow_revive 0
// Player Respawn Delay
// values[]={5,30,60,120,240};
// texts[]={"Dynamic","30 Sec","1 Min","2 Min","4 Min"};
#define INS_REV_DEF_respawn_delay 1200
// Life Time for Revive
// values[]={-1,30,60,120,180,300,600};
// texts[]={"Unlimited","30 Sec","1 Min","2 Min","3 Min","5 Min","10 Min"};
#define INS_REV_DEF_life_time 1200
// How long takes time to revive
// values[]={10,15,20,25,30,40,50,60,120};
// texts[]={"10 sec","15 sec","20 Sec","25 Sec","30 Sec","40 Sec","50 Sec","1 Min","2 Min"};
#define INS_REV_DEF_revive_take_time 10
// Require Medkit for Rivive
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_require_medkit 0
// Respawn Faction
// values[]={ 0,1,2 };
// texts[]={ "ALL (Co-Op Only)","SIDE (Co-Op, PvP)","GROUP (Co-Op, PvP)"};
#define INS_REV_DEF_respawn_type 2
// Respawn Location
// values[]={ 0,1,2 };
// texts[]={ "Base + Alive friendly unit","Base","Alive friendly unit"};
#define INS_REV_DEF_respawn_location 2
// Display Respawn Locations Marker
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_displayRespawnLocationMarker 0
// - Marker Color
// values[]={ 0,1,2,3,4,5,6,7,8,9 };
// texts[]={ "ColorOrange","ColorYellow","ColorGreen","ColorPink","ColorBrown","ColorKhaki","ColorBlue","ColorRed","ColorBlack","ColorWhite" };
#define INS_REV_DEF_respawnLocationMarkerColor 0
// - Marker Type
// values[]={ 0,1,2,3,4,5,6 };
// texts[]={ "mil_flag","mil_dot","mil_box","mil_triangle","mil_marker","mil_destroy","mil_circle" };
#define INS_REV_DEF_respawnLocationMarkerType 6
// Destroy when base vehicle can't move. (Mobile Respawn)
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_destroyDamagedVehicle 0
// - Delay Time
// values[]={10,15,20,25,30,40,50,60,120,300,600};
// texts[]={"10 sec","15 sec","20 Sec","25 Sec","30 Sec","40 Sec","50 Sec","1 Min","2 Min","5 Min", "10 Min"};
#define INS_REV_DEF_destroyDamagedVehicleDelay 30
// On JIP Action
// values[]={ 0,1,2 };
// texts[]={ "None","Teleport Action","Dispalay respawn camera"};
#define INS_REV_DEF_jip_action 1
// Allow to Drag Body
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_can_drag_body 1
// Allow to Carry Body
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_can_carry_body 1
// - Allow to load Body (MEDEVAC)
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_medevac 1
// Player can respawn player's own body
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_can_respawn_player_body 0
// Player can respawn player's own body, If half of players are dead.
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_half_dead_repsawn_player_body 0
// Player can respawn immediately, if there is not exist friendly unit near player
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_near_friendly 0
// - Friendly unit search distance
// values[]={ 10,30,50,100,300,500 };
// texts[]={ "10m","30m","50m","100m","300m","500m"};
#define INS_REV_DEF_near_friendly_distance 100
// Player cannot respawn, if exist enemy unit near player
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_near_enemy 0
// - Enemy unit search distance
// values[]={ 10,30,50,100,300,500 };
// texts[]={ "10m","30m","50m","100m","300m","500m"};
#define INS_REV_DEF_near_enemy_distance 50
// Player can respawn immediately, if all players are dead.
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_all_dead_respawn 0
// Restore loadout on respawn
// values[]={ 1,0 };
// texts[]={ "Enabled","Disabled"};
#define INS_REV_DEF_loadout_on_respawn 0// Configuration file
// RESPAWN LOCATION list
// You can define vehicle or object
INS_REV_CFG_list_of_respawn_locations_blufor = ["base","mobile_1","air_1","boat_1"];
INS_REV_CFG_list_of_respawn_locations_opfor = ["base2","car_1"];
INS_REV_CFG_list_of_respawn_locations_civ = [];
INS_REV_CFG_list_of_respawn_locations_guer = ["mobile_1"];
// RESPAWN DELAY TIME
// You can define respawn delay time.
//
//INS_REV_CFG_respawn_delay = 120; // Overrided by decription.ext parameter
//INS_REV_CFG_respawn_delay_blufor = 120; // If you want to set delay time by each side, uncomment this value.
//INS_REV_CFG_respawn_delay_opfor = 120; // If you want to set delay time by each side, uncomment this value.
//INS_REV_CFG_respawn_delay_civ = 120; // If you want to set delay time by each side, uncomment this value.
//INS_REV_CFG_respawn_delay_guer = 120; // If you want to set delay time by each side, uncomment this value.
// LANGUAGE
// Language selection ("en" for english, you can create your own "XX_strings_lang.sqf" file)
INS_REV_CFG_language = "en";
// REVIVE LIFE TIME
// You can define life time for revive.
//
//INS_REV_CFG_life_time = 300; // Overrided by decription.ext parameter
// How long takes time to revive
// You can define how log takes time to revive.
//
//INS_REV_CFG_revive_take_time = 15; // Overrided by decription.ext parameter
// REVIVE REQUIRES MEDKIT
// Revive consumes a first aid kit when reviving.
//
//INS_REV_CFG_require_medkit = false; // Overrided by decription.ext parameter
// DISPLAY RESPAWN LOCATIONS MARKER
// Display Respawn Locations Marker
// Color Index : "ColorOrange","ColorYellow","ColorGreen","ColorPink","ColorBrown","ColorKhaki","ColorBlue","ColorRed","ColorBlack","ColorWhite"
// Type Index : "mil_marker","mil_flag","mil_dot","mil_box","_mil_triangle","mil_destroy","mil_circle"
//
//INS_REV_CFG_displayRespawnLocationMarker = true; // Overrided by decription.ext parameter
//INS_REV_CFG_respawnLocationMarkerColor = 0; // Overrided by decription.ext parameter
//INS_REV_CFG_respawnLocationMarkerType = 0; // Overrided by decription.ext parameter
// DESTROY WHEN BASE VEHICLE CAN"T MOVE
// Destroy when base vehicle can't move
//
//INS_REV_CFG_destroyDamagedVehicle = false; // Overrided by decription.ext parameter
//INS_REV_CFG_destroyDamagedVehicleDelay = 30; // Overrided by decription.ext parameter
// PLAYER CAN RESPAWN PLAYER's BODY
// You can define is it possible to respawn player's body.
//
//INS_REV_CFG_can_respawn_player_body = false; // Overrided by decription.ext parameter
// PLAYER CAN RESPAWN PLAYER's BODY, WHEN HALF OF PLAYERS ARE DEAD
// You can define is it possible to respawn player's body, when half of players are dead.
//
//INS_REV_CFG_half_dead_repsawn_player_body = true; // Overrided by decription.ext parameter
// PLAYER RESPAWN TYPE
// "ALL" - You can respawn all respawn locations and all alive players.(even if enemy)
// "SIDE" - You can only respawn friendly respawn locations and alive friendly players.
// "GROUP" - You can only repsawn your current group.
//
//INS_REV_CFG_respawn_type = "ALL"; // Overrided by decription.ext parameter
// PLAYER RESPAWN LOCATION
// "BOTH" - Base + Alive Friendldy Unit
// "BASE" - Base Only
// "FRIENDLY_UNIT" - Alive Friendly Unit Only
//
//INS_REV_CFG_respawn_location = "BOTH"; // Overrided by decription.ext parameter
// PLAYER CAN RESPAWN IMMEDIATELY WHEN THERE'S NOT EXIST FRIENDLY UNIT NEAR PLAYER
// There's not exist friendly unit near player, player can respawn immediately.
//
//INS_REV_CFG_respawn_near_friendly = false; // Overrided by decription.ext parameter
//INS_REV_CFG_respawn_near_friendly_range = 50; // Overrided by decription.ext parameter
// PLAYER CANNOT RESPAWN, IF EXIST ENEMY UNIT NEAR PLAYER
// If exist enemy unit near player, player cannot respawn.
//
//INS_REV_CFG_near_enemy = false; // Overrided by decription.ext parameter
//INS_REV_CFG_near_enemy_range = 50; // Overrided by decription.ext parameter
// PLAYER CAN RESPAWN IMMEDIATELY WHEN ALL PLAYERS ARE DEAD
// When all players are dead, player can respawn immediately.
//
//INS_REV_CFG__all_dead_respawn = true; // Overrided by decription.ext parameter
// JIP TELEPORT ACTION
// True to allow JIP to use teleport action menu with in 3 minutes.
// False to when JIP connected, he will be shown respawn display.
// 0 is none
// 1 is add 'Teleport to teammate' action
// 2 is dead camera
//
//INS_REV_CFG_JIP_Teleport_Action = 1; // Overrided by decription.ext parameter
// ALLOW TO DRAG BODY
// True to allow any player to drag unconscious bodies
// The value can be changed with an external script at any time with an instant effect
//
//INS_REV_CFG_player_can_drag_body = true; // Overrided by decription.ext parameter
// ALLOW TO CARRY BODY
// True to allow any player to carry unconscious bodies
// The value can be changed with an external script at any time with an instant effect
//
//INS_REV_CFG_player_can_carry_body = true; // Overrided by decription.ext parameter
// ALLOW TO LOAD BODY
// True to allow any player to load unconscious bodies to vehicle
// The value can be changed with an external script at any time with an instant effect
//
//INS_REV_CFG_medevac = true; // Overrided by decription.ext parameter
// NUMBER OF REVIVES (Not implemented yet)
// Maximal number of revives for a player
//
//INS_REV_CFG_number_of_revives = 3;
/**
* ALLOW TO REVIVE (system with three variables)
* There are different ways to define who can revive unconscious bodies.
*
* The variable INS_REV_CFG_list_of_classnames_who_can_revive contains the list of classnames (i.e. the types of soldiers) who can revive.
* To allow every soldiers to revive, you can write : INS_REV_CFG_list_of_classnames_who_can_revive = ["CAManBase"];
* To allow USMC officers and medics, you can write : INS_REV_CFG_list_of_classnames_who_can_revive = ["USMC_Soldier_Officer", "USMC_Soldier_Medic"];
* To not use the classnames to specify who can revive, you can write an empty list : INS_REV_CFG_list_of_classnames_who_can_revive = [];
* To know the different classnames of soldiers, you can visit this page : http://browser.six-projects.net/cfg_vehicles/tree?utf8=%E2%9C%93&version=67
*
* The variable INS_REV_CFG_list_of_slots_who_can_revive contains the list of named slots (or units) who can revive.
* For example, consider that you have two playable units named "medic1" and "medic2" in your mission editor.
* To allow these two medics to revive, you can write : INS_REV_CFG_list_of_slots_who_can_revive = [medic1, medic2];
* To not use the slots list to specify who can revive, you can write an empty list : INS_REV_CFG_list_of_slots_who_can_revive = [];
*
* The variable INS_REV_CFG_all_medics_can_revive is a boolean to allow all medics to revive.
*
* These three variables can be used together. The players who can revive are the union of the allowed players for each variable.
* For example, if you set :
* INS_REV_CFG_all_player_can_revive = false;
* INS_REV_CFG_all_medics_can_revive = true;
* INS_REV_CFG_list_of_classnames_who_can_revive = ["USMC_Soldier_Officer"];
* INS_REV_CFG_list_of_slots_who_can_revive = [special_slot1, special_slot2];
* then all the medics, all the "USMC_Soldier_Officer" and the players at special_slot1, special_slot1 can revive.
* If a player "appears" in two categories (e.g. he is an "USMC_Soldier_Officer" at the slot named "special_slot2"),
* it is not a matter. He will be allowed to revive without problem.
*
* The value of the three variables can be changed with an external script at any time with an instant effect.
*/
//
//INS_REV_CFG_all_player_can_revive = true; // Overrided by decription.ext parameter
//INS_REV_CFG_all_medics_can_revive = true; // Overrided by decription.ext parameter
INS_REV_CFG_list_of_classnames_who_can_revive = [];
INS_REV_CFG_list_of_slots_who_can_revive = [];
// Validate Config
#include "validate_cfg.sqf"
/*
AUTHOR: aeroson
NAME: get_loadout.sqf
VERSION: 3.4
DOWNLOAD & PARTICIPATE:
https://github.com/aeroson/a3-loadout
http://forums.bistudio.com/showthread.php?148577-GET-SET-Loadout-(saves-and-loads-pretty-much-everything)
DESCRIPTION:
I guarantee backwards compatibility.
These scripts allows you set/get (load/save)all of the unit's gear, including:
uniform, vest, backpack, contents of it, all quiped items, all three weapons with their attachments, currently loaded magazines and number of ammo in magazines.
All this while preserving order of items.
Useful for saving/loading loadouts.
Ideal for revive scripts where you have to set exactly the same loadout to newly created unit.
Uses workaround with placeholders to add vest/backpack items, so items stay where you put them.
PARAMETER(S):
0 : target unit
1 : (optional) array of options, default [] :
"ammo" will save ammo count of partially emptied magazines
"repetitive" intended for repetitive use, will not use selectWeapon, means no visible effect on solder, but will not save magazines of assigned items such as laser designator batteries
RETURNS:
Array : array of strings/arrays containing target unit's loadout, to be used by fnc_set_loadout.sqf
addAction support:
Saves player's loadout into global var loadout
*/
private ["_target","_options","_saveMagsAmmo","_isRepetitive","_isOnFoot","_currentWeapon","_currentMode","_isFlashlightOn","_isIRLaserOn","_magazinesAmmo","_loadedMagazines","_saveWeaponMagazines","_getMagsAmmo","_backPackItems","_assignedItems","_data"];
_options = [];
// addAction support
if(count _this < 4) then {
#define PARAM_START private ["_PARAM_INDEX"]; _PARAM_INDEX=0;
#define PARAM_REQ(A) if (count _this <= _PARAM_INDEX) exitWith { systemChat format["required param '%1' not supplied in file:'%2' at line:%3", #A ,__FILE__,__LINE__]; }; A = _this select _PARAM_INDEX; _PARAM_INDEX=_PARAM_INDEX+1;
#define PARAM(A,B) A = B; if (count _this > _PARAM_INDEX) then { A = _this select _PARAM_INDEX; }; _PARAM_INDEX=_PARAM_INDEX+1;
PARAM_START
PARAM_REQ(_target)
PARAM(_options,[])
} else {
_target = player;
};
_saveMagsAmmo = "ammo" in _options;
_isRepetitive = "repetitive" in _options;
_isOnFoot = vehicle _target == _target;
_currentWeapon = "";
_currentMode = "";
_isFlashlightOn = false;
_isIRLaserOn = false;
_magazinesAmmo = magazinesAmmoFull _target;
// save weapon mode and muzzle
if(_isOnFoot) then {
_currentWeapon = currentMuzzle _target;
_currentMode = currentWeaponMode _target;
_isFlashlightOn = _target isFlashlightOn _currentWeapon;
_isIRLaserOn = _target isIRLaserOn _currentWeapon;
} else {
_currentWeapon = currentWeapon _target;
};
_loadedMagazines=[];
// universal weapon saving
_saveWeaponMagazines = {
private ["_weapon","_magazines","_muzzles","_saveMagazine"];
_weapon = _this select 0;
_magazines = [];
_saveMagazine = { // find, save and eat mag for _weapon
private ["_weapon","_magazine","_ammo"];
_weapon = _this select 0;
_magazine = "";
_ammo = 0;
{
if((_x select 4)==_weapon) then {
_magazine = _x select 0;
_ammo = _x select 1;
_x = -1;
};
} forEach _magazinesAmmo;
_magazinesAmmo = _magazinesAmmo - [-1];
if(_magazine!="") then {
if(_saveMagsAmmo) then {
_magazines set [count _magazines, [_magazine, _ammo]];
} else {
_magazines set [count _magazines, _magazine];
};
};
};
if(_weapon != "") then {
[_weapon] call _saveMagazine;
_muzzles = configFile>>"CfgWeapons">>_weapon>>"muzzles";
if(isArray(_muzzles)) then {
{ // add one mag for each muzzle
if (_x != "this") then {
[_x] call _saveMagazine;
};
} forEach getArray(_muzzles);
};
};
_loadedMagazines set [count _loadedMagazines, _magazines];
};
// save loaded mags for each weapon separetely, since some weapons can use same magazines
[primaryWeapon _target] call _saveWeaponMagazines;
[handgunWeapon _target] call _saveWeaponMagazines;
[secondaryWeapon _target] call _saveWeaponMagazines;
_getMagsAmmo = { // default function with _saveMagsAmmo == false
_this select 0;
};
if(_saveMagsAmmo) then {
// check if input array contains magazine, if it does, find it add ammo count
_getMagsAmmo = {
private ["_items","_location","_item","_itemIndex"];
_items = _this select 0;
_location = _this select 1;
{
_item = _x;
_itemIndex = _forEachIndex;
{
if((_x select 4)==_location && (_x select 0)==_item) then {
_items set[_itemIndex, [_item, _x select 1]];
_x = -1;
};
} forEach _magazinesAmmo;
_magazinesAmmo = _magazinesAmmo - [-1];
} forEach _items;
_items;
};
};
// get backpack items
_cargo = getbackpackcargo (unitbackpack _target);
_backpacks = [];
{
for "_i" from 1 to ((_cargo select 1) select _foreachindex) do {
_backpacks set [count _backpacks, _x];
};
} foreach (_cargo select 0);
_backPackItems = (backpackitems _target) + _backpacks;
// get assigned items, headgear and goggles is not part of assignedItems
_assignedItems = assignedItems _target;
_headgear = headgear _target;
_goggles = goggles _target;
if((_headgear != "") && !(_headgear in _assignedItems)) then {
_assignedItems set [count _assignedItems, _headgear];
};
if((_goggles != "") && !(_goggles in _assignedItems)) then {
_assignedItems set [count _assignedItems, _goggles];
};
/*
// use this once magazinesAmmoFull is fixed and shows magazines of assignedItems
// get magazines of everything else except weapons, most likely assigned items
// only ["Uniform","Vest","Backpack"] locations remain, weapon locations have already been eaten
_magazines = [];
{
if(_x select 2) then {
if(_saveMagsAmmo) then {
_magazines set[count _magazines, [_x select 0, _x select 1]];
} else {
_magazines set[count _magazines, _x select 0];
};
_x = -1;
};
} forEach _magazinesAmmo;
_magazinesAmmo = _magazinesAmmo - [-1];
_loadedMagazines set [3, _magazines];
*/
// old method using selectWeapon, cycles and tries to selectWeapon all assigned items
if(!_isRepetitive) then {
private ["_weaponHasChanged"];
_weaponHasChanged = false;
// get magazines of all assigned items
_magazines = [];
{
_target selectWeapon _x;
if(currentWeapon _target==_x) then {
_weaponHasChanged = true;
_magazine = currentMagazine _target;
if(_magazine != "") then {
if(_saveMagsAmmo) then {
_magazines set[count _magazines, [_magazine, _target ammo _x]];
} else {
_magazines set[count _magazines, _magazine];
};
};
};
} forEach _assignedItems;
_loadedMagazines set [3, _magazines];
// select back originaly selected weapon and mode, only if weapon has changed
if(_weaponHasChanged) then {
if(_isOnFoot) then {
if(_currentWeapon != "" && _currentMode != "") then {
_muzzles = 0;
while{ (_currentWeapon != currentMuzzle _target || _currentMode != currentWeaponMode _target ) && _muzzles < 200 } do {
_target action ["SWITCHWEAPON", _target, _target, _muzzles];
_muzzles = _muzzles + 1;
};
if(_isFlashlightOn) then {
_target action ["GunLightOn"];
} else {
_target action ["GunLightOff"];
};
if(_isIRLaserOn) then {
_target action ["IRLaserOn"];
} else {
_target action ["IRLaserOff"];
};
};
} else {
_currentMode = "";
};
if(_currentMode == "") then {
if(_currentWeapon=="") then {
_target action ["SWITCHWEAPON", _target, _target, 0];
} else {
_target selectWeapon _currentWeapon;
};
};
};
};
_data = [
_assignedItems, //0 []
primaryWeapon _target, //1 ""
primaryWeaponItems _target, //2 []
handgunWeapon _target, //3 ""
handgunItems _target, //4 []
secondaryWeapon _target, //5 ""
secondaryWeaponItems _target, //6 []
uniform _target, //7 ""
[uniformItems _target, "Uniform"] call _getMagsAmmo, //8 ["magazine without ammo count",["magazine with ammo count",30], ....]
vest _target, //9 ""
[vestItems _target, "Vest"] call _getMagsAmmo, //10
backpack _target, //11 ""
[_backPackItems, "Backpack"] call _getMagsAmmo, //12
_loadedMagazines, //13 (optional) [[primary mags],[handgun mags],[secondary mags],[other mags]]
_currentWeapon, //14 (optional) ""
_currentMode //15 (optional) ""
];
// addAction support
if(count _this < 4) then {
_data;
} else {
loadout = _data;
//playSound3D ["A3\Sounds_F\sfx\ZoomOut.wav", _target];
}; /*
AUTHOR: aeroson
NAME: set_loadout.sqf
VERSION: 4.3
DOWNLOAD & PARTICIPATE:
https://github.com/aeroson/a3-loadout
http://forums.bistudio.com/showthread.php?148577-GET-SET-Loadout-(saves-and-loads-pretty-much-everything)
DESCRIPTION:
I guarantee backwards compatibility.
These scripts allows you set/get (load/save)all of the unit's gear, including:
uniform, vest, backpack, contents of it, all quiped items, all three weapons with their attachments, currently loaded magazines and number of ammo in magazines.
All this while preserving order of items.
Useful for saving/loading loadouts.
Ideal for revive scripts where you have to set exactly the same loadout to newly created unit.
Uses workaround with placeholders to add vest/backpack items, so items stay where you put them.
PARAMETER(S):
0 : target unit
1 : array of strings/arrays containing desired target unit's loadout, obtained from get_loadout.sqf
2 : (optional) array of options, default [] : ["ammo"] will allow loading of partially emptied magazines, otherwise magazines will be full
addAction support:
Sets player's loadout from global var loadout
*/
private ["_target","_options","_loadMagsAmmo","_data","_loadedMagazines","_placeholderCount","_loadBeforeAdd","_add","_outfit","_addWeapon","_addPrimary","_addHandgun","_addSecondary","_addOrder","_currentWeapon","_currentMode"];
_options = [];
// addAction support
if(count _this < 4) then {
#define PARAM_START private ["_PARAM_INDEX"]; _PARAM_INDEX=0;
#define PARAM_REQ(A) if (count _this <= _PARAM_INDEX) exitWith { systemChat format["required param '%1' not supplied in file:'%2' at line:%3", #A ,__FILE__,__LINE__]; }; A = _this select _PARAM_INDEX; _PARAM_INDEX=_PARAM_INDEX+1;
#define PARAM(A,B) A = B; if (count _this > _PARAM_INDEX) then { A = _this select _PARAM_INDEX; }; _PARAM_INDEX=_PARAM_INDEX+1;
PARAM_START
PARAM_REQ(_target)
PARAM_REQ(_data)
PARAM(_options,[])
} else {
_target = player;
_data = loadout;
//playSound3D ["A3\Sounds_F\sfx\ZoomIn.wav", _target];
};
if(isNil{_data}) exitWith {
systemChat "you are trying to set/load empty loadout";
};
if(count _data < 13) exitWith {
systemChat "you are trying to set/load corrupted loadout";
};
#define QUOTE(A) #A
#define EL(A,B) ((A) select (B))
#define _THIS(A) EL(_this,A)
// placeholders
#define PLACEHOLDER_BACKPACK QUOTE(B_Kitbag_mcamo) // any backpack with capacity>0
#define PLACEHOLDER_ITEM QUOTE(ItemWatch) // addItem placeholder should be smallest item possible
_loadMagsAmmo = "ammo" in _options;
_loadedMagazines = [];
if(count _data > 13) then {
if(typeName(_data select 13)=="ARRAY") then {
_loadedMagazines = _data select 13;
};
};
_currentWeapon = "";
if(count _data > 14) then {
_currentWeapon = _data select 14;
};
_currentMode = "";
if(count _data > 15) then {
_currentMode = _data select 15;
};
_placeholderCount = 0;
// basic add function intended for use with uniform and vest
_add = {
private ["_target","_item","_callback"];
_target = _this select 0;
_item = _this select 1;
_callback = _this select 2;
if(typename _item == "ARRAY") then {
if(_item select 0 != "") then {
if(_loadMagsAmmo) then {
_target addMagazine _item;
} else {
(_item select 0) call _callback;
};
};
} else {
if(_item != "") then {
_item call _callback;
};
};
};
// remove clothes to prevent incorrect mag loading
removeUniform _target;
removeVest _target;
removeBackpack _target;
_outfit = PLACEHOLDER_BACKPACK; // we need to add items somewhere before we can assign them
_target addBackpack _outfit;
clearAllItemsFromBackpack _target;
removeAllAssignedItems _target;
removeHeadgear _target;
removeGoggles _target;
// add loaded magazines of assigned items
if(count _loadedMagazines>=3) then {
{
[_target, _x, { _target addItemToBackpack _x }] call _add;
} forEach (_loadedMagazines select 3);
};
// add assigned items
{
[_target, _x, { _target addItemToBackpack _x }] call _add;
_target assignItem _x;
} forEach (_data select 0);
clearAllItemsFromBackpack _target;
// get assigned items, headgear and goggles is not part of assignedItems
private ["_assignedItems","_headgear","_goggles"];
_assignedItems = assignedItems _target;
_headgear = headgear _target;
_goggles = goggles _target;
if((_headgear != "") && !(_headgear in _assignedItems)) then {
_assignedItems set [count _assignedItems, _headgear];
};
if((_goggles != "") && !(_goggles in _assignedItems)) then {
_assignedItems set [count _assignedItems, _goggles];
};
// add asigned items that could not be added with assign item
// asuming each assigned item can be put only into one slot
{
if(!(_x in _assignedItems)) then {
_target addWeapon _x;
}
} forEach (_data select 0);
// universal add weapon to hands
_addWeapon = {
private ["_weapon","_magazines","_muzzles"];
clearAllItemsFromBackpack _target;
_target removeWeapon ([] call _THIS(0));
_weapon = _data select _THIS(1);
if(_weapon != "") then {
if(isClass(configFile>>"CfgWeapons">>_weapon)) then {
if (_currentWeapon == "") then {
_currentWeapon = _weapon;
};
if(count _loadedMagazines > 0) then {
_magazines = _loadedMagazines select _THIS(5); // get loaded magazines from saved loadout
if(typename _magazines != "ARRAY") then { // backwards compatibility, make sure _magazines is array
if(_magazines=="") then {
_magazines = [];
} else {
_magazines = [_magazines];
};
};
} else {
_magazines = [getArray(configFile>>"CfgWeapons">>_weapon>>"magazines") select 0]; // generate weapon magazine
_muzzles = configFile>>"CfgWeapons">>_weapon>>"muzzles";
if(isArray(_muzzles)) then { // generate magazine for each muzzle
{
if (_x != "this") then {
_magazines set [count _magazines, toLower(getArray(configFile>>"CfgWeapons">>_weapon>>_x>>"magazines") select 0)];
};
} forEach getArray(_muzzles);
};
};
{
[_target, _x, { _target addItemToBackpack _x }] call _add;
} forEach _magazines; // add magazines
_target addWeapon _weapon;
{
if(_x!="" && !(_x in ([] call _THIS(3)))) then {
_x call _THIS(4);
};
} forEach (_data select (1+_THIS(1))); // add weapon items
} else {
systemchat format["%1 %2 doesn't exist",_THIS(2),_weapon];
if (_currentWeapon == _weapon) then {
_currentWeapon = "";
_currentMode = "";
};
};
};
};
// add primary weapon, add primary weapon loaded magazine, add primary weapon items
_addPrimary = {
[
{ primaryWeapon _target }, // 0 // get current weapon
1, // 1 //weapon classname index in _data
"primary", // 2 // weapon debug type
{ primaryWeaponItems _target }, // 3 // weapon items
{ _target addPrimaryWeaponItem _this }, // 4 // add weapon item
0 // 5 // index in _loadedMagazines
] call _addWeapon;
};
// add handgun weapon, add handgun weapon loaded magazine, add handgun weapon items
_addHandgun = {
[
{ handgunWeapon _target }, // 0 // get current weapon
3, // 1 //weapon classname index in _data
"handgun", // 2 // weapon debug type
{ handgunItems _target }, // 3 // weapon items
{ _target addHandgunItem _this }, // 4 // add weapon item
1 // 5 // index in _loadedMagazines
] call _addWeapon;
};
// add secondary weapon, add secondary weapon loaded magazine, add secondary weapon items
_addSecondary = {
[
{ secondaryWeapon _target }, // 0 // get current weapon
5, // 1 //weapon classname index in _data in _data
"secondary", // 2 // weapon debug type
{ secondaryWeaponItems _target }, // 3 // weapon items
{ _target addSecondaryWeaponItem _this }, // 4 // add weapon item
2 // 5 // index in _loadedMagazines
] call _addWeapon;
};
// first added weapon is selected weapon, order add functions to firstly add currently selected weapon
_addOrder=[_addPrimary,_addHandgun,_addSecondary];
if(_currentWeapon!="") then {
_addOrder = switch _currentWeapon do {
case (_data select 3): {[_addHandgun,_addPrimary,_addSecondary]};
case (_data select 5): {[_addSecondary,_addPrimary,_addHandgun]};
default {_addOrder};
};
};
{
[] call _x;
} forEach _addOrder;
// select weapon and firing mode
if(vehicle _target == _target && _currentWeapon != "" && _currentMode != "") then {
_muzzles = 0;
while { (_currentWeapon != currentMuzzle _target || _currentMode != currentWeaponMode _target ) && _muzzles < 100 } do {
_target action ["SWITCHWEAPON", _target, _target, _muzzles];
_muzzles = _muzzles + 1;
};
if(_muzzles >= 100) then {
systemchat format["mode %1 for %2 doesn't exist", _currentMode, _currentWeapon];
_currentMode = "";
};
} else {
_currentMode = "";
};
if(_currentMode == "" && _currentWeapon != "") then {
_target selectWeapon _currentWeapon;
};
clearAllItemsFromBackpack _target;
// add uniform, add uniform items and fill uniform with item placeholders
_outfit = _data select 7;
if(_outfit != "") then {
if(isClass(configFile>>"CfgWeapons">>_outfit)) then {
_target addUniform _outfit;
_target addItem PLACEHOLDER_ITEM;
if(loadUniform _target > 0) then {
_placeholderCount = _placeholderCount + 1;
{
[_target, _x, { _target addItemToUniform _x }] call _add;
} forEach (_data select 8);
while{true} do {
_loadBeforeAdd = loadUniform _target;
_target addItem PLACEHOLDER_ITEM;
if(loadUniform _target == _loadBeforeAdd) exitWith {};
_placeholderCount = _placeholderCount + 1;
};
};
} else {
systemchat format["uniform %1 doesn't exist",_outfit];
};
};
// add vest, add vest items and fill vest with item placeholders
_outfit = _data select 9;
if(_outfit != "") then {
if(isClass(configFile>>"CfgWeapons">>_outfit)) then {
_target addVest _outfit;
_target addItem PLACEHOLDER_ITEM;
if(loadVest _target > 0) then {
_placeholderCount = _placeholderCount + 1;
{
[_target, _x, { _target addItemToVest _x }] call _add;
} forEach (_data select 10);
while{true} do {
_loadBeforeAdd = loadVest _target;
_target addItem PLACEHOLDER_ITEM;
if(loadVest _target == _loadBeforeAdd) exitWith {};
_placeholderCount = _placeholderCount + 1;
};
};
} else {
systemchat format["vest %1 doesn't exist",_outfit];
};
};
// add backpack and add backpack items
removeBackpack _target;
_outfit = _data select 11;
if(_outfit != "") then {
if(getNumber(configFile>>"CfgVehicles">>_outfit>>"isbackpack")==1) then {
_target addBackpack _outfit;
clearAllItemsFromBackpack _target;
_target addItem PLACEHOLDER_ITEM;
_placeholderCount = _placeholderCount + 1;
if(loadBackpack _target > 0) then {
{
[_target, _x, { _target addItemToBackpack _x }] call _add;
} forEach (_data select 12);
};
} else {
systemchat format["backpack %1 doesn't exist",_outfit];
};
};
// remove item placeholders
for "_i" from 1 to _placeholderCount do {
_target removeItem PLACEHOLDER_ITEM;
};
// make loadout visible fix?
if(vehicle _target == _target) then {
//_target switchMove (getArray(configFile>>"CfgMovesMaleSdr">>"States">>animationState player>>"ConnectTo") select 0);
_target setPosATL (getPosATL _target);
};private ["_obj", "_caller", "_id", "_loadout"];
_obj = _this select 0; //the object that had the action
_caller = _this select 1; //unit that called the action
_id = _this select 2; //id of the action
// Saves loadout of player into var loadout
_loadout = [_caller] call INS_REV_FNCT_get_loadout;
INS_REV_GVAR_player_loadout = _loadout;
// Call defalt value
#include "config.hpp"
class EmtpyLine1 {
title = ":: Revive Settings";
values[]={0,0};
texts[]={ "",""};
default = 0;
};
class INS_REV_PARAM_allow_revive {
title=" Allow Revive";
values[]={ 0,1,2 };
default = INS_REV_DEF_allow_revive;
texts[]={ "Everyone","Medic only","Pre-Defined"};
};
class INS_REV_PARAM_respawn_delay {
title=" Player Respawn Delay";
values[]={5,30,60,120,240};
default = INS_REV_DEF_respawn_delay;
texts[]={"Dynamic","30 Sec","1 Min","2 Min","4 Min"};
};
class INS_REV_PARAM_life_time {
title=" Life Time for Revive";
values[]={-1,30,60,120,180,300,600};
default = INS_REV_DEF_life_time;
texts[]={"Unlimited","30 Sec","1 Min","2 Min","3 Min","5 Min","10 Min"};
};
class INS_REV_PARAM_revive_take_time {
title=" How long takes time to revive (+-5 sec)";
values[]={10,15,20,25,30,40,50,60,120};
default = INS_REV_DEF_revive_take_time;
texts[]={"10 sec","15 sec","20 Sec","25 Sec","30 Sec","40 Sec","50 Sec","1 Min","2 Min"};
};
class INS_REV_PARAM_require_medkit {
title=" Requires Medkit for Revive";
values[]={ 1,0 };
default = INS_REV_DEF_require_medkit;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_respawn_type {
title=" Respawn Faction";
values[]={ 0,1,2 };
default = INS_REV_DEF_respawn_type;
texts[]={ "ALL (Co-Op Only)","SIDE (Co-Op, PvP)","GROUP (Co-Op, PvP)"};
};
class INS_REV_PARAM_respawn_location {
title=" Respawn Location";
values[]={ 0,1,2 };
default = INS_REV_DEF_respawn_location;
texts[]={ "Base + Alive Friendly Unit","Base","Alive Friendly Unit"};
};
class INS_REV_PARAM_displayRespawnLocationMarker {
title=" Display Respawn Locations Marker";
values[]={ 1,0 };
default = INS_REV_DEF_displayRespawnLocationMarker;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_respawnLocationMarkerColor {
title=" - Marker Color";
values[]={ 0,1,2,3,4,5,6,7,8,9 };
default = INS_REV_DEF_respawnLocationMarkerColor;
texts[]={ "ColorOrange","ColorYellow","ColorGreen","ColorPink","ColorBrown","ColorKhaki","ColorBlue","ColorRed","ColorBlack","ColorWhite" };
};
class INS_REV_PARAM_respawnLocationMarkerType {
title=" - Marker Type";
values[]={ 0,1,2,3,4,5,6 };
default = INS_REV_DEF_respawnLocationMarkerType;
texts[]={ "mil_marker","mil_flag","mil_dot","mil_box","mil_triangle","mil_destroy","mil_circle" };
};
class INS_REV_PARAM_destroyDamagedVehicle {
title=" Destroy when base vehicle can't move. (Mobile Respawn)";
values[]={ 1,0 };
default = INS_REV_DEF_destroyDamagedVehicle;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_destroyDamagedVehicleDelay {
title=" - Delay Time";
values[]={10,15,20,25,30,40,50,60,120,300,600};
default = INS_REV_DEF_destroyDamagedVehicleDelay;
texts[]={"10 sec","15 sec","20 Sec","25 Sec","30 Sec","40 Sec","50 Sec","1 Min","2 Min","5 Min", "10 Min"};
};
class INS_REV_PARAM_jip_action {
title=" On JIP Action";
values[]={ 0,1,2 };
default = INS_REV_DEF_jip_action;
texts[]={ "None","Teleport Action","Dispalay respawn camera"};
};
class INS_REV_PARAM_can_drag_body {
title=" Allow to Drag Body";
values[]={ 1,0 };
default = INS_REV_DEF_can_drag_body;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_can_carry_body {
title=" - Allow to Carry Body";
values[]={ 1,0 };
default = INS_REV_DEF_can_carry_body;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_medevac {
title=" - Allow to Load Body (MEDEVAC)";
values[]={ 1,0 };
default = INS_REV_DEF_medevac;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_can_respawn_player_body {
title=" Player can respawn player's own body";
values[]={ 1,0 };
default = INS_REV_DEF_can_respawn_player_body;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_half_dead_repsawn_player_body {
title=" Player can respawn player's own body, If half of players are dead";
values[]={ 1,0 };
default = INS_REV_DEF_half_dead_repsawn_player_body;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_near_friendly {
title=" Player can respawn immediately, if there is not exist friendly unit near player";
values[]={ 1,0 };
default = INS_REV_DEF_near_friendly;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_near_friendly_distance {
title=" - Friendly unit search distance";
values[]={ 10,30,50,100,300,500 };
default = INS_REV_DEF_near_friendly_distance;
texts[]={ "10m","30m","50m","100m","300m","500m"};
};
class INS_REV_PARAM_near_enemy {
title=" Player cannot respawn, if exist enemy units near player (except static BASE)";
values[]={ 1,0 };
default = INS_REV_DEF_near_enemy;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_near_enemy_distance {
title=" - Enemy unit search distance";
values[]={ 10,30,50,100,300,500 };
default = INS_REV_DEF_near_enemy_distance;
texts[]={ "10m","30m","50m","100m","300m","500m"};
};
class INS_REV_PARAM_all_dead_respawn {
title=" Player can respawn immediately, if all players are dead";
values[]={ 1,0 };
default = INS_REV_DEF_all_dead_respawn;
texts[]={ "Enabled","Disabled"};
};
class INS_REV_PARAM_loadout_on_respawn {
title=" Restore loadout on respawn";
values[]={ 1,0 };
default = INS_REV_DEF_loadout_on_respawn;
texts[]={ "Enabled","Disabled"};
};/////////////////////////////////////////////////////////////////////////////////
//
// INS revive script (based on R3F_revive) v0.3.1 by naong
//
/////////////////////////////////////////////////////////////////////////////////
//
// This software is the revive system for ArmA 2, Arma 2 Free, Arma 2 OA, Arma 2 CO, Arma 3
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
/////////////////////////////////////////////////////////////////////////////////
//
// Features
//
// - Support Arma 2, Arma 2 OA, Arma 2 CO, Arma 3.
// - Support dedicated and local server.
// - Support Co-op and PvP missions.
// - Support Join-in-progress player.
// - Support Ace mod (Arma 2 OA, Arma 2 CO).
// - Support various respawn location (vehicle, static).
// - Insurgency style dead camera.
// - Respawn, Revive, Drag body, Cancel actions.
// - Admin reserved slot.
// - On JIP Action (Teleport action or Respawn camera).
// - On respawn, revert loadout.
// - Implemented Virtual Ammobox System v0.9 (Author : Tonic) (modified some codes).
// * Fixed load and save functions to aeroson's Loadout functions. (get_loadout 2.6, set_loadout 3.4)
// * Optimized load and save listbox display function.
// * Added : Backpack restrict option. (and restricted mortar backpacks)
// * Changed : When close VAS dialog, automaticaly save loadout for respawn.
// - Implemented TAW View Distance Dialog.(Author : Tonic)
// - Implemented Personal UAV.(Author: Thomas Ryan, Tweaked by Rarek)
// - Implemented Team Killer Lock system v2. (Author : Murcielago)
// - Vehicle repiar, unflip, push boat actions
// - Player name tag
// - Player markers : Server side (Co-Op) or Client side (PvP).
// - UAV Briefing
// - Manual NV Goggle sensitivity (Implemented Fixed Range Nightvision add-on 0.7 by sholio)
// - Squad Management (Author : Xeno)
// - VTS Simple weapon resting (Author : L etranger)
// - [VAS] Interface Upgrade 1.0 (Author : GranolaBar & PokerTour)
//
/////////////////////////////////////////////////////////////////////////////////
//
// Credits & Thanks:
//
// - madbull (R3F revive)
// - pogoman, Fireball, Kol9yN (Insurgency dead camera)
// - Tonic (Virtual Ammobox System v0.9, TAW View Distance Dialog)
// - aeroson (Loadout functions. get_loadout 2.6, set_loadout 3.4)
// - Thomas Ryan, Rarek (Personal UAV)
// - Xeno (Domination vehicle repair script, Squad management script)
// - Murcielago (Team Killer Lock system v2)
// - sholio (Fixed Range Nightvision add-on 0.7)
// - Sinky (Mission Settings 1.1)
// - L etranger (VTS Simple weapon resting release 05)
// - GranolaBar & PokerTour ([VAS] Interface Upgrade 1.0)
//
/////////////////////////////////////////////////////////////////////////////////
//
// Change Log
//
// v0.3.1 (10-June-2014)
// - added VTS Simple weapon resting release 05 (Weapon Resting Key : Ctrl + Space).
// - replaced VAS to [VAS] Interface Upgrade 1.0.
// - updated aeroson's Loadout function (get_loadout 3.4, set_loadout 4.3)
// - fixed dialog resource errors.
//
// v0.3.0 (4-October-2013)
// - updated VAS to version 2.0.
// - updated aeroson's Loadout function (get_loadout 3.3, set_loadout 4.1)
// - fixed respawning bug.
// - added INS_Revive core version.
//
// v0.2.9 (12-September-2013)
// - added 'On JIP Action - None' item.
// - updated VAS to version 1.8.
// - fixed 'Carring Body' action.
// - minor bug fix.
//
// v0.2.8 (3-August-2013)
// - updated VAS to version 1.6.
// - removed debug message.
//
// v0.2.7 (28-July-2013)
// - fixed 'Respawn Faction' works fine.
//
// v0.2.6 (27-July-2013)
// - fixed undefined variable errors.
//
// v0.2.5 (27-July-2013)
// - support Stable Build 0.74.108135.
// - changed when players are in the vehicle, player marker displays crew counter.
// - updated VAS to version 1.5.
// - fixed some bugs.
//
// v0.2.4 (14-July-2013)
// - added an option 'Only engineer can repair'.
// - fixed player can repair in underwater.
// - fixed Independent faction works fine.
// - improved Push Boat function.
// - updated VAS to version 1.4.
//
// v0.2.3 (26-June-2013)
// - added an option 'Display Respawn Locations Marker'.
// - added an option 'Destroy when base vehicle can't move. (Mobile Respawn)'.
// - changed repair action will takes longer than before.
// - updated VAS to version 1.3.
// - updated aeroson's Loadout function (get_loadout 3.0, set_loadout 3.9)
//
// v0.2.2 (22-June-2013)
// - support Beta(development) 0.71.106777. do not support alpha version.
// - fixed VAS error in Beta.
// - fixed a bug when respawn at the vehile.
// - changed you can drag the injured while prone.
//
// v0.2.1 (14-June-2013)
// - fixed a bug when you press [Load On] button in VAS dialog, it removes all respawn event handlers.
//
// v0.2.0 (12-June-2013)
// - added an option 'Only squad leader can use the UAV'.
// - added an option 'Player cannot respawn, if exist enemy units near player (except static BASE)'.
// - fixed a bug when you change your squad, squad color isn't changed.
//
// v0.1.9 (9-June-2013)
// - added options each side of delay time in 'config.sqf'.
// - revert config dialog and uav settings from v0.1.7.
// - updated VAS to version 1.2.
// - updated aeroson's Loadout function (get_loadout 2.7, set_loadout 3.7)
// - changed if you set 'Restore loadout on respawn' value to 'Disable', when you die your ammo count will be saved. And 'Respawn' button will be disabled.
//
// v0.1.8 (19-May-2013)
// - rolled back to version 0.1.6
// - added an option 'Allow to Carry Body'.
// - added an option 'Protect ammobox'.
// - inherit some options from version 0.1.7. (Squad Management, Push Boat, Flip Vehicle)
// - fixed a bug if use VAS function in the vehicle, player be force ejected.(removed aeroson's loadout functions from VAS)
//
// v0.1.7 (11-May-2013)
// - added Xeno's Domination Squad Management script.
// - added an option 'Player cannot respawn, if exist enemy units near player (Except BASE)'.
// - added an option 'Push Boat'.
// - added an option 'Flip Vehicle'.
// - added an option 'UAV Delay Time'.
// - added an option 'Enable UAV Setting Dialog'.
// - added an option 'Allow map click UAV position'.
// - added an option 'Default altitude'.
// - added an option 'Default radius of the circular movement'.
// - changed if you use 'BASE' respawn and 'Life Time' functions, when bleed time out you can't spectate friendly unit.
//
// v0.1.6 (6-May-2013)
// - added an option 'Life Time for Revive'.
// - added an option 'Requires Medkit for Revive'.
// - added an option 'Allow to Load Body (MEDEVAC)'.
// - added an option 'Restore loadout on respawn'.
// - fixed a bug when use PvP mode, enemy vehicle marker was visible.
//
// v0.1.5 (27-Apr-2013)
// - fixed compatibility with Arma 3 dev version.
// - updated aeroson's Loadout function (get_loadout 2.6)
//
// v0.1.4 (20-Apr-2013)
// - added an option 'Respawn Locations' ('Base + Alive friendly unit', 'Base', 'Alive friedly unit')
// - changed to override 'Player Marker Process Method' depend on 'Respawn Faction'.
//
// v0.1.3 (18-Apr-2013)
// - changed all configurable object value to string value in config.sqf. (It fixes compatibility with Simple Vehicle Respawn Script.)
//
// v0.1.2 (14-Apr-2013) added two option for PvP. The player marker's color depend on squad.
// - If all players are dead, you can respawn immediately.
// - If half of players are dead, you can respawn your own body.
//
// v0.1.1 (14-Apr-2013)
// - added Manual NV Goggle sensitivity function
//
// v0.1.0 (13-Apr-2013)
// - first public release
//
/////////////////////////////////////////////////////////////////////////////////
//
// Instalation
//
// Copy [INS_revive] folder and 'stringtable.xml' file to your mission folder. And I recommend disable AI.
// You can configure 'config.sqf' and 'config.hpp' file.
////////////////////////
// In your init.sqf put:
////////////////////////
// JIP Check (This code should be placed first line of init.sqf file)
if (!isServer && isNull player) then {isJIP=true;} else {isJIP=false;};
// Wait until player is initialized
if (!isDedicated) then {waitUntil {!isNull player && isPlayer player};};
// INS_revive initialize
[] execVM "INS_revive\revive_init.sqf";
////////////////////////////////////////////////////////////////////////
////////////////////////
// In your description.ext put:
////////////////////////
Respawn = "INSTANT";
RespawnDelay = 5;
DisabledAI = true;
//// Respawn Script - Start ////
#include "INS_revive\description.hpp"
//// Respawn Script - End ////
class Params
{
//// Respawn Script - Start ////
#include "INS_revive\params.hpp"
//// Respawn Script - End ////
};
class RscTitles
{
//// Respawn Script - Start ////
#include "INS_revive\rsctitles.hpp"
//// Respawn Script - End ////
};
class cfgFunctions {
//// Respawn Script - Start ////
#include "INS_revive\cfgfunctions.hpp"
//// Respawn Script - End ////
};
class CfgSounds {
//// Respawn Script - Start ////
#include "INS_revive\cfgsounds.hpp"
//// Respawn Script - End ////
}
/////////////////////////////////////////////////////////////////////////*
* Cancel revive action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
INS_REV_GVAR_cancel_revive = true;
(_this select 0) removeAction (_this select 2);/*
* Carry body action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
private ["_injured", "_player", "_release_body_action","_playerMove","_wrong_moves","_dir","_trigger"];
// Remove action
(_this select 0) removeAction (_this select 2);
// Set variable
_injured = (_this select 3) select 0;
_release_body_action = (_this select 3) select 1;
_trigger = (_this select 3) select 2;
_player = player;
_wrong_moves = ["helper_switchtocarryrfl","acinpknlmstpsraswrfldnon_amovppnemstpsraswrfldnon","acinpknlmstpsraswrfldnon_acinpercmrunsraswrfldnon","acinpercmrunsraswrfldnon","acinpercmrunsraswrfldf"];
INS_REV_GVAR_do_release_body = false;
INS_REV_GVAR_is_carring = true;
INS_REV_GVAR_injured = _injured;
// Infrom player is taking care of injured
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", _player, true];
// Start carring move
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
waitUntil {animationState _injured == "AinjPpneMstpSnonWrflDnon"};
_injured switchMove "AinjPfalMstpSnonWnonDnon_carried_Up";
_injured attachto [player,[0.05, 1.1, 0]];
detach _injured;
_injured setPos [getPos _injured select 0,getPos _injured select 1,0.01];
[_injured, (getDir _player + 180)] call INS_REV_FNCT_setDir;
[_player, "AcinPknlMstpSrasWrflDnon_AcinPercMrunSrasWrflDnon"] call INS_REV_FNCT_playMoveNow;
while {animationState _injured == "ainjpfalmstpsnonwnondnon_carried_up" && alive _player && !INS_REV_GVAR_do_release_body && vehicle _player == _player} do {sleep 0.01};
_player playMove "manPosCarrying";
sleep 0.1;
// Create dir funciton
if (isNil "FNC_dir_func") then {
FNC_dir_func = {
private ["_veh","_unit","_v","_p","_c","_dir"];
_veh = _this select 0;
_unit = _this select 1;
_v = getDir _veh;
_p = getDir _unit;
_c = 360;
_dir = _c-((_c-_p)-(_c-_v));
_dir
};
};
// Attach injured to player
[_injured, "AinjPfalMstpSnonWnonDnon_carried_still"] call INS_REV_FNCT_switchMove;
sleep 0.1;
_injured attachto [_player,[0.1, 0.1, 0]];
_dir = [_player, _injured] call FNC_dir_func;
[_injured, _dir + 180] call INS_REV_FNCT_setDir;
if (isNil "FNC_is_finished_carring") then {
FNC_is_finished_carring = {
private ["_result","_player","_injured"];
_player = _this select 0;
_injured = _this select 1;
_carring_moves = ["acinpercmstpsraswrfldnon","acinpercmrunsraswrfldf","acinpercmrunsraswrfldfr","acinpercmrunsraswrfldfl","acinpercmrunsraswrfldl","acinpercmrunsraswrfldr","acinpercmrunsraswrfldb","acinpercmrunsraswrfldbr","acinpercmrunsraswrfldbl"];
_result = true;
if (!INS_REV_GVAR_do_release_body) then {
if (!isNull _player && alive _player && !isNull _injured && alive _injured && isPlayer _injured && vehicle _player == _player && _injured getVariable "INS_REV_PVAR_is_unconscious") then {
if (animationState _player in _carring_moves) then {
_result = false;
};
};
};
_result
};
};
waitUntil {animationState _player == "acinpercmstpsraswrfldnon" || !alive _player || INS_REV_GVAR_do_release_body || vehicle _player != _player};
// Wait until dragging is finished
while {!([_player, _injured] call FNC_is_finished_carring)} do {
sleep 0.5;
};
// If injured is not disconnected
if (!isNull _injured) then {
// Detach injured
detach _injured;
// If injured is alive set move
if (alive _player && _injured getVariable "INS_REV_PVAR_is_unconscious") then {
[_injured, "AinjPpneMstpSnonWrflDb_release"] call INS_REV_FNCT_playMoveNow;
} else {
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
};
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
};
// Finish carring
if !(isNull _player) then {
[_player, "AmovPknlMstpSrasWrflDnon"] call INS_REV_FNCT_switchMove;
};
// Remove actions
_player removeAction _release_body_action;
if (INS_REV_CFG_medevac) then {
if (!isNil "INS_REV_GVAR_loadActionID") then {
_player removeAction INS_REV_GVAR_loadActionID;
INS_REV_GVAR_loadActionID = nil;
};
// Remove trigger
if (!isNil "_trigger" && {!isNull _trigger}) then {
deleteVehicle _trigger;
_trigger = nil;
};
};
// Clear variable
INS_REV_GVAR_is_carring = false;
INS_REV_GVAR_do_release_body = true;/*
* Drag body action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
private ["_injured", "_player", "_release_body_action","_carry_body_action","_playerMove","_wrong_moves","_trigger"];
// Set variable
_injured = _this select 0;
_player = player;
_wrong_moves = ["helper_switchtocarryrfl","acinpknlmstpsraswrfldnon_amovppnemstpsraswrfldnon","acinpknlmstpsraswrfldnon_acinpercmrunsraswrfldnon","acinpercmrunsraswrfldnon","acinpercmrunsraswrfldf"];
_prone_moves = ["amovppnemstpsraswrfldnon","amovppnemrunslowwrfldf","amovppnemsprslowwrfldfl","amovppnemsprslowwrfldfr","amovppnemrunslowwrfldb","amovppnemsprslowwrfldbl","amovppnemsprslowwrfldr","amovppnemstpsraswrfldnon_turnl","amovppnemstpsraswrfldnon_turnr","amovppnemrunslowwrfldl","amovppnemrunslowwrfldr","amovppnemsprslowwrfldb","amovppnemrunslowwrfldbl","amovppnemsprslowwrfldl","amovppnemsprslowwrfldbr"];
INS_REV_GVAR_do_release_body = false;
INS_REV_GVAR_is_carring = false;
INS_REV_GVAR_injured = _injured;
// If while prone
if (animationState player in _prone_moves) exitWith {
_this execVM "INS_revive\revive\act_drag_body_prone.sqf";
};
// Infrom player is taking care of injured
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", _player, true];
// Add release body action
_release_body_action = _player addAction [STR_INS_REV_action_release_body, "INS_revive\revive\act_release_body.sqf", _injured, 10, false, true, "", ""];
// Add load body action
if (INS_REV_CFG_medevac) then {
if (isNil "FNC_check_load_vehicle") then {
FNC_check_load_vehicle = {
private ["_objs","_vcl","_result"];
_result = false;
_objs = nearestObjects [player, ["Car","Tank","Helicopter","Plane","Boat"], 5];
INS_REV_GVAR_load_vehicle = nil;
if (count _objs > 0) then {
INS_REV_GVAR_load_vehicle = _objs select 0;
if (alive INS_REV_GVAR_load_vehicle) then {
_result = true;
};
};
_result
};
};
_trigger = createTrigger["EmptyDetector" ,getPos player];
_trigger setTriggerArea [0, 0, 0, true];
_trigger setTriggerActivation ["NONE", "PRESENT", true];
_trigger setTriggerStatements[
"call FNC_check_load_vehicle",
"INS_REV_GVAR_loadActionID = player addAction [format[STR_INS_REV_action_load_body,name INS_REV_GVAR_injured,getText(configFile >> 'CfgVehicles' >> typeOf INS_REV_GVAR_load_vehicle >> 'displayname')], 'INS_revive\revive\act_load_body.sqf',[INS_REV_GVAR_injured,INS_REV_GVAR_load_vehicle],10,false];",
"player removeAction INS_REV_GVAR_loadActionID; INS_REV_GVAR_loadActionID = nil;"
];
};
// Attach player to injured
_injured attachTo [_player, [0, 1.1, 0.092]];
[_injured, 180] call INS_REV_FNCT_setDir;
// Start dragging move
_playerMove = "AcinPknlMstpSrasWrflDnon";
_player playMoveNow _playerMove;
waitUntil {animationState player == _playerMove};
waitUntil {(animationState _player == "acinpknlmwlksraswrfldb" || animationState _player == "acinpknlmstpsraswrfldnon")};
// Set injured move
if !(call INS_REV_FNCT_is_finished_dragging) then {
//if !(GVAR_is_arma3) then {
[_injured, "AinjPpneMrunSnonWnonDb_grab"] call INS_REV_FNCT_switchMove;
//} else {
// [_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_playMoveNow;
//};
};
// Add carry body action
if (INS_REV_CFG_medevac && INS_REV_CFG_player_can_carry_body) then {
_carry_body_action = _player addAction [STR_INS_REV_action_carry_body, "INS_revive\revive\act_carry_body.sqf", [_injured, _release_body_action, _trigger], 10, false, true, "", ""];
} else {
_carry_body_action = _player addAction [STR_INS_REV_action_carry_body, "INS_revive\revive\act_carry_body.sqf", [_injured, _release_body_action, nil], 10, false, true, "", ""];
};
// Wait until dragging is finished
while {!(call INS_REV_FNCT_is_finished_dragging) || INS_REV_GVAR_is_carring} do {
sleep 0.5;
};
if (!isNil "INS_REV_GVAR_is_carring" && {INS_REV_GVAR_is_carring}) exitWith {};
// If injured is not disconnected, release body
if !(isNull _injured) then {
// Detach injured
detach _injured;
/*
// If injured is alive set move
//if (alive _injured) then {
//[_injured, "AinjPpneMstpSnonWrflDb_release"] call INS_REV_FNCT_playMoveNow;
//} else {
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
//};
*/
if (_injured getVariable "INS_REV_PVAR_is_unconscious") then {
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
};
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
};
// Finish dragging
if !(isNull _player) then {
// If player is dead, terminate move
if (!alive _player) then {
[_player, "AmovPknlMstpSrasWrflDnon"] call INS_REV_FNCT_switchMove;
} else {
// If player stand up, terminate move
if ((animationState _player) in _wrong_moves) then {
while {(animationState _player) in _wrong_moves} do {
[_player, "AmovPknlMstpSrasWrflDnon"] call INS_REV_FNCT_switchMove;
sleep 0.5;
};
} else {
_player playMoveNow "AmovPknlMstpSrasWrflDnon";
};
};
};
// Remove actions
_player removeAction _release_body_action;
_player removeAction _carry_body_action;
if (INS_REV_CFG_medevac) then {
if (!isNil "INS_REV_GVAR_loadActionID") then {
_player removeAction INS_REV_GVAR_loadActionID;
INS_REV_GVAR_loadActionID = nil;
};
// Remove trigger
if (!isNull _trigger) then {
deleteVehicle _trigger;
_trigger = nil;
};
};
// Clear variable
INS_REV_GVAR_do_release_body = nil;
INS_REV_GVAR_injured = nil;/*
* Drag body action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
private ["_injured", "_player", "_release_body_action","_carry_body_action","_playerMove","_wrong_moves","_trigger"];
// Set variable
_injured = _this select 0;
_player = player;
_wrong_moves = ["helper_switchtocarryrfl","acinpknlmstpsraswrfldnon_amovppnemstpsraswrfldnon","acinpknlmstpsraswrfldnon_acinpercmrunsraswrfldnon","acinpercmrunsraswrfldnon","acinpercmrunsraswrfldf"];
_prone_moves = ["amovppnemstpsraswrfldnon","amovppnemrunslowwrfldf","amovppnemsprslowwrfldfl","amovppnemsprslowwrfldfr","amovppnemrunslowwrfldb","amovppnemsprslowwrfldbl","amovppnemsprslowwrfldr","amovppnemstpsraswrfldnon_turnl","amovppnemstpsraswrfldnon_turnr","amovppnemrunslowwrfldl","amovppnemrunslowwrfldr","amovppnemsprslowwrfldb","amovppnemrunslowwrfldbl","amovppnemsprslowwrfldl","amovppnemsprslowwrfldbr"];
INS_REV_GVAR_do_release_body = false;
INS_REV_GVAR_is_carring = false;
INS_REV_GVAR_injured = _injured;
// Infrom player is taking care of injured
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", _player, true];
// Add release body action
_release_body_action = _player addAction [STR_INS_REV_action_release_body, "INS_revive\revive\act_release_body.sqf", _injured, 10, false, true, "", ""];
// Add load body action
if (INS_REV_CFG_medevac) then {
if (isNil "FNC_check_load_vehicle") then {
FNC_check_load_vehicle = {
private ["_objs","_vcl","_result"];
_result = false;
_objs = nearestObjects [player, ["Car","Tank","Helicopter","Plane","Boat"], 5];
INS_REV_GVAR_load_vehicle = nil;
if (count _objs > 0) then {
INS_REV_GVAR_load_vehicle = _objs select 0;
if (alive INS_REV_GVAR_load_vehicle) then {
_result = true;
};
};
_result
};
};
_trigger = createTrigger["EmptyDetector" ,getPos player];
_trigger setTriggerArea [0, 0, 0, true];
_trigger setTriggerActivation ["NONE", "PRESENT", true];
_trigger setTriggerStatements[
"call FNC_check_load_vehicle",
"INS_REV_GVAR_loadActionID = player addAction [format[STR_INS_REV_action_load_body,name INS_REV_GVAR_injured,getText(configFile >> 'CfgVehicles' >> typeOf INS_REV_GVAR_load_vehicle >> 'displayname')], 'INS_revive\revive\act_load_body.sqf',[INS_REV_GVAR_injured,INS_REV_GVAR_load_vehicle],10,false];",
"player removeAction INS_REV_GVAR_loadActionID; INS_REV_GVAR_loadActionID = nil;"
];
};
INS_REV_FNCT_drag_prone_keydown = {
if ((_this select 1) in (actionKeys "moveForward" + actionKeys "moveFastForward")) exitWith {true};
false
};
// Add KeyDown event handler
INS_REV_GVAR_keydown_event = (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call INS_REV_FNCT_drag_prone_keydown"];
// Attach player to injured
_injured attachTo [_player, [0, 1.5, 0.092]];
[_injured, 180] call INS_REV_FNCT_setDir;
// Start dragging move
/*
_playerMove = "AcinPknlMstpSrasWrflDnon";
_player playMoveNow _playerMove;
waitUntil {animationState player == _playerMove};
waitUntil {(animationState _player == "acinpknlmwlksraswrfldb" || animationState _player == "acinpknlmstpsraswrfldnon")};
// Set injured move
if !(call INS_REV_FNCT_is_finished_dragging) then {
//if !(GVAR_is_arma3) then {
[_injured, "AinjPpneMrunSnonWnonDb_grab"] call INS_REV_FNCT_switchMove;
//} else {
// [_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_playMoveNow;
//};
};
*/
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_playMoveNow;
/*
// Add carry body action
if (INS_REV_CFG_medevac && INS_REV_CFG_player_can_carry_body) then {
_carry_body_action = _player addAction [STR_INS_REV_action_carry_body, "INS_revive\revive\act_carry_body.sqf", [_injured, _release_body_action, _trigger], 10, false, true, "", ""];
} else {
_carry_body_action = _player addAction [STR_INS_REV_action_carry_body, "INS_revive\revive\act_carry_body.sqf", [_injured, _release_body_action, nil], 10, false, true, "", ""];
};
*/
// Wait until dragging is finished
while {!(call INS_REV_FNCT_is_finished_dragging_prone) || INS_REV_GVAR_is_carring} do {
sleep 0.5;
};
if (INS_REV_GVAR_is_carring) exitWith {};
// If injured is not disconnected, release body
if !(isNull _injured) then {
// Detach injured
detach _injured;
/*
// If injured is alive set move
//if (alive _injured) then {
//[_injured, "AinjPpneMstpSnonWrflDb_release"] call INS_REV_FNCT_playMoveNow;
//} else {
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
//};
*/
if (_injured getVariable "INS_REV_PVAR_is_unconscious") then {
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
};
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
};
// Finish dragging
if !(isNull _player) then {
// If player is dead, terminate move
if (!alive _player) then {
//[_player, "amovppnemstpsraswrfldnon"] call INS_REV_FNCT_switchMove;
} else {
// If player stand up, terminate move
if ((animationState _player) in _wrong_moves) then {
while {(animationState _player) in _wrong_moves} do {
[_player, "amovppnemstpsraswrfldnon"] call INS_REV_FNCT_switchMove;
sleep 0.5;
};
} else {
//_player playMoveNow "amovppnemstpsraswrfldnon";
};
};
};
// Remove actions
_player removeAction _release_body_action;
_player removeAction _carry_body_action;
if (INS_REV_CFG_medevac) then {
if (!isNil "INS_REV_GVAR_loadActionID") then {
_player removeAction INS_REV_GVAR_loadActionID;
INS_REV_GVAR_loadActionID = nil;
};
// Remove trigger
if (!isNull _trigger) then {
deleteVehicle _trigger;
_trigger = nil;
};
};
if (!isNil {INS_REV_GVAR_keydown_event}) then {
(findDisplay 46) displayRemoveEventHandler ["KeyDown", INS_REV_GVAR_keydown_event];
};
// Clear variable
INS_REV_GVAR_do_release_body = nil;
INS_REV_GVAR_injured = nil;
INS_REV_GVAR_keydown_event = nil;/*
* Load body action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
private ["_player","_injured","_load_vehicle"];
_player = player;
_injured = (_this select 3) select 0;
_load_vehicle = (_this select 3) select 1;
if (!isNull _injured && alive _injured && _injured getVariable "INS_REV_PVAR_is_unconscious") then {
if (_load_vehicle emptyPositions "Cargo" > 0) then {
// Load injured to vehicle
detach _injured;
[_injured, _load_vehicle] call INS_REV_FNCT_moveInCargo;
//[_injured, "kia_hmmwv_driver"] call INS_REV_FNCT_switchMove;
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
//[_injured, "kia_passenger_mrap_01_front"] call INS_REV_FNCT_switchMove;
_player playMoveNow "AmovPknlMstpSrasWrflDnon";
// Add unload action
INS_REV_GVAR_add_unload = [_load_vehicle, _injured];
publicVariable "INS_REV_GVAR_add_unload";
["INS_REV_GVAR_add_unload", INS_REV_GVAR_add_unload] spawn INS_REV_FNCT_add_unload_action;
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
sleep 0.5;
// Check injured is loaded
if (vehicle _injured != _injured) then {
player sidechat format["'%1' loaded in '%2'",name _injured, getText(configFile >> 'CfgVehicles' >> typeOf _load_vehicle >> 'displayname')];
} else {
// Swtich move
if (_injured getVariable "INS_REV_PVAR_is_unconscious") then {
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
while {animationState _injured != "AinjPpneMstpSnonWrflDnon"} do {
sleep 0.1;
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
};
/*
[_injured, "kia_passenger_mrap_01_front"] call INS_REV_FNCT_switchMove;
while {animationState _injured != "kia_passenger_mrap_01_front"} do {
sleep 0.1;
[_injured, "kia_passenger_mrap_01_front"] call INS_REV_FNCT_switchMove;
};
*/
};
// Remove unload action
INS_REV_GVAR_del_unload = [_load_vehicle, _injured];
publicVariable "INS_REV_GVAR_del_unload";
["INS_REV_GVAR_del_unload", INS_REV_GVAR_del_unload] spawn INS_REV_FNCT_remove_unload_action;
player sidechat format["Failed loading",name _injured, getText(configFile >> 'CfgVehicles' >> typeOf _load_vehicle >> 'displayname')];
};
} else {
player sidechat format["There's no cargo space in '%1'",getText(configFile >> 'CfgVehicles' >> typeOf _load_vehicle >> 'displayname')];
};
};/*
* Release body action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
INS_REV_GVAR_do_release_body = true;
(_this select 0) removeAction (_this select 2);/*
* Revive action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
private ["_injured", "_player", "_i","_playerMove","_startTime","_cancel_revive_action"];
scopeName "main";
// Set variable
_injured = _this select 0;
_player = player;
_startTime = time;
_reviveTakeTime = INS_REV_CFG_revive_take_time + (random 5);
INS_REV_GVAR_cancel_revive = false;
// Check medkit
if (INS_REV_CFG_require_medkit) then {
private ["_uniformItems","_vestItems","_backpackItems","_itemList"];
_uniformItems = uniformItems _player;
_vestItems = vestItems _player;
_backpackItems = backpackItems _player;
_itemList = _uniformItems + _vestItems + _backpackItems;
if !("FirstAidKit" in _itemList) then {
_player sidechat "You don't have a First Aid Kit.";
breakOut "main";
};
};
// Protect player
[_player, false] call INS_REV_FNCT_allowDamage;
// Infrom player is taking care of injured
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", _player, true];
// Attach to injured
_player attachTo [_injured, [-0.888, 0.222, 0]];
_player setDir 90;
_player playMoveNow "AinvPknlMstpSnonWrflDnon_medic";
// Set injured move
[_injured, "AinjPpneMstpSnonWrflDnon_rolltoback"] call INS_REV_FNCT_playMoveNow;
// Detach player
if (GVAR_is_arma3) then {
if ([_player] call INS_REV_FNCT_is_underwater) then {
waitUntil {animationState _player == "AinvPknlMstpSnonWrflDnon_medic" || _startTime + _reviveTakeTime < time};
} else {
sleep 0.5;
};
} else {
sleep 0.5;
};
detach _player;
// Add cancel revive action
_cancel_revive_action = player addAction [
STR_INS_REV_action_cancel_revive, /* Title */
"INS_revive\revive\act_cancel_revive.sqf", /* Filename */
[], /* Arguments */
10, /* Priority */
false, /* ShowWindow */
true, /* HideOnUse */
"", /* Shortcut */
"" /* Condition */
];
// Wait _reviveTakeTime until player is alive and injured is not disconnected
while {!isNull _player && alive _player && !isNull _injured && alive _injured && _startTime + _reviveTakeTime > time && !INS_REV_GVAR_cancel_revive} do {
_playerMove = format ["AinvPknlMstpSnonWrflDnon_medic0", floor random 6];
_player playMove _playerMove;
waitUntil {animationState _player == _playerMove || INS_REV_GVAR_cancel_revive || _startTime + _reviveTakeTime < time};
waitUntil {animationState _player != _playerMove || INS_REV_GVAR_cancel_revive || _startTime + _reviveTakeTime < time};
_player playMoveNow "AinvPknlMstpSnonWrflDnon_medic";
};
// Check medkit
if (INS_REV_CFG_require_medkit) then {
private ["_uniformItems","_vestItems","_backpackItems","_itemList"];
_uniformItems = uniformItems _player;
_vestItems = vestItems _player;
_backpackItems = backpackItems _player;
_itemList = _uniformItems + _vestItems + _backpackItems;
if !("FirstAidKit" in _itemList) then {
// Reset variable
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
// Finish player revive action
if !(isNull _player) then {
if (alive _player && !INS_REV_GVAR_cancel_revive) then {
_player playMoveNow "AinvPknlMstpSnonWrflDnon_medicEnd";
sleep 1;
} else {
_player playMoveNow "amovpknlmstpsraswrfldnon";
};
_player removeAction _cancel_revive_action;
};
// Clear variable
INS_REV_GVAR_cancel_revive = nil;
_player sidechat "You don't have a First Aid Kit. Revive failed.";
breakOut "main";
} else {
_player removeItem "FirstAidKit";
};
};
// If injured is not disconnected
if !(isNull _injured) then {
// If player and injured is alive
if (!isNull _player && alive _player && alive _injured && !INS_REV_GVAR_cancel_revive) then {
// Remove actions
if !(PVAR_isAce) then {
INS_REV_GVAR_end_unconscious = _injured;
publicVariable "INS_REV_GVAR_end_unconscious";
["INS_REV_GVAR_end_unconscious", INS_REV_GVAR_end_unconscious] spawn INS_REV_FNCT_remove_actions;
};
// Set variable
_injured setVariable ["INS_REV_PVAR_is_unconscious", false, true];
// Set injured move
[_injured, "AmovPpneMstpSrasWrflDnon"] call INS_REV_FNCT_playMoveNow;
//[_injured, "AmovPpneMstpSnonWnonDnon_healed"] call INS_REV_FNCT_playMoveNow;
};
// Reset variable
_injured setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
};
// Finish player revive action
if !(isNull _player) then {
if (alive _player && !INS_REV_GVAR_cancel_revive) then {
_player playMoveNow "AinvPknlMstpSnonWrflDnon_medicEnd";
sleep 1;
} else {
_player playMoveNow "amovpknlmstpsraswrfldnon";
};
_player removeAction _cancel_revive_action;
};
// Unprotect player
[_player, true] call INS_REV_FNCT_allowDamage;
// Clear variable
INS_REV_GVAR_cancel_revive = nil;/*
* Teleport to teammate action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
[player, player] call INS_REV_FNCT_onKilled;
player removeAction INS_REV_GVAR_teleportToTeam;
player setVariable ["INS_REV_PVAR_isTeleport", true, true];
/*
* Load body action
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
private ["_id","_player","_injured","_loaded_vehicle"];
_player = player;
_loaded_vehicle = (_this select 3) select 0;
_injured = (_this select 3) select 1;
_id = _this select 2;
if (vehicle _injured == _loaded_vehicle) then {
// Unload
_injured action ["EJECT", vehicle _injured];
// Swtich move
if (_injured getVariable "INS_REV_PVAR_is_unconscious") then {
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
while {animationState _injured != "AinjPpneMstpSnonWrflDnon"} do {
sleep 0.1;
[_injured, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
};
};
player sidechat format["'%1' unloaded from '%2'",name _injured, getText(configFile >> 'CfgVehicles' >> typeOf _loaded_vehicle >> 'displayname')];
};
// Remove unload action
INS_REV_GVAR_del_unload = [_loaded_vehicle, _injured];
publicVariable "INS_REV_GVAR_del_unload";
["INS_REV_GVAR_del_unload", INS_REV_GVAR_del_unload] spawn INS_REV_FNCT_remove_unload_action;
_loaded_vehicle removeAction _id;
// English language
STR_INS_REV_action_revive = "Revive";
STR_INS_REV_action_cancel_revive = "Cancel Revive";
STR_INS_REV_action_drag_body = "Drag body";
STR_INS_REV_action_carry_body = "Carry body";
STR_INS_REV_action_release_body = "Release body";
STR_INS_REV_action_load_body = "Load %1 to %2";
STR_INS_REV_action_unload_body = "Unload %1";
/*
* INS_revive functions
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
// Remote execution
INS_REV_FNCT_remote_exec = {
private ["_unit", "_command", "_parameter"];
_unit = _this select 1 select 0;
_command = _this select 1 select 1;
_parameter = _this select 1 select 2;
if (_command == "switchMove") exitWith {
_unit switchMove _parameter;
};
if (_command == "allowDamage") exitWith {
if (_parameter) then {
_unit allowDamage true;
_unit setCaptive false;
} else {
_unit allowDamage false;
_unit setCaptive true;
};
};
if (local _unit) then
{
switch (_command) do
{
//case "switchMove": {_unit switchMove _parameter;};
case "setDir": {_unit setDir _parameter;};
case "playMove": {_unit playMove _parameter;};
case "playMoveNow": {_unit playMoveNow _parameter;};
case "moveInCargo": {_unit moveInCargo _parameter;};
};
};
};
"INS_REV_GVAR_remote_exec" addPublicVariableEventHandler INS_REV_FNCT_remote_exec;
// Switch move
// Usage : '[_unit, _move] call INS_REV_FNCT_switchMove;'
INS_REV_FNCT_switchMove = {
private ["_unit","_move"];
_unit = _this select 0;
_move = _this select 1;
//_unit switchMove _move;
//processInitCommands;
INS_REV_GVAR_remote_exec = [_unit, "switchMove", _move];
publicVariable "INS_REV_GVAR_remote_exec";
["INS_REV_GVAR_remote_exec", INS_REV_GVAR_remote_exec] spawn INS_REV_FNCT_remote_exec;
};
// Set allow damage
// Usage : '[_unit, _value] call INS_REV_FNCT_allowDamage;'
INS_REV_FNCT_allowDamage = {
private ["_unit", "_value"];
_unit = _this select 0;
_value = _this select 1;
INS_REV_GVAR_remote_exec = [_unit, "allowDamage", _value];
publicVariable "INS_REV_GVAR_remote_exec";
["INS_REV_GVAR_remote_exec", INS_REV_GVAR_remote_exec] spawn INS_REV_FNCT_remote_exec;
};
// Set dir
// Usage : '[_unit, _value] call INS_REV_FNCT_setDir;'
INS_REV_FNCT_setDir = {
private ["_unit","_dir"];
_unit = _this select 0;
_dir = _this select 1;
INS_REV_GVAR_remote_exec = [_unit, "setDir", _dir];
publicVariable "INS_REV_GVAR_remote_exec";
["INS_REV_GVAR_remote_exec", INS_REV_GVAR_remote_exec] spawn INS_REV_FNCT_remote_exec;
};
// Play move
// Usage : '[_unit, _move] call INS_REV_FNCT_playMoveNow;'
INS_REV_FNCT_playMove = {
private ["_unit","_move"];
_unit = _this select 0;
_move = _this select 1;
INS_REV_GVAR_remote_exec = [_unit, "playMove", _move];
publicVariable "INS_REV_GVAR_remote_exec";
["INS_REV_GVAR_remote_exec", INS_REV_GVAR_remote_exec] spawn INS_REV_FNCT_remote_exec;
};
// Play move now
// Usage : '[_unit, _move] call INS_REV_FNCT_playMoveNow;'
INS_REV_FNCT_playMoveNow = {
private ["_unit","_move"];
_unit = _this select 0;
_move = _this select 1;
INS_REV_GVAR_remote_exec = [_unit, "playMoveNow", _move];
publicVariable "INS_REV_GVAR_remote_exec";
["INS_REV_GVAR_remote_exec", INS_REV_GVAR_remote_exec] spawn INS_REV_FNCT_remote_exec;
};
// Move in cargo
// Usage : '[_unit, _vehicle] call INS_REV_FNCT_moveInCargo;'
INS_REV_FNCT_moveInCargo = {
private ["_unit","_vehicle"];
_unit = _this select 0;
_vehicle = _this select 1;
INS_REV_GVAR_remote_exec = [_unit, "moveInCargo", _vehicle];
publicVariable "INS_REV_GVAR_remote_exec";
["INS_REV_GVAR_remote_exec", INS_REV_GVAR_remote_exec] spawn INS_REV_FNCT_remote_exec;
};
// Check vehicle is full
// Usage : 'call INS_REV_FNCT_vclisFull;'
// Return : bool
INS_REV_FNCT_vclisFull = {
private ["_result", "_turrets", "_sub_turrets"];
scopeName "main";
_result = true;
if (_this isKindOf "man" || _this isKindOf "building") exitWith { false };
if (_this emptyPositions "Driver" > 0) exitWith { false };
if (_this emptyPositions "Gunner" > 0)exitWith { false };
if (_this emptyPositions "Commander" > 0) exitWith { false };
if (_this emptyPositions "Cargo" > 0) exitWith { false };
// Check turrets
_turrets = configFile >> "CfgVehicles" >> typeof _this >> "turrets";
if (count _turrets > 0) then {
for "_i" from 0 to (count _turrets) - 1 do {
if (isNull (_this turretUnit [_i])) then { _result = false; breakTo "main";};
_sub_turrets = _x >> "turrets";
if (count _sub_turrets > 0) then {
for "_j" from 0 to (count _sub_turrets) - 1 do {
if (isNull (_this turretUnit [_i, _j])) then { _result = false; breakTo "main";};
};
};
};
};
_result
};
// Move in vehicle
// Usage : '[unit, vehicle] call INS_REV_FNCT_moveInVehicle;'
INS_REV_FNCT_moveInVehicle = {
private ["_id","_unit","_vehicle","_turrets","_sub_turrets"];
scopeName "main";
_unit = _this select 0;
_vehicle = _this select 1;
//if (_vehicle emptyPositions "Driver" > 0) exitWith { _unit action["getInDriver", _vehicle]; };
if (_vehicle emptyPositions "Driver" > 0) exitWith { _unit moveInDriver _vehicle;};
//if (_vehicle emptyPositions "Gunner" > 0) exitWith { _unit action["getInTurret", _vehicle, [0]]; };
if (_vehicle emptyPositions "Gunner" > 0) exitWith { _unit moveInGunner _vehicle;};
// Turret
_turrets = configFile >> "CfgVehicles" >> typeof _vehicle >> "turrets";
if (count _turrets > 0) then {
for "_i" from 0 to (count _turrets) - 1 do {
if (isNull (_vehicle turretUnit [_i])) then { _unit moveInTurret [_vehicle, [_i]]; breakOut "main";};
_sub_turrets = _x >> "turrets";
if (count _sub_turrets > 0) then {
for "_j" from 0 to (count _sub_turrets) - 1 do {
if (isNull (_vehicle turretUnit [_i, _j])) then { _unit moveInTurret [_vehicle, [_i, _j]]; breakOut "main";};
};
};
_i = _i + 1;
};
};
//if (_vehicle emptyPositions "Commander" > 0) exitWith { _unit action["getInCommander", _vehicle]; };
if (_vehicle emptyPositions "Commander" > 0) exitWith { _unit moveInCommander _vehicle;};
if (_vehicle emptyPositions "Cargo" > 0) exitWith {
_id = count (crew _vehicle - [driver _vehicle] - [gunner _vehicle] - [commander _vehicle]);
//_unit action["getInCargo", _vehicle, _id];
_unit moveInCargo [_vehicle, _id];
};
};
// Check object is respawn locations
// Usage : 'object call INS_REV_FNCT_isRespawnLocation;'
// Return : bool
INS_REV_FNCT_isRespawnLocation = {
private ["_location", "_respawnLocations"];
// Set variable
_location = _this;
_result = false;
_respawnLocations = call INS_REV_FNCT_get_respawn_locations;
// Check location
if (_location in _respawnLocations) then {
_result = true;
};
// Retrun value
_result
};
// Get respawn locations and alive players
// Usage : 'call INS_REV_FNCT_getFriendly;'
// Return : array
INS_REV_FNCT_getFriendly = {
private ["_playerSide", "_respawn_locations", "_aliveFriendlyUnits","_result","_temp"];
// Check respawn type
if (INS_REV_CFG_respawn_type == "ALL") then {
// Get units
_aliveFriendlyUnits = call INS_REV_FNCT_getAlivePlayers;
} else {
// Check respawn type
if (INS_REV_CFG_respawn_type == "SIDE") then {
// Get alive friendly units
_aliveFriendlyUnits = call INS_REV_FNCT_getAliveFriendlyUnits;
} else {
// Get alive group units
_aliveFriendlyUnits = call INS_REV_FNCT_getAliveGroupUnits;
};
};
// Get respawn locations
if (INS_REV_CFG_respawn_location == "FRIENDLY_UNIT") then {
_respawn_locations = [];
} else {
_respawn_locations = call INS_REV_FNCT_get_respawn_locations;
};
// Set temporary result
_result = [];
_result = _result + _aliveFriendlyUnits + _respawn_locations;
// If you can revive your body, add it.
if (count _result == 0) then {
_result = [player];
} else {
if (call INS_REV_FNCT_can_respawn_player_body) then {
if (count _aliveFriendlyUnits == 0) then {
_temp = _result;
_result = [player] + _temp;
} else {
_result = _result + [player];
};
};
};
// return value
_result
};
// Get respawn locations
// Usage : 'call INS_REV_FNCT_get_respawn_locations;'
// Return : array
INS_REV_FNCT_get_respawn_locations = {
private ["_playerSide","_location", "_respawn_locations", "_respawn_locations_result"];
// Check respawn type
if (INS_REV_CFG_respawn_type == "ALL") then {
// Get respawn loacations
_respawn_locations = INS_REV_CFG_list_of_respawn_locations_blufor + INS_REV_CFG_list_of_respawn_locations_opfor + INS_REV_CFG_list_of_respawn_locations_civ + INS_REV_CFG_list_of_respawn_locations_guer;
} else {
// Get respawn loacations
_playerSide = player getVariable "INS_REV_PVAR_playerSide";
if (isNil "_playerSide") then {_playerSide = side player};
switch (format["%1",_playerSide]) do {
case "WEST": {
_respawn_locations = INS_REV_CFG_list_of_respawn_locations_blufor;
};
case "EAST": {
_respawn_locations = INS_REV_CFG_list_of_respawn_locations_opfor;
};
case "CIV": {
_respawn_locations = INS_REV_CFG_list_of_respawn_locations_civ;
};
case "GUER": {
_respawn_locations = INS_REV_CFG_list_of_respawn_locations_guer;
};
};
};
// Check respawn location is alive
_respawn_locations_result = [];
{
// String to Object
if (!isNil _x) then {
_location = call compile format["%1",_x];
if (alive _location && !(_location in _respawn_locations_result)) then {
_respawn_locations_result = _respawn_locations_result + [_location];
};
};
} forEach _respawn_locations;
_respawn_locations_result
};
// Get all players
// Usage : 'call INS_REV_FNCT_getAllPlayers;'
// Return : array
INS_REV_FNCT_getAllPlayers = {
private ["_playableUnits","_result"];
// Set variable
_playableUnits = playableUnits;
_result = [];
// Check unit is player
{
if (isPlayer _x) then {
_result = _result + [_x];
};
} forEach _playableUnits;
// Retrun value
_result
};
// Get all alive players
// Usage : 'call INS_REV_FNCT_getAlivePlayers;'
// Return : array
INS_REV_FNCT_getAlivePlayers = {
private ["_allPlayers","_result"];
// Set variable
_allPlayers = call INS_REV_FNCT_getAllPlayers;
_result = [];
// Check unit is alive
{
if (alive _x && !(_x getVariable "INS_REV_PVAR_is_unconscious")) then {
_result = _result + [_x];
};
} forEach _allPlayers;
// Retrun value
_result
};
// Get all friendlfy players
// Usage : 'call INS_REV_FNCT_getAllFriendlyUnits;'
// Return : array
INS_REV_FNCT_getAllFriendlyUnits = {
private ["_allPlayers","_result","_playerSide"];
// Set variable
_allPlayers = call INS_REV_FNCT_getAllPlayers;
_playerSide = player getVariable "INS_REV_PVAR_playerSide";
if (isNil "_playerSide") then {_playerSide = side player};
_result = [];
// Check unit is friendly
{
if (_x getVariable "INS_REV_PVAR_playerSide" == _playerSide) then {
_result = _result + [_x];
};
} forEach _allPlayers;
// Retrun value
_result
};
// Get alive friendly players
// Usage : 'call INS_REV_FNCT_getAliveFriendlyUnits;'
// Return : array
INS_REV_FNCT_getAliveFriendlyUnits = {
private ["_friendlyUnits","_result"];
// Set variable
_friendlyUnits = call INS_REV_FNCT_getAllFriendlyUnits;
_result = [];
// Check unit is alive
{
if (alive _x && !(_x getVariable "INS_REV_PVAR_is_unconscious")) then {
_result = _result + [_x];
};
} forEach _friendlyUnits;
_result
};
// Get all group players
// Usage : 'call INS_REV_FNCT_getAllGroupUnits;'
// Return : array
INS_REV_FNCT_getAllGroupUnits = {
private ["_playerGroup","_groupUnits","_result"];
// Set variable
_playerGroup = player getVariable "INS_REV_PVAR_playerGroup";
_groupUnits = units _playerGroup;
_result = [];
// Check is playable unit
{
if (isPlayer _x) then {
_result = _result + [_x];
};
} forEach _groupUnits;
// Retrun value
_result
};
// Get alive group players
// Usage : 'call INS_REV_FNCT_getAliveGroupUnits;'
// Return : array
INS_REV_FNCT_getAliveGroupUnits = {
private ["_playableUnits","_result","_playerSide"];
// Set variable
_groupUnits = call INS_REV_FNCT_getAllGroupUnits;
_result = [];
// Check is alive unit
{
if (alive _x && !(_x getVariable "INS_REV_PVAR_is_unconscious")) then {
_result = _result + [_x];
};
} forEach _groupUnits;
// Retrun value
_result
};
// Check enemies near player
// Usage : '[unit] call INS_REV_FNCT_is_near_enemy;'
// Return : bool
INS_REV_FNCT_is_near_enemy = {
private ["_result","_arr1","_arr2","_playerSide"];
scopeName "main";
_result = false;
_arr1 = nearestObjects[_this select 0, ["LandVehicle"],INS_REV_CFG_near_enemy_range];
_arr2 = nearestObjects[_this select 0, ["Man"], INS_REV_CFG_near_enemy_range];
_playerSide = player getVariable "INS_REV_PVAR_playerSide";
{
if (side _x != _playerSide && primaryWeapon _x != "" && alive _x && isNil {_x getVariable "INS_REV_PVAR_is_unconscious"}) exitWith {_result = true;};
if (side _x != _playerSide && primaryWeapon _x != "" && alive _x && !(_x getVariable "INS_REV_PVAR_is_unconscious")) exitWith {_result = true;};
} forEach _arr2;
if (_result) exitWith {_result};
for "_i" from 0 to (count _arr1 - 1) do {
{
if (side _x != _playerSide && (!alive _x || !(_x getVariable "INS_REV_PVAR_is_unconscious"))) exitWith {
_result = true;
breakTo "main"
};
} forEach (crew (_arr1 select _i));
};
_result
};
// Check half of friendly players is dead
// Usage : 'call INS_REV_FNCT_is_dead_half_of_players;'
// Return : bool
INS_REV_FNCT_is_dead_half_of_players = {
private ["_allUnits","_aliveUnits","_result"];
// Check respawn type
switch (INS_REV_CFG_respawn_type) do {
case "ALL": {
_allUnits = call INS_REV_FNCT_getAllPlayers;
_aliveUnits = call INS_REV_FNCT_getAlivePlayers;
};
case "SIDE": {
_allUnits = call INS_REV_FNCT_getAllFriendlyUnits;
_aliveUnits = call INS_REV_FNCT_getAliveFriendlyUnits;
};
case "GROUP": {
_allUnits = call INS_REV_FNCT_getAllGroupUnits;
_aliveUnits = call INS_REV_FNCT_getAliveGroupUnits;
};
};
_result = false;
if ((count (_allUnits) / 2) >= count _aliveUnits) then {
_result = true;
};
// Return value
_result
};
// Check player can respawn player's own body
// Usage : 'call INS_REV_FNCT_can_respawn_player_body;'
// Return : bool
INS_REV_FNCT_can_respawn_player_body = {
private ["_result"];
_result = false;
if (INS_REV_CFG_can_respawn_player_body) then {
_result = true;
} else {
if (INS_REV_CFG_half_dead_repsawn_player_body) then {
if (call INS_REV_FNCT_is_dead_half_of_players) then {
_result = true;
};
} else {
private ["_aliveFriendlyUnits","_respawn_locations","_friendly"];
// Check respawn type
if (INS_REV_CFG_respawn_type == "ALL") then {
// Get units
_aliveFriendlyUnits = call INS_REV_FNCT_getAlivePlayers;
} else {
// Check respawn type
if (INS_REV_CFG_respawn_type == "SIDE") then {
// Get alive friendly units
_aliveFriendlyUnits = call INS_REV_FNCT_getAliveFriendlyUnits;
} else {
// Get alive group units
_aliveFriendlyUnits = call INS_REV_FNCT_getAliveGroupUnits;
};
};
// Get respawn locations
_respawn_locations = call INS_REV_FNCT_get_respawn_locations;
// Set temporary result
_friendly = [];
_friendly = _friendly + _aliveFriendlyUnits + _respawn_locations;
if (count _friendly == 0) then {
_result = true;
};
};
};
_result
};
// Check friendly units are all dead
// Usage : 'call INS_REV_FNCT_isAllDead;'
// Return : bool
INS_REV_FNCT_isAllDead = {
private ["_allUnits","_result"];
// Check respawn type
switch (INS_REV_CFG_respawn_type) do {
case "ALL": {
_allUnits = call INS_REV_FNCT_getAllPlayers;
};
case "SIDE": {
_allUnits = call INS_REV_FNCT_getAllFriendlyUnits;
};
case "GROUP": {
_allUnits = call INS_REV_FNCT_getAllGroupUnits;
};
};
_result = true;
{
if (!(_x getVariable "INS_REV_PVAR_is_unconscious")) exitWith {_result = false;};
} forEach _allUnits;
_result
};
// Check is there near friendly units
// Usage : 'call INS_REV_FNCT_isNearFriendly;'
// Return : bool
INS_REV_FNCT_isNearFriendly = {
private ["_units","_nearUnits","_nearFrieldy","_range","_result"];
// If disalbed in config exit and return true
if (!INS_REV_CFG_respawn_near_friendly) exitWith {
true
};
// Set variable
_range = INS_REV_CFG_respawn_near_friendly_range;
_units = call INS_REV_FNCT_getFriendly;
_nearUnits = nearestObjects [player, ["CAManBase"], _range];
_result = false;
// Check friendly exists defined near area
{
if (_x in _units) exitWith {_result = true};
} forEach _nearUnits;
// Return value
_result
};
// Get dead units
// Usage : 'call INS_REV_FNC_get_dead_units;'
// Return : array
INS_REV_FNC_get_dead_units = {
private ["_allUnits","_result","_isDead","_isJIP"];
// Check respawn type
switch (INS_REV_CFG_respawn_type) do {
case "ALL": {
_allUnits = call INS_REV_FNCT_getAllPlayers;
};
case "SIDE": {
_allUnits = call INS_REV_FNCT_getAllFriendlyUnits;
};
case "GROUP": {
_allUnits = call INS_REV_FNCT_getAllFriendlyUnits;
};
};
_result = [];
// Check unit is dead
{
_isDead = _x getVariable "INS_REV_PVAR_is_unconscious";
if (isNil "_isDead") then {_isDead = false};
_isTeleport = _x getVariable "INS_REV_PVAR_isTeleport";
if (isNil "_isTeleport") then {_isTeleport = false};
if ((!alive _x || _isDead) && (isPlayer _x) && !_isTeleport) then {
_result = _result + [_x];
};
} forEach _allUnits;
_result
};
// Check player can revive
// Usage : 'call INS_REV_FNCT_can_revive;'
// Return : bool
INS_REV_FNCT_can_revive = {
if (INS_REV_CFG_all_player_can_revive) then {
true
} else {
if (INS_REV_CFG_all_medics_can_revive && getNumber (configFile >> "CfgVehicles" >> (typeOf player) >> "attendant") == 1) then {
true
} else {
if (player in INS_REV_CFG_list_of_slots_who_can_revive) then {
true
} else {
if (typeOf player in INS_REV_CFG_list_of_classnames_who_can_revive) then {
true
} else {
false
};
};
};
};
};
// Set dead marker
// Usage : '[marker_array] call INS_REV_FNC_set_number_of_markers;'
// Return : array
INS_REV_FNC_set_number_of_markers = {
private ["_markers","_count","_markerCount"];
// Set variable
_markers = _this select 0;
_count = _this select 1;
_markerCount = count _markers;
// Check current marker count
switch true do {
// If equal
case (_markerCount == _count): {
// exit
};
case (_markerCount > _count): {
// Delete marker
for "_x" from _count to (_markerCount - 1) do {
_delMarker = _markers select _x;
if (INS_REV_CFG_player_marker_serverSide) then {
deleteMarker _delMarker;
} else {
deleteMarkerLocal _delMarker;
};
_markers = _markers - [_delMarker];
};
};
case (_markerCount < _count): {
// Create marker
for "_x" from _markerCount to (_count - 1) do {
if (INS_REV_CFG_player_marker_serverSide) then {
_marker=createMarker [format ["dmarker%1",_x],[0,0,0]];
_marker setMarkerType "mil_dot";
_marker setMarkerColor "colorRed";
_marker setMarkerSize [0.4, 0.4];
_marker setMarkerAlpha 0;
} else {
_marker=createMarkerLocal [format ["dmarker%1",_x],[0,0,0]];
_marker setMarkerTypeLocal "mil_dot";
_marker setMarkerColorLocal "colorRed";
_marker setMarkerSizeLocal [0.4, 0.4];
_marker setMarkerAlphaLocal 0;
};
_markers set [_x,_marker];
};
};
};
_markers
};
// Set dead marker
// Usage : '[unit] call INS_REV_FNC_set_dead_marker;'
INS_REV_FNC_set_dead_marker = {
private ["_markers","_deadUnits","_unit","_marker","_i"];
_markers = _this select 0;
_deadUnits = call INS_REV_FNC_get_dead_units;
// Syncronize number of markers and aliveplayers count
_markers = [_markers, count _deadUnits] call INS_REV_FNC_set_number_of_markers;
{
_unit=_x;
_marker=_markers select (_deadUnits find _unit);
// Check method serverside or clientside
if (INS_REV_CFG_player_marker_serverSide) then {
_marker setMarkerPos getPos _unit;
_marker setMarkerText format["%1 is down", name _x];
if (INS_REV_CFG_life_time > 0) then {
if (_unit getVariable "INS_REV_PVAR_is_dead") then {
_marker setMarkerAlpha 0;
} else {
_marker setMarkerAlpha 1;
};
} else {
_marker setMarkerAlpha 1;
};
} else {
_marker setMarkerPosLocal getPos _unit;
_marker setMarkerTextLocal format["%1 is down", name _x];
if (INS_REV_CFG_life_time > 0) then {
if (_unit getVariable "INS_REV_PVAR_is_dead") then {
_marker setMarkerAlphaLocal 0;
} else {
_marker setMarkerAlphaLocal 1;
};
} else {
_marker setMarkerAlphaLocal 1;
};
};
} forEach _deadUnits;
_markers
};
// Draw dead marker
// Usage(thread) : '_script = [] spawn INS_REV_FNCT_draw_dead_marker;'
INS_REV_FNCT_draw_dead_marker = {
private ["_markers"];
_markers = [];
while {true} do {
_markers = [_markers] call INS_REV_FNC_set_dead_marker;
sleep 1;
};
};
// Add revive related action to unit
// Usage : '[variable, unit] call INS_REV_FNCT_add_actions;'
INS_REV_FNCT_add_actions = {
private ["_unit", "_id_action", "_isTeleport"];
scopeName "main";
// Set variable
_unit = _this select 1;
_isTeleport = _unit getVariable "INS_REV_PVAR_isTeleport";
if (isNil "_isTeleport") then {_isTeleport = false};
if (INS_REV_CFG_respawn_type != "ALL") then {
private ["_playerSide","_injuredSide"];
_injuredSide = _unit getVariable "INS_REV_PVAR_playerSide";
if (isNil "_injuredSide") then {_injuredSide = side _unit};
_playerSide = player getVariable "INS_REV_PVAR_playerSide";
if (isNil "_playerSide") then {_playerSide = side player};
if (_injuredSide != _playerSide) exitWith {
breakOut "main";
};
};
// If unit is not null and not teleported then add actions.
if (!isNull _unit && !_isTeleport) then {
player reveal _unit;
// Revive action
_id_action = _unit addAction [
STR_INS_REV_action_revive, /* Title */
"INS_revive\revive\act_revive.sqf", /* Filename */
[], /* Arguments */
10, /* Priority */
false, /* ShowWindow */
true, /* HideOnUse */
"", /* Shortcut */
"player distance _target < 2 && !(player getVariable ""INS_REV_PVAR_is_unconscious"") && call INS_REV_FNCT_can_revive && alive _target && isPlayer _target && (_target getVariable ""INS_REV_PVAR_is_unconscious"") && isNil {_target getVariable ""INS_REV_PVAR_who_taking_care_of_injured""}" /* Condition */
];
_unit setVariable ["INS_REV_id_action_revive", _id_action, false];
// Drag body action
_id_action = _unit addAction [
STR_INS_REV_action_drag_body, /* Title */
"INS_revive\revive\act_drag_body.sqf", /* Filename */
[], /* Arguments */
10, /* Priority */
false, /* ShowWindow */
true, /* HideOnUse */
"", /* Shortcut */
"player distance _target < 2 && !(player getVariable ""INS_REV_PVAR_is_unconscious"") && INS_REV_CFG_player_can_drag_body && alive _target && isPlayer _target && (_target getVariable ""INS_REV_PVAR_is_unconscious"") && isNil {_target getVariable ""INS_REV_PVAR_who_taking_care_of_injured""}" /* Condition */
];
_unit setVariable ["INS_REV_id_action_drag_body", _id_action, false];
};
};
// Remove revive related action
// Usage : '[variable, unit] call INS_REV_FNCT_remove_actions;'
INS_REV_FNCT_remove_actions = {
private ["_unit"];
scopeName "main";
_unit = _this select 1;
if (INS_REV_CFG_respawn_type != "ALL") then {
private ["_playerSide","_injuredSide"];
_injuredSide = _unit getVariable "INS_REV_PVAR_playerSide";
if (isNil "_injuredSide") then {_injuredSide = side _unit};
_playerSide = player getVariable "INS_REV_PVAR_playerSide";
if (isNil "_playerSide") then {_playerSide = side player};
if (_injuredSide != _playerSide) exitWith {
breakOut "main";
};
};
// If unit is not null then remove actions
if !(isNull _unit) then {
if !(isNil {_unit getVariable "INS_REV_id_action_revive"}) then {
_unit removeAction (_unit getVariable "INS_REV_id_action_revive");
_unit setVariable ["INS_REV_id_action_revive", nil, false];
};
if !(isNil {_unit getVariable "INS_REV_id_action_drag_body"}) then {
_unit removeAction (_unit getVariable "INS_REV_id_action_drag_body");
_unit setVariable ["INS_REV_id_action_drag_body", nil, false];
};
};
};
// Add unload action to vehicle
// Usage : '[unit, vehicle] call INS_REV_FNCT_add_unload_action;'
INS_REV_FNCT_add_unload_action = {
private ["_vehicle", "_injured", "_id_action", "_loaded_list"];
// Set variable
_vehicle = (_this select 1) select 0;
_injured = (_this select 1) select 1;
// If vehicle is not null then add actions.
if (!isNull _vehicle) then {
player reveal _vehicle;
// Unload action
_id_action = _vehicle addAction [
format[STR_INS_REV_action_unload_body,name _injured], /* Title */
"INS_revive\revive\act_unload_body.sqf", /* Filename */
[_vehicle, _injured], /* Arguments */
10, /* Priority */
false, /* ShowWindow */
true, /* HideOnUse */
"", /* Shortcut */
"" /* Condition */
];
if !(isNil {_vehicle getVariable "INS_REV_GVAR_loaded_list"}) then {
_loaded_list = _vehicle getVariable "INS_REV_GVAR_loaded_list";
} else {
_loaded_list = [];
};
if (count _loaded_list > 0) then {
_loaded_list set [count _loaded_list, [_injured, _id_action]];
} else {
_loaded_list = [[_injured, _id_action]];
};
_vehicle setVariable ["INS_REV_GVAR_loaded_list", _loaded_list, false];
};
};
// Remove unload action
// Usage : '[vehicle, unit] call INS_REV_FNCT_remove_unload_action;'
INS_REV_FNCT_remove_unload_action = {
private ["_vehicle","_injured", "_loaded_list","_i"];
// Set variable
_vehicle = (_this select 1) select 0;
_injured = (_this select 1) select 1;
// If vehicle is not null then remove actions
if !(isNull _vehicle) then {
if !(isNil {_vehicle getVariable "INS_REV_GVAR_loaded_list"}) then {
_loaded_list = _vehicle getVariable "INS_REV_GVAR_loaded_list";
_i = 0;
{
if (_x select 0 == _injured) exitWith {
_vehicle removeAction (_x select 1);
_loaded_list set [_i, -1];
_loaded_list = _loaded_list - [-1];
if (count _loaded_list > 0) then {
_vehicle setVariable ["INS_REV_GVAR_loaded_list", _loaded_list, false];
} else {
_vehicle setVariable ["INS_REV_GVAR_loaded_list", nil, false];
};
};
_i = _i + 0;
} forEach _loaded_list;
};
};
};
// Check player can respawn to camPlayer.
// Usage : 'call INS_REV_FNCT_can_respawn;'
// Return : bool
INS_REV_FNCT_can_respawn = {
private ["_result"];
// Set variable
_result = false;
// If vehicle and not full
if ([INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle) then {
if (!((vehicle INS_REV_GVAR_camPlayer) call INS_REV_FNCT_vclisFull) && alive vehicle INS_REV_GVAR_camPlayer) then {
_result = true;
};
} else {
// If player
if (vehicle INS_REV_GVAR_camPlayer isKindOf "Man" && alive vehicle INS_REV_GVAR_camPlayer) then {
if (!(INS_REV_GVAR_camPlayer getVariable "INS_REV_PVAR_is_unconscious") || call INS_REV_FNCT_can_respawn_player_body) then {
_result = true;
};
} else {
// If respawn loacation
if (INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation) then {
_result = true;
};
};
};
// Return value
_result
};
// Check player can respawn to camPlayer.
// Usage : 'call INS_REV_FNCT_can_respawn;'
// Return : bool
INS_REV_FNCT_can_respawn_except_vehicle = {
private ["_result"];
// Set variable
_result = false;
// If vehicle and not full
if ([INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle) then {
if (alive vehicle INS_REV_GVAR_camPlayer) then {
_result = true;
};
} else {
// If player
if (vehicle INS_REV_GVAR_camPlayer isKindOf "Man" && alive vehicle INS_REV_GVAR_camPlayer) then {
if (!(INS_REV_GVAR_camPlayer getVariable "INS_REV_PVAR_is_unconscious") || call INS_REV_FNCT_can_respawn_player_body) then {
_result = true;
};
} else {
// If respawn loacation
if (INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation) then {
_result = true;
};
};
};
// Return value
_result
};
// Check object is vehicle.
// Usage : '[object] call INS_REV_FNCT_is_vehicle;'
// Return : bool
INS_REV_FNCT_is_vehicle = {
private ["_result", "_veh"];
// Set variable
_result = false;
_veh = _this select 0;
// Check object is vehicle
if ((vehicle _veh isKindOf "LandVehicle" || vehicle _veh isKindOf "Air" || vehicle _veh isKindOf "Ship")) then {
_result = true;
};
// Return value
_result
};
// Get camera attach coordinate
// Usage : 'call INS_REV_FNCT_get_camAttachCoords;'
// Return : array
INS_REV_FNCT_get_camAttachCoords = {
private ["_result","_xC","_yC","_zC"];
_xC = INS_REV_GVAR_camRange * sin(INS_REV_GVAR_theta) * cos(INS_REV_GVAR_phi);
_yC = INS_REV_GVAR_camRange * sin(INS_REV_GVAR_theta) * sin(INS_REV_GVAR_phi);
_zC = INS_REV_GVAR_camRange * cos(INS_REV_GVAR_theta);
_result = [_xC,_yC,_zC];
_result
};
// Reset dead camera
// Usage : 'call INS_REV_FNCT_reset_camera;'
INS_REV_FNCT_reset_camera = {
private ["_friendly","_camAttachCoords","_camStaticCoords"];
// If not exitst INS_REV_GVAR_camPlayer, reset INS_REV_GVAR_camPlayer
if (isNull INS_REV_GVAR_camPlayer) then {
_friendly = call INS_REV_FNCT_getFriendly;
INS_REV_GVAR_camPlayer = _friendly select 0;
};
// Set distance
if ((vehicle INS_REV_GVAR_camPlayer) isKindOf "Man") then {
INS_REV_GVAR_camRange = 5;
} else {
INS_REV_GVAR_camRange = (sizeOf typeOf vehicle INS_REV_GVAR_camPlayer) max 5;
};
// Set angle and coordinate
INS_REV_GVAR_theta = 74;
INS_REV_GVAR_phi = -90;
_camAttachCoords = call INS_REV_FNCT_get_camAttachCoords;
_camStaticCoords = [((getPos vehicle INS_REV_GVAR_camPlayer) select 0) + (_camAttachCoords select 0),((getPos vehicle INS_REV_GVAR_camPlayer) select 1) + (_camAttachCoords select 1),((getPos vehicle INS_REV_GVAR_camPlayer) select 2) + (_camAttachCoords select 2)];
// attatch camera to target
if (INS_REV_GVAR_camPlayer isKindOf "Man" || [INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle) then {
INS_REV_GVAR_dead_camera = "camera" camCreate _camStaticCoords;
INS_REV_GVAR_dead_camera cameraEffect ["INTERNAL","Back"];
INS_REV_GVAR_dead_camera CamSetTarget vehicle INS_REV_GVAR_camPlayer;
INS_REV_GVAR_dead_camera camCommit 0;
INS_REV_GVAR_dead_camera attachTo [vehicle INS_REV_GVAR_camPlayer, _camAttachCoords];
} else {
INS_REV_GVAR_dead_camera = "camera" camCreate _camStaticCoords;
INS_REV_GVAR_dead_camera cameraEffect ["INTERNAL","Back"];
INS_REV_GVAR_dead_camera CamSetTarget INS_REV_GVAR_camPlayer;
INS_REV_GVAR_dead_camera camSetRelPos _camAttachCoords;
INS_REV_GVAR_dead_camera camCommit 0;
};
/*
INS_REV_GVAR_dead_camera = "camera" camCreate _camStaticCoords;
INS_REV_GVAR_dead_camera cameraEffect ["INTERNAL","Back"];
INS_REV_GVAR_dead_camera CamSetTarget vehicle INS_REV_GVAR_camPlayer;
INS_REV_GVAR_dead_camera camCommit 0;
INS_REV_GVAR_dead_camera attachTo [vehicle INS_REV_GVAR_camPlayer, _camAttachCoords];
*/
// Black in effact
titleText [" ","Black in", 2];
};
// Set respawn tag
// Usage : 'call INS_REV_FNCT_respawn_tag;'
INS_REV_FNCT_respawn_tag = {
private ["_unit","_leftTime","_leftTimeText","_lifeTime","_name","_txt","_ctrlText","_color","_respawnDelay"];
// If player turn on map exit
if INS_REV_GVAR_camMap exitWith {};
// Set variable
_unit = _this select 0;
_respawnDelay = call INS_REV_FNCT_getRespawnDelay;
_leftTime = round ((_unit getVariable "INS_REV_PVAR_deadTime") + _respawnDelay - time);
if (INS_REV_CFG_life_time > 0) then {
_lifeTime = round (INS_RES_GVAR_killed_time + INS_REV_CFG_life_time - time);
};
// Set name
if (!(INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation)) then {
_name = name INS_REV_GVAR_camPlayer;
} else {
_name = toUpper (format["%1",INS_REV_GVAR_camPlayer]);
};
// If restrict respawn
If (INS_REV_CFG_respawn_location == "BASE" && !(INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation)) exitWith {
cutRsc["Rtags", "PLAIN",5];
_color = "#C11B17";
_leftTimeText = "";
if (_leftTime > 0) then {_leftTimeText = format["
(Respawn in %1 sec)",_leftTime];};
_txt = format["%1 (Spectating)
(You can only respawn at the base)%2", _name, _leftTimeText];
_ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434;
_ctrlText ctrlSetStructuredText parseText format[
"%1
Left Arrow: Previous unit
Right Arrow: Next unit
",
_txt,
_color
];
};
// If vehicle cannot move
if ([vehicle INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle && !canMove INS_REV_GVAR_camPlayer) exitWith {
cutRsc["Rtags", "PLAIN",5];
_color = "#C11B17";
_leftTimeText = "";
if (_leftTime > 0) then {_leftTimeText = format["
(Respawn in %1 sec)",_leftTime];};
_txt = format["%1 (Spectating)
(Cannot respawn at the damaged vehicle)%2", _name, _leftTimeText];
_ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434;
_ctrlText ctrlSetStructuredText parseText format[
"%1
Left Arrow: Previous unit
Right Arrow: Next unit
",
_txt,
_color
];
};
// If left respawn delay time
if (_leftTime > 0) exitWith {
cutRsc["Rtags", "PLAIN",5];
_color = "#C11B17";
_txt = format["%1 (Spectating)
(Respawn in %2 sec)", _name, _leftTime];
_ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434;
_ctrlText ctrlSetStructuredText parseText format[
"%1
Left Arrow: Previous unit
Right Arrow: Next unit
",
_txt,
_color
];
};
// If vehicle is not full and not respawn location
if (vehicle INS_REV_GVAR_camPlayer call INS_REV_FNCT_vclisFull) exitWith {
cutRsc["Rtags", "PLAIN",5];
_color = "#C11B17";
_leftTimeText = "";
if (_leftTime > 0) then {_leftTimeText = format["
(Respawn in %1 sec)",_leftTime];};
_txt = format["%1 (Spectating)
(Cannot spawn while vehicle is full)%2", _name, _leftTimeText];
_ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434;
_ctrlText ctrlSetStructuredText parseText format[
"%1
Left Arrow: Previous unit
Right Arrow: Next unit
",
_txt,
_color
];
};
// If you can respawn
if (INS_REV_CFG_life_time > 0) then {
if (_lifeTime > 0) then {
_txt = format["%1 (Press Enter to Spawn)
(Life Time : %2)", _name, _lifeTime];
} else {
_txt = format["%1 (Press Enter to Spawn)
(Life time is over. You cannot be revived.)", _name];
};
} else {
_txt = format["%1 (Press Enter to Spawn)", _name];
};
if (!(INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation)) then {
_color = "#347C17";
} else {
_color = "#2554C7";
};
/*
// If camplayer lost conscious
if (lifeState INS_REV_GVAR_camPlayer == "UNCONSCIOUS") then {
_txt = format["%1 (Cannot spawn on a critically wounded soldier)", getName(INS_REV_GVAR_camPlayer)];
_color = "#C11B17";
};
*/
// Apply respawn tag
cutRsc["Rtags", "PLAIN",5];
_ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434;
_ctrlText ctrlSetStructuredText parseText format[
"%1
Left Arrow: Previous unit
Right Arrow: Next unit
",
_txt,
_color
];
};
// Set respawn tag
// Usage(thread) : '_sctipt = unit spawn INS_REV_FNCT_dead_camera;'
INS_REV_FNCT_dead_camera = {
private ["_unit","_camPlayer","_respawnDelay","_KH","_MH1","_MH2","_to_be_Respawned_in","_doRespawn","_camAttachCoords","_vehicle","_ctrlText","_deadTime","_condition","_isTeleport"];
disableserialization;
// Set parameter to variable
_unit = _this;
// Set variable
_camPlayer = objNull;
INS_REV_GVAR_camMap = false;
INS_REV_GVAR_camPlayer = objNull;
_respawnDelay = call INS_REV_FNCT_getRespawnDelay;
//sleep 0.1;
// Initialize dead camera
call INS_REV_FNCT_reset_camera;
// Check arma 2
if (GVAR_is_arma3 || GVAR_is_arma2oa) then {
call INS_REV_FNCT_disalble_thermal_cam;
};
showcinemaborder false; // Disable cinema border
// Initialize variable
_camPlayer = INS_REV_GVAR_camPlayer;
_vehicle = vehicle INS_REV_GVAR_camPlayer;
_to_be_Respawned_in = round (time + 5);
_doRespawn = false;
INS_REV_GVAR_enterSpawn = false;
// Wait until player be respawned
waitUntil {player getVariable "INS_REV_PVAR_is_unconscious"};
_unit = player;
// Set revive delay time
_isTeleport = _unit getVariable "INS_REV_PVAR_isTeleport";
// If not teleport
if (!_isTeleport) then {
_deadTime = _unit getVariable "INS_REV_PVAR_deadTime";
// If not exist INS_REV_PVAR_deadTime
if (isNil "_deadTime") then {
_deadTime = time;
} else {;
// Delay time is not expired
if (_deadTime + _respawnDelay < time) then {
_deadTime = time;
};
};
} else {
_deadTime = time - _respawnDelay;
};
_unit setVariable ["INS_REV_PVAR_deadTime", _deadTime, false];
// Keyboard and mouse hooking
waitUntil { !(isNull (findDisplay 46)) };
_KH = (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call INS_REV_FNCT_onKeyPress;"];
_MH1 = (findDisplay 46) displayAddEventHandler ["MouseMoving", "_this call INS_REV_FNCT_onMouseMove;"];
_MH2 = (findDisplay 46) displayAddEventHandler ["MouseZChanged", "_this call INS_REV_FNCT_onMouseWheel;"];
// Check Ace mod
if (PVAR_isAce) then {
_condition = _unit call ace_sys_wounds_fnc_isUncon;
} else {
_condition = _unit getVariable "INS_REV_PVAR_is_unconscious";
};
// Loop while player is unconscious
while {_condition && alive _unit} do {
// If changed camera target, reset camera
if (isNull INS_REV_GVAR_camPlayer || INS_REV_GVAR_camPlayer != _camPlayer) then {
call INS_REV_FNCT_reset_camera;
// Reset variables
_camPlayer = INS_REV_GVAR_camPlayer;
_vehicle = vehicle INS_REV_GVAR_camPlayer;
_to_be_Respawned_in = round (time + 5);
INS_REV_GVAR_enterSpawn = false;
};
// Display respawn tag
if ((INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation || alive INS_REV_GVAR_camPlayer) && !INS_REV_GVAR_enterSpawn) then {
// Reset player's to be respawned time
_to_be_Respawned_in = round (time + 5);
// If player get in vehicle then change deadCamera's coordinate
if (_vehicle != vehicle INS_REV_GVAR_camPlayer) then {
_vehicle = vehicle INS_REV_GVAR_camPlayer;
_camAttachCoords = call INS_REV_FNCT_get_camAttachCoords;
INS_REV_GVAR_dead_camera attachTo [_vehicle, _camAttachCoords];
INS_REV_GVAR_dead_camera camSetTarget _vehicle;
INS_REV_GVAR_dead_camera camCommit 0;
};
// Update respawn tag
[_unit] call INS_REV_FNCT_respawn_tag;
};
// Display to be respawned timeout tag
if (_camPlayer == INS_REV_GVAR_camPlayer && INS_REV_GVAR_enterSpawn) then {
// If not player can respawn to camPlayer then exit
if !(call INS_REV_FNCT_can_respawn) exitWith {
// Reset variable
INS_REV_GVAR_enterSpawn = false; _to_be_Respawned_in = round (time + 5);
};
// Display respawn tag
cutRsc["Rtags", "PLAIN",5];
_ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434;
_ctrlText ctrlSetStructuredText parseText format[
"Spawning in %1
Left Arrow: Previous unit
Right Arrow: Next unit
",
round (_to_be_Respawned_in - time),
"#FFFFFF"
];
// If to be respawned timeout is over, do respawn (End loop)
if (round (_to_be_Respawned_in - time) <= 0) exitWith {
// Check Ace mod
if (PVAR_isAce) then {
if ([_player] call ACE_fnc_isBurning) then { ['ace_sys_wounds_burnoff', _player] call CBA_fnc_globalEvent;};
_unit call ace_sys_wounds_fnc_unitInit;
_unit call ace_sys_wounds_fnc_RemoveBleed;
_unit call ace_sys_wounds_fnc_RemovePain;
_unit call ace_sys_wounds_fnc_RemoveUncon;
[_unit,0] call ace_sys_wounds_fnc_heal;
};
// Reset variable
_unit setVariable ["INS_REV_PVAR_is_unconscious", false, true];
_doRespawn = true;
};
};
// If player choose respawn to INS_REV_GVAR_camPlayer (Exit loop)
if (_doRespawn) exitWith {
// If player can respawn to camPlayer
if (call INS_REV_FNCT_can_respawn) then {
if ([INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle && !(vehicle INS_REV_GVAR_camPlayer call INS_REV_FNCT_vclisFull)) then {
if (!isNil "INS_REV_GVAR_is_loaded" && {INS_REV_GVAR_is_loaded} && INS_REV_CFG_medevac) then {
_unit action ["EJECT", vehicle _unit];
sleep 0.5;
};
[_unit,(vehicle INS_REV_GVAR_camPlayer)] call INS_REV_FNCT_moveInVehicle;
} else {
if (!isNil "INS_REV_GVAR_is_loaded" && {INS_REV_GVAR_is_loaded} && INS_REV_CFG_medevac) then {
_unit action ["EJECT", vehicle _unit];
sleep 0.5;
};
_unit setDir getDir INS_REV_GVAR_camPlayer;
_unit setPosATL getPosATL INS_REV_GVAR_camPlayer;
[_unit, "AmovPercMstpSrasWrflDnon"] call INS_REV_FNCT_switchMove;
};
_doRespawn = false;
} else {
// If failed respawn to camPlayer, respawn your body
[_unit, "AmovPercMstpSrasWrflDnon"] call INS_REV_FNCT_switchMove;
};
};
// If INS_REV_GVAR_camPlayer is dead, reset camera
if !(call INS_REV_FNCT_can_respawn_except_vehicle) then {
INS_REV_GVAR_camPlayer = objNull;
};
// If left respawn delay time, check allDead and nearest friendly
if (_deadTime + _respawnDelay > time) then {
if (INS_REV_CFG_respawn_near_friendly) then {
if (!(call INS_REV_FNCT_isNearFriendly) && _deadTime + 10 < time) then {
_unit setVariable ["INS_REV_PVAR_deadTime", _deadTime - _respawnDelay, true];
};
};
if (INS_REV_CFG__all_dead_respawn) then {
if (call INS_REV_FNCT_isAllDead) then {
_unit setVariable ["INS_REV_PVAR_deadTime", _deadTime - _respawnDelay, true];
};
};
};
// Moditor frequency
sleep 0.2;
// Update player's condition
if (PVAR_isAce) then {
_condition = _unit call ace_sys_wounds_fnc_isUncon;
} else {
_condition = _unit getVariable "INS_REV_PVAR_is_unconscious";
};
};
// Remove display eventhander
(findDisplay 46) displayRemoveEventHandler ["KeyDown",_KH];
(findDisplay 46) displayRemoveEventHandler ["MouseMoving",_MH1];
(findDisplay 46) displayRemoveEventHandler ["MouseZChanged",_MH2];
// Terminate dead camera
openMap [false,false];
INS_REV_GVAR_dead_camera cameraEffect ["terminate","back"];
camDestroy INS_REV_GVAR_dead_camera;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
};
// KeyDown event handler
INS_REV_FNCT_onKeyPress = {
private ["_handled","_list","_id","_size","_key","_leftTime","_respawnDelay"];
scopeName "main";
_key = _this select 1;
// _shift = _this select 2;
//_ctrl = _this select 3;
//_alt = _this select 4;
_handled = false;
_respawnDelay = call INS_REV_FNCT_getRespawnDelay;
/*
if (_key in actionKeys "tacticalView") then { hint "Tactical View is disabled in current mission."; _handled=true; };
*/
// if not alive player then exit function.
if (!alive player) exitWith {};
if (_key in (actionKeys 'showmap')) then {
//if isNull respawnCamera exitWith {};
INS_REV_GVAR_camMap = !INS_REV_GVAR_camMap;
openMap [INS_REV_GVAR_camMap,INS_REV_GVAR_camMap];
if INS_REV_GVAR_camMap then {
mapAnimAdd [0,0.1,getPosATL INS_REV_GVAR_camPlayer];
mapAnimCommit;
};
};
switch _key do {
//TAB key
/*
case 15: {
if (!_ctrl) exitWith {};
if (useroptions != 1) exitWith {};
if (!dialog) then {
createDialog "OPTIONS";
} else {
closeDialog 0;
};
};
*/
//ESC key
//case 1: {
//};
//N key
case 49: {
//if (isNull respawnCamera) exitWith {};
if (isNil "INS_REV_GVAR_camNVG") then { INS_REV_GVAR_camNVG = true; };
camUseNVG INS_REV_GVAR_camNVG;
INS_REV_GVAR_camNVG = !INS_REV_GVAR_camNVG;
};
//W key
case 17: {
if (speed player == 0 && lifeState player != "UNCONSCIOUS") then { detach player; };
};
//S key
case 31: {
if (speed player == 0 && lifeState player != "UNCONSCIOUS") then { detach player; };
};
//Y key (used for Teamkill Punishment Forgive action)
case 21: {
Punish_YES = True;
};
//Enter key
case 28: {
_leftTime = round ((player getVariable "INS_REV_PVAR_deadTime") + _respawnDelay - time);
if ( _leftTime > 0) exitWith {};
if (INS_REV_CFG_respawn_location == "BASE" && !(INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation)) exitWith {};
if ([INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle && !canMove INS_REV_GVAR_camPlayer) exitWith {};
if (isNull INS_REV_GVAR_dead_camera || INS_REV_GVAR_camMap ) exitWith {};
if (INS_REV_GVAR_enterSpawn) exitWith { INS_REV_GVAR_enterSpawn = false;};
if (INS_REV_CFG_near_enemy) then {
if ((INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation) && !([INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle)) exitWith {};
if ([INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_near_enemy) exitWith {
titleText [format["There's an enemy near '%1'. You can't respawn now.", name INS_REV_GVAR_camPlayer], "PLAIN"];
breakOut "main";
};
};
if (!INS_REV_GVAR_enterSpawn && (INS_REV_GVAR_camPlayer call INS_REV_FNCT_isRespawnLocation)) exitWith { INS_REV_GVAR_enterSpawn = true;};
if (vehicle INS_REV_GVAR_camPlayer call INS_REV_FNCT_vclisFull) exitWith {};
//if (lifeState INS_REV_GVAR_camPlayer == "UNCONSCIOUS") exitWith {};
if !INS_REV_GVAR_enterSpawn then { INS_REV_GVAR_enterSpawn = true;};
};
//Left
case 203: {
//if isNull respawnCamera exitWith {};
//_list = (call INS_REV_FNCT_getGroupMembers) + [flag_usa];
_list = call INS_REV_FNCT_getFriendly;
_size = count _list;
_id = _list find INS_REV_GVAR_camPlayer;
_id = _id - 1;
if (_id < 0) then { _id = _size - 1; };
INS_REV_GVAR_camPlayer = _list select _id;
};
//Right
case 205: {
//if isNull respawnCamera exitWith {};
_list = call INS_REV_FNCT_getFriendly;
_size = count _list;
_id = _list find INS_REV_GVAR_camPlayer;
_id = _id + 1;
if (_id == _size) then { _id = 0; };
INS_REV_GVAR_camPlayer = _list select _id;
};
//Backspace
//case 14: {
//};
};
_handled
};
// MouseMove event handler
INS_REV_FNCT_onMouseMove = {
private ["_xS","_yS","_xC","_yC","_zC","_camAttachCoords"];
// If not exist dead camera, exit
if (isNull INS_REV_GVAR_dead_camera ) exitWith {};
_yS = (_this select 1);
_xS = (_this select 2);
// Calculate theta
INS_REV_GVAR_theta = INS_REV_GVAR_theta - _xS;
if (INS_REV_GVAR_theta < 20) then {INS_REV_GVAR_theta = 20;};
if (INS_REV_GVAR_theta > 160) then {INS_REV_GVAR_theta = 160;};
// Calculate phi
INS_REV_GVAR_phi = INS_REV_GVAR_phi - _yS;
if (INS_REV_GVAR_phi < -270) then {INS_REV_GVAR_phi = -270;};
if (INS_REV_GVAR_phi > 90) then {INS_REV_GVAR_phi = 90;};
// Calculate cam attach coordinate
_camAttachCoords = call INS_REV_FNCT_get_camAttachCoords;
// If camPlayer is man or vehicle then attach camera.
if (INS_REV_GVAR_camPlayer isKindOf "Man" || [INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle) then {
INS_REV_GVAR_dead_camera attachTo [vehicle INS_REV_GVAR_camPlayer, _camAttachCoords];
} else {
// Or set camera
detach INS_REV_GVAR_dead_camera;
INS_REV_GVAR_dead_camera CamSetTarget vehicle INS_REV_GVAR_camPlayer;
INS_REV_GVAR_dead_camera camSetRelPos _camAttachCoords;
INS_REV_GVAR_dead_camera camCommit 0.5;
};
/*
INS_REV_GVAR_dead_camera attachTo [vehicle INS_REV_GVAR_camPlayer, _camAttachCoords];
*/
};
// MouseWheel event handler
INS_REV_FNCT_onMouseWheel = {
private ["_xC","_yC","_zC","_vC","_camAttachCoords"];
// If not exist dead camera, exit
if (isNull INS_REV_GVAR_dead_camera) exitWith {};
// Calculate cam range
_vC = (_this select 1);
if (_vC > 0) then {
INS_REV_GVAR_camRange = INS_REV_GVAR_camRange - 1;
} else {
INS_REV_GVAR_camRange = INS_REV_GVAR_camRange + 1;
};
if (INS_REV_GVAR_camRange < 2) then {INS_REV_GVAR_camRange = 2;};
// Calculate cam attach coordinate
_camAttachCoords = call INS_REV_FNCT_get_camAttachCoords;
// If camPlayer is man or vehicle then attach camera.
if (INS_REV_GVAR_camPlayer isKindOf "Man" || [INS_REV_GVAR_camPlayer] call INS_REV_FNCT_is_vehicle) then {
INS_REV_GVAR_dead_camera attachTo [vehicle INS_REV_GVAR_camPlayer, _camAttachCoords];
} else {
// Or set camera
detach INS_REV_GVAR_dead_camera;
INS_REV_GVAR_dead_camera CamSetTarget vehicle INS_REV_GVAR_camPlayer;
INS_REV_GVAR_dead_camera camSetRelPos _camAttachCoords;
INS_REV_GVAR_dead_camera camCommit 0.5;
};
/*
INS_REV_GVAR_dead_camera attachTo [vehicle INS_REV_GVAR_camPlayer, _camAttachCoords];
*/
};
// On killed event handler
INS_REV_FNCT_onKilled = {
if (_this select 0 != player) exitWith {};
// Terminate existing thread
terminate INS_REV_thread_exec_wait_revive;
// Set variable
player setVariable ["INS_REV_PVAR_is_unconscious", false, true];
player setVariable ["INS_REV_PVAR_is_dead", false, true];
if (INS_REV_CFG_life_time > 0) then {
INS_RES_GVAR_killed_time = time;
INS_REV_GVAR_is_lifeTime_over = false;
};
// Spawn new thread
INS_REV_thread_exec_wait_revive = [] spawn INS_REV_FNCT_onKilled_process;
};
// Process onKilled event
INS_REV_FNCT_onKilled_process = {
private ["_position_before_dead", "_altitude_ATL_before_dead", "_direction_before_dead","_magazines_before_dead","_weapons_before_dead", "_player","_condition","_loadout","_who_taking_care_of_injured"];
// Memorize player's body position
_position_before_dead = getPos INS_REV_GVAR_body_before_dead;
_altitude_ATL_before_dead = getPosATL INS_REV_GVAR_body_before_dead select 2;
_direction_before_dead = getDir INS_REV_GVAR_body_before_dead;
// Memorize player's loadout
if (!GVAR_is_arma3) then {
_magazines_before_dead = magazines INS_REV_GVAR_body_before_dead;
_weapons_before_dead = weapons INS_REV_GVAR_body_before_dead;
// Backpack
if (GVAR_is_arma2oa) then {
[_player, INS_REV_GVAR_player_loadout] call INS_REV_FNCT_set_loadout_a2oa;
};
};
// Remove dead body's actions
if !(PVAR_isAce) then {
INS_REV_GVAR_end_unconscious = INS_REV_GVAR_body_before_dead;
publicVariable "INS_REV_GVAR_end_unconscious";
["INS_REV_GVAR_end_unconscious", INS_REV_GVAR_end_unconscious] spawn INS_REV_FNCT_remove_actions;
INS_REV_GVAR_body_before_dead setVariable ["INS_REV_PVAR_is_unconscious", false, true];
INS_REV_GVAR_body_before_dead setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
};
// Wait respawn camera
sleep round (playerRespawnTime - 1);
// Terminate existing dead camera thread
terminate INS_REV_thread_dead_camera;
// Start dead camera thread
INS_REV_thread_dead_camera = player spawn INS_REV_FNCT_dead_camera;
// Wait until player will be respawned
waitUntil {alive player};
sleep 0.1;
// If Ace mod, terminate spectator
if (PVAR_isAce) then {
ace_sys_spectator_exit_spectator=true;
[player,1,true,9999999] call ace_w_setunitdam;
};
// Set variable
_player = player;
// Revert Loadout
if (GVAR_is_arma3) then {
if (INS_REV_CFG_loadout_on_respawn) then {
[_player, INS_REV_GVAR_player_loadout] call INS_REV_FNCT_set_loadout;
} else {
[_player, INS_REV_GVAR_player_loadout, ["ammo"]] call INS_REV_FNCT_set_loadout;
};
} else {
{_player addMagazine _x;} forEach _magazines_before_dead;
{_player addWeapon _x;} forEach _weapons_before_dead;
if (GVAR_is_arma2oa) then {
[_player, INS_REV_GVAR_player_loadout] call INS_REV_FNCT_set_loadout_a2oa;
};
};
// Set player do not allow damage and cannot be attacked
[_player, false] call INS_REV_FNCT_allowDamage;
if !(PVAR_isAce) then {
[_player, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
};
// Set variable
if !(PVAR_isAce) then {
INS_REV_GVAR_start_unconscious = _player;
publicVariable "INS_REV_GVAR_start_unconscious";
};
_player setVariable ["INS_REV_PVAR_is_unconscious", true, true];
_player setVariable ["INS_REV_PVAR_playerSide", INS_REV_GVAR_body_before_dead getVariable "INS_REV_PVAR_playerSide", true];
_player setVariable ["INS_REV_PVAR_playerGroup", INS_REV_GVAR_body_before_dead getVariable "INS_REV_PVAR_playerGroup", true];
_player setVariable ["INS_REV_PVAR_playerGroupColor", INS_REV_GVAR_body_before_dead getVariable "INS_REV_PVAR_playerGroupColor", true];
_player setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
_player setVariable ["INS_REV_revived", false, true];
// If player not used teleport, remove dead body
if !(_player getVariable "INS_REV_PVAR_isTeleport") then {
waitUntil {INS_REV_GVAR_body_before_dead != _player};
if !(GVAR_is_arma3) then {
if (call INS_REV_FNCT_can_respawn_player_body) then {deleteVehicle INS_REV_GVAR_body_before_dead;};
} else {
deleteVehicle INS_REV_GVAR_body_before_dead;
};
};
// Check Ace mod
if (!PVAR_isAce) then {
// If player can respawn player's own body
if !(GVAR_is_arma3) then {
if (!(call INS_REV_FNCT_can_respawn_player_body)) then {
//_player setPos [_position_before_dead select 0, _position_before_dead select 1, 2000];
_player setPos [0,0,0];
};
};
// If player not used teleport, remove dead body
if !(_player getVariable "INS_REV_PVAR_isTeleport") then {
// If player cannot respawn player's own body
if !(GVAR_is_arma3) then {
if (!(call INS_REV_FNCT_can_respawn_player_body)) then {
sleep 5;
deleteVehicle INS_REV_GVAR_body_before_dead;
};
};
};
_player setVelocity [0, 0, 0];
_player setDir _direction_before_dead;
_player setPos [_position_before_dead select 0, _position_before_dead select 1, _altitude_ATL_before_dead - (_position_before_dead select 2)];
};
// Reset variable
INS_REV_GVAR_body_before_dead = _player;
// Wait respawn or revive
if (PVAR_isAce) then {
_condition = _player call ace_sys_wounds_fnc_isUncon;
} else {
_condition = _player getVariable "INS_REV_PVAR_is_unconscious";
};
while {_condition} do
{
_who_taking_care_of_injured = _player getVariable "INS_REV_PVAR_who_taking_care_of_injured";
// If somebody is taking care of you
if !(isNil "_who_taking_care_of_injured") then {
// If the one who taking care of you is not alive.
if (isNull _who_taking_care_of_injured || !alive _who_taking_care_of_injured || !isPlayer _who_taking_care_of_injured) then {
// Reset player's state
detach _player;
if !(isNull _who_taking_care_of_injured) then {detach _who_taking_care_of_injured;};
_player switchMove "AinjPpneMstpSnonWrflDnon";
_player setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
};
};
// Check MEDEVAC vehicle
if (!PVAR_isAce && INS_REV_CFG_medevac) then {
if (_player != vehicle _player) then {
if (alive vehicle _player) then {
INS_REV_GVAR_is_loaded = true;
INS_REV_GVAR_loaded_vehicle = vehicle _player;
} else {
[] call INS_REV_FNCT_unload;
};
};
if (_player == vehicle _player && !isNil "INS_REV_GVAR_is_loaded" && {INS_REV_GVAR_is_loaded}) then {
[] call INS_REV_FNCT_unload;
};
};
// Check Life Time
if (INS_REV_CFG_life_time > 0) then {
if (!INS_REV_GVAR_is_lifeTime_over) then {
private "_lifeTime";
_lifeTime = round (INS_RES_GVAR_killed_time + INS_REV_CFG_life_time);
if (time > _lifeTime) then {
INS_REV_GVAR_is_lifeTime_over = true;
// Remove revive action
INS_REV_GVAR_end_unconscious = _player;
publicVariable "INS_REV_GVAR_end_unconscious";
["INS_REV_GVAR_end_unconscious", INS_REV_GVAR_end_unconscious] spawn INS_REV_FNCT_remove_actions;
// Set variable for dead marker
_player setVariable ["INS_REV_PVAR_is_dead", true, true];
};
};
};
sleep 0.3;
// Check Ace mod
if (PVAR_isAce) then {
_condition = _player call ace_sys_wounds_fnc_isUncon;
} else {
_condition = _player getVariable "INS_REV_PVAR_is_unconscious";
};
// Prevent drown in Arma3
if (GVAR_is_arma3) then {
[_player] call INS_REV_FNCT_prevent_drown;
};
};
sleep 0.2;
// Select primary weapon
_player selectWeapon (primaryWeapon _player);
// Check Ace mod
if (PVAR_isAce) then {
if ([_player] call ACE_fnc_isBurning) then { ['ace_sys_wounds_burnoff', _player] call CBA_fnc_globalEvent;};
//[_player, 0, true, 999999] call ace_w_setunitdam;
//_player call ace_sys_wounds_fnc_RemoveBleed;
//_player call ace_sys_wounds_fnc_RemovePain;
//_player call ace_sys_wounds_fnc_RemoveUncon;
//_player setVariable ["ace_w_heal", true];
//_player setVariable ["ace_w_eh",0];
//[_player,0] call ace_sys_wounds_fnc_heal;
_player call ace_sys_wounds_fnc_unitInit;
[_player,0] call ace_sys_wounds_fnc_heal;
_player setdamage 0;
} else {
// Remove revive action
INS_REV_GVAR_end_unconscious = _player;
publicVariable "INS_REV_GVAR_end_unconscious";
["INS_REV_GVAR_end_unconscious", INS_REV_GVAR_end_unconscious] spawn INS_REV_FNCT_remove_actions;
// Remove unload action
if (!isNil "INS_REV_GVAR_is_loaded" && {INS_REV_GVAR_is_loaded} && INS_REV_CFG_medevac) then {
INS_REV_GVAR_del_unload = [INS_REV_GVAR_loaded_vehicle, _player];
publicVariable "INS_REV_GVAR_del_unload";
["INS_REV_GVAR_del_unload", INS_REV_GVAR_del_unload] spawn INS_REV_FNCT_remove_unload_action;
INS_REV_GVAR_is_loaded = false;
INS_REV_GVAR_loaded_vehicle = nil;
};
};
// Set player allow damage and can be attacked
[_player, true] call INS_REV_FNCT_allowDamage;
// Reset variable
isJIP = false;
_player setVariable ["INS_REV_PVAR_isTeleport", false, true];
_player setVariable ["INS_REV_PVAR_is_dead", false, true];
};
// Unload player from vehicle
// Usage : 'call INS_REV_FNCT_unload;'
INS_REV_FNCT_unload = {
private ["_player"];
_player = player;
// Remove unload action
INS_REV_GVAR_del_unload = [INS_REV_GVAR_loaded_vehicle, _player];
publicVariable "INS_REV_GVAR_del_unload";
["INS_REV_GVAR_del_unload", INS_REV_GVAR_del_unload] spawn INS_REV_FNCT_remove_unload_action;
// Unload
_player action ["EJECT", vehicle _player];
[_player, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
while {animationState _player != "AinjPpneMstpSnonWrflDnon"} do {
sleep 0.1;
[_player, "AinjPpneMstpSnonWrflDnon"] call INS_REV_FNCT_switchMove;
};
INS_REV_GVAR_is_loaded = false;
INS_REV_GVAR_loaded_vehicle = nil;
};
// Teleport to teammate action
INS_REV_FNCT_init_teleport_to_teamate = {
sleep 3;
INS_REV_GVAR_teleportToTeam = player addAction [
"Teleport To Teammate", /* Title */
"INS_revive\revive\act_teleportToTeam.sqf", /* Script */
[], /* Arguments */
10, /* Priority */
false, /* ShowWindow */
true, /* HideOnUse */
"", /* Shortcut */
"" /* Condition */
];
sleep 10;
hintSilent "Use your scroll wheel to teleport to your teammate. (It available only within 3 minutes.)";
sleep 180;//3min
player removeAction INS_REV_GVAR_teleportToTeam;
isJIP = false;
player setVariable ["INS_REV_PVAR_isTeleport", false, true];
};
// Check dragging is finished
// Usage : 'call INS_REV_FNCT_is_finished_dragging;'
// Return : bool
INS_REV_FNCT_is_finished_dragging = {
private "_result";
_result = true;
if (!isNil "INS_REV_GVAR_do_release_body" && {!INS_REV_GVAR_do_release_body}) then {
if (!isNull _player && alive _player && !isNull _injured && alive _injured && isPlayer _injured && _injured getVariable "INS_REV_PVAR_is_unconscious") then {
if (animationState _player == "acinpknlmwlksraswrfldb" || animationState _player == "acinpknlmstpsraswrfldnon") then {
_result = false;
};
};
};
_result
};
// Check dragging is finished
// Usage : 'call INS_REV_FNCT_is_finished_dragging;'
// Return : bool
INS_REV_FNCT_is_finished_dragging_prone = {
private ["_result", "_prone_moves"];
_result = true;
_prone_moves = ["amovppnemstpsraswrfldnon","amovppnemrunslowwrfldf","amovppnemsprslowwrfldfl","amovppnemsprslowwrfldfr","amovppnemrunslowwrfldb","amovppnemsprslowwrfldbl","amovppnemsprslowwrfldr","amovppnemstpsraswrfldnon_turnl","amovppnemstpsraswrfldnon_turnr","amovppnemrunslowwrfldl","amovppnemrunslowwrfldr","amovppnemsprslowwrfldb","amovppnemrunslowwrfldbl","amovppnemsprslowwrfldl","amovppnemsprslowwrfldbr"];
if (!isNil "INS_REV_GVAR_do_release_body" && {!INS_REV_GVAR_do_release_body}) then {
if (!isNull _player && alive _player && !isNull _injured && alive _injured && isPlayer _injured && _injured getVariable "INS_REV_PVAR_is_unconscious") then {
if (animationState _player in _prone_moves) then {
_result = false;
};
};
};
_result
};
// Get group color index
// Usage : '[unit] call FNC_GET_GROUP_COLOR_INDEX;'
// Return : number
INS_REV_FNCT_get_group_color_index = {
private ["_phoneticCode", "_found", "_index", "_result", "_i", "_j"];
// Set variable
_unit = _this select 0;
_phoneticCode = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf"];
_found = false;
_index = 0;
// Find group name
{
for "_i" from 1 to 4 do {
for "_j" from 1 to 3 do {
_groupName = format["%1 %2-%3", _x, _i, _j];
if (format["b %1",_groupName] == str(group _unit) || format["o %1",_groupName] == str(group _unit)) exitWith {
_found = true;
};
_index = _index + 1;
};
if (_found) exitWith {};
};
if (_found) exitWith {};
} forEach _phoneticCode;
// If not found, return 0
if (!_found) then {
_result = 0;
} else {
_result = _index % 10;
};
_result
};
// Get group color
// Usage : '[unit] call FNC_GET_GROUP_COLOR;'
// Return : string
INS_REV_FNCT_get_group_color = {
private ["_unit", "_colors", "_colorIndex", "_result"];
// Set varialble
_unit = _this select 0;
_colors = ["ColorGreen","ColorYellow","ColorOrange","ColorPink","ColorBrown","ColorKhaki","ColorBlue","ColorRed","ColorBlack","ColorWhite"];
_colorIndex = [_unit] call INS_REV_FNCT_get_group_color_index;
// Set color
_result = _colors select _colorIndex;
// Return value
_result
};
// Get respawn delay time
// Usage : 'call INS_REV_FNCT_getRespawnDelay;'
// Return : int
INS_REV_FNCT_getRespawnDelay = {
private ["_result","_playerSide"];
_result = INS_REV_CFG_respawn_delay;
_playerSide = player getVariable "INS_REV_PVAR_playerSide";
switch (format["%1",_playerSide]) do {
case "WEST": {
if (!isNil {INS_REV_CFG_respawn_delay_blufor}) then {_result = INS_REV_CFG_respawn_delay_blufor;};
};
case "EAST": {
if (!isNil {INS_REV_CFG_respawn_delay_opfor}) then {_result = INS_REV_CFG_respawn_delay_opfor;};
};
case "CIV": {
if (!isNil {INS_REV_CFG_respawn_delay_civ}) then {_result = INS_REV_CFG_respawn_delay_civ;};
};
case "GUER": {
if (!isNil {INS_REV_CFG_respawn_delay_guer}) then {_result = INS_REV_CFG_respawn_delay_guer;};
};
};
_result;
};
// Damage event handler
// Usage : 'player addEventHandler ["HandleDamage", {_this call INS_REV_FNCT_clientHD}];'
// Return : damage
INS_REV_FNCT_clientHD = {
private ["_unit","_dam"];
_unit = _this select 0;
//_part = _this select 1;
_dam = _this select 2;
//_injurer = _this select 3;
//_ammo = _this select 4;
if (!alive _unit || {_dam == 0}) exitWith {
//__TRACE_1("ClientHD exiting, unit dead or healing","_dam");
_dam
};
if (_unit getVariable "INS_REV_PVAR_is_unconscious") exitWith {
//__TRACE_2("ClientHD exiting, unit uncon or invulnerable","_part");
0
};
/*
if (d_no_teamkill == 0 && {_dam >= 0.1} && {!isNull _injurer} && {isPlayer _injurer} && {_injurer != _unit} && {vehicle _unit == _unit} && {side (group _injurer) == side (group _unit)}) exitWith {
if (_part == "" && {_ammo != ""} && {getText (configFile >> "CfgAmmo" >> _ammo >> "simulation") in __shots} && {time > (__pGetVar(d_tk_cutofft) + 3)}) then {
_unit setVariable ["d_tk_cutofft", time];
hint format [(localize "STR_DOM_MISSIONSTRING_497"), name _injurer];
["d_unit_tkr", [_unit,_injurer]] call d_fnc_NetCallEventCTS;
if (d_domdatabase) then {
["d_ptkkg", _injurer] call d_fnc_NetCallEventCTS;
};
};
0
};
*/
if (_dam >= 0.9 && {time > INS_REV_GVAR_player_loadout_time}) then {
//__TRACE_1("ClientHD saving respawn gear","_dam");
//_unit setVariable [QGVARXR(last_gear_save), time + 1];
//call d_fnc_save_respawngear;
//_unit setVariable [QGVARXR(isleader), leader (group player) == player];
//GVARXR(pl_group) = group player;
INS_REV_GVAR_player_loadout_time = time + 1;
INS_REV_GVAR_player_loadout = [_unit,["ammo"]] call INS_REV_FNCT_get_loadout;
};
BIS_hitArray = _this; BIS_wasHit = true;
_dam
};
// Block respawn button
// Usage : 'spawn INS_REV_FNCT_respawnBlock;'
INS_REV_FNCT_respawnBlock = {
private ["_ctrl","_enCtrl"];
disableSerialization;
while {true} do {
waitUntil {!isNull (findDisplay 49)};
_ctrl = (findDisplay 49) displayCtrl 1010; //respawn control
_ctrl ctrlEnable false;
waitUntil {sleep 0.12;isNull (findDisplay 49)};
};
};
// Draw respawn locations marker
// Usage : 'spawn INS_REV_FNCT_displayRespawnLocationMarker;'
INS_REV_FNCT_displayRespawnLocationMarker = {
private ["_respawnLocations", "_markers", "_markersUpdate", "_marker","_color", "_type","_colorArray","_markerTypeArray","_vehicleType"];
_respawnLocations = [] call INS_REV_FNCT_get_respawn_locations;
_colorArray = ["ColorOrange","ColorYellow","ColorGreen","ColorPink","ColorBrown","ColorKhaki","ColorBlue","ColorRed","ColorBlack","ColorWhite"];
_markerTypeArray = ["mil_marker","mil_flag","mil_dot","mil_box","mil_triangle","mil_destroy","mil_circle"];
_markers = [];
_color = _colorArray select INS_REV_CFG_respawnLocationMarkerColor;
while {true} do {
_respawnLocations = [] call INS_REV_FNCT_get_respawn_locations;
_markersUpdate = [];
{
_marker = format["lmarker%1",_x];
_markersUpdate = _markersUpdate + [_marker];
if !(_marker in _markers) then {
_marker=createMarkerLocal [format ["lmarker%1",_x],[0,0,0]];
switch true do {
case (vehicle _x isKindOf "Helicopter"): {_type = "n_air"};
case (vehicle _x isKindOf "Plane"): {_type = "n_plane"};
case (vehicle _x isKindOf "Car"): {_type = "n_motor_inf"};
case (vehicle _x isKindOf "Tank"): {_type = "n_armor"};
case (vehicle _x isKindOf "Ship"): {_type = "n_motor_inf"};
default {_type = _markerTypeArray select INS_REV_CFG_respawnLocationMarkerType;};
};
_marker setMarkerTypeLocal _type;
_marker setMarkerColorLocal _color;
_marker setMarkerSizeLocal [0.7, 0.7];
_marker setMarkerPosLocal getPos _x;
_marker setMarkerTextLocal toUpper format["%1", _x];
_markers = _markers + [_marker];
};
_marker setMarkerPosLocal getPos _x;
} forEach _respawnLocations;
{
if !(_x in _markersUpdate) then {
_markers = _markers - [_x];
deleteMarkerLocal _x;
};
} forEach _markers;
sleep 1;
};
};
// Destroy damaged vehicle
// Usage : 'spawn INS_REV_FNCT_destroyDamagedVehicle;'
INS_REV_FNCT_destroyDamagedVehicle = {
private ["_respawnLocations", "_vehicles"];
while {true} do {
_respawnLocations = [] call INS_REV_FNCT_get_respawn_locations;
_vehicles = [];
{
if ([_x] call INS_REV_FNCT_is_vehicle) then {
if (!canMove _x) then {
[_x] spawn {
private ["_delayTime","_isDestroyed","_vehicle"];
_vehicle = _this select 0;
_delayTime = time + INS_REV_CFG_destroyDamagedVehicleDelay;
_isDestroyed = false;
while {time < _delayTime && !_isDestroyed} do {
if (!alive _vehicle) then {
isDestroyed = true
};
sleep 1;
};
if (!_isDestroyed) then {_vehicle setDamage 1;};
};
};
};
} forEach _respawnLocations;
sleep 1;
};
};
// Inform that initialization of functions is completed
INS_REV_FNCT_init_completed = true;
/*
* INS_revive functions for Arma 2 OA
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
// Get backpack data for Arma 2 OA
// Usage : '[unit] call INS_REV_FNCT_get_loadout_a2oa;'
// Return : array
INS_REV_FNCT_get_loadout_a2oa = {
private ["_backpack","_result"];
_backpack = unitBackpack (_this select 0);
if (isNull _backpack) then {
_result = [];
} else {
_result = [
typeOf _backpack,
getWeaponCargo _backpack,
getMagazineCargo _backpack
];
};
_result
};
// Set backpack data for Arma 2 OA
// Usage : '[unit, backapck_data_array] call INS_REV_FNCT_set_loadout_a2oa;'
INS_REV_FNCT_set_loadout_a2oa = {
private ["_unit", "_backpack_data"];
_unit = _this select 0;
_backpack_data = _this select 1;
// If the unit has a backpack, remove it
if !(isNull (unitBackpack _unit)) then
{
removeBackpack _unit;
};
// If there's backpack data
if (count _backpack_data == 3) then
{
private ["_backpack", "_commande_init", "_i"];
// Remove all items from backpack
_commande_init = "";
_commande_init = _commande_init + "clearWeaponCargo this;";
_commande_init = _commande_init + "clearMagazineCargo this;";
// Add weapons to backpack
for [{_i = 0}, {_i < count (_backpack_data select 1 select 0)}, {_i = _i+1}] do
{
_commande_init = _commande_init + format ["this addWeaponCargo [""%1"",%2];",
_backpack_data select 1 select 0 select _i,
_backpack_data select 1 select 1 select _i];
};
// Add magazine to backpack
for [{_i = 0}, {_i < count (_backpack_data select 2 select 0)}, {_i = _i+1}] do
{
_commande_init = _commande_init + format ["this addMagazineCargo [""%1"",%2];",
_backpack_data select 2 select 0 select _i,
_backpack_data select 2 select 1 select _i];
};
// Add backpack to unit
_unit addBackpack (_backpack_data select 0);
_backpack = unitBackpack _unit;
_backpack setVehicleInit _commande_init;
processInitCommands;
};
};
// Disable thermal cam
// Usage : 'call INS_REV_FNCT_disalble_thermal_cam;'
INS_REV_FNCT_disalble_thermal_cam = {
false setCamUseTi 0;
};
INS_REV_FNCT_a2oa_init_completed = true;/*
* INS_revive functions for Arma 3
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
// Get loadout
// Usage(thread) : '[unit] call INS_REV_FNCT_get_loadout;'
// Return : array
INS_REV_FNCT_get_loadout = compile preprocessFileLineNumbers 'INS_revive\loadout\fnc_get_loadout.sqf';
// Set loadout
// Usage : '[unit, loadout_array] call INS_REV_FNCT_set_loadout;'
INS_REV_FNCT_set_loadout = compile preprocessFileLineNumbers 'INS_revive\loadout\fnc_set_loadout.sqf';
// Prevent drown
// Usage : '[unit] call INS_REV_FNCT_prevent_drown;'
INS_REV_FNCT_prevent_drown = {
private "_unit";
_unit = _this select 0;
_unit setOxygenRemaining 1;
};
// Check unit is underwater
// Usage(thread) : '[unit] call INS_REV_FNCT_is_underwater;'
// Return : boot
INS_REV_FNCT_is_underwater = {
private ["_unit","_result"];
_unit = _this select 0;
_result = underwater _unit;
_result
};
// Disable thermal cam
// Usage : 'call INS_REV_FNCT_disalble_thermal_cam;'
INS_REV_FNCT_disalble_thermal_cam = {
false setCamUseTi 0;
};
INS_REV_FNCT_a3_init_completed = true;/*
* Initialize INS_revive system (ACE mod).
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
ace_wounds_prevtime = 6000; publicVariable "ace_wounds_prevtime";
ace_sys_wounds_withSpect = false; publicVariable "ace_sys_wounds_withSpect";
ace_sys_eject_fnc_weaponcheck = {}; publicVariable "ace_sys_eject_fnc_weaponcheck"; //disable aircraft weapon removal
ace_sys_wounds_enabled = true; publicVariable "ace_sys_wounds_enabled";
ace_sys_wounds_noai = false; publicVariable "ace_sys_wounds_noai";
ace_sys_wounds_leftdam = 0; publicVariable "ace_sys_wounds_leftdam";
ace_sys_wounds_all_medics = true; publicVariable "ace_sys_wounds_all_medics";
ace_sys_wounds_no_rpunish = true; publicVariable "ace_sys_wounds_no_rpunish";
ace_sys_wounds_auto_assist_any = true; publicVariable "ace_sys_wounds_auto_assist_any";
ace_sys_wounds_ai_movement_bloodloss = true; publicVariable "ace_sys_wounds_ai_movement_bloodloss";
ace_sys_wounds_player_movement_bloodloss = true; publicVariable "ace_sys_wounds_player_movement_bloodloss";
ace_sys_wounds_auto_assist = true; publicVariable "ace_sys_wounds_auto_assist";
ace_sys_aitalk_enabled = true; publicVariable "ace_sys_aitalk_enabled";
ace_sys_aitalk_radio_enabled = true; publicVariable "ace_sys_aitalk_radio_enabled";
ace_sys_aitalk_talkforplayer = true; publicVariable "ace_sys_aitalk_talkforplayer";
ace_ifak_capacity = 6; publicVariable "ace_ifak_capacity"; //medical gear slots
// Remote execution
if !(GVAR_is_arma3) then {
INS_REV_FNCT_remote_exec =
{
private ["_unit", "_command", "_parameter"];
_unit = _this select 1 select 0;
_command = _this select 1 select 1;
_parameter = _this select 1 select 2;
if (local _unit) then
{
switch (_command) do
{
case "switchMove": {_unit switchMove _parameter;};
case "setDir": {_unit setDir _parameter;};
case "playMove": {_unit playMove _parameter;};
case "playMoveNow": {_unit playMoveNow _parameter;};
};
};
};
"INS_REV_remote_exec" addPublicVariableEventHandler INS_REV_FNCT_remote_exec;
};
// Load language string
call compile preprocessFile format ["INS_revive\revive\%1_strings_lang.sqf", INS_REV_CFG_language];
// Call functions
call compile preprocessFile "INS_revive\revive\functions.sqf";
waitUntil {!isNil "INS_REV_FNCT_init_completed"};
if (GVAR_is_arma3) then {
call compile preprocessFile "INS_revive\revive\functions_a3.sqf";
waitUntil {!isNil "INS_REV_FNCT_a3_init_completed"};
};
if (GVAR_is_arma2oa) then {
call compile preprocessFile "INS_revive\revive\functions_a2oa.sqf";
waitUntil {!isNil "INS_REV_FNCT_a2oa_init_completed"};
};
if (GVAR_is_arma2) then {
call compile preprocessFile "INS_revive\revive\functions_a2.sqf";
waitUntil {!isNil "INS_REV_FNCT_a2_init_completed"};
};
// Start serverside scripts
if (isServer) then {
// Set makers when player dead
if (INS_REV_CFG_player_marker_serverSide) then {
INS_REV_thread_draw_dead_marker = [] spawn INS_REV_FNCT_draw_dead_marker;
};
// Destroy when base vehicle can't move
if (INS_REV_CFG_destroyDamagedVehicle) then {
[] spawn INS_REV_FNCT_destroyDamagedVehicle;
};
};
if (!isDedicated) then
{
// Initailize revive
[] spawn {
// Set thread
INS_REV_thread_exec_wait_revive = [] spawn {}; // On killed wating revive thread
INS_REV_thread_dead_camera = [] spawn {}; // On killed dead camera thread
// Wait until player initialized
waitUntil {!(isNull player)};
// Set makers when player dead (client side)
if (!INS_REV_CFG_player_marker_serverSide) then {
INS_REV_thread_draw_dead_marker = [] spawn INS_REV_FNCT_draw_dead_marker;
};
// Display Respawn Locations Marker
if (INS_REV_CFG_displayRespawnLocationMarker) then {
[] spawn INS_REV_FNCT_displayRespawnLocationMarker;
};
// Initialize Player Loadout
if (GVAR_is_arma3) then {
// Arma 3
_loadout = [player] call INS_REV_FNCT_get_loadout;
INS_REV_GVAR_player_loadout = _loadout;
} else {
// Arma 2 oa
if (GVAR_is_arma2oa) then {
INS_REV_GVAR_player_loadout = [player] call INS_REV_FNCT_get_loadout_a2oa;
};
};
// Memorize player's body before dead
INS_REV_GVAR_body_before_dead = player;
// Add event handler
player addEventHandler ["killed", INS_REV_FNCT_onKilled];
["ace_sys_wounds_rev", {call INS_REV_FNCT_onKilled}] call CBA_fnc_addEventhandler;
sleep 0.5;
// Initialize Variable
player setVariable ["INS_REV_PVAR_is_unconscious", false, true];
player setVariable ["INS_REV_PVAR_isTeleport", false, true];
player setVariable ["INS_REV_PVAR_playerSide", side player, true];
player setVariable ["INS_REV_PVAR_playerGroup", group player, true];
player setVariable ["INS_REV_PVAR_playerGroupColor", [player] call INS_REV_FNCT_get_group_color, true];
player setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
// JIP Process
if (isJIP) then {
switch (INS_REV_CFG_JIP_Teleport_Action) do {
case 0: {
// none
};
case 1: {
// add 'Teleport to teammate' action
call INS_REV_FNCT_init_teleport_to_teamate;
};
case 2: {
// dead camera
player setVariable ["INS_REV_PVAR_isTeleport", true, true];
[player, player] call INS_REV_FNCT_onKilled;
};
};
};
};
};/*
* Initialize INS_revive system.
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
// Load language string
call compile preprocessFile format ["INS_revive\revive\%1_strings_lang.sqf", INS_REV_CFG_language];
// Call functions
call compile preprocessFile "INS_revive\revive\functions.sqf";
waitUntil {!isNil "INS_REV_FNCT_init_completed"};
if (GVAR_is_arma3) then {
call compile preprocessFile "INS_revive\revive\functions_a3.sqf";
waitUntil {!isNil "INS_REV_FNCT_a3_init_completed"};
};
if (GVAR_is_arma2oa) then {
call compile preprocessFile "INS_revive\revive\functions_a2oa.sqf";
waitUntil {!isNil "INS_REV_FNCT_a2oa_init_completed"};
};
// Start serverside scripts
if (isServer) then {
// Set makers when player dead
if (INS_REV_CFG_player_marker_serverSide) then {
INS_REV_thread_draw_dead_marker = [] spawn INS_REV_FNCT_draw_dead_marker;
};
// Destroy when base vehicle can't move
if (INS_REV_CFG_destroyDamagedVehicle) then {
[] spawn INS_REV_FNCT_destroyDamagedVehicle;
};
};
// If not player then exit
if (!isDedicated) then
{
// Initailize revive
[] spawn {
private ["_loadout", "_playableUnits"];
// Set thread
INS_REV_thread_exec_wait_revive = [] spawn {}; // On killed wating revive thread
INS_REV_thread_dead_camera = [] spawn {}; // On killed dead camera thread
// Wait until player initialized
waitUntil {!(isNull player)};
// Display Respawn Locations Marker
if (INS_REV_CFG_displayRespawnLocationMarker) then {
[] spawn INS_REV_FNCT_displayRespawnLocationMarker;
};
// Initialize Player Loadout
if (GVAR_is_arma3) then {
// Arma 3
_loadout = [player] call INS_REV_FNCT_get_loadout;
INS_REV_GVAR_player_loadout = _loadout;
INS_REV_GVAR_player_loadout_time = time;
} else {
// Arma 2 oa
if (GVAR_is_arma2oa) then {
INS_REV_GVAR_player_loadout = [player] call INS_REV_FNCT_get_loadout_a2oa;
};
};
if (!INS_REV_CFG_loadout_on_respawn) then {
[] spawn INS_REV_FNCT_respawnBlock;
};
// Memorize player's body before dead
INS_REV_GVAR_body_before_dead = player;
// Add event handler
player addEventHandler ["killed", INS_REV_FNCT_onKilled];
"INS_REV_GVAR_start_unconscious" addPublicVariableEventHandler INS_REV_FNCT_add_actions;
"INS_REV_GVAR_end_unconscious" addPublicVariableEventHandler INS_REV_FNCT_remove_actions;
"INS_REV_GVAR_add_unload" addPublicVariableEventHandler INS_REV_FNCT_add_unload_action;
"INS_REV_GVAR_del_unload" addPublicVariableEventHandler INS_REV_FNCT_remove_unload_action;
if (!INS_REV_CFG_loadout_on_respawn) then {
//player addEventHandler ["HandleDamage",{BIS_hitArray = _this; BIS_wasHit = true; _this select 2;} ];
//player removeAllEventHandlers "HandleDamage";
player addEventHandler ["HandleDamage", {_this call INS_REV_FNCT_clientHD}];
};
sleep 0.5;
// Initialize Variable
player setVariable ["INS_REV_PVAR_is_unconscious", false, true];
player setVariable ["INS_REV_PVAR_isTeleport", false, true];
player setVariable ["INS_REV_PVAR_playerSide", side player, true];
player setVariable ["INS_REV_PVAR_playerGroup", group player, true];
player setVariable ["INS_REV_PVAR_playerGroupColor", [player] call INS_REV_FNCT_get_group_color, true];
player setVariable ["INS_REV_PVAR_who_taking_care_of_injured", nil, true];
player setVariable ["INS_REV_PVAR_is_dead", false, true];
// Initialize other players state (JIP, disabledAI, ...)
_playableUnits = playableUnits;
{
["INS_REV_GVAR_end_unconscious", _x] call INS_REV_FNCT_remove_actions;
if (_x != player) then {
if !(isNil {_x getVariable "INS_REV_PVAR_is_unconscious"}) then {
if (_x getVariable "INS_REV_PVAR_is_unconscious") then {
["INS_REV_GVAR_start_unconscious", _x] call INS_REV_FNCT_add_actions;
};
};
};
} forEach _playableUnits;
// JIP Process
if (isJIP) then {
switch (INS_REV_CFG_JIP_Teleport_Action) do {
case 0: {
// none
};
case 1: {
// add 'Teleport to teammate' action
call INS_REV_FNCT_init_teleport_to_teamate;
};
case 2: {
// dead camera
player setVariable ["INS_REV_PVAR_isTeleport", true, true];
[player, player] call INS_REV_FNCT_onKilled;
};
};
};
};
};
#define CT_STRUCTURED_TEXT 13
class Rtags {
idd=64431;
movingEnable = true;
fadein = 0;
fadeout = 0;
duration = 0.2;
name = "TAGS_HUD";
controls[] = { "camtag", "nametag", "interact"};
onLoad = "uiNamespace setVariable ['TAGS_HUD', _this select 0]";
class camtag {
type = CT_STRUCTURED_TEXT;
idc = 64434;
style = 0x00;
x = safeZoneX;
y = safeZoneY+safeZoneH/2+0.3;
w = safeZoneW;
h = safeZoneH;
font = "EtelkaNarrowMediumPro";
size = 0.035;
colorText[] = { 0, 0.4, 0.8, 0.8};
colorBackground[] = { 0,0,0,0.0};
text = "";
class Attributes {
font = "EtelkaNarrowMediumPro";
color = "#347C17";
align = "center";
valign = "middle";
shadow = "1";
shadowColor = "#000000";
size = "1";
};
};
class nametag {
type = CT_STRUCTURED_TEXT;
idc = 64435;
style = 0x00;
x = safeZoneX+ 0.1;
y = safeZoneY+safeZoneH/2+0.05;
w = safeZoneW;
h = safeZoneH;
font = "EtelkaNarrowMediumPro";
size = 0.035;
colorText[] = { 0, 0.4, 0.8, 0.8};
colorBackground[] = { 0,0,0,0.0};
text = "";
class Attributes {
font = "EtelkaNarrowMediumPro";
color = "#2B60DE";
align = "center";
valign = "middle";
shadow = "1";
shadowColor = "#000000";
size = "1";
};
};
class interact {
type = CT_STRUCTURED_TEXT;
idc = 64436;
style = 0x00;
x = safeZoneX;
y = safeZoneY+safeZoneH/2+0.2;
w = safeZoneW;
h = safeZoneH;
font = "EtelkaNarrowMediumPro";
size = 0.035;
colorText[] = { 1, 1, 0, 0.8};
colorBackground[] = { 0,0,0,0.0};
text = "";
class Attributes {
font = "EtelkaNarrowMediumPro";
color = "#2B60DE";
align = "center";
valign = "middle";
shadow = "1";
shadowColor = "#000000";
size = "1";
};
};
};
/*
* Initialize INS_revive sytem
*
* Copyleft 2013 naong
*
* This program is free software under the terms of the GNU General Public License version 3.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
// Load Config File
#include "config.sqf"
// Set JIP variable
if (isNil "isJIP") then {
isJIP = false;
player setVariable ["isJIP", false, true];
} else {
if (isJIP) then {
player setVariable ["isJIP", true, true];
} else {
player setVariable ["isJIP", false, true];
};
};
// Check for Arma 3 or 2
GVAR_is_arma3 = false;
if (isClass (configfile >> "CfgAddons" >> "PreloadAddons" >> "A3")) then {
GVAR_is_arma3 = true;
};
// Check for Arma 2 OA
GVAR_is_arma2oa = false;
if (isClass (configfile >> "CfgVehicles" >> "BAF_Soldier_MTP")) then {
GVAR_is_arma2oa = true;
};
// Check Ace Mode
if (isServer) then {
if (isClass(configFile >> "CfgPatches" >> "ace_main")) then {
PVAR_isAce = true; publicvariable "PVAR_isAce";
} else {
PVAR_isAce = false; publicvariable "PVAR_isAce";
};
};
// INS_revive Initializing
waitUntil {!isNil "PVAR_isAce"};
if (PVAR_isAce) then {
ace_wounds_prevtime = 6000; publicVariable "ace_wounds_prevtime";
ace_sys_wounds_withSpect = false; publicVariable "ace_sys_wounds_withSpect";
ace_sys_eject_fnc_weaponcheck = {}; publicVariable "ace_sys_eject_fnc_weaponcheck"; //disable aircraft weapon removal
ace_sys_wounds_enabled = true; publicVariable "ace_sys_wounds_enabled";
ace_sys_wounds_noai = false; publicVariable "ace_sys_wounds_noai";
ace_sys_wounds_leftdam = 0; publicVariable "ace_sys_wounds_leftdam";
ace_sys_wounds_all_medics = true; publicVariable "ace_sys_wounds_all_medics";
ace_sys_wounds_no_rpunish = true; publicVariable "ace_sys_wounds_no_rpunish";
ace_sys_wounds_auto_assist_any = true; publicVariable "ace_sys_wounds_auto_assist_any";
ace_sys_wounds_ai_movement_bloodloss = true; publicVariable "ace_sys_wounds_ai_movement_bloodloss";
ace_sys_wounds_player_movement_bloodloss = true; publicVariable "ace_sys_wounds_player_movement_bloodloss";
ace_sys_wounds_auto_assist = true; publicVariable "ace_sys_wounds_auto_assist";
ace_sys_aitalk_enabled = true; publicVariable "ace_sys_aitalk_enabled";
ace_sys_aitalk_radio_enabled = true; publicVariable "ace_sys_aitalk_radio_enabled";
ace_sys_aitalk_talkforplayer = true; publicVariable "ace_sys_aitalk_talkforplayer";
ace_ifak_capacity = 6; publicVariable "ace_ifak_capacity"; //medical gear slots
Call Compile preprocessFileLineNumbers "INS_revive\revive\init_ace.sqf";
} else {
Call Compile preprocessFileLineNumbers "INS_revive\revive\init_vanilla.sqf";
};
//// Respawn Script - Start ////
#include "revive\rsctitles.hpp"
//// Respawn Script - End //////------------------
// Validate Config
//------------------
// Remove null object in array
// Usage : '[array] call INS_REV_FNCT_remove_null_objects;'
// Return : array
INS_REV_FNCT_remove_null_objects = {
private ["_arr", "_result"];
_arr = _this select 0;
_result = [];
{
if (!isNil _x) then {
if (!isNull call compile format["%1",_x]) then {
_result = _result + [_x];
};
};
} forEach _arr;
_result
};
// Get param value(number)
// Usage : '["_param","_value",_default] call INS_REV_FNCT_param_to_bool;'
INS_REV_FNCT_param_to_bool = {
private ["_param","_value","_default"];
_param = _this select 0;
_value = _this select 1;
_default = _this select 2;
if (!isNil call compile format["'%1'",_param]) then {
call compile format["%1 = (%2 == 1)", _value, _param];
} else {
if (isNil call compile format["'%1'",_value]) then {
call compile format["%1 = %2", _value, _default];
};
};
};
// Process param to value
// Usage : '["_param","_value",_default] call INS_REV_FNCT_param_to_value;'
INS_REV_FNCT_param_to_value = {
private ["_param","_value","_default"];
_param = _this select 0;
_value = _this select 1;
_default = _this select 2;
if (!isNil call compile format["'%1'",_param]) then {
call compile format["%1 = %2", _value, _param];
} else {
if (isNil call compile format["'%1'",_value]) then {
call compile format["%1 = %2", _value, _default];
};
};
};
INS_REV_CFG_list_of_respawn_locations_blufor = [INS_REV_CFG_list_of_respawn_locations_blufor] call INS_REV_FNCT_remove_null_objects;
INS_REV_CFG_list_of_respawn_locations_opfor = [INS_REV_CFG_list_of_respawn_locations_opfor] call INS_REV_FNCT_remove_null_objects;
//INS_REV_CFG_list_of_ammobox = [INS_REV_CFG_list_of_ammobox] call INS_REV_FNCT_remove_null_objects;
// Get parameter value from description.ext
for [ {_i = 0}, {_i < count(paramsArray)}, {_i = _i + 1} ] do
{
call compile format
[
"%1 = %2",
(configName ((missionConfigFile >> "Params") select _i)),
(paramsArray select _i)
];
};
// ALLOW TO REVIVE
if (!isNil "INS_REV_PARAM_allow_revive") then {
// Everyone
if (INS_REV_PARAM_allow_revive == 0) then {
INS_REV_CFG_all_player_can_revive = true;
} else {
// Medic Only
if (INS_REV_PARAM_allow_revive == 1) then {
INS_REV_CFG_all_player_can_revive = false;
INS_REV_CFG_all_medics_can_revive = true;
// Pre-Defined
} else {
INS_REV_CFG_all_player_can_revive = false;
INS_REV_CFG_all_medics_can_revive = false;
};
};
} else {
if (isNil "INS_REV_CFG_all_player_can_revive") then {
INS_REV_CFG_all_player_can_revive = true;
};
};
// RESPAWN DELAY TIME
["INS_REV_PARAM_respawn_delay",
"INS_REV_CFG_respawn_delay",
120 ] call INS_REV_FNCT_param_to_value;
// LIFE TIME FOR REVIVE
["INS_REV_PARAM_life_time",
"INS_REV_CFG_life_time",
300 ] call INS_REV_FNCT_param_to_value;
// TAKE TIME TO REVIVE
["INS_REV_PARAM_revive_take_time",
"INS_REV_CFG_revive_take_time",
15 ] call INS_REV_FNCT_param_to_value;
// REQUIRES MEDKIT TO REVIVE
["INS_REV_PARAM_require_medkit",
"INS_REV_CFG_require_medkit",
false ] call INS_REV_FNCT_param_to_bool;
// PLAYER RESPAWN TYPE
if (!isNil "INS_REV_PARAM_respawn_type") then {
switch (INS_REV_PARAM_respawn_type) do {
case 0: {
// ALL
INS_REV_CFG_respawn_type = "ALL";
};
case 1: {
// SIDE
INS_REV_CFG_respawn_type = "SIDE";
};
case 2: {
// GROUP
INS_REV_CFG_respawn_type = "GROUP";
};
};
} else {
if (isNil "INS_REV_CFG_respawn_type") then {
INS_REV_CFG_respawn_type = "ALL";
};
};
// PLAYER RESPAWN LOCATION
if (!isNil "INS_REV_PARAM_respawn_location") then {
switch (INS_REV_PARAM_respawn_location) do {
case 0: {
// Base + Alive friendly unit
INS_REV_CFG_respawn_location = "BOTH";
};
case 1: {
// Base
INS_REV_CFG_respawn_location = "BASE";
};
case 2: {
// Alive Friendly Unit
INS_REV_CFG_respawn_location = "FRIENDLY_UNIT";
};
};
} else {
if (isNil "INS_REV_CFG_respawn_location") then {
INS_REV_CFG_respawn_location = "BOTH";
};
};
// DISPLAY RESPAWN LOCATIONS MARKER
["INS_REV_PARAM_displayRespawnLocationMarker",
"INS_REV_CFG_displayRespawnLocationMarker",
true ] call INS_REV_FNCT_param_to_bool;
// - Marker Color
["INS_REV_PARAM_respawnLocationMarkerColor",
"INS_REV_CFG_respawnLocationMarkerColor",
0 ] call INS_REV_FNCT_param_to_value;
// - Marker Type
["INS_REV_PARAM_respawnLocationMarkerType",
"INS_REV_CFG_respawnLocationMarkerType",
0 ] call INS_REV_FNCT_param_to_value;
// DESTROY WHEN BASE VEHICLE CAN"T MOVE
["INS_REV_PARAM_destroyDamagedVehicle",
"INS_REV_CFG_destroyDamagedVehicle",
false ] call INS_REV_FNCT_param_to_bool;
// - Delay Time
["INS_REV_PARAM_destroyDamagedVehicleDelay",
"INS_REV_CFG_destroyDamagedVehicleDelay",
30 ] call INS_REV_FNCT_param_to_value;
// JIP TELEPORT ACTION
["INS_REV_PARAM_jip_action",
"INS_REV_CFG_JIP_Teleport_Action",
1 ] call INS_REV_FNCT_param_to_value;
// ALLOW TO DRAG BODY
["INS_REV_PARAM_can_drag_body",
"INS_REV_CFG_player_can_drag_body",
true ] call INS_REV_FNCT_param_to_bool;
// ALLOW TO CARRY BODY
["INS_REV_PARAM_can_carry_body",
"INS_REV_CFG_player_can_carry_body",
true ] call INS_REV_FNCT_param_to_bool;
// Allow to load Body (MEDEVAC)
["INS_REV_PARAM_medevac",
"INS_REV_CFG_medevac",
true ] call INS_REV_FNCT_param_to_bool;
// PLAYER CAN RESPAWN PLAYER's BODY
["INS_REV_PARAM_can_respawn_player_body",
"INS_REV_CFG_can_respawn_player_body",
false ] call INS_REV_FNCT_param_to_bool;
// PLAYER CAN RESPAWN PLAYER's BODY, WHEN HALF OF PLAYERS ARE DEAD
["INS_REV_PARAM_half_dead_repsawn_player_body",
"INS_REV_CFG_half_dead_repsawn_player_body",
false ] call INS_REV_FNCT_param_to_bool;
// PLAYER CAN RESPAWN IMMEDIATELY WHEN THERE'S NOT EXIST FRIENDLY UNIT NEAR PLAYER
["INS_REV_PARAM_near_friendly",
"INS_REV_CFG_respawn_near_friendly",
false ] call INS_REV_FNCT_param_to_bool;
// PLAYER CAN RESPAWN IMMEDIATELY WHEN ALL PLAYERS ARE DEAD
["INS_REV_PARAM_all_dead_respawn",
"INS_REV_CFG__all_dead_respawn",
true ] call INS_REV_FNCT_param_to_bool;
// Friendly unit search distnace
["INS_REV_PARAM_near_friendly_distance",
"INS_REV_CFG_respawn_near_friendly_range",
50 ] call INS_REV_FNCT_param_to_value;
// PLAYER CANNOT RESPAWN, IF EXIST ENEMY UNIT NEAR PLAYER
["INS_REV_PARAM_near_enemy",
"INS_REV_CFG_near_enemy",
true ] call INS_REV_FNCT_param_to_bool;
// Enemy unit search distance
["INS_REV_PARAM_near_enemy_distance",
"INS_REV_CFG_near_enemy_range",
50 ] call INS_REV_FNCT_param_to_value;
// Restore loadout on respawn : Core Version
["INS_REV_PARAM_loadout_on_respawn",
"INS_REV_CFG_loadout_on_respawn",
false ] call INS_REV_FNCT_param_to_bool;
// Teamkiller Lock System
["INS_REV_PARAM_teamkiller_lock",
"INS_REV_CFG_teamkiller_lock",
true ] call INS_REV_FNCT_param_to_bool;
// Teamkill Limit
["INS_REV_PARAM_teamkill_limit",
"INS_REV_CFG_teamkill_limit",
3 ] call INS_REV_FNCT_param_to_value;
// Virtual Ammobox System
["INS_REV_PARAM_virtual_ammobox",
"INS_REV_CFG_virtual_ammobox",
true ] call INS_REV_FNCT_param_to_bool;
// - Protect ammobox
["INS_REV_PARAM_vas_protect_ammobox",
"INS_REV_CFG_vas_protect_ammobox",
true ] call INS_REV_FNCT_param_to_bool;
// TAW View Distance Script
["INS_REV_PARAM_taw_view",
"INS_REV_CFG_taw_view",
true ] call INS_REV_FNCT_param_to_bool;
// Squad Management Script
["INS_REV_PARAM_squad_management",
"INS_REV_CFG_squad_management",
true ] call INS_REV_FNCT_param_to_bool;
// DOM Repair
["INS_REV_PARAM_repair_system",
"INS_REV_CFG_dom_repair",
true ] call INS_REV_FNCT_param_to_bool;
// Repair delay time
["INS_REV_PARAM_repair_system_delay",
"INS_REV_CFG_dom_repair_delay",
120 ] call INS_REV_FNCT_param_to_value;
// - Push Boat
["INS_REV_PARAM_repair_push_boat",
"INS_REV_CFG_dom_repair_push_boat",
true ] call INS_REV_FNCT_param_to_bool;
// - Flip Vehicle
["INS_REV_PARAM_repair_flip_vehicle",
"INS_REV_CFG_dom_repair_flip_vehicle",
true ] call INS_REV_FNCT_param_to_bool;
// - Only engineer can repair
["INS_REV_PARAM_repair_engineer_only",
"INS_REV_CFG_dom_repair_engineer_only",
false ] call INS_REV_FNCT_param_to_bool;
// Manual NV Goggle sensitivity
["INS_REV_PARAM_s_nvg",
"INS_REV_CFG_s_nvg",
true ] call INS_REV_FNCT_param_to_bool;
// Player Name Tag
["INS_REV_PARAM_name_tag",
"INS_REV_CFG_name_tag",
true ] call INS_REV_FNCT_param_to_bool;
// Player Marker
["INS_REV_PARAM_player_marker",
"INS_REV_CFG_player_marker",
true ] call INS_REV_FNCT_param_to_bool;
// Player Marker Process Method
["INS_REV_PARAM_player_marker_method",
"INS_REV_CFG_player_marker_serverSide",
true ] call INS_REV_FNCT_param_to_bool;
// Override player marker process method depend on Respawn Faction
if (INS_REV_CFG_respawn_type != "ALL") then {
INS_REV_CFG_player_marker_serverSide = false;
};
// Personal UAV
["INS_REV_PARAM_uav_recon",
"INS_REV_CFG_uav",
true ] call INS_REV_FNCT_param_to_bool;
// - UAV delay time
["INS_REV_PARAM_uav_delay",
"INS_REV_CFG_uav_delay",
120 ] call INS_REV_FNCT_param_to_value;
// Only squad leader can use the UAV
["INS_REV_PARAM_uav_squadleader_only",
"INS_REV_CFG_uav_squadleader_only",
true ] call INS_REV_FNCT_param_to_bool;
// - Enable UAV Setting Dialog
["INS_REV_PARAM_uav_setting_dialog",
"INS_REV_CFG_uav_setting_dialog",
false ] call INS_REV_FNCT_param_to_bool;
// - Allow map click UAV position
["INS_REV_PARAM_uav_allow_map_click",
"INS_REV_CFG_uav_allow_map_click",
false ] call INS_REV_FNCT_param_to_bool;
// - Personal UAV enemy marker
["INS_REV_PARAM_uav_recon_enemy_marker",
"INS_REV_CFG_uav_enemy_marker",
false ] call INS_REV_FNCT_param_to_bool;
// - UAV default altitude
["INS_REV_PARAM_uav_altitude",
"INS_REV_CFG_uav_altitude",
300 ] call INS_REV_FNCT_param_to_value;
// - UAV default radius of the circular movement
["INS_REV_PARAM_uav_circle",
"INS_REV_CFG_uav_circle",
250 ] call INS_REV_FNCT_param_to_value;
// UAV Briefing
["INS_REV_PARAM_uav_briefing",
"INS_REV_CFG_uav_briefing",
false ] call INS_REV_FNCT_param_to_bool;Script name : Close Air Support
Author : JW Custom
Version : 0.1b
Changelog:
----------
v0.1b
- Initial release
Mission implementation:
-----------------------
1). Copy/move description.ext into your mission folder. If you already
got one then copy the content from this one into your own.
2). Copy/move init.sqf into your mission folder. If you already
got one then copy/paste the content from this one into your own.
3). Copy/move the JWC_CASFS folder into your mission folder.
4). Add line below to the init field of the unit/object which should carry the CAS Field System.
null = [this, 500, true, 2] execVM "JWC_CASFS\addAction.sqf"
Parameters:
-----------
Param 0 = [this, 500, true, 2] -> Object/unit to assign the action.
------
Param 1 = [this, 500, true, 2] -> Max distance in meters allowed between requester and target.
-----
Param 2 = [this, 500, true, 2] -> If true only owner of action can call it. If owner is not
------ "Man" action won't get locked to owner even if the param is true!
Param 3 = [this, 500, true, 2] -> Max number of time allowed to call in CAS. Canceled requests
--- and aborted access is not counted.
Munition types:
---------------
JDAM : Laser Guided Mk82 (Based on map click)
CBU(AP) : Cluster Bomb Anti-Personnel (Based on map click)
JDAM/CBU(AP) : Combo of above (Based on map click)
Info:
-----
Icons of spotted vehicles on the map ain't placed correctly so setting target position
directly on this icon will result in being of actual target!
To help this issue you can toggle the "Snap to nearest target" by pressing [A] while the
CAS menu is open. Only targets which user have a knowsAbout value higher than 2.5 will be
snapped to.
Ingame usage:
-------------
1). Select the "Open CAS Field System" action from the action menu(mouse scroll).
2). Click on map to mark target position. If needed you can toggle the "snap" function
by pressing [A] to snap target position to nearest known target for precision with
vehicle targets mainly.
3). Select munition.
4). Click "Request CAS" button to complete the request or click "Exit Menu" to abort.
5). If you need to cancel enroute CAS select the "Request Close Air Support" action
from the action menu and click "Cancel CAS".
_object = _this select 0;
_maxDist = _this select 1;
_lock = _this select 2;
_num = _this select 3;
_str = format["Open CAS Field System (%1)",_num];
_object addAction [_str, "JWC_CASFS\casMenu.sqf", [_maxDist, _lock, _num], -1, false, true, ""];
OggS p ڳvorbis D w OggS p -vorbis Xiph.Org libVorbis I 20070622 vorbis)BCV 1L ŀАU `$)fI)(yHI)0c1c1c 4d ( Ij9g'r9iN8 Q9 &cnkn)%
Y @H!RH!b!b!r!r
*
2 L2餓N:騣:(B-JL1Vc]|s9s9s BCV BdB!R)r
2ȀАU GI˱$O,Q53ESTMUUUUu]Wvevuv}Y[}Y[]aaaa}}} 4d #9)"9 d ")Ifjihm˲,˲ iiiiiiifYeYeYeYeYeYeYeYeYeYeYeYeY@h* @ @qq$ER$r,
Y @R,r4Gs4s