sreVbriefing.htmlLdescription.ext.M{ init.sqfLinitClient.sqfL^initServer.sqfL|LoadingScreen.extLmission.sqm.MM:client\briefing.sqfLxclient\defines.sqfLclient\mainLoop.sqfL client\variables.sqfLRclient\actions\functions.sqfL:#client\actions\noScript.sqfLclient\AI\functions.sqfLAclient\gear\functions.sqfLeclient\gear\loadouts.sqfLk client\images\i_clear.paaLclient\images\i_reload.paaLclient\injured\functions.sqfLclient\markers\createMarkers.sqfLclient\markers\functions.sqfLkclient\misc\functions.sqfLclient\misc\triggers.sqfLclient\respawn\functions.sqfL client\support\functions.sqfL client\UI\functions.sqfLclient\UI\onKeyPress.sqfLclient\UI\onMouseMove.sqfLcommon\defines.sqf.M'common\functions.sqfLE(resources\constants.hppLresources\dialogs.hppLm%resources\titles.hppLresources\types.hppL=server\defines.sqf.Mserver\mainLoop.sqfLserver\AI\functions.sqfLserver\AI\initUPS.sqfLserver\AI\UPS.sqfL?Xserver\caches\functions.sqfL server\cleanup\functions.sqfL@server\data\functions.txtL*server\markers\functions.sqfLserver\vehicles\functions.sqfL* showCompass = 1; showGPS = 1; showMap = 1; showWatch = 1; debriefing = 1; respawn = 3; respawnDelay = 30; respawnDialog = 1; disabledAI = 1; class Header { gameType = Coop; minPlayers = 1; maxPlayers = 24; }; class Params { class aiSkill { title="AI Accuracy"; values[]={ 1,2,3,4,5,6,7,8,9,10 }; texts[]={ "0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0" }; default=4; code = ""; }; class aiNumber { title="AI Numbers"; values[]={ 4,8,12,16,20 }; texts[]={ "25%","50%","75%","100%","125%" }; default=16; code = ""; }; class markers { title="Enable Insurgency Markers"; values[]={ 0,1 }; texts[]={ "False","True" }; default=1; code = ""; }; class cacheCount { title="Number of Ammo Caches"; values[]={ 1,2,3,4,5,6,7,8,9 }; texts[]={ "1","2","3","4","5","6","7","8","9" }; default=9; code = ""; }; class respawnNum { title="Number of Respawns"; values[]={ -1,0,5,10,20,50,100,200,350,500 }; texts[]={ "Infinite","0","5","10","20","50","100","200","350","500" }; default=-1; code = ""; }; class Month { title="Month"; values[]={ 1,2,3,4,5,6,7,8,9,10,11,12}; texts[]={ "January","Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; default=7; code = ""; }; class Day { title="Day"; values[]={ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; texts[]={ "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"}; default=24; code = ""; }; class Hour { title="Hour"; values[]={ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}; texts[]={ "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24"}; default=12; code = ""; }; class Minute { title="Minute"; values[]={ 00,15,30,45}; texts[]={ "00","15","30","45"}; default=00; code = ""; }; }; #include "resources\constants.hpp" #include "resources\types.hpp" #include "resources\dialogs.hpp" #include "resources\titles.hpp" #define LOADSCREEN "\CA\Missions_e\campaign\missions\CE2_Pathfinder.Takistan\img\loading03_co.paa" #define LOADSCREENTEXT "Insurgency - by pogoman|edits by chief" #include "LoadingScreen.ext" loadScreen = LOADSCREEN; onLoadMission = LOADSCREENTEXT; onLoadMissionTime = false;if !isDedicated then { startLoadingScreen ["Loading...","RscLoadScreenCustom"]; }; enableSaving [false, false]; waitUntil { isServer || !isNull player }; waitUntil { !isNil "BIS_MPF_InitDone"}; waitUntil { BIS_MPF_InitDone}; if (!isNull player) then { call compile preprocessFileLineNumbers "initClient.sqf"; }; if (isServer) then { call compile preprocessFileLineNumbers "initServer.sqf"; }; #include "common\defines.sqf" #include "common\functions.sqf" #include "client\defines.sqf" #include "client\variables.sqf" #include "client\briefing.sqf" #include "client\AI\functions.sqf" #include "client\actions\functions.sqf" #include "client\gear\functions.sqf" #include "client\injured\functions.sqf" #include "client\markers\functions.sqf" #include "client\markers\createMarkers.sqf" #include "client\misc\functions.sqf" #include "client\misc\triggers.sqf" #include "client\respawn\functions.sqf" #include "client\support\functions.sqf" #include "client\UI\functions.sqf" #include "client\UI\onKeyPress.sqf" #include "client\UI\onMouseMove.sqf" player enableIRLasers true; player enableGunLights true; player setVariable ["BIS_noCoreConversations", true]; if isWest then { player addRating 1000000; player addEventHandler ["handleDamage", { _this call handleDamage; }]; player addEventHandler ["killed",{ _this call onPlayerKilled; }]; player addEventHandler ["respawn",{ titleCut ["", "BLACK IN", 10]; }]; player addEventHandler ["fired",{ call firedEH; }]; call addActions; } else { if (playersNumber west/4 < playersNumber east && !debug) then { player groupChat "You are stacking the opfor side, you must join the blufor side within 30 seconds or you will be kicked"; hint "You are stacking the opfor side, you must join the blufor side within 30 seconds or you will be kicked"; titleText["You are stacking the opfor side, you must join the blufor side within 30 seconds or you will be kicked", "PLAIN", 30]; sleep 30; if (playersNumber west/4 < playersNumber east) then { [nil,server,"loc",rSPAWN,name player,{serverCommand format["#kick %1",_this];}] call RE; }; }; }; if (isServer) then { [] spawn { call compile preprocessFileLineNumbers "initServer.sqf"; }; }; endLoadingScreen; waitUntil { !(isNull (findDisplay 46)) }; (findDisplay 46) displaySetEventHandler ["KeyDown", "_this call onKeyPress"]; (findDisplay 46) displaySetEventHandler ["MouseMoving", "_this call onMouseMove"]; waitUntil { !isDead(HQ) || time > 30 }; #include "client\mainLoop.sqf"#include "common\defines.sqf" #include "common\functions.sqf" #include "server\defines.sqf" #include "server\cleanup\functions.sqf" #include "server\markers\functions.sqf" #include "server\AI\functions.sqf" #include "server\AI\initUPS.sqf" #include "server\caches\functions.sqf" #include "server\vehicles\functions.sqf" onPlayerConnected ' _caches = cacheList; for "_i" from 0 to (count _caches - 1) do { _cache = _caches select _i; { _x setMarkerPos (getMarkerPos _x); _x setMarkerText (markerText _x); } forEach cacheMarkers(_cache); }; '; _c = count paramsArray; _month = paramsArray select (_c - 4); _day = paramsArray select (_c - 3); _hour = paramsArray select (_c - 2); _minute = paramsArray select (_c - 1); setDate [2010, _month, _day, _hour, _minute + (time/60)]; setViewDistance viewDistanceInt; _pos = [(centerPos select 0)+random 6000-random 6000,(centerPos select 1)+random 6000-random 6000, 0]; while { count (_pos isFlatEmpty [30,0,0.2,20,0,false,objNull]) == 0 } do { _pos = [(centerPos select 0)+random 6000-random 6000,(centerPos select 1)+random 6000-random 6000, 0]; }; HQ setDir (((centerPos select 0) - (_pos select 0)) atan2 ((centerPos select 1) - (_pos select 1))+90); HQ setPosATL _pos; call spawnAIGuns; call setupCaches; waitUntil { !isDead(HQ) }; call spawnAIVehicles; #include "server\mainLoop.sqf"// ====================== // Loading screen related // ====================== #ifndef LOADSCREENTEXT #define LOADSCREEN "img\loading_CO.paa" #endif #ifndef LOADSCREENTEXT #define LOADSCREENTEXT "Loading..." #endif class RscLoadingText : RscText { x = SafezoneX+0.025; y = SafezoneY; w = SafezoneW*0.95; h = SafezoneH*0.075; sizeEx = 0.05; text = ""; colorText[] = { 1,1,0.8,1}; shadow = 2; }; class RscProgress { idc = 104; type = 8; style = 0; shadow = 2; texture = "\ca\ui\data\loadscreen_progressbar_ca.paa"; colorFrame[] = { 0,0,0,0}; colorBar[] = { 1,1,1,1}; x = (SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.5/2/4)*3*SafezoneH; y = SafezoneY+SafezoneH*0.95; w =0.5* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH); h = 0.0261438; }; class RscLoadingBg : RscText { x = SafeZoneXAbs; y = safezoneY; w = SafeZoneWAbs; h = safezoneH; text = ""; colorText[] = { 0,0,0,0}; colorBackground[] = { 0,0,0,1}; }; class RscLoadingPicture: RscPicture { style = 48 + 0x800; // Keep aspect ratio x = SafezoneX; y = SafezoneY+SafezoneH*0.075; w = SafezoneW; h = SafezoneH*0.85; text = ""; }; class RscLoadScreenCustom { idd = -1; duration = 10e10; fadein = 0; fadeout = 0; name = "Loading Screen"; class ControlsBackground { class Loading_BG : RscLoadingBg { }; class Loading_CE2 : RscLoadingPicture { text = LOADSCREEN; }; }; class controls { class Title1 : RscLoadingText { text = LOADSCREENTEXT; }; class CA_Progress : RscProgress { }; }; }; version=11; class Mission { addOns[]= { "cacharacters_e", "ca_modules_functions", "ca_modules_e_weather", "ca_modules_clouds", "camisc_e_wf", "camisc3", "camisc_e", "CAWheeled_E_stryker", "fallujah_v1_0" }; addOnsAuto[]= { "cacharacters_e", "ca_modules_functions", "ca_modules_e_weather", "ca_modules_clouds", "camisc_e_wf", "camisc3", "camisc_e", "CAWheeled_E_stryker", "fallujah_v1_0" }; randomSeed=8342719; class Intel { briefingName="Insurgency 0.72.1"; briefingDescription="by pogoman|edit by chief"; resistanceEast=1; startWeather=0; forecastWeather=0; year=2011; month=6; day=15; hour=12; minute=0; }; class Groups { items=17; class Item0 { side="WEST"; class Vehicles { items=5; class Item0 { position[]={0,0,0}; azimut=91.808899; special="NONE"; id=0; side="WEST"; vehicle="US_Soldier_TL_EP1"; player="PLAYER COMMANDER"; leader=1; rank="SERGEANT"; skill=1; text="Hitman111"; init="this setGroupId [""Hitman 1 - 1 -""];"; description="Hitman 1-1-1 (Team Leader)"; }; class Item1 { position[]={0,0,0}; azimut=91.808899; special="NONE"; id=1; side="WEST"; vehicle="US_Delta_Force_Medic_EP1"; player="PLAY CDG"; rank="CORPORAL"; skill=1; text="Hitman112"; description="Hitman 1-1-2 (Medic)"; }; class Item2 { position[]={0,0,0}; azimut=91.808899; special="NONE"; id=2; side="WEST"; vehicle="US_Soldier_LAT_EP1"; player="PLAY CDG"; skill=1; text="Hitman113"; description="Hitman 1-1-3"; }; class Item3 { position[]={0,0,0}; azimut=91.808899; special="NONE"; id=3; side="WEST"; vehicle="US_Soldier_EP1"; player="PLAY CDG"; skill=1; text="Hitman114"; description="Hitman 1-1-4"; }; class Item4 { position[]={0,0,0}; special="NONE"; id=25; side="WEST"; vehicle="US_Soldier_GL_EP1"; player="PLAY CDG"; skill=0.60000002; text="Hitman115"; description="Hitman 1-1-5"; }; }; }; class Item1 { side="WEST"; class Vehicles { items=5; class Item0 { position[]={0,0,0}; azimut=-21.4862; special="NONE"; id=4; side="WEST"; vehicle="US_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; rank="SERGEANT"; skill=1; text="Hitman121"; init="this setGroupId [""Hitman 1 - 2 -""]; "; description="Hitman 1-2-1 (Team Leader)"; }; class Item1 { position[]={0,0,0}; azimut=-21.4862; special="NONE"; id=5; side="WEST"; vehicle="US_Delta_Force_Medic_EP1"; player="PLAY CDG"; rank="CORPORAL"; skill=1; text="Hitman122"; description="Hitman 1-2-2 (Medic)"; }; class Item2 { position[]={0,0,0}; azimut=-21.4862; special="NONE"; id=6; side="WEST"; vehicle="US_Soldier_LAT_EP1"; player="PLAY CDG"; skill=1; text="Hitman123"; description="Hitman 1-2-3"; }; class Item3 { position[]={0,0,0}; azimut=-21.4862; special="NONE"; id=7; side="WEST"; vehicle="US_Soldier_EP1"; player="PLAY CDG"; skill=1; text="Hitman124"; description="Hitman 1-2-4"; }; class Item4 { position[]={0,0,0}; special="NONE"; id=24; side="WEST"; vehicle="US_Soldier_GL_EP1"; player="PLAY CDG"; skill=0.60000002; text="Hitman125"; description="Hitman 1-2-5"; }; }; }; class Item2 { side="WEST"; class Vehicles { items=5; class Item0 { position[]={0,0,0}; azimut=-21.4443; special="NONE"; id=8; side="WEST"; vehicle="US_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; rank="SERGEANT"; skill=1; text="Hitman131"; init="this setGroupId [""Hitman 1 - 3 -""]; "; description="Hitman 1-3-1 (Team Leader)"; }; class Item1 { position[]={0,0,0}; azimut=-21.4443; special="NONE"; id=9; side="WEST"; vehicle="US_Delta_Force_Medic_EP1"; player="PLAY CDG"; rank="CORPORAL"; skill=1; text="Hitman132"; description="Hitman 1-3-2 (Medic)"; }; class Item2 { position[]={0,0,0}; azimut=-21.4443; special="NONE"; id=10; side="WEST"; vehicle="US_Soldier_LAT_EP1"; player="PLAY CDG"; skill=1; fuel=0.76006347; text="Hitman133"; description="Hitman 1-3-3"; }; class Item3 { position[]={0,0,0}; azimut=-21.4443; special="NONE"; id=11; side="WEST"; vehicle="US_Soldier_EP1"; player="PLAY CDG"; skill=1; text="Hitman134"; description="Hitman 1-3-4"; }; class Item4 { position[]={0,0,0}; special="NONE"; id=23; side="WEST"; vehicle="US_Soldier_GL_EP1"; player="PLAY CDG"; skill=0.60000002; text="Hitman135"; description="Hitman 1-3-5"; }; }; }; class Item3 { side="WEST"; class Vehicles { items=5; class Item0 { position[]={0,0,0}; azimut=-20.999001; special="NONE"; id=12; side="WEST"; vehicle="US_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; rank="SERGEANT"; skill=1; text="Hitman141"; init="this setGroupId [""Hitman 1 - 4 -""]; "; description="Hitman 1-4-1 (Team Leader)"; }; class Item1 { position[]={0,0,0}; azimut=-20.999001; special="NONE"; id=13; side="WEST"; vehicle="US_Delta_Force_Medic_EP1"; player="PLAY CDG"; rank="CORPORAL"; skill=1; text="Hitman142"; description="Hitman 1-4-2 (Medic)"; }; class Item2 { position[]={0,0,0}; azimut=-20.999001; special="NONE"; id=14; side="WEST"; vehicle="US_Soldier_LAT_EP1"; player="PLAY CDG"; skill=1; text="Hitman143"; description="Hitman 1-4-3"; }; class Item3 { position[]={0,0,0}; azimut=-20.999001; special="NONE"; id=15; side="WEST"; vehicle="US_Soldier_EP1"; player="PLAY CDG"; skill=1; text="Hitman144"; description="Hitman 1-4-4"; }; class Item4 { position[]={0,0,0}; special="NONE"; id=22; side="WEST"; vehicle="US_Soldier_GL_EP1"; player="PLAY CDG"; skill=0.60000002; text="Hitman145"; description="Hitman 1-4-5"; }; }; }; class Item4 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={5937.1172,7,10205.079}; azimut=-168.66684; id=16; side="LOGIC"; vehicle="Logic"; leader=1; skill=0.60000002; text="vclSpawn1"; }; }; }; class Item5 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={6434.957,6.9800091,107.33246}; azimut=329.82928; id=17; side="LOGIC"; vehicle="Logic"; leader=1; skill=0.60000002; text="vclSpawn3"; }; }; }; class Item6 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={25.068193,6.9900079,2747.2791}; azimut=447.73914; id=18; side="LOGIC"; vehicle="Logic"; leader=1; skill=0.60000002; text="vclSpawn2"; }; }; }; class Item7 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={-723.53101,353.15918,960.0874}; id=19; side="LOGIC"; vehicle="FunctionsManager"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; class Item8 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={-735.82593,371.43045,793.14502}; id=21; side="LOGIC"; vehicle="Logic"; leader=1; skill=0.60000002; text="server"; }; }; }; class Item9 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={-600.13647,363.49042,950.86182}; id=26; side="LOGIC"; vehicle="WeatherPostprocessManager"; leader=1; lock="UNLOCKED"; skill=0.60000002; text="Colors"; init="this setVariable [""intensity"", 1.1]"; }; }; }; class Item10 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={-596.73413,376.90738,865.28174}; id=27; side="LOGIC"; vehicle="BIS_clouds_Logic"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; class Item11 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={0.95320749,81.282928,-399.15479}; azimut=93.227798; special="NONE"; id=32; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; skill=1; text="east4"; }; }; }; class Item12 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={0.95320749,81.282928,-399.15479}; azimut=93.227806; special="NONE"; id=31; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; skill=1; text="east1"; }; }; }; class Item13 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={0.95320749,81.282928,-399.15479}; azimut=93.227798; special="NONE"; id=30; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; skill=1; text="east2"; }; }; }; class Item14 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={0.95320749,81.282928,-399.15479}; azimut=93.227798; special="NONE"; id=29; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; skill=1; text="east3"; }; }; }; class Item15 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={-597.59009,377.19937,800.89337}; azimut=-180.42642; special="NONE"; id=37; side="EAST"; vehicle="TK_INS_Soldier_EP1"; leader=1; rank="COLONEL"; skill=1; text="graveDigger"; init="this allowDamage false; doStop this"; }; }; }; class Item16 { side="CIV"; class Vehicles { items=1; class Item0 { position[]={-615.27405,372.40643,1093.0129}; id=41; side="CIV"; vehicle="TK_CIV_Takistani01_EP1"; leader=1; skill=1; text="pilotController"; init="this allowDamage false; doStop this"; }; }; }; }; class Vehicles { items=9; class Item0 { position[]={-365.79379,448.38852,728.51611}; id=20; side="EMPTY"; vehicle="US_WarfareBVehicleServicePoint_EP1"; skill=0.60000002; text="vehicleServicePoint"; init="this allowDamage false"; }; class Item1 { position[]={-298.00314,447.15646,726.45966}; id=28; side="EMPTY"; vehicle="HeliH"; skill=0.60000002; text="helipad"; }; class Item2 { position[]={23.59333,608.17462,24.680115}; id=33; side="EMPTY"; vehicle="Land_BagFenceRound"; skill=0.60000002; text="bagshumv11"; init="this allowDamage false"; }; class Item3 { position[]={23.59333,603.61981,9.9753418}; id=34; side="EMPTY"; vehicle="Land_BagFenceRound"; skill=0.60000002; text="bagshumv12"; init="this allowDamage false"; }; class Item4 { position[]={24.293045,600.17633,-2.6300049}; id=35; side="EMPTY"; vehicle="Land_BagFenceRound"; skill=0.60000002; text="bagshumv13"; init="this allowDamage false"; }; class Item5 { position[]={24.293045,599.08105,-15.234497}; id=36; side="EMPTY"; vehicle="Land_BagFenceRound"; skill=0.60000002; text="bagshumv14"; init="this allowDamage false"; }; class Item6 { position[]={-496.30185,422.90982,727.54291}; id=38; side="EMPTY"; vehicle="MASH_EP1"; skill=0.60000002; text="fieldHospital"; init="this addEventHandler [""handleDamage"", {0}];"; }; class Item7 { position[]={-434.76376,434.46091,730.83197}; id=39; side="EMPTY"; vehicle="M1130_CV_EP1"; skill=0.60000002; text="MHQ"; }; class Item8 { position[]={-580.77271,400.73474,721.72009}; id=40; side="EMPTY"; vehicle="M1130_HQ_unfolded_Base_EP1"; skill=0.60000002; text="HQ"; init="this allowDamage false"; }; }; class Markers { items=3; class Item0 { position[]={-499.20776,413.4437,761.74854}; name="USFLAG"; type="Faction_USA_EP1"; }; class Item1 { position[]={0,0,0}; name="respawn_west"; type="Empty"; }; class Item2 { position[]={0.95320749,81.282928,-399.15479}; name="respawn_east"; type="Empty"; angle=93.227806; }; }; class Sensors { items=1; class Item0 { position[]={-710.66772,360.0238,1149.5513}; activationBy="JULIET"; interruptable=1; age="UNKNOWN"; text=" "; class Effects { }; }; }; }; class Intro { addOns[]= { "zargabad", "takistan", "fallujah_v1_0" }; addOnsAuto[]= { "fallujah_v1_0" }; randomSeed=7738663; class Intel { startWeather=0.40000001; forecastWeather=0.25; year=2008; month=10; day=11; hour=14; minute=20; }; }; class OutroWin { addOns[]= { "zargabad", "takistan", "fallujah_v1_0" }; addOnsAuto[]= { "fallujah_v1_0" }; randomSeed=3605365; class Intel { startWeather=0.40000001; forecastWeather=0.25; year=2008; month=10; day=11; hour=14; minute=20; }; }; class OutroLoose { addOns[]= { "zargabad", "takistan", "fallujah_v1_0" }; addOnsAuto[]= { "fallujah_v1_0" }; randomSeed=5244217; class Intel { startWeather=0.40000001; forecastWeather=0.25; year=2008; month=10; day=11; hour=14; minute=20; }; }; player createDiaryRecord ["Diary", [ "Credits", " Mission by pogoman.
Insurgency is based on the gamemode created by Project Reality (an excellent realism mod for battlefield 2).
The patrolling AI vehicles use Kronzy's fantastic Urban Patrol Script (UPS).
The gear respawn dialog is a heavily modified version of the one used in Warfare - Benny edition. " ] ]; player createDiaryRecord ["Diary", [ "Controls", " Respawn camera additional controls:
N: night vision, M: open map

The M136 now requires no magazines, it is a single shot disposable weapon as irl.

If your humvee's wheel(s) are busted you can change the tyre if via the action menu if you are close enough to the tyre.

Ctrl+TAB: Disable/Enable Insurgency keys/tags.

Ctrl+E: Get in/out of vehicles, interrogate surrendered insurgents.

Ctrl+T: Place firebase (SL only).

Shift+Page up: Increase color intensity.

Shift+Page down: Decrease color intensity.

" ] ]; player createDiaryRecord ["Diary", [ "Objectives", " The objective of the game is to find and destroy 9 ammo cache's.
You can find out intel on the location of these ammo caches by interrogating surrendered insurgents.
" ] ]; player createDiaryRecord ["Diary", [ "About", " Areas on the map that are green have been cleared by the blufor and will have no enemies, red areas could have enemies and haven't been cleared.

Click on a player/vehicle's icon on the map to see their id/name.

The weapons you select via the loadout action will only appear on your person after a respawn, unless you are within 50m of the main base in which case you will obtain them instantly.

Player controlled close air support is available by selecting ""communcation"" on your radio. Once selected your squad leader must approve the CAS request. CAS is available for each squad every 20 minutes.

I suck at writing briefings. If you think of any information that is missing from the briefing that should be in there, please let me know.
" ] ]; //Misc #define night (daytime >= 18 || daytime <= 6) #define time2 (time - startTime) #define isEast (typeOf player in eastInfClasses) #define isWest (typeOf player in westSoldierClasses) #define remoteControlling (typeOf cameraOn == HELITYPE && (driver cameraOn in units group player || !(player in crew cameraOn))) //Gear #define leaderItems [] #include "gear\loadouts.sqf" //Injured #define healPlace0 [0.75,0.15,0] #define healPlace1 [-0.75,0.1,0] #define healInjuredModelChestPos [0,0.08,0] #define bloodloosCrit 30 #define bloodlossFreq 60 #define bloodlossInc 5 #define reviveTime 300 #define minHealTime 20 #define healAnims ["ainvpknlmstpsnonwrfldnon_ainvpknlmstpsnonwrfldnon_medic","ainvpknlmstpsnonwrfldnon_medic","ainvpknlmstpsnonwrfldr_medic0s","ainvpknlmstpsnonwrfldnon_medic0s","ainvpknlmstpsnonwrfldr_medic0","ainvpknlmstpsnonwrfldnon_medic0","ainvpknlmstpsnonwrfldr_medic1","ainvpknlmstpsnonwrfldnon_medic1","ainvpknlmstpsnonwrfldr_medic2","ainvpknlmstpsnonwrfldnon_medic2","ainvpknlmstpsnonwrfldr_medic3","ainvpknlmstpsnonwrfldnon_medic3","ainvpknlmstpsnonwrfldr_medic4","ainvpknlmstpsnonwrfldnon_medic4","ainvpknlmstpsnonwrfldr_medic5","ainvpknlmstpsnonwrfldnon_medic5"] #define draggedAnim "ainjppnemstpsnonwrfldb_still" #define draggerAnims ["acinpknlmstpsraswrfldnon","acinpknlmwlksraswrfldb"] #define carrierAnim "acinpercmstpsraswrfldnon" #define carriedAnims ["ainjpfalmstpsnonwrfldnon_carried_up","ainjpfalmstpsnonwrfldnon_carried_down","ainjpfalmstpsnonwrfldnon_carried_still","ainjpfalmstpsnonwrfldf_carried_fallwc"] //Misc #define sTypes ["#ZRPole", "#ZRTrava"] //Respawn #define respawnRange 75 #define A10respawn 1500 #define artyRespawn 1800 call disableSerialization; private ["_sign","_mapClickBool","_ppEffectsOn","_weapons","_dust"]; _time = time; _A10Timer = time; _artyTimer = time; _block = 10; if isWest then { [] spawn { call disableSerialization; while { true } do { //UI call playerTags; call vehicleTags; sleep 0.1; }; }; }; if isWest then { [] spawn { _aiTimer = time; while { true } do { //AI call aiSpawn; call aiDespawn; if (time - _aiTimer > 30) then { _aiTimer = time; call aiMonitor; }; call groupAI; sleep 0.1; }; }; }; _HQstate = startLocation; while { isWest } do { //Injured call injuredLoop; call ppEffects; //Markers call gridPath; if (markersEnabled == 1) then { call playerMarkers; call vehicleMarkers; call markerTexts; }; //Misc call clearHouses; call casePickup; call oneShotM136; call nameStrings; if (_HQstate != startLocation) then { if (_HQstate == HQ) then { hint "HQ mobilised!"; } else { hint "HQ deployed!"; "USFLAG" setMarkerPosLocal startPos; }; _HQstate = startLocation; }; if (getMarkerPos "USFLAG" distance (vehicleServicePoint modelToWorld [10,0,0]) > 10) then { "USFLAG" setMarkerPosLocal (vehicleServicePoint modelToWorld [10,0,0]); }; if remoteControlling then { hintSilent "You are remotely controlling this vehicle. Press the 'Backspace' key at any time to exit."; if (!alive cameraOn || !alive driver cameraOn) then { call exitRC; }; }; _members = groupMembers(true,"array"); if (count units group player == 1 && count _members > 0) then { _group = group (_members select 0); if (driver heli in units _group) exitWith {}; _oldGroup = group player; [player] joinSilent _group; deleteGroup _oldGroup; }; //Respawn if (isDead(player) && isNull respawnCamera) then { [] spawn respawnSystem; }; if (livesLeft == 0 && time > 30) then { if (nearestPlayers(centerPos,AORadius,true,"count") == 0) then { endMission "LOSER"; }; }; //Support call supportTimer; sleep 0.1; }; _player = player; removeAllWeapons player; _spawnPos = getMarkerPos "respawn_east"; while { isEast } do { //Injured call injuredLoop; //Markers call AImarkers; call markerTexts; //Respawn if (isDead(player) && !visibleMap) then { hintSilent "To start playing, open your map and click on the ai unit you wish to become. You can switch units at any time during the game by doing this. If there are no ai units visible on the map it means no blufor players are near hostile areas and so no ai have spawned. In this case either wait awhile or join the blufor team."; }; if (!alive player && player != _player) then { _oldUnit = player; selectPlayer _player; [_oldUnit] joinSilent oldGroup; }; if (player distance _spawnPos > 10 && isDead(player)) then { player setPosATL _spawnPos; }; if (player distance startPos < 400) then { _pos = startLocation modelToWorld [0,600,0]; _pos set [2,0]; player setPosATL _pos; hint "You are not allowed near the Enemy's main base."; }; //UI call eastPlayerTags; sleep 0.1; }; //Gear respawnWeapons = weapons player; respawnMagazines = magazines player; startWeapon = primaryWeapon player; //Injured bloodloss = 0; //Limiting #ifdef BAF quantityBAF_LRR_scoped = 2; #endif #ifndef BAF quantityM24_des_EP1 = 2; #endif quantityJavelin = 1; //Misc playerNames = ["","","","","","","","","","","","","","","","","","","",""]; serverLoadHint = false; mapInUse = false; startTime = time; startGroup = group player; oldGroup = group player; //Respawn camPlayer = objNull; enterSpawn = false; respawnCamera = objNull; camMap = false; deadPos = centerPos; //Support A10available = false; artyAvailable = false; //User Interface keyblock = false; tagsOn = true; addActions = { if !isNil "actionLoadout" then { HQ removeAction actionLoadout; actionLoadout = nil; }; actionLoadout = HQ addAction ["Loadout","client\actions\noScript.sqf","[] spawn gearDialog;",1,false,true,"",""]; if !isNil "actionHQDeploy" then { player removeAction actionHQDeploy; actionHQDeploy = nil; }; actionHQDeploy = player addAction ["Deploy HQ","client\actions\noScript.sqf"," _pos = getPosATL MHQ; if (count (_pos isFlatEmpty [0,0,0.2,20,0,false,MHQ]) == 0) exitWith { player groupChat ""Cannot deploy here. The terrain is unsuitable""; }; { moveOut _x } forEach crew MHQ; MHQ setPosATL [0,30,1]; HQ setPosATL _pos; HQ setDir getDir MHQ; ",1,false,true,"",'vehicle _target == _target && _target distance MHQ < 4']; if !isNil "actionHQMobilise" then { HQ removeAction actionHQMobilise; actionHQMobilise = nil; }; actionHQMobilise = HQ addAction ["Mobilise HQ","client\actions\noScript.sqf",' if (lifeState player == "UNCONSCIOUS") exitWith {}; _leader = squadString(player)+"1"; _str = "you need a squad leader to mobilise the HQ"; if (isNil _leader) exitWith { player groupChat _str; }; _leader = call compile _leader; if (isNull _leader || !isPlayer _leader) exitWith { player groupChat _str; }; if (!alive _leader || isDead(_leader)) exitWith { player groupChat "your squad leader is dead!"; }; player sideChat format["Sent request to %1 (%2).", unitID(_leader), getName(_leader)]; [nil,_leader,"loc",rSPAWN,player,{ requestingPlayer = _this; player sideChat format["%1 (%2) is requesting permission to mobilise the HQ. Accept?", unitID(_this), getName(_this)]; showCommandingMenu "#USER:query_Menu_MHQ"; }] call RE; ',1,false,true,"",'']; if !isNil "actionBagsDeploy" then { player removeAction actionBagsDeploy; actionBagsDeploy = nil; }; actionBagsDeploy = player addAction ["Deploy sandbags","client\actions\noScript.sqf"," _cT = cursorTarget; _bags = call compile format[""bags%1"", _cT]; _pos = _cT modelToWorld [0,-5,0]; _bags setDir (getDir _cT); _bags setPosATL [_pos select 0,_pos select 1,0]; ",1,false,true,"",' _cT = cursorTarget; if !isNull _cT then { if (!(typeOf _cT in (westVehicleClasses-[ATVTYPE]-[HELITYPE])) || !alive _cT) exitWith {}; _pos = _cT modelToWorld [0,-3,0]; _bags = call compile format["bags%1", _cT]; alive _cT && player distance _pos < 3 && _bags distance spawnPos < 50 }; ']; if !isNil "actionBagsLoad" then { player removeAction actionBagsLoad; actionBagsLoad = nil; }; actionBagsLoad = player addAction ["Load sandbags","client\actions\noScript.sqf"," cursorTarget setPosATL [0,0,0]; ",1,false,true,"",' _cT = cursorTarget; if !isNull _cT then { if !(typeOf _cT == "Land_BagFenceRound") exitWith {}; _vcl = call compile format["humv1%1", unitNumber(_cT)]; player distance _cT < 3 && _cT distance _vcl < 10 }; ']; if !isNil "actionTyre" then { player removeAction actionTyre; actionTyre = nil; }; actionTyre = player addAction ["Change tyre","client\actions\noScript.sqf","[] spawn changeTyre",1,false,true,"",' _cT = cursorTarget; if !isNull _cT then { if !(typeOf _cT in westVehicleClasses) exitWith {}; alive _cT && !canMove _cT && _cT call getTyre != ""; }; ']; if !isNil "actionPullout" then { player removeAction actionPullout; actionPullout = nil; }; actionPullout = player addAction ["Pull Out Injured","client\actions\noScript.sqf",' _anim = "AmovPercMstpSnonWnonDnon_AcrgPknlMstpSnonWnonDnon_getInLow"; player playMove _anim; waitUntil { animationState player == _anim }; waitUntil { animationState player != _anim }; { if (lifestate _x == "UNCONSCIOUS") then { moveOut _x; }; } foreach crew cursorTarget; ',1,false,true,"",' _cT = cursorTarget; if !isNull _cT then { if !(_cT isKindOf "LandVehicle") exitWith {}; _crew = crew _cT; _bool = false; { if (lifestate _x == "UNCONSCIOUS") exitWith { _bool = true; }; } foreach _crew; _bool && _target distance _cT < 4 }; ']; if !isNil "actionLoadInjured" then { player removeAction actionLoadInjured; actionLoadInjured = nil; }; actionLoadInjured = player addAction ["Load Injured Into Vehicle","client\actions\noScript.sqf",' _dragged = (nearestPlayers(getPosATL player,5,false,"array") - [player]); { _anim = animationState _x; if (_anim in carriedAnims) exitWith { _dragged = _x; }; } forEach _dragged; if (typeName _dragged == "ARRAY") then { _dragged = _dragged select 0; }; detach _dragged; player playAction "released"; [nil,_dragged,"loc",rSWITCHACTION,"released"] call RE; sleep 0.8; [nil,_dragged,"loc",rSPAWN,cursorTarget,{player moveInCargo _this;}] call RE; ',1,false,true,"",' _cT = cursorTarget; if !isNull _cT then { if !(_cT in westVehicles) exitWith {}; _cT distance player < 4 && _cT emptyPositions "Cargo" > 0 && animationState player == carrierAnim }; ']; if !isNil "actionDrag" then { player removeAction actionDrag; actionDrag = nil; }; actionDrag = player addAction ["Drag","client\actions\noScript.sqf",' _cT = cursorTarget; player playActionNow "grabdrag"; sleep 1; [nil,_cT,"loc",rSPAWN,player,{ detach player; player switchMove "ainjppnemstpsnonwrfldb_still"; player attachTo [_this, [0.1, 1.01, 0]]; sleep 0.001; player setDir 180; }] call RE; ',1,false,true,"",' _cT = cursorTarget; if !isNull _cT then { _target distance _cT < 3 && lifeState _cT == "UNCONSCIOUS" && !(animationState _target in (draggerAnims+[carrierAnim])) && animationState _cT == "ainjppnemstpsnonwrfldnon" } ']; if !isNil "actionCarry" then { player removeAction actionCarry; actionCarry = nil; }; actionCarry = player addAction ["Carry","client\actions\noScript.sqf",' _dragged = (nearestPlayers(getPosATL player,5,false,"array") - [player]); { if (animationState _x == draggedAnim) exitWith { _dragged = _x; }; } forEach _dragged; if (typeName _dragged == "ARRAY") then { _dragged = _dragged select 0; }; detach _dragged; [nil,_dragged,rSWITCHMOVE,"ainjpfalmstpsnonwrfldnon_carried_up"] call RE; player switchMove "acinpknlmstpsraswrfldnon_acinpercmrunsraswrfldnon"; sleep 10; _dragged attachTo [player,[0,-0.1,-1.2], "RightShoulder"]; [nil, _dragged, rSETDIR, 180] call RE; ',1,false,true,"",'animationState _target in draggerAnims']; if !isNil "actionDrop" then { player removeAction actionDrop; actionDrop = nil; }; actionDrop = player addAction ["Drop","client\actions\noScript.sqf",' _dragged = (nearestPlayers(getPosATL player,5,false,"array") - [player]); { _anim = animationState _x; if (_anim == draggedAnim || _anim in carriedAnims) exitWith { _dragged = _x; }; } forEach _dragged; if (typeName _dragged == "ARRAY") then { _dragged = _dragged select 0; }; detach _dragged; player playAction "released"; if (animationState _dragged in carriedAnims) exitWith { [nil,_dragged,"loc",rSWITCHMOVE,"AinjPfalMstpSnonWrflDnon_carried_down"] call RE; }; [nil,_dragged,"loc",rSWITCHACTION,"released"] call RE; ',1,false,true,"",'animationState _target in (draggerAnims+[carrierAnim])' ]; if !isNil "actionRearm" then { player removeAction actionRearm; actionRearm = nil; }; actionRearm = player addAction ["Rearm stationary weapon","client\actions\noScript.sqf"," _vcl = cursorTarget; player groupChat ""rearming...""; player playMove ""ainvpknlmstpslaywrfldnon_medic""; _time = time; waitUntil{ animationState player == ""ainvpknlmstpslaywrfldnon_medic""}; waitUntil{ animationState player != ""ainvpknlmstpslaywrfldnon_medic""}; if (time - _time > 7) then { _vcl setVehicleAmmo 1; }; ",1,false,true,"",' _cT = cursorTarget; if !isNull _cT then { _cT isKindOf "staticWeapon" && alive _cT } ']; }; changeTyre = { _vcl = cursorTarget; _tyre = _vcl call getTyre; player groupChat "changing tyre..."; player playMove "ainvpknlmstpslaywrfldnon_medic"; sleep 3; waitUntil { animationState player != "ainvpknlmstpslaywrfldnon_medic"}; [nil, nil, rSPAWN, [_vcl, _tyre], { (_this select 0) setHit [_this select 1, 0]; (_this select 0) setVelocity[0,0,1]; }] call RE; }; getTyre = { _offset = [-1,1.7,-2]; _pos = _this modelToWorld _offset; if (player distance _pos < 1.5 && canSee(player,_pos,45)) exitWith { "wheel_1_1_steering" }; _offset = [-1,-1.7,-2]; _pos = _this modelToWorld _offset; if (player distance _pos < 1.5 && canSee(player,_pos,45)) exitWith { "wheel_1_2_steering" }; _offset = [1,1.7,-2]; _pos = _this modelToWorld _offset; if (player distance _pos < 1.5 && canSee(player,_pos,45)) exitWith { "wheel_2_1_steering" }; _offset = [1,-1.7,-2]; _pos = _this modelToWorld _offset; if (player distance _pos < 1.5 && canSee(player,_pos,45)) exitWith { "wheel_2_2_steering" }; };_code = _this select 3; if ((typeName _code) == "ARRAY") then { { call compile format ["%1", _x]; } forEach _code; } else { call compile format [ "%1", _code]; }; aiMonitor = { _ais = nearestMen(getPosATL player,100,true,"array"); _guns = nearestObjects[getPosATL player, eastStationaryGuns, 500]; _ai = objNull; _gun = objNull; if (count _ais > 0) then { if (vehicle (_ais select 0) == (_ais select 0)) then { _ai = _ais select 0; }; }; if (count _guns > 0) then { _gun = gunner (_guns select 0); }; if (isNull _gun && isNull _ai) exitWith {}; [nil,server,"loc",rSPAWN,[_ai,player,_gun],{ _ai = _this select 0; _plr = _this select 1; _gun = _this select 2; if !isNull _ai then { _ai reveal _plr; _ai setUnitPos "UP"; _ai doWatch _plr; _ai doMove getPosATL _plr; }; if !isNull _gun then { _gun reveal _plr; _dir = ((getPosATL _plr select 0) - (getPosATL _gun select 0)) atan2 ((getPosATL _plr select 1) - (getPosATL _gun select 1)); group _gun setFormDir _dir; _gun doTarget _plr; sleep 1; _time = time; while { time - _time < 5 } do { vehicle _gun fireAtTarget [_plr,currentWeapon vehicle _gun]; sleep (0.1 + random 0.2); }; }; }] call RE; }; findHousesFront = { private "_x"; _buildings = nearestObjects [_this select 0, ["House"], _this select 1]; _minPositions = (_this select 2) - 1; _enterables = []; { if ( format["%1", _x buildingPos _minPositions] != "[0,0,0]" && !(typeOf _x in illegalHouses) && damage _x == 0 && canSee(player,_x,60) ) then { _enterables set [count _enterables, _x]; }; } forEach _buildings; _enterables }; findSquadAIName = { private ["_i","_num"]; _squad = _this select 0; _i = _this select 1; if (_i > maxAIPerPlayer) exitWith { "" }; _str = format["%1ai%2", _squad, _i]; if isNil _str exitWith { _str }; _unit = call compile _str; if isNull _unit exitWith { _str }; _plrs = nearestPlayers(getPosATL _unit,spawnRange,true,"array"); if ( alive _unit && !(str leader _unit in eastPlayerStrings) && ( (count _plrs == 0 || !arrCanSee(_plrs,_unit,90,100)) || (!(player in _plrs) && !arrCanSee(_plrs,_unit,35,50)) ) ) exitWith { _str }; [_squad, _i+1] call findSquadAIName; }; #define findSquadAIName(X) ([X,1] call findSquadAIName) #define exitCondition (findSquadAIName(player) == "" || !alive player) fillHouseEast = { private ["_x","_process"]; scopeName "fillHouseEastMain"; _process = false; _nPos = nPos(_house); _cCount = count eastInfClasses - 1; _x = round random (_nPos-1); _hID = cacheHousePositions find (typeOf _house); _arr = []; if (_hID != -1 && _wCount > 0) then { _arr = cacheHousePositions select (_hID + 1); }; for [{ _i=_x},{ _i<((_nPos-1)+_x)},{ _i=_i+_inc}] do { if (count _arr == 0 && _wCount > 0 && _hID != -1) exitWith {}; _pos = _house buildingPos (_i % _nPos); if (count _arr > 0) then { _pID = (_arr select 0); _pos = _house buildingPos _pID; _arr = _arr - [(_arr select 1)] - [_pID]; }; if (count nearestObjects[_pos, ["Man"], 3] == 0) then { _name = findSquadAIName(player); if (_name == "") exitWith { breakTo "fillHouseEastMain"; }; _bool = !isNil _name; if _bool then { _bool = alive (call compile _name); }; if _bool exitWith { _unit = call compile _name; _unit setPosATL _pos; _unit setDamage 0; [server,server,"loc",rSPAWN,_unit,{ _this doMove getPosATL _this; sleep 1; doStop _this; }] call RE; if debug then { server globalChat format["moving %1", _name]; }; }; if debug then { server globalChat format["spawning %1", _name]; }; _class = eastInfClasses select (random _cCount); _ai = _group createUnit [_class, spawnPos, [], 0, "NONE"]; _ai setPosATL _pos; call compile format[' %1 = _ai; _ai setVehicleInit '' this setVehicleVarName ''''%1''''; %1 = this; doStop this; this addMagazine (%2 select (random (count %2 - 1))); this addMagazine (%2 select (random (count %2 - 1))); this setSkill [''''aimingAccuracy'''',%3]; this addEventHandler [''''killed'''', { missionNamespace setVariable [''''%1var'''', time]; if (random 100 > 90) then { _case = createVehicle [''''suitcase'''', %4, [], 0, ''''None'''']; _case setPosATL getPosATL (_this select 0); }; }]; ''; ', _name, IEDList, aiSkill, spawnPos]; _process = true; }; sleep 0.1; }; if _process then { processInitCommands; }; }; aiSpawn = { if exitCondition exitWith {}; _houses = [getPosATL player, spawnRange, 3] call findHousesFront; _hCount = count _houses; if (_hCount == 0) exitWith {}; _group = [player, "EastAIGrp", ""] call getGroup; _inc = 6; if (_hCount < 10) then { _inc = 3; }; for "_j" from 0 to (count _houses - 1) do { _house = _houses select _j; _clear = _house getVariable "cleared"; _gMkr = str(_house call getGridPos); if (markerColor _gMkr == "ColorRed" && isNil "_clear") then { _hPos = getPosATL _house; _eCount = count nearestObjects[_hPos, ["Man"], 15]; _wUnits = nearestPlayers(_hPos,spawnRange-200,true,"array"); _wCount = count _wUnits; if (_eCount == 0 && (_wCount == 0 || !arrCanSee(_wUnits,_hPos,30,50))) then { call fillHouseEast; }; }; if exitCondition exitWith {}; }; }; aiDespawn = { private ["_i","_unit","_str"]; for "_i" from 1 to 4 do { _str = format["%1ai%2", player, _i]; if !isNil _str then { _unit = call compile _str; if isNull _unit exitWith {}; if !alive _unit then { _str = _str + "var"; if (_unit distance graveDigger < 10) exitWith { if debug then { server globalChat format["deleting %1 at gravedigger...", format["%1ai%2", player, _i]]; }; deleteVehicle _unit; missionNamespace setVariable [_str, nil]; }; _plrs = nearestPlayers(getPosATL _unit,200,true,"array"); if (count _plrs == 0 || !arrCanSee(_plrs,_unit,35,30)) then { _var = missionNamespace getVariable _str; if isNil "_var" exitWith { missionNamespace setVariable [_str, time]; }; if (time - _var < infDeleteTime) exitWith { if debug then { server globalChat format["waiting to delete %1: %2s left", format["%1ai%2", player, _i], infDeleteTime - (time - _var)]; }; }; if (_unit distance graveDigger >= 10 && isPlayer _unit && !isNull group _unit) exitWith { _unit call setGrpNull; }; if debug then { server globalChat format["deleting %1...", format["%1ai%2", player, _i]]; }; deleteVehicle _unit; missionNamespace setVariable [_str, nil]; }; sleep 0.01; }; }; }; }; setGrpNull = { if debug then { server globalChat format["sending %1 to gravedigger", format["%1ai%2", player, _i]]; }; if alive _this then { _this setDamage 1; }; [_this] join group graveDigger; _this setPosATL getPosATL graveDigger; }; groupAI = { scopeName "main"; if (isDead(player) || lifeState player != "ALIVE" || vehicle player != player) exitWith {}; if (nearestMen(getPosATL player,respawnRange,true,"count") > 0) exitWith {}; if ((round (time*10)) % 50 != 0) exitWith {}; { if !(isNil _x) then { _unit = call compile _x; if (isNull _unit) exitWith {}; _waited = _unit getVariable "waited"; if !(isDead(_unit) && alive _unit && local _unit) exitWith { if !(isNil "_waited") then { _unit setVariable ["waited", nil]; }; }; if (isNil "_waited") exitWith { _unit setVariable ["waited", true]; breakTo "main"; }; _unit setVariable ["waited", nil]; _unit setPosATL getPosATL player; breakTo "main"; }; } forEach squadUnitStrings(squadString(player)); };getQuantity = { if isEast exitWith { "" }; private "_str"; scopeName "main"; _str = ""; _wep = _this; _quantity = call compile format["quantity%1", _wep]; if (!isNil "_quantity") then { _str = str (_quantity - nearestWeapons(_wep,centerPos,AORadius,true,"count")); }; if (_wep in limitedGearList) then { for "_i" from 0 to (count limitedSquadGear - 1) do { _arr = limitedSquadGear select _i; if (_wep in _arr) then { for "_j" from 0 to (count _arr - 1) do { _wep2 = _arr select _j; { if (!isNil _x) then { _unit = call compile _x; if (_unit hasWeapon _wep2 && !isDead(_unit) && alive _unit) exitWith { _str = format["H-%1-%2", squadNumber(_unit), unitNumber(_unit)]; breakTo "main"; }; }; } forEach squadUnitStrings(squadString(player)); }; }; }; }; _str }; loadout = { removeAllWeapons player; removeAllItems player; if (!isNull (unitBackpack player)) then { removeBackpack player; }; { _quantity = _x call getQuantity; if (_quantity != "" && _quantity != "1" && _quantity != "2") then { _type = getNumber(configFile >> "CfgWeapons" >> _x >> "type"); respawnWeapons = respawnWeapons - [_x]; if (_type == 1 || _type == 5) then { respawnWeapons = respawnWeapons + [startWeapon]; }; _magTypeOld = getArray(configFile >> "CfgWeapons" >> _x >> "magazines") select 0; if !(_magTypeOld in respawnMagazines) then { _magTypeOld = getArray(configFile >> "CfgWeapons" >> _x >> "magazines") select 1; }; _typeOld = getNumber(configFile >> 'CfgMagazines' >> _magTypeOld >> 'type'); _magTypeNew = getArray(configFile >> "CfgWeapons" >> startWeapon >> "magazines") select 0; _typeNew = getNumber(configFile >> 'CfgMagazines' >> _magTypeNew >> 'type'); _count = count respawnMagazines; respawnMagazines = respawnMagazines - [_magTypeOld]; for "_i" from 0 to ((_count - count respawnMagazines)*(_typeOld/_typeNew) - 1) do { respawnMagazines = respawnMagazines + [_magTypeNew]; }; }; } forEach respawnWeapons; { player addMagazine _x; } forEach respawnMagazines; { if (getNumber(configFile >> "CfgWeapons" >> _x >> "type") > 0) then { player addWeapon _x; } else { player addBackpack _x; }; } forEach respawnWeapons; player selectWeapon primaryWeapon player; }; replaceInventoryAmmo = { private ['_magazines','_newMag','_oldMags','_presentMags','_replacement','_spaceToReduce','_inc','_size']; _newMag = _this select 0; _oldMags = _this select 1; _magazines = _this select 2; if isNil "_newMag" exitWith { _magazines }; if ((_oldMags select 0) == "20rnd_762x51_B_SCAR" && !((_oldMags select 0) in _magazines)) then { _oldMags set[0, "20Rnd_762x51_B_SCAR"]; }; _replacement = []; _inc = getNumber(configFile >> 'CfgMagazines' >> _newMag >> 'type'); _size = 128; if (_inc >= 256) then { _size = 3072; }; { _type = getNumber(configFile >> 'CfgMagazines' >> _x >> 'type'); if (_type == _inc || _type == _inc*2 || _type == _inc/2 || _type == _inc*6 || _type == _inc/6) then { _size = _size - _type; }; } forEach (_magazines - _oldMags); for "_i" from _inc to _size step _inc do { _replacement = _replacement + [_newMag] }; _magazines = (_magazines - _oldMags) + _replacement; _magazines }; displayInventory = { private ['_inventorySlots','_loadout','_miscItemSlots','_sidearmInventorySlots','_wSlot','_sSlot','_iSlot']; _loadout = _this; _inventoryGUI = 3503; _sidearmInvGUI = 3515; _miscInvGUI = 3523; for [{_count = 0},{_count < 12},{_count = _count + 1}] do {CtrlSetText[_inventoryGUI + _count,"\Ca\UI\Data\ui_gear_mag_gs.paa"]}; for [{_count = 0},{_count < 8},{_count = _count + 1}] do {CtrlSetText[_sidearmInvGUI + _count,"\Ca\UI\Data\ui_gear_mag_gs.paa"]}; for [{_count = 0},{_count < 12},{_count = _count + 1}] do {CtrlSetText[_miscInvGUI + _count,"\Ca\UI\Data\ui_gear_eq_gs.paa"]}; _inventorySlots = []; _sidearmInventorySlots = []; _miscItemSlots = []; _wSlot = 0; _sSlot = 0; _iSlot = 0; { _space = getNumber(configFile >> 'CfgMagazines' >> _x >> 'type'); if (_space >= 256) then { ctrlSetText[_inventoryGUI + _wSlot, getText(configFile >> 'CfgMagazines' >> _x >> 'picture')]; _wSlot = _wSlot + 1; _inventorySlots = _inventorySlots + [_x]; for [{_count = _space/256 - 1},{_count > 0},{_count = _count - 1}] do { ctrlSetText[_inventoryGUI + _wSlot,""]; _wSlot = _wSlot + 1; _inventorySlots = _inventorySlots + [""]; }; }; if (_space == 16) then { ctrlSetText[_sidearmInvGUI + _sSlot,getText(configFile >> 'CfgMagazines' >> _x >> 'picture')]; _sSlot = _sSlot + 1; _sidearmInventorySlots = _sidearmInventorySlots + [_x]; for [{_count = _space/16 - 1},{_count > 0},{_count = _count - 1}] do { ctrlSetText[_sidearmInvGUI + _sSlot,""]; _sSlot = _sSlot + 1; _sidearmInventorySlots = _sidearmInventorySlots + [""]; }; }; if (_space == 0) then { _space = getNumber(configFile >> 'CfgWeapons' >> _x >> 'type'); ctrlSetText[_miscInvGUI + _iSlot, getText(configFile >> 'CfgWeapons' >> _x >> 'picture')]; _iSlot = _iSlot + 1; _miscItemSlots = _miscItemSlots + [_x]; for [{_count = _space/131072 - 1},{_count > 0},{_count = _count - 1}] do { ctrlSetText[_miscInvGUI + _iSlot,""]; _iSlot = _iSlot + 1; _miscItemSlots = _miscItemSlots + [""]; }; }; } forEach _loadout; [_inventorySlots,_sidearmInventorySlots,_miscItemSlots] }; gearDialog = { if dialog exitWith { closeDialog 0; }; createDialog "RscGear"; _primaries = primaries; _secondaries = secondaries; _sidearms = sidearms; _misc = misc; _all = _primaries + _secondaries + _sidearms + _misc; lbChange = false; lbMainAction = ""; inventoryClick = -1; WF_Gear_Action = ""; primClicked = false; secoClicked = false; sideClicked = false; saveLoadout = false; buyLoadout = false; _displayInv = false; _updateUnit = true; _updateFiller = false; disableSerialization; _lb = 3700; _lbm = 3701; _primaryIDC = 3500; _secondaryIDC = 3501; _sidearmIDC = 3502; _specialIDC = 3535; _display = findDisplay 16000; _totalWeapons = count primaries + count secondaries + count sidearms; _fillerIDC = [3401,3402,3403,3404,3405]; _fillerTypes = ["all","primaries","secondaries","sidearms","misc"]; _inventorySlots = []; _lastFiller = "nil"; _id = _fillerTypes find "primaries"; _list = []; _listPictures = []; _listMagazines = []; _miscItemSlots = []; _sidearmInventorySlots = []; (_display DisplayCtrl (_fillerIDC select _id)) ctrlSetTextColor [0.7, 1, 0.7, 1]; _currentItem = ""; _currentMags = []; _currentData = ""; _currentValue = ""; _currentPrimary = ""; _currentSecondary = ""; _currentSidearm = ""; _old = ""; _currentWeapons = []; _currentSpecials = []; _currentItems = []; _currentMagazines = []; //--- Set command is just terrific... _replaceArray = { private ["_array","_indexExcluded","_newArray"]; _array = _this select 0; _indexExcluded = _this select 1; _newArray = []; for [{_x = 0},{_x < count(_array)},{_x = _x + 1}] do { if (_x != _indexExcluded) then { _newArray = _newArray + [_array select _x]; }; }; _newArray }; _getMagazines = { _tm = getArray(configFile >> "CfgWeapons" >> _this >> "magazines"); _artm = _tm; { if (!(_x in legalMagazines)) then {_artm = _artm - [_x]}; } forEach _tm; _artm }; _fillList = { private ["_list","_filler","_i","_listBox","_listBoxArray","_u"]; _list = _this select 0; _filler = _this select 1; _listBox = _this select 2; _listBoxArray = []; _u = 0; _i = 0; { _quant = _x call getQuantity; if (_filler == "magazine") then { _quant = ""; }; _class = "CfgMagazines"; if ( (!(_x in legalMagazines) || (_x in legalMagazines && _x in secondaries)) && _filler != "magazine") then { _class = "CfgWeapons"; }; _name = getText(configFile >> _class >> _x >> "displayName"); _pic = getText(configFile >> _class >> _x >> "picture"); if (_name == "") then { _name = toArray(_x); for "_j" from 0 to (count _name - 1) do { _char = [_name select _j]; if (toString(_char) == "_" || _j >= (count _name - 3)) then { _name set[_j,toArray(" ") select 0]; }; }; _name = toString(_name); _pic = getText(configFile >> "cfgVehicles" >> _x >> "picture"); }; lnbAddRow [_listBox,[_quant,_name]]; lnbSetPicture [_listBox,[_i,0],_pic]; lnbSetData [_listBox,[_i,0],_filler]; lnbSetData [_listBox,[_i,1],_quant]; lnbSetValue [_listBox,[_i,0],_u]; _i = _i + 1; _u = _u + 1; } forEach _list; lnbSetCurSelRow [_listBox,0] }; _addMagazine = { private ["_type","_mag","_magazines","_size","_inc"]; _magazines = _this select 0; _mag = _this select 1; _inc = getNumber(configFile >> "CfgMagazines" >> _mag >> "type"); _size = 128; if (_inc >= 256) then { _size = 3072; }; { _type = getNumber(configFile >> "CfgMagazines" >> _x >> "type"); if (_type == _inc || _type == _inc*2 || _type == _inc/2 || _type == _inc*6 || _type == _inc/6) then { _size = _size - getNumber(configFile >> "CfgMagazines" >> _x >> "type"); }; } forEach _magazines; if (_size >= _inc) then {_magazines = _magazines + [_mag]; }; _magazines }; _addItem = { private ["_items","_limit","_mag","_magazines","_size"]; _items = _this select 0; _mag = _this select 1; _size = 0; _limit = 12; {_size = _size + 1} forEach _items; if (_size + 1 <= _limit) then {_items = _items + [_mag]}; _items }; server setVariable ["filler", "all"]; while {alive player && dialog} do { scopeName "main"; _filler = server getVariable "filler"; //--- _filler Changed. if (_filler != _lastFiller || _updateFiller) then { _updateFiller = false; _list = call compile format["_%1", _filler]; lnbClear _lb; [_list,_filler,_lb] call _fillList; _id = _fillerTypes find _filler; {(_display displayCtrl _x) ctrlSetTextColor [1, 1, 1, 1]} forEach _fillerIDC; (_display displayCtrl (_fillerIDC select _id)) ctrlSetTextColor [0.7, 1, 0.7, 1]; //--- Update the list since the _filler changed. lbChange = true; }; //--- List Selection Changed. if lbChange then { lbChange = false; _currentRow = lnbCurSelRow _lb; _currentData = lnbData[_lb,[_currentRow,0]]; _currentValue = lnbValue[_lb,[_currentRow,0]]; _currentItem = _list select _currentValue; lnbClear _lbm; _listMagazines = _currentItem call _getMagazines; [_listMagazines,'magazine',_lbm] call _fillList; }; //--- Player have clicked on one of the listbox. if (lbMainAction != "") then { _quantity = lnbData [_lb,[lnbCurSelRow _lb, 1]]; if (lbMainAction != "addWeapon") then { _quantity = ""; }; if (_quantity == "NA") exitWith { player groupChat "this item is not available"; lbMainAction = ""; }; if (_quantity == "0") exitWith { player groupChat "unavailable at this time"; lbMainAction = ""; }; if (_quantity != "1" && _quantity != "2" && _quantity != "") exitWith { player groupChat "your squad is already using a weapon of this type"; lbMainAction = ""; }; switch lbMainAction do { case "addWeapon": { _skip = true; if (_filler == "primaries" || _filler == "secondaries" || _filler == "sidearms" || _filler == "all") then { if (_currentItem in misc) then {_skip = false;_currentValue = _currentValue - _totalWeapons}; if (_skip) then { _slist = call compile format ["_%1",_currentData]; _index = _slist find _currentItem; _type = getNumber(configFile >> "CfgWeapons" >> _currentItem >> "type"); if (_type == 0) then { _currentData = "secondary"; }; if (_type == 4 && getNumber(configFile >> "CfgWeapons" >> _currentPrimary >> "type") == 5) exitWith { player groupChat "you cannot carry two heavy weapons"; lbMainAction = ""; breakTo "main"; }; if (_type == 5 && _currentSecondary != "") exitWith { player groupChat "you cannot carry two heavy weapons"; lbMainAction = ""; breakTo "main"; }; if (_index != -1) then { if (_type == 1 || _type == 5) then {_currentData = "primary"} else { if (_type == 4) then {_currentData = "secondary"} else { if (_type == 2) then {_currentData = "sidearm"}; }; }; if ( (_currentData == "primary" && _currentItem in limitedGearList && _currentSecondary in limitedGearList) || (_currentData == "secondary" && _currentItem in limitedGearList && _currentPrimary in limitedGearList) ) exitWith { player groupChat "you cannot use two different specialised weapons"; lbMainAction = ""; breakTo "main"; }; call compile format [" _old = _current%1; _currentWeapons = _currentWeapons - [_current%1]; _current%1 = _slist select _index; _picture = getText(configFile >> ""CfgWeapons"" >> _currentItem >> ""picture""); if (_type == 0) then { _picture = getText(configFile >> ""CfgVehicles"" >> _currentItem >> ""picture""); }; ctrlSetText[_%1IDC,_picture] ",_currentData]; _currentMags = _currentItem call _getMagazines; _oldMags = []; if (!isNil "_old") then { _oldMags = _old call _getMagazines; }; _currentMagazines = [_currentMags select 0,_oldMags,_currentMagazines] call replaceInventoryAmmo; }; _currentWeapons = _currentWeapons + [_currentItem]; _displayInv = true; }; }; if (_filler == "misc" || !_skip) then { _type = getNumber(configFile >> "CfgWeapons" >> _currentItem >> "type"); if (_type == 0 || _type == 65536) then { _type = getNumber(configFile >> "CfgMagazines" >> _currentItem >> "type"); if (_type == 16 || _type >= 256) then { _currentMagazines = [_currentMagazines,_currentItem] call _addMagazine; _displayInv = true; }; }; if (_type == 4096 && count _currentSpecials < 3 && !(_currentItem in _currentSpecials)) then { _currentSpecials = _currentSpecials + [_currentItem]; _u = 0; { _index = misc find _x; ctrlSetText[_specialIDC + _u,getText(configFile >> "CfgWeapons" >> _x >> "picture")]; _u = _u + 1; } forEach _currentSpecials; _displayInv = true; }; if (_type == 131072) then { if (!(_currentItem in _currentItems)) then { _currentItems = [_currentItems,_currentItem] call _addItem; _displayInv = true; }; }; }; }; case "addMagazine": { _currentMag = _currentItem call _getMagazines select 0; _currentMagazines = [_currentMagazines,_currentMag] call _addMagazine; _displayInv = true; }; }; lbMainAction = ""; }; //--- Remove a weapon by clicking on it. if (primClicked) then {primClicked = false;if (_currentPrimary != "") then {ctrlSetText [_primaryIDC,"\ca\ui\data\ui_gear_gun_gs.paa"];_index = primaries find _currentPrimary;_currentWeapons = _currentWeapons - [_currentPrimary];_currentPrimary = "";_displayInv = true}}; if (secoClicked) then {secoClicked = false;if (_currentSecondary != "") then {ctrlSetText [_secondaryIDC,"\ca\ui\data\ui_gear_sec_gs.paa"];_index = secondaries find _currentSecondary;_currentWeapons = _currentWeapons - [_currentSecondary];_currentSecondary = "";_displayInv = true}}; if (sideClicked) then {sideClicked = false;if (_currentSidearm != "") then {ctrlSetText [_sidearmIDC,"\ca\ui\data\ui_gear_hgun_gs.paa"];_index = sidearms find _currentSidearm;_currentWeapons = _currentWeapons - [_currentSidearm];_currentSidearm = "";_displayInv = true}}; if (_updateUnit) then { _currentWeapons = respawnWeapons; _currentMagazines = respawnMagazines; _currentSpecials = []; _currentItems = []; _currentPrimary = ""; _currentSecondary = ""; _currentSidearm = ""; _sideGear = _currentWeapons; {if (!(_x in _all)) then {_sideGear = _sideGear - [_x]}} forEach _currentWeapons; _currentWeapons = _sideGear; _sideGear = _currentMagazines; {if (!(_x in misc) && !(_x in legalMagazines)) then {_sideGear = _sideGear - [_x]}} forEach _currentMagazines; _currentMagazines = _sideGear; ctrlSetText [_primaryIDC,"\ca\ui\data\ui_gear_gun_gs.paa"]; ctrlSetText [_secondaryIDC,"\ca\ui\data\ui_gear_sec_gs.paa"]; ctrlSetText [_sidearmIDC,"\ca\ui\data\ui_gear_hgun_gs.paa"]; ctrlSetText [3535,"\Ca\UI\Data\ui_gear_eq_gs.paa"]; ctrlSetText [3536,"\Ca\UI\Data\ui_gear_eq_gs.paa"]; { _index = primaries find _x; if (_index != -1) then {_currentPrimary = primaries select _index; ctrlSetText[_primaryIDC,getText(configFile >> "CfgWeapons" >> _x >> "picture")]}; _index = secondaries find _x; if (_index != -1) then { _currentSecondary = secondaries select _index; _picture = getText(configFile >> "CfgWeapons" >> _x >> "picture"); if (_picture == "") then { _picture = getText(configFile >> "CfgVehicles" >> _x >> "picture"); }; ctrlSetText[_secondaryIDC,_picture]; }; _index = sidearms find _x; if (_index != -1) then {_currentSidearm = sidearms select _index;ctrlSetText[_sidearmIDC,getText(configFile >> "CfgWeapons" >> _x >> "picture")]}; _index = misc find _x; if (_index != -1) then { _type = getNumber(configFile >> "CfgWeapons" >> _x >> "type"); if (_type == 0) then { _type = getNumber(configFile >> "CfgMagazines" >> _x >> "type"); }; switch _type do { case 4096: { _currentSpecials = _currentSpecials + [_x]; _u = 0; { _i = misc find _x; ctrlSetText[_specialIDC + _u,getText(configFile >> "CfgWeapons" >> _x >> "picture")]; _u = _u + 1; } forEach _currentSpecials; }; case 131072: { _currentItems = _currentItems + [_x]; }; }; }; } forEach _currentWeapons; _currentWeapons = _currentWeapons - misc; _data = (_currentMagazines + _currentItems) call DisplayInventory; _inventorySlots = _data select 0; _sidearmInventorySlots = _data select 1; _miscItemSlots = _data select 2; _updateUnit = false; }; //--- Remove a magazine by clicking on it. if (inventoryClick != -1) then { //--- Main Inventory. if (inventoryClick > 3502 && inventoryClick < 3515) then { _slot = inventoryClick - 3503; if (_slot < count _inventorySlots) then { _index = _currentMagazines find (_inventorySlots Select _slot); if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] call _replaceArray}; }; }; //--- Handgun Inventory if (inventoryClick > 3514 && inventoryClick < 3523) then { _slot = inventoryClick - 3515; if (_slot < count _sidearmInventorySlots) then { _index = _currentMagazines find (_sidearmInventorySlots Select _slot); if (_index != -1) then {_currentMagazines = [_currentMagazines,_index] call _replaceArray}; }; }; //--- Misc Inventory if (inventoryClick > 3522 && inventoryClick < 3535) then { _slot = inventoryClick - 3523; if (_slot < count _miscItemSlots) then { _index = _currentItems find (_miscItemSlots Select _slot); if (_index != -1) then {_currentItems = [_currentItems,_index] call _replaceArray}; }; }; //--- Remove a special item. if (inventoryClick == 3535 || inventoryClick == 3536) then { _slot = inventoryClick - 3535; if (_slot < count _currentSpecials) then { _currentSpecials = _currentSpecials - [_currentSpecials select _slot]; for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,"\Ca\UI\Data\ui_gear_eq_gs.paa"]}; _u = 0; { _index = misc find _x; ctrlSetText[_specialIDC + _u,getText(configFile >> "CfgWeapons" >> _x >> "picture")]; _u = _u + 1; } forEach _currentSpecials; }; }; InventoryClick = -1; _displayInv = true; }; //--- Custom UA. if (WF_Gear_Action != "") then { switch (WF_Gear_Action) do { case "reload": { if !(isNil "respawnWeapons") then { _currentPrimary = ""; _currentSecondary = ""; _currentSidearm = ""; _currentWeapons = []; _currentItems = []; _currentSpecials = []; { _index = primaries find _x; if (_index != -1) then {_currentWeapons = _currentWeapons + [_x];_currentPrimary = _x;ctrlSetText[_primaryIDC,getText(configFile >> "CfgWeapons" >> _x >> "picture")]} else { _index = secondaries find _x; if (_index != -1) then {_currentWeapons = _currentWeapons + [_x];_currentSecondary = _x;ctrlSetText[_secondaryIDC,getText(configFile >> "CfgWeapons" >> _x >> "picture")]} else { _index = sidearms find _x; if (_index != -1) then {_currentWeapons = _currentWeapons + [_x];_currentSidearm = _x;ctrlSetText[_sidearmIDC,getText(configFile >> "CfgWeapons" >> _x >> "picture")]}; }; }; _index = misc find _x; if (_index != -1) then { _type = getNumber(configFile >> "CfgWeapons" >> _x >> "type"); if (_type == 0) then { _type = getNumber(configFile >> "CfgMagazines" >> _x >> "type"); }; switch _type do { case 4096: { _currentSpecials = _currentSpecials + [_x]; }; case 131072: { _currentItems = _currentItems + [_x]; }; }; }; } forEach respawnWeapons; if (_currentPrimary == "") then {ctrlSetText [_primaryIDC,"\ca\ui\data\ui_gear_gun_gs.paa"]}; if (_currentSecondary == "") then {ctrlSetText [_secondaryIDC,"\ca\ui\data\ui_gear_sec_gs.paa"]}; if (_currentSidearm == "") then {ctrlSetText [_sidearmIDC,"\ca\ui\data\ui_gear_hgun_gs.paa"]}; _currentMagazines = respawnMagazines; for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,"\Ca\UI\Data\ui_gear_eq_gs.paa"]}; _u = 0; { _index = misc find _x; ctrlSetText[_specialIDC + _u,getText(configFile >> "CfgWeapons" >> _x >> "picture")]; _u = _u + 1; } forEach _currentSpecials; _displayInv = true; }; }; case "clear": { _currentPrimary = ""; _currentSecondary = ""; _currentSidearm = ""; _currentWeapons = []; _currentItems = []; _currentSpecials = []; _currentMagazines = []; ctrlSetText [_primaryIDC,"\ca\ui\data\ui_gear_gun_gs.paa"]; ctrlSetText [_secondaryIDC,"\ca\ui\data\ui_gear_sec_gs.paa"]; ctrlSetText [_sidearmIDC,"\ca\ui\data\ui_gear_hgun_gs.paa"]; for [{_x = 0},{_x < 2},{_x = _x + 1}] do {ctrlSetText[_specialIDC + _x,"\Ca\UI\Data\ui_gear_eq_gs.paa"]}; _displayInv = true; }; }; WF_Gear_Action = ""; }; //Kit Limiting _quantity = _currentPrimary call getQuantity; if (_quantity != "" && _quantity != "1" && _quantity != "2") then { _currentWeapons = _currentWeapons - [_currentPrimary] + [startWeapon]; _magTypeOld = getArray(configFile >> "CfgWeapons" >> _currentPrimary >> "magazines") select 0; if !(_magTypeOld in respawnMagazines) then { _magTypeOld = getArray(configFile >> "CfgWeapons" >> _currentPrimary >> "magazines") select 1; }; _typeOld = getNumber(configFile >> 'CfgMagazines' >> _magTypeOld >> 'type'); _magTypeNew = getArray(configFile >> "CfgWeapons" >> startWeapon >> "magazines") select 0; _typeNew = getNumber(configFile >> 'CfgMagazines' >> _magTypeNew >> 'type'); _count = count respawnMagazines; respawnMagazines = respawnMagazines - [_magTypeOld]; for "_i" from 0 to ((_count - count respawnMagazines)*(_typeOld/_typeNew) - 1) do { respawnMagazines = respawnMagazines + [_magTypeNew]; }; respawnWeapons = respawnWeapons - [_currentPrimary] + [startWeapon]; _currentPrimary = startWeapon; _updateFiller = true; _updateUnit = true; }; _quantity = _currentSecondary call getQuantity; if (_quantity != "" && _quantity != "1" && _quantity != "2") then { _currentWeapons = _currentWeapons - [_currentSecondary]; _magTypeOld = getArray(configFile >> "CfgWeapons" >> _currentSecondary >> "magazines") select 0; if !(_magTypeOld in respawnMagazines) then { _magTypeOld = getArray(configFile >> "CfgWeapons" >> _currentSecondary >> "magazines") select 1; }; _typeOld = getNumber(configFile >> 'CfgMagazines' >> _magTypeOld >> 'type'); _magTypeNew = getArray(configFile >> "CfgWeapons" >> _currentPrimary >> "magazines") select 0; _typeNew = getNumber(configFile >> 'CfgMagazines' >> _magTypeNew >> 'type'); _count = count respawnMagazines; respawnMagazines = respawnMagazines - [_magTypeOld]; for "_i" from 0 to ((_count - count respawnMagazines)*(_typeOld/_typeNew) - 1) do { respawnMagazines = respawnMagazines + [_magTypeNew]; }; respawnWeapons = respawnWeapons - [_currentSecondary]; _currentSecondary = ""; _updateFiller = true; _updateUnit = true; }; //--- Show inventory (Icons). if (_displayInv) then { _displayInv = false; _data = (_currentMagazines + _currentItems) call displayInventory; _inventorySlots = _data select 0; _sidearmInventorySlots = _data select 1; _miscItemSlots = _data select 2; }; //--- Buy a loadout. if (buyLoadout) then { buyLoadout = false; respawnWeapons = _currentWeapons + _currentSpecials + _currentItems; respawnMagazines = _currentMagazines; if (player distance HQ < 50 && isWest) then { hint "Weapons updated!"; call loadout; _updateFiller = true; }; _weapons = (_currentWeapons + _currentSpecials + _currentItems); _ammo = _currentMagazines; _data = (_currentMagazines + _currentItems) call displayInventory; _inventorySlots = _data select 0; _sidearmInventorySlots = _data select 1; _miscItemSlots = _data select 2; }; _lastFiller = _filler; sleep 0.05; }; }; if isWest then { if !BAF2 then { primaries = [ "M16A2", "M16A2GL", "M24_des_EP1", "M14_EP1", "m240_scoped_EP1", "M249_EP1", "M249_TWS_EP1", "M249_m145_EP1", "M4A1", "M4A3_CCO_EP1", "M4A3_RCO_GL_EP1", "SCAR_L_CQC", "SCAR_L_CQC_Holo", "SCAR_L_STD_Mk4CQT", "SCAR_L_STD_EGLM_RCO", "SCAR_L_CQC_EGLM_Holo", "SCAR_L_STD_EGLM_TWS", "SCAR_L_STD_HOLO", "SCAR_H_CQC_CCO", "SCAR_H_STD_EGLM_Spect" ]; secondaries = [ "M136", "Javelin", "US_Assault_Pack_EP1", "US_Assault_Pack_Ammo_EP1", "US_Assault_Pack_AmmoSAW_EP1", "US_Assault_Pack_Explosives_EP1", "US_Patrol_Pack_EP1", "US_Patrol_Pack_Ammo_EP1", "US_Patrol_Pack_Specops_EP1", "US_Backpack_EP1", "US_Backpack_AmmoMG_EP1", "US_Backpack_AT_EP1", "US_Backpack_Specops_EP1", "Tripod_Bag", "M252_US_Bag_EP1", "TOW_TriPod_US_Bag_EP1", "MK19_TriPod_US_Bag_EP1", "M2HD_mini_TriPod_US_Bag_EP1", "M2StaticMG_US_Bag_EP1" ]; sidearms = ["Colt1911","M9","glock17_EP1"]; misc = [ "HandGrenade_West", "IR_Strobe_Target", "IR_Strobe_Marker", "SmokeShell", "SmokeShellRed", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellYellow", "SmokeShellOrange", "SmokeShellPurple", "FlareWhite_M203", "FlareYellow_M203", "FlareGreen_M203", "FlareRed_M203", "1Rnd_HE_M203", "1Rnd_Smoke_M203", "1Rnd_SmokeRed_M203", "1Rnd_SmokeGreen_M203", "1Rnd_SmokeYellow_M203", "Laserdesignator", "Mine", "PipeBomb", "Binocular", "NVGoggles", "Binocular_Vector", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch" ]; } else { primaries = [ "M14_EP1", "BAF_L110A1_Aim", "BAF_L7A2_GPMG", "BAF_L85A2_RIS_ACOG", "BAF_L85A2_RIS_CWS", "BAF_L85A2_RIS_Holo", "BAF_L85A2_RIS_SUSAT", "BAF_L85A2_UGL_ACOG", "BAF_L85A2_UGL_Holo", "BAF_L85A2_UGL_SUSAT", "BAF_L86A2_ACOG", "BAF_LRR_scoped", "M16A2", "M16A2GL", "M4A1", "M4A3_CCO_EP1", "M4A3_RCO_GL_EP1" ]; secondaries = [ "BAF_NLAW_Launcher", "Javelin", "BAF_AssaultPack_RifleAmmo", "BAF_AssaultPack_ARAmmo", "BAF_AssaultPack_MGAmmo", "BAF_AssaultPack_ATAmmo", "BAF_AssaultPack_HATAmmo", "BAF_AssaultPack_Special", "BAF_AssaultPack_FAC", "BAF_AssaultPack_HAAAmmo", "BAF_AssaultPack_LRRAmmo", "Tripod_Bag", "M252_US_Bag_EP1", "TOW_TriPod_US_Bag_EP1", "MK19_TriPod_US_Bag_EP1", "M2HD_mini_TriPod_US_Bag_EP1", "M2StaticMG_US_Bag_EP1" ]; sidearms = ["Colt1911","M9","glock17_EP1"]; misc = [ "BAF_L109A1_HE", "IR_Strobe_Target", "IR_Strobe_Marker", "SmokeShell", "SmokeShellRed", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellYellow", "SmokeShellOrange", "SmokeShellPurple", "FlareWhite_M203", "FlareYellow_M203", "FlareGreen_M203", "FlareRed_M203", "1Rnd_HE_M203", "1Rnd_Smoke_M203", "1Rnd_SmokeRed_M203", "1Rnd_SmokeGreen_M203", "1Rnd_SmokeYellow_M203", "Laserdesignator", "Mine", "PipeBomb", "Binocular", "NVGoggles", "Binocular_Vector", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch" ]; }; }; GGATCGVAGGATGALFGGATSFFO@pw~ UUUUUUUU-m۶m#QUUU5Զmۆ$UUI$~` UUWJI$I$IJUUUTUUUUUUUUUUUU7m[bU5=M$\AXWU}$Ir AWUU $Iy UU$ApU϶mۅڶUUTPUUUU1m۶a;ӜUU\ځM}!qZTV gޏ!% "(B`? HAH$I$BTWUUG㉘!qM5I$I$AUUUVI 55X-۰m)JTWUU_H$L$ cP&x' P\\TUUUUUUUUIDI6M۱=ӜWVTVڶb+6by55r ۳ۯ{UUWTx&bT\P?nm۶-EmkUUUUUUUUUUUUUUU ^cm cUUUݱ !T\SIo6j %U$E)WCZzI$H$UWTWUUUUUUUUUUUU Fb#mUUI'Ĝ U\% ѶmUUUMةg] UVpI$I$AUUUVUUUUUUUUUUUUUUUUI$I$UUU$I$u UUU̕ !p^U H$I$bTUUUUUUUUUUUp,sUU5gIr P cAU 'uI9,c Ux wI$O' cUUWTj9*Q cAIqP`.0 bb&I$\!PZUUz[r=Y6ZPsaie^` c aMCs!b -)\y!U_PX$I$AiUUUɗI$ c5UUf-H1ZA-U~&b$!WXXWUUUU@7a -~:xQ W~|6v =؄MӜ WTVVo_E6Q}ss}N%2IJ$!T\\:;ZGGATCGVAGGATGALFGGATSFFO@pw~ UUUUUUUUI$IXqUUU5׶mۆ$UUI$~` UUWLI$I$iJUUUTUUUUUUUUUUUU9m[bU5=Mqsyܶb'p&M$!\^WWooȖ60b}C}P: R9V^^JKhandleDamage = { _unit = _this select 0; _hitArea = _this select 1; _damage = _this select 2; _shooter = _this select 3; _ammoUsed = _this select 4; _bool = (_hitArea == "legs" || _hitArea == "hands") && (handsHit _unit == 1 || !canStand _unit); if (!alive _unit) exitWith { _damage}; if (_hitArea == "" && vehicle player == player) exitWith {0}; if (lifeState _unit == "UNCONSCIOUS") exitWith { bloodloss = bloodloss + _damage; if (bloodloss > 100) then { bloodloss = 100; }; hintSilent ("Approximate bloodloss: "+str(round bloodloss)+"%\nCritical bloodloss: 30%"); if (bloodloss >= bloodloosCrit) then { player setDamage 1; }; 0 }; if (vehicle _unit != _unit && _damage > 0.9 && lifeState _unit != "UNCONSCIOUS") exitWith { _unit setUnconscious true; _unit setDamage 0.8; 0.8 }; if (_hitArea == "body" && _damage > 0.9 && lifeState _unit != "UNCONSCIOUS") exitWith { _unit setUnconscious true; _unit setDamage 0.8; 0.8 }; if (_bool && _damage > 0.9 && lifeState _unit != "UNCONSCIOUS") exitWith { _unit setUnconscious true; _unit setDamage 0.8; _damage }; _damage }; handleHeal = { _injured = _this select 0; _healPlace = "healPlace0"; _anim = animationState _injured; if (_anim == draggedAnim || _anim in carriedAnims) exitWith { player groupChat "you must release the soldier first!"; false }; _pWep = primaryWeapon player; if (_pWep == "") exitWith { player groupChat "due to scripting limitations you need a primaryWeapon to perform this action"; }; if (currentWeapon player != _pWep) then { player selectWeapon _pWep; sleep 2; }; if ((player distance (_injured modelToWorld healPlace1))<((_injured modelToWorld healPlace0) distance player)) then { _healPlace = "healPlace1"; }; if (_healPlace == "healPlace0") then { player attachTo [_injured, healPlace0]; player playActionNow "medicStartRightSide"; } else { player attachTo [_injured, healPlace1]; player playActionNow "medicStart"; }; sleep 0.001; _posh = player modelToWorld [0,0,0]; _posi = _injured modelToWorld healInjuredModelChestPos; _dy = (_posh select 1) - (_posi select 1); _dx = (_posh select 0) - (_posi select 0); _dir = getDir player; player setDir (270 - (_dy atan2 _dx) - direction _injured); [nil, _injured, "loc", rSPAWN, player, { _healer = _this; nMedics = nMedics + 1; if (animationState player != "ainjppnemstpsnonwrfldnon") then { player playAction "agonyStart"; }; _time = time - 1; waitUntil { animationState _healer in healAnims }; waitUntil { if (animationState player != "ainjppnemstpsnonwrfldnon") then { player playAction "agonyStart"; }; !alive player || !(animationState _healer in healAnims) || round(time - _time)*nMedics >= round(minHealTime + bloodloss) }; nMedics = nMedics - 1; if (alive player && animationState _healer in healAnims) then { player setDamage 0; }; }] call RE; waitUntil { animationState player in healAnims }; _time = time; waitUntil { !(animationState player in healAnims) || !alive _injured || damage _injured == 0}; if (lifeState player == "ALIVE") exitWith { detach player; player switchAction "medicStart"; player playActionNow "medicStop"; true }; false }; injuredLoop = { { if (lifeState _x == "UNCONSCIOUS") then { _agony = format["%1inAgony", _x]; _bool = missionNamespace getVariable _agony; if isNil "_bool" then { missionNamespace setVariable [_agony, false]; _bool = false; }; if !_bool then { missionNamespace setVariable [_agony, true]; _x spawn animations; }; }; } forEach playableUnits; }; ppEffects = { if (isNil "_ppEffectsOn") then { _ppEffectsOn = false; }; if (isNil "ppUnconscious") then { ppUnconscious = ppEffectCreate [["radialblur", 170], ["colorcorrections", 1580]]; }; if (alive player && lifeState player == "UNCONSCIOUS" && floor((time - _time)*10 % 5) == 0) then { if!(_ppEffectsOn) then { _ppEffectsOn = true; { _x ppEffectEnable true } forEach ppUnconscious; }; ppUnconscious select 0 ppEffectAdjust [random 0.005 + 0.0025, random 0.005 + 0.0025, 0.0, 0.0]; ppUnconscious select 0 ppEffectCommit 0.5; ppUnconscious select 1 ppEffectAdjust [1.0, 1.0, 0.0, random 0.6, 0.0, 0.0, random 0.6, 0.0, 1.0, 1.0, 1.0, 0.199, 0.587, 0.114, 0.0]; ppUnconscious select 1 ppEffectCommit 0.5; }; if ((!alive player || lifeState player != "UNCONSCIOUS") && _ppEffectsOn) then { { _x ppEffectEnable false} forEach ppUnconscious; _ppEffectsOn = false; }; }; initBloodloss = { _time = time; nMedics = 0; if (animationState player in healAnims) then { detach player; player switchAction "medicStart"; player playActionNow "medicStop"; }; if (animationState player in (draggerAnims+[carrierAnim]+carriedAnims+[draggedAnim])) then { detach player; player switchAction "released"; }; waitUntil { !(animationState player in healAnims) }; if (vehicle player == player) then { player playAction "agonyStart"; }; if (!captive player) then { [nil,player, rSETCAPTIVE, true] call RE; }; while{ alive player && damage player > 0}do{ waitUntil { nMedics == 0 }; if (round(time - _time) % bloodlossFreq == 0) then { if (bloodloss >= bloodloosCrit) exitWith { player setDamage 1; }; hint ("Approximate bloodloss: "+str(round bloodloss)+"%\nCritical bloodloss: 30%"); _anim = animationState player; if (_anim == draggedAnim || _anim in carriedAnims) exitWith {}; if (!captive player) then { [nil,player, rSETCAPTIVE, true] call RE; }; player playAction "agonyStart"; waitUntil { animationState player == "ainjppnemstpsnonwrfldnon"}; _time = time; waitUntil { _anim = animationState player; if (_anim != "ainjppnemstpsnonwrfldnon" && _anim != draggedAnim && !(_anim in carriedAnims)) then { player playAction "agonyStart"; }; (time - _time) > bloodloss*bloodlossFreq/bloodloosCrit || nMedics > 0 }; }; bloodloss = bloodloss + bloodloosCrit/reviveTime; sleep 1; }; if (captive player) then { [nil,player, rSETCAPTIVE, false] call RE; }; player setUnconscious false; if (!alive player) exitWith {}; player playAction "agonyStop"; }; animations = { if isWest then { _this removeAllEventHandlers "handleHeal"; _this addEventHandler ["handleHeal", { _this spawn handleHeal; }]; _this sideChat (switch floor random 2 do { case 0: { "[ugh]"}; case 1: { "[aaah]"}; default { "[arrrrrrrghhhhhh]"}}); }; if (player == _this) then { [] spawn initBloodloss; }; while { lifeState _this == "UNCONSCIOUS"} do { if (vehicle _this != _this) then { _this playAction "GestureAgonyCargo"; waitUntil { vehicle _this == _this }; if (player == _this) then { player playAction "agonyStart"; }; }; waitUntil { vehicle _this != _this || animationState _this == "ainjppnemstpsnonwrfldnon" || lifeState _this != "UNCONSCIOUS" }; _this playAction "GestureSpasm" + str floor random 7; waitUntil { vehicle _this != _this || animationState _this != "ainjppnemstpsnonwrfldnon" || lifeState _this != "UNCONSCIOUS" }; _this playAction "GestureNod"; }; waitUntil { !isNull _this }; _this removeAllEventHandlers "handleHeal"; missionNamespace setVariable [format["%1inAgony", _this], false]; }; _houses = [centerPos,AORadius, 3] call findHouses; { _pos = _x call getGridPos; _mkr = str _pos; if (getMarkerPos _mkr select 0 == 0) then { _mkr = createMarkerLocal[_mkr, _pos]; _mkr setMarkerShapeLocal "RECTANGLE"; _mkr setMarkerTypeLocal "SOLID"; _mkr setMarkerSizeLocal [50,50]; _mkr setMarkerAlphaLocal 0.2; }; _var = missionNamespace getVariable format["%1cleared", _mkr]; if isNil "_var" then { _mkr setMarkerColorLocal "ColorRed"; } else { _mkr setMarkerColorLocal "ColorGreen"; }; } forEach _houses; if (isWest && markersEnabled == 1) then { { _mkr = createMarkerLocal[_x, spawnPos]; _mkr setMarkerTypeLocal "mil_triangle"; _mkr setMarkerSizeLocal [0.5,0.7]; } forEach playerStrings; { _mkr = createMarkerLocal[_x, spawnPos]; _mkr setMarkerTypeLocal "mil_triangle"; _mkr setMarkerSizeLocal [0.8,1.0]; _i = westVehicleStrings find _x; if (_i > 3 && _i < 8) then { _mkr setMarkerSizeLocal [0.65,0.85]; }; } forEach westVehicleStrings; }; gridPath = { if (vehicle player != player) exitWith {}; _gMkr = str(player call getGridPos); if isNil "_gMkr" exitWith {}; if (markerColor _gMkr == "ColorGreen") exitWith {}; if (nearestMen(call compile _gMkr,70,true,"count") > 0 || nearestPlayers(call compile _gMkr,140,true,"count") < 2) exitWith {}; _gMkr setMarkerColor "ColorGreen"; missionNamespace setVariable [format["%1cleared", _gMkr], true]; publicVariable format["%1cleared", _gMkr]; }; AImarkers = { { if (alive _x && _x != graveDigger) then { _mkr = str _x; if (getMarkerPos _mkr select 0 == 0) then { _mkr = createMarkerLocal[_mkr, getPosATL _x]; _mkr setMarkerShapeLocal "ICON"; _mkr setMarkerTypeLocal "mil_triangle"; _mkr setMarkerSizeLocal [0.5,0.7]; _mkr spawn { sleep 10; deleteMarkerLocal _this; }; }; _mkr setMarkerPosLocal getPosATL _x; _mkr setMarkerDirLocal getDir _x; _txt = getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName"); _isPlayer = str leader _x in eastPlayerStrings; if _isPlayer then { _txt = name _x; }; _mkr setMarkerTextLocal _txt; _color = "ColorRed"; if (_isPlayer || nearestPlayers(getPosATL _x,100,true,"count") > 0) then { _color = "ColorOrange"; }; _mkr setMarkerColorLocal _color; }; } forEach nearestObjects[centerPos, eastInfClasses, AORadius]; }; playerMarkers = { { if !isNil _x then { _plr = call compile _x; if(isNull _plr) exitWith { _x setMarkerPosLocal spawnPos; _x setMarkerTextLocal ""; }; _vcl = vehicle _plr; if (_vcl != _plr) exitWith { _x setMarkerPosLocal spawnPos; }; _colour = "ColorBlue"; if (str _plr in squadUnitStrings(squadString(player))) then { _colour = "ColorGreen"; }; if (!alive _plr) then { _colour = "ColorBlack"; }; if (lifeState _plr == "UNCONSCIOUS") then { _colour = "ColorRed"; }; _x setMarkerColorLocal _colour; _x setMarkerPosLocal getPosATL _plr; _x setMarkerDirLocal getDir _plr; } else { _x setMarkerPosLocal spawnPos; _x setMarkerTextLocal ""; }; } forEach playerStrings; }; vehicleMarkers = { { if !isNil _x then { _mkr = _x; _vcl = call compile _x; _mkr setMarkerPosLocal getPosATL _vcl; _mkr setMarkerDirLocal getDir _vcl; _crew = crew _vcl; _type = typeOf _vcl; if (!alive _vcl) then { _mkr setMarkerColorLocal "ColorBlack"} else { if (count _crew == 0 || (count _crew == 1 && _type == HELITYPE) ) then { _mkr setMarkerColorLocal "ColorYellow"; } else { _bool = false; for "_i" from 0 to (count _crew - 1) do { if (str (_crew select _i) in squadUnitStrings(squadString(player))) then { _bool = true; }; }; if (_bool) then { _mkr setMarkerColorLocal "ColorGreen"; } else { _mkr setMarkerColorLocal "ColorBlue"; }; }; }; }; } forEach westVehicleStrings; }; markerTexts = { if (isNil "_mapClickBool") then { _mapClickBool = false; }; if !visibleMap exitWith { if _mapClickBool then { _mapClickBool = false; }; if mapInUse then { mapInUse = false; }; }; if !(_mapClickBool || mapInUse) then { _mapClickBool = true; onMapSingleClick ' _pos = [_pos select 0, _pos select 1]; if isEast exitWith { _units = nearestMen(_pos,40,true,"array"); if (count _units == 0) exitWith {}; _unit = _units select 0; if (str leader _unit in eastPlayerStrings) exitWith { player groupChat "Cannot switch into a player''s unit"; }; if (nearestPlayers(getPosATL _unit,100,true,"count") > 0) exitWith { player groupChat "this unit is too close to the enemy"; }; _unit spawn { _unit = _this; _group = group _unit; [_unit] joinSilent startGroup; _oldUnit = player; hint "Switching unit..."; waitUntil { local _unit }; selectPlayer _unit; hint "Switched unit!"; if !(str _oldUnit in eastPlayerStrings) then { [_oldUnit] joinSilent oldGroup; }; oldGroup = _group; }; openMap false; }; _units = nearestObjects[_pos,westAllClasses,40]; if (count _units == 0) exitWith {}; _unit = _units select 0; _mkr = str _unit; if (_unit isKindOf "man" && _mkr in playerStrings) then { _id = unitID(_unit); _name = getName(_unit); if (markerText _mkr == "") exitWith { _mkr setMarkerTextLocal _id; }; if (markerText _mkr == _id) exitWith { _mkr setMarkerTextLocal _name; }; _mkr setMarkerTextLocal ""; }; if (_unit in westVehicles) then { _id = victorID(_unit); if (markerText _mkr == "") exitWith { _mkr setMarkerTextLocal _id; }; _mkr setMarkerTextLocal ""; }; '; }; }; clearHouses = { _gMkr = str(player call getGridPos); if (markerColor _gMkr == "ColorRed") then { _houses = [getPosATL player, 8, 3] call findHouses; if (count _houses > 0) then { _house = _houses select 0; _cleared = _house getVariable "cleared"; if (isNil "_cleared") then { if (nearestMen(getPosATL _house, 10, true, "count") == 0) then { _house setVariable ["cleared", true]; }; }; }; }; }; casePickup = { if (_block < 10) exitWith { _block = _block + 1; }; _cases = nearestObjects[getPosATL player,["suitcase"], 3]; if (count _cases == 0) exitWith {}; _case = _cases select 0; if isNull _case exitWith {}; _block = 0; deleteVehicle _case; player groupChat "you retrieved some intel on the location of an ammo cache"; _cache = nearestObjects[getPosATL player, [cacheType], AORadius] select 0; [nil,nil,rSPAWN,_cache,{ if (isServer) then { _this call createIntel; }; hint "New intel received on the location of an ammo cache. A marker has been added to the map."; }] call RE; }; firedEH = { if ((_this select 1) == ATTYPE) then { [] spawn { sleep 0.5; player removeWeapon ATTYPE; }; }; if (captive player) then { [nil,player, rSETCAPTIVE, false] call RE; }; }; oneShotM136 = { if (currentWeapon player == ATTYPE && !(ATMAGTYPE in magazines player)) then { player removeWeapon ATTYPE; player addMagazine ATMAGTYPE; player addWeapon ATTYPE; player selectWeapon ATTYPE; }; if (currentWeapon player != ATTYPE && ATMAGTYPE in magazines player) then { player removeMagazine ATMAGTYPE; }; }; nameStrings = { { _id = playerStrings find _x; if !isNil _x then { _plr = call compile _x; if (!isNull _plr && isPlayer _plr) then { if alive _plr then { if (playerNames select _id == "Error: No unit") exitWith {}; _name = name _plr; if (playerNames select _id != _name) then { playerNames set[_id, _name]; }; }; } else { if (playerNames select _id != "") then { playerNames set[_id, ""]; }; }; } else { if (playerNames select _id != "") then { playerNames set[_id, ""]; }; }; } forEach playerStrings; }; vclisFull = { 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 }; true }; moveInVehicle = { if (_this emptyPositions "Driver" > 0) exitWith { player action["getInDriver", _this]; }; if (_this emptyPositions "Gunner" > 0) exitWith { player action["getInTurret", _this, [0]]; }; if (_this emptyPositions "Commander" > 0) exitWith { player action["getInCommander", _this]; }; if (_this emptyPositions "Cargo" > 0) exitWith { _id = count (crew _this - [driver _this] - [gunner _this] - [commander _this]); player action["getInCargo", _this, _id]; }; }; crewToStr = { _num = count _this - 1; _vcl = vehicle (_this select 0); _str = ""; for "_j" from 0 to (_num) do { _man = _this select _j; if (alive _man && str _man in playerStrings) then { _str = _str + getName(_man); _pos = " (Cargo)"; if (driver _vcl == _man) then { _pos = " (Driver)"; }; if (_vcl turretUnit [0] == _man) then { _pos = " (Turret)"; }; if (_vcl turretUnit [1] == _man) then { _pos = " (Front Gunner)"; }; _str = _str + _pos; if (_j < _num) then { _str = _str + "
"; }; }; }; _str }; equals = { _arr1 = _this select 0; _arr2 = _this select 1; _bool = true; if (count _arr1 != count _arr2) exitWith { false}; for "_i" from 0 to (count _arr1 - 1) do { if (!((_arr1 select _i) in _arr2)) exitWith { _bool = false; }; if (!((_arr2 select _i) in _arr1)) exitWith { _bool = false; }; }; _bool }; particles = { if (night || isNil "_dust") exitWith {}; if ( surfaceType [(getPosATL player select 0)+30, getPosATL player select 1, getPosATL player select 2] in sTypes || surfaceType [(getPosATL player select 0)-30, getPosATL player select 1, getPosATL player select 2] in sTypes || surfaceType [(getPosATL player select 0), (getPosATL player select 1)+30, getPosATL player select 2] in sTypes || surfaceType [(getPosATL player select 0), (getPosATL player select 1)-30, getPosATL player select 2] in sTypes ) exitWith { if (_dust distance spawnPos > 50) then { _dust setPosATL spawnPos; }; }; _speed = speed (vehicle player); _dust setParticleCircle [30, [1, 1, 0]]; _dust setDropInterval 0.1 - 0.001*_speed; _dust setParticleParams [["\Ca\Data\Cl_basic.p3d", 1, 0, 1], "", "Billboard", 1, 10, [1, 0, 0], [0,0,0], 5, 0.2, 0.1568, 0.0, [4, 13], [[0.7,0.6,0.5,0.0],[0.7,0.6,0.5,0.2],[0.7,0.6,0.5,0.0]], [0, 1], 1, 0, "", "", vehicle player]; _dust setPosATL getPosATL player; }; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "Ammo Caches Left"; _trg setTriggerActivation ["ALPHA", "PRESENT", true]; _trg setTriggerStatements ["this", ' hint parseText format[" %1/%2 ammo cache''s have been destroyed. ",cacheCount - count cacheList, cacheCount] ', ""]; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "Player Identities"; _trg setTriggerActivation ["BRAVO", "PRESENT", true]; _trg setTriggerStatements ["this", ' _str = ""; { if (!isNil _x) then { _plr = call compile _x; if !isNull _plr then { _color = "#0000FF"; if (str _plr in squadUnitStrings(squadString(player))) then { _color = "#00FF00"; }; _str = _str + format[" %2: %3

", _color, unitID(_plr), getName(_plr)]; }; }; } forEach playerStrings; hint parseText _str; ', ""]; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "Server Load"; _trg setTriggerActivation ["CHARLIE", "PRESENT", true]; _trg setTriggerStatements ["this", ' if (serverLoadHint) exitWith { player groupChat "You may only check the server load every 30 seconds to prevent network lag"; }; serverLoadHint = true; [nil,server,"loc",rSPAWN,player,{ [nil,_this,"loc",rSPAWN,diag_fps,{ hint format["nAiUnits: %1\nnGroups: %2\nServer FPS: %3\n Run Time: %4 mins", numberOfAI, count allGroups, round _this, round (time/60)]; sleep 30; serverLoadHint = false; }] call RE; }] call RE; ', ""]; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "View Distance - 100"; _trg setTriggerActivation ["DELTA", "PRESENT", true]; _trg setTriggerStatements ["this", 'if (viewDistance > 0) then { setViewDistance (viewDistance - 100); }; hintSilent format["View Distance: %1", viewDistance]', ""]; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "View Distance + 100"; _trg setTriggerActivation ["ECHO", "PRESENT", true]; _trg setTriggerStatements ["this", 'if (viewDistance < 5000) then { setViewDistance (viewDistance + 100); }; hintSilent format["View Distance: %1", viewDistance]', ""]; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "Fix Headbug"; _trg setTriggerActivation ["FOXTROT", "PRESENT", true]; _trg setTriggerStatements ["this", ' if (lifeState player == "UNCONSCIOUS") exitWith {}; _pos = getPosATL player; _vcl = "Old_bike_TK_CIV_EP1" createVehicleLocal spawnPos; player moveInDriver _vcl; moveOut player; player setPosATL _pos; deleteVehicle _vcl; player switchCamera "INTERNAL"; detach player; ', ""]; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText " "; _trg setTriggerActivation ["GOLF", "PRESENT", true]; if (startLives > -1) then { deleteVehicle _trg; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "Lives remaining"; _trg setTriggerActivation ["GOLF", "PRESENT", true]; _trg setTriggerStatements ["this", ' hint parseText format[" West lives remaining: %1 ",livesLeft]; ', ""]; }; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText " "; _trg setTriggerActivation ["HOTEL", "PRESENT", true]; if (getPlayerUID player == "3046918") then { deleteVehicle _trg; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "AI Markers"; _trg setTriggerActivation ["HOTEL", "PRESENT", true]; _trg setTriggerStatements ["this", '{ [_x,_x] call createDebugMarker } forEach nearestObjects[centerPos,eastInfClasses,AORadius*2]',""]; }; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText " "; _trg setTriggerActivation ["INDIA", "PRESENT", true]; if debug then { deleteVehicle _trg; _trg = createTrigger ["EmptyDetector", position player]; _trg setTriggerText "teleport"; _trg setTriggerActivation ["INDIA", "PRESENT", true]; _trg setTriggerStatements ["this", 'hint "Click on map to select teleport destination"; onMapSingleClick "player setPosATL _pos; onMapSingleClick """"; hint ""Teleported!"" " ',""]; }; showRadio true; onPlayerKilled = { if (livesLeft > 0 && time > 30) then { westDeaths = westDeaths + 1; publicVariable "westDeaths"; hint parseText format[" West lives remaining: %1 ",livesLeft]; }; if remoteControlling then { call exitRC; }; detach player; player setUnconscious false; if (captive player) then { [nil,player, rSETCAPTIVE, false] call RE; }; bloodloss = 0; camPlayer = objNull; deadPos = getPosATL player; [server,server,"loc",rSPAWN,player,{ sleep 180; hideBody _this; sleep 10; deleteVehicle _this; }] call RE; }; respawnSystem = { private ["_c","_vehicle","_txt","_color","_bool"]; call disableSerialization; scopeName "main"; _camPlayer = objNull; respawnCamera = "camera" camCreate [0,0,0]; respawnCamera cameraEffect ["INTERNAL","Back"]; while {isDead(player) && time > 30} do { if (isNull camPlayer || _camPlayer != camPlayer) then { _arr = groupMembers(true,"array")+[fieldHospital]; if (livesLeft == 0) then { _arr = nearestPlayers(centerPos,AORadius,true,"array"); }; if (isNull camPlayer) then { camPlayer = _arr select 0; }; camAttachCoords = [0,-3,1.5]; if (camPlayer == fieldHospital) then { camAttachCoords = [-50, 0, 12]; }; respawnCamera camSetTarget camPlayer; titleText [" ","Black in", 2]; respawnCamera camCommit 0; respawnCamera attachTo [camPlayer, camAttachCoords]; _camPlayer = camPlayer; _vehicle = camPlayer; enterSpawn = false; _c = 5; }; if (alive camPlayer && !enterSpawn && isDead(player)) then { if (_c < 5) then { _c = 5; }; if (_vehicle != vehicle camPlayer) then { _vehicle = vehicle camPlayer; respawnCamera attachTo [_vehicle, camAttachCoords]; respawnCamera camSetTarget _vehicle; respawnCamera camCommit 0; }; call respawnTags; }; if (_camPlayer == camPlayer && enterSpawn) then { _plrs = nearestPlayers(getPosATL camPlayer,300,true,"array"); if (camPlayer != fieldHospital && (nearestMen(getPosATL camPlayer,respawnRange,true,"count") > 0 || vehicle camPlayer call vclisFull) ) exitWith { enterSpawn = false; _c = 5; }; cutRsc["Rtags", "PLAIN"]; _ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434; _ctrlText ctrlSetStructuredText parseText format[ "Spawning in %1

Left Arrow: Previous unit
Right Arrow: Next unit
Backspace: Respawn gear menu
" , abs ceil _c, _color]; if ((ceil _c) <= 0) exitWith { breakTo "main"; }; _c = _c - 0.1; }; if (!alive camPlayer) then { camPlayer = objNull; }; sleep 0.1; }; if (!isNull camPlayer && alive camPlayer) then { call loadout; call addActions; if (vehicle camPlayer != camPlayer) exitWith { (vehicle camPlayer) call moveInVehicle; }; player setDir getDir camPlayer; player setPosATL getPosATL camPlayer; } else { _pos = startLocation modelToWorld [-14,-13+(squadNumber(player)-1)*6+(unitNumber(player)-1)*1.2,0]; player setPosATL _pos; player setDir (getDir startLocation)+90; }; openMap [false,false]; respawnCamera cameraEffect ["terminate","back"]; camDestroy respawnCamera; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 5; };exitRC = { objNull remoteControl driver cameraOn; vehicle player switchCamera "INTERNAL"; [player] joinSilent startGroup; }; supportTimer = { if (str player == (squadString(player)+"1") && !A10available && time - _A10Timer > A10respawn) then { [west,"HQ"] sideChat "CAS (A10) is now available for your squad"; A10available = true; _A10Timer = 99999; }; if (_A10Timer == 99999 && !A10available) then { _A10Timer = time; }; /* if (str player == (squadString(player)+"1") && !artyAvailable && time - _artyTimer > artyRespawn) then { [west,"HQ"] sideChat "Artillery support is now available for your squad"; artyAvailable = true; _artyTimer = 99999; }; if (_artyTimer == 99999 && !artyAvailable) then { _artyTimer = time; }; */ }; if isWest then { controlChopper = { _group = ["pilot" + str _this, "Grp", "", "west"] call getGroup; _pilot = driver _this; if !(pilotController in units (group _pilot)) exitWith { player groupChat "This helicopter is currently being controlled by another player"; }; player joinAsSilent [_group, 1]; _pilot joinAsSilent [_group, 2]; waitUntil { local _pilot }; _pilot disableAI "TARGET"; _pilot disableAI "AUTOTARGET"; _pilot disableAI "MOVE"; _pilot disableAI "ANIM"; _this switchCamera "INTERNAL"; player remoteControl _pilot; }; BIS_MENU_GroupCommunication = [ ["Support",true], ["Request CAS (A10)", [2], "", -5, [["expression", ' if (lifeState player == "UNCONSCIOUS") exitWith {}; _leader = squadString(player)+"1"; _str = "you need a squad leader to call for support"; if (isNil _leader) exitWith { player groupChat _str; }; _leader = call compile _leader; if (isNull _leader || !isPlayer _leader) exitWith { player groupChat _str; }; if (!alive _leader || isDead(_leader)) exitWith { player groupChat "your squad leader is dead!"; }; player sideChat format["Sent request to %1 (%2) for support.", unitID(_leader), getName(_leader)]; [nil,_leader,"loc",rSPAWN,player,{ if (!A10available && !debug) exitWith { [nil,_this,"loc",rSPAWN,player,{[west,"HQ"] sideChat "CAS (A10) support is currently not available for your squad";}] call RE; }; requestingPlayer = _this; player sideChat format["%1 (%2) is requesting CAS support. Accept?", unitID(_this), getName(_this)]; showCommandingMenu "#USER:query_Menu_CAS"; }] call RE; ']], "1", "1"], ["Control Helicopter", [3], "", -5, [["expression", ' heli spawn controlChopper; ']], "1", "1"] ]; query_Menu_CAS = [ ["Accept call for support",false], ["Yes",[2],"",-5,[["expression",' [nil,requestingPlayer,"loc",rSPAWN,player,{ player sideChat format["%1 (%2) accepted your request for support. Click a location on the map to designate for CAS", unitID(_this), getName(_this)]; mapInUse = true; openMap true; onMapSingleClick "call spawnA10;"; }] call RE; ']],"1","1"], ["No",[3],"",-5,[["expression",' [nil,requestingPlayer,"loc",rSPAWN,player,{ player sideChat format["%1 (%2) Denied your request for support", unitID(_this), getName(_this)]; }] call RE; ']],"1","1"] ]; query_Menu_MHQ = [ ["Accept mobilise request",false], ["Yes",[2],"",-5,[["expression",' _pos = HQ modelToWorld [14,0,0]; HQ setPosATL [30,0,0]; MHQ setDamage 0; MHQ setFuel 1; MHQ setPosATL _pos; ']],"1","1"], ["No",[3],"",-5,[["expression",' [nil,requestingPlayer,"loc",rSPAWN,player,{ player sideChat format["%1 (%2) Denied your request to mobilise the HQ", unitID(_this), getName(_this)]; }] call RE; ']],"1","1"] ]; }; artillery = { _pos = _this; artyAvailable = false; _pos set [2,0]; hint "Position selected!"; openMap [false,false]; mapInUse = false; _sID = squadID(player); _gPos = mapGridPosition _pos; player sideChat format["Crossroad, this is %1, Adjust fire, over.", _sID]; sleep 5; [west,"HQ"] sideChat format["%1 this is Crossroad, adjust fire, out.", _sID]; sleep 4; player sideChat format["Grid %1, over", _gPos]; sleep 3; [west,"HQ"] sideChat format["Grid %1, out", _gPos]; sleep 5; [west,"HQ"] sideChat "R, F, DPICM in effect, 5 rounds, over."; sleep 3; player sideChat "DPICM in effect, 5 rounds, out."; sleep 7; [west,"HQ"] sideChat "shot, over."; sleep 3; player sideChat "shot, out."; sleep 25; [west,"HQ"] sideChat "splash, over."; sleep 2; player sideChat "splash, out."; sleep 5; _c = 0; while { _c < 5 } do { "ARTY_R_227mm_HE" createVehicle [(_pos select 0) + random 50 - random 50,(_pos select 1) + random 50 - random 50,(_pos select 2)]; sleep (0.5+random 2); _c = _c + 1; }; }; spawnA10 = { [nil,call compile (squadString(player)+"1"),"loc",rSPAWN,player,{ A10available = false; }] call RE; hint "Position selected!"; openMap [false,false]; mapInUse = false; _startPos = getPosATL player; _dir = ((_pos select 0) - (centerPos select 0)) atan2 ((_pos select 1) - (centerPos select 1)); _pos2 = [(_pos select 0) + (sin _dir)*5000,(_pos select 1) + (cos _dir)*8000,500]; _vcl = "A10_US_EP1" createVehicle spawnPos; _vcl engineOn true; _vcl setPosATL _pos2; _dir = ((_pos select 0) - (_pos2 select 0)) atan2 ((_pos select 1) - (_pos2 select 1)); _vcl setDir _dir; _vcl setVelocity [(sin _dir)*100,(cos _dir)*100,20]; moveOut player; player moveInDriver _vcl; [nil,nil,rSPAWN,[_vcl,player,_startPos,_pos],{ _vcl = _this select 0; _plr = _this select 1; _pos = _this select 3; if (player == _plr) then { flyTime = "-"; _vcl addEventHandler ["fired",{ (_this select 0) removeEventHandler ["fired",0]; flyTime = 30;}]; while { alive player } do { if (typeName flyTime != "STRING") exitWith {}; hintSilent format[ "Distance to target: %1m\nBearing-target offset: %2dgs" , round(player distance _pos), round([player,_pos] call getBearing)]; }; _time = time; waitUntil { hintSilent format[ "Time remaining: %1s\nDistance to target: %2m\nBearing-target offset: %3dgs" , round(flyTime - (time - _time)), round(player distance _pos), round([player,_pos] call getBearing)]; time - _time > flyTime || !alive player }; if (alive player && vehicle player == _vcl) then { player setPosATL (_this select 2); if (lifeState player == "UNCONSCIOUS") then { player setUnconscious false; }; }; }; if isServer then { waitUntil { !isNull (driver _vcl) }; waitUntil { isNull (driver _vcl) || !alive _vcl }; if !alive _vcl exitWith {}; _dir = getDir _vcl; _grp = createGroup civilian; _man = _grp createUnit [typeOf _plr, spawnPos, [], 0, "NONE"]; _man assignAsDriver _vcl; _man moveInDriver _vcl; _vcl flyInHeight 300; _vcl engineOn true; _vcl setCaptive true; _pos2 = getPosATL _vcl; _man doMove [(_pos2 select 0) + (sin _dir)*10000,(_pos2 select 1) + (cos _dir)*10000,0]; waitUntil { nearestPlayers(getPosATL _vcl, 3000, true, "count") == 0 || !alive _vcl }; if alive _vcl then { deleteVehicle _vcl; }; deleteVehicle _man; deleteGroup _grp; }; }] call RE; }; respawnTags = { if camMap exitWith {}; if (livesLeft == 0) exitWith { cutRsc["Rtags", "PLAIN"]; _color = "#347C17"; if (!(str camPlayer in squadUnitStrings(squadString(player)))) then { _color = "#C11B17"; }; _txt = format["%1: %2 (Spectating)", unitID(camPlayer), getName(camPlayer)]; _ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434; _ctrlText ctrlSetStructuredText parseText format[ "%1" , _txt, _color]; }; _bool = nearestMen(getPosATL camPlayer,respawnRange,true,"count") == 0; if (camPlayer != fieldHospital) then { _txt = format["%1: %2 (Press Enter to Spawn)", unitID(camPlayer), getName(camPlayer)]; _color = "#347C17"; if !_bool then { _txt = format["%1: %2 (Cannot spawn while enemies near)", unitID(camPlayer), getName(camPlayer)]; _color = "#C11B17"; }; } else { _txt = "Main Base (Press Enter to Spawn)"; _color = "#2554C7"; }; if (lifeState camPlayer == "UNCONSCIOUS") then { _txt = format["%1: %2 (Cannot spawn on a critically wounded soldier)", unitID(camPlayer), getName(camPlayer)]; _color = "#C11B17"; }; if (vehicle camPlayer call vclisFull) then { _txt = format["%1: %2 (Cannot spawn while vehicle is full)", unitID(camPlayer), getName(camPlayer)]; _color = "#C11B17"; }; cutRsc["Rtags", "PLAIN"]; _ctrlText = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64434; _ctrlText ctrlSetStructuredText parseText format[ "%1

Left Arrow: Previous unit
Right Arrow: Next unit
Backspace: Respawn gear menu
" , _txt, _color]; }; playerTags = { if (!isNull respawnCamera || isNull cursorTarget || !tagsOn || cameraView == "GUNNER") exitWith {}; _cT = cursorTarget; if (!(str _cT in playerStrings) || !(_cT isKindOf "man") || (!alive _cT && lifeState _cT != "DEAD-RESPAWN") ) exitWith {}; cutRsc["Rtags", "PLAIN"]; _ctrlOffset = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64435; _color = "#2554C7"; if (str _cT in squadUnitStrings(squadString(player))) then { _color = "#347C17"; }; if (lifeState _cT == "UNCONSCIOUS") then { _color = "#C11B17"; }; if (lifeState _cT == "DEAD-RESPAWN") then { _color = "#736F6E"; }; _ctrlOffset ctrlSetStructuredText parseText format[ "%1
%2
" , unitID(_cT), getName(_cT), _color]; }; eastPlayerTags = { if (!isNull respawnCamera || isNull cursorTarget || !tagsOn || cameraView == "GUNNER") exitWith {}; _cT = cursorTarget; if (!(str leader _cT in eastPlayerStrings) || !(_cT isKindOf "man") || !alive _cT ) exitWith {}; cutRsc["Rtags", "PLAIN"]; _ctrlOffset = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64435; _color = "#2554C7"; if (_cT in units group player) then { _color = "#347C17"; }; _ctrlOffset ctrlSetStructuredText parseText format[ "%1" , name _cT, _color]; }; vehicleTags = { if (!isNull respawnCamera || isNull cursorTarget || !tagsOn || cameraView == "GUNNER") exitWith {}; _cT = cursorTarget; _dist = player distance _cT; if (_cT in westVehicles) then { _crew = crew _cT; if (count _crew == 0 || _dist < 4) exitWith {}; _bool = false; _color = "#2554C7"; for "_i" from 0 to (count _crew - 1) do { if (str (_crew select _i) in squadUnitStrings(squadString(player))) exitWith { _bool = true; }; }; if (_bool) then { _color = "#347C17"; }; cutRsc["Rtags", "PLAIN"]; _ctrlOffset = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64435; _ctrlOffset ctrlSetStructuredText parseText format[ "%1" , crew _cT call crewToStr, _color]; }; _nVcls = nearestObjects[getPosATL player,westVehicleClasses,5]; if (count _nVcls == 0 || vehicle player != player || lifeState player == "UNCONSCIOUS") exitWith {}; _vcl = _nVcls select 0; if (!(_vcl call atEntryPoint)) exitWith {}; titleRsc["Rtags", "PLAIN"]; _ctrlCenter = (uiNamespace getVariable 'TAGS_HUD') displayCtrl 64436; _ctrlCenter ctrlSetStructuredText parseText "GET IN (Ctrl+E)"; }; atEntryPoint = { _offset = [0,0.5,-1.5]; _pos = _this modelToWorld _offset; _facing = false; if (player distance _pos < 3 && canSee(player,_pos,45)) then { _facing = true; }; if (!alive _this || _this call vclisFull || !_facing) exitWith { false }; true }; superman = { if (!debug) exitWith {}; player allowDamage false; case 57: { _vcl = vehicle player; if (_shift) then { _vcl setVelocity[(velocity _vcl select 0),(velocity _vcl select 1),(velocity _vcl select 2)+1]; if (_vcl == player) then { _handled=true; }; }; }; case 17: { _vcl = vehicle player; if (_shift) then { _vcl setVelocity[(velocity _vcl select 0)+(sin (getDir _vcl)),(velocity _vcl select 1)+(cos (getDir _vcl)),velocity _vcl select 2]; if (_vcl == player) then { _handled=true; }; }; }; case 31: { _vcl = vehicle player; if (_shift) then { _vcl setVelocity[(velocity _vcl select 0)-(sin (getDir _vcl)),(velocity _vcl select 1)-(cos (getDir _vcl)),velocity _vcl select 2]; if (_vcl == player) then { _handled=true; }; }; }; case 30: { _vcl = vehicle player; if (_shift) then { _vcl setVelocity[(velocity _vcl select 0)-(cos (getDir _vcl)),(velocity _vcl select 1)+(sin (getDir _vcl)),velocity _vcl select 2]; if (_vcl == player) then { _handled=true; }; }; }; case 32: { _vcl = vehicle player; if (_shift) then { _vcl setVelocity[(velocity _vcl select 0)+(cos (getDir _vcl)),(velocity _vcl select 1)-(sin (getDir _vcl)),velocity _vcl select 2]; if (_vcl == player) then { _handled=true; }; }; }; }; onKeyPress = { _key = _this select 1; _shift = _this select 2; _ctrl = _this select 3; _alt = _this select 4; _handled = false; if (difficultyEnabled "3rdPersonView" && _key in actionKeys "personView" && remoteControlling) exitWith { if (cameraView == "INTERNAL") then { cameraOn switchCamera "EXTERNAL"; } else { cameraOn switchCamera "INTERNAL"; }; true }; if (_key in actionKeys "tacticalView") then { hint "Tactical View is disabled in Insurgency"; _handled=true; }; if (!alive player) exitWith {}; if (_key in (actionKeys 'showmap')) then { if isNull respawnCamera exitWith {}; camMap = !camMap; openMap [camMap,camMap]; if camMap then { mapAnimAdd [0,0.1,getPosATL camPlayer]; mapAnimCommit; }; }; switch _key do { //TAB key case 15: { if (!_ctrl) exitWith {}; if (!tagsOn) then { tagsOn=true; titletext["Insurgency interface enabled", "PLAIN DOWN"]; } else { tagsOn=false; titletext["Insurgency interface disabled", "PLAIN DOWN"]; }; }; //E key case 18: { if (!tagsOn || keyblock || lifeState player == "UNCONSCIOUS") exitWith {}; _cT = cursorTarget; _dist = player distance _cT; _nVcls = nearestObjects[getPosATL player,westVehicleClasses,5]; if (count _nVcls > 0) then { _vcl = _nVcls select 0; if (vehicle player == player && _ctrl) exitWith { if !(_vcl call atEntryPoint) exitWith {}; keyblock=true; _vcl call moveInVehicle; keyblock=false; }; }; _vcl = vehicle player; if (_vcl != player && _ctrl) exitWith { if (speed _vcl > 30) exitWith { player groupChat "The vehicle is moving too fast"; }; moveOut player; }; }; //N key case 49: { if (isNull respawnCamera) exitWith {}; if (isNil "camNVG") then { camNVG = true; }; camUseNVG camNVG; camNVG = !camNVG; }; if debug then { call superman; }; //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; }; }; //Enter key case 28: { if (isNull respawnCamera || camMap || livesLeft == 0) exitWith {}; if enterSpawn exitWith { enterSpawn = false; }; if (!enterSpawn && camPlayer == fieldHospital) exitWith { enterSpawn = true; }; if (nearestMen(getPosATL camPlayer,respawnRange,true,"count") > 0) exitWith {}; if (vehicle camPlayer call vclisFull) exitWith {}; if (lifeState camPlayer == "UNCONSCIOUS") exitWith {}; if !enterSpawn then { enterSpawn = true; }; }; //Left case 203: { if isNull respawnCamera exitWith {}; _list = [fieldHospital] + groupMembers(true,"array"); if (livesLeft == 0) then { _list = nearestPlayers(centerPos,AORadius,true,"array"); }; _size = count _list; _id = _list find camPlayer; _id = _id - 1; if (_id < 0) then { _id = _size - 1; }; camPlayer = _list select _id; }; //Right case 205: { if isNull respawnCamera exitWith {}; _list = [fieldHospital] + groupMembers(true,"array"); if (livesLeft == 0) then { _list = nearestPlayers(centerPos,AORadius,true,"array"); }; _size = count _list; _id = _list find camPlayer; _id = _id + 1; if (_id == _size) then { _id = 0; }; camPlayer = _list select _id; }; //Backspace case 14: { if isNull respawnCamera exitWith { if remoteControlling then { call exitRC; }; }; if (startLocation == MHQ) exitWith { player groupChat "Unavailable when the HQ is mobilised"; }; [] spawn gearDialog; _handled = true; }; //PAGE UP case 201: { if !_shift exitWith {}; _intensity = (colors getVariable "intensity") + 0.1; colors setVariable ["intensity", _intensity]; hint str _intensity; }; //PAGE DOWN case 209: { if !_shift exitWith {}; _intensity = (colors getVariable "intensity") - 0.1; colors setVariable ["intensity", _intensity]; hint str _intensity; }; }; _handled; }; onMouseMove = { if (isNull respawnCamera || camPlayer == fieldHospital || dialog) exitWith {}; _xS = (_this select 1)/45; _yS = (_this select 2)/25; if (abs _xS < abs _yS) then { _xS = 0; }; if (abs _yS < abs _xS) then { _yS = 0; }; _xC = (camAttachCoords select 0) - _xS; if (_xC > 3) then { _xC = 3; }; if (_xC < -3) then { _xC = -3; }; _yC = camAttachCoords select 1; if (_xC <= 0) then { _yC = _yC + _xS; }; if (_xC > 0) then { _yC = _yC - _xS; }; if (_yC > 0) then { _yC = 0; }; if (_yC < -3 && camPlayer isKindOf "man") then { _yC = -3; }; if (_yC < -3 && !(camPlayer isKindOf "man")) then { _yC = -7; }; _zC = (camAttachCoords select 2) + _yS; if (_zC > 7) then { _zC = 7; }; if (_zC < -2) then { _zC = -2; }; camAttachCoords = [_xC,_yC,_zC]; respawnCamera attachTo [vehicle camPlayer, camAttachCoords]; respawnCamera camSetTarget vehicle camPlayer; respawnCamera camCommit 0; }; #define debug false //#define BAF true #define BAF2 false //Constants #define viewDistanceInt 1500 #define AORadius 5400 #define spawnRange 500 #define centerPos [4752.25,5064.67,0] #define spawnPos [0,0,0] #define wepDespawnRange 100 #define maxCollateral 50 //Misc Functions #define getDirTo(X,Y) (((((if(typeName Y == "OBJECT")then{getPosATL Y}else{Y} select 0) - (getPosATL X select 0)) atan2 ((if(typeName Y == "OBJECT")then{getPosATL Y}else{Y} select 1) - (getPosATL X select 1)))+360)%360) #define isDead(X) (getPosATL X select 2 < 50 && X distance spawnPos < 1000) //Params #define startLocation (if(isDead(MHQ))then{HQ}else{MHQ}) #define startPos (getPosATL fieldHospital) aiSkill = (paramsArray select 0)/10; maxAIPerPlayer = paramsArray select 1; markersEnabled = paramsArray select 2; cacheCount = paramsArray select 3; startLives = paramsArray select 4; #define livesLeft (startLives - westDeaths) //AI #define infDeleteTime 30 #define cacheHousePositions ["Land_dum_istan3_hromada2",[8],"Land_House_K_1_EP1",[1,2,3,4],"Land_House_L_4_EP1",[6],"Land_House_C_5_V3_EP1",[0,2,6],"Land_House_C_12_EP1",[5,6],"Land_House_K_3_EP1",[9,1,2,3,5],"Land_House_C_5_V2_EP1",[4,0,1,5],"Land_House_L_8_EP1",[7,8],"Land_House_C_4_EP1",[7,12,13,15],"Land_House_C_2_EP1",[1,2,5,6,7,8,9],"Land_House_L_7_EP1",[0,1,2,3,4,5],"Land_House_C_10_EP1",[7,8,9,10,11,12,13,14],"Land_House_K_6_EP1",[6,7,8,9,10],"Land_House_C_11_EP1",[7,8,9,10],"Land_House_C_9_EP1",[2,3,4,5],"Land_House_C_3_EP1",[7,8,9,10,11,12,13,28,29,30,31,32],"Land_A_Office01_EP1",[5,6],"Land_A_Mosque_small_1_EP1",[3,4,5],"Land_A_Stationhouse_ep1",[6,9,13],"Land_House_C_5_EP1",[3,4,5],"Land_House_K_7_EP1",[4,5,6,11],"Land_Mil_ControlTower_EP1",[2,3,4,6],"Land_House_C_5_V1_EP1",[6,7],"Land_House_K_8_EP1",[4,0,1,2,3],"Land_A_BuildingWIP_EP1",[18,20,24,25,26,27,28,29,30,31],"Land_A_Villa_EP1",[4,6,7,8,9],"Land_House_L_6_EP1",[4,0,3],"Land_House_L_3_EP1",[0,1,2],"Land_House_K_5_EP1",[1,2],"Land_House_C_1_v2_EP1",[0,1,2,3],"Land_Farm_Cowshed_a",[0,1,2,3,4,5,6,7,8,9],"Land_Ind_SawMillPen",[1,3],"Land_Misc_deerstand",[1,2,3],"land_army_hut_int",[0,1,2,4,5],"Land_army_hut_storrage",[0,1,2],"Land_Tovarna2",[22,23,25,28,29,33,34,36],"Land_Hlidac_budka",[1,2,3,4],"Land_House_L_1_EP1",[1,2],"Land_dum_istan3_pumpa",[1],"Land_MBG_Police_Station",[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,29,30,31],"Land_sara_Domek_sedy",[0,1,2,3,4,5,6,7,8,9],"Land_Ind_Workshop01_L",[1,2],"Land_dum_mesto_in",[0,1,2,3,4,5,6,7,8],"Land_Shed_Ind02",[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"Land_majak2",[1],"Land_stodola_old_open",[5,8,9,10,11,15,20,21,22],"land_hut02",[1,2],"land_hut01",[1,2],"land_hut04",[3,5,6],"Land_Mil_Barracks_i",[1,2,3,4,5,6,7,8],"Land_Panelak2",[0,4],"Land_afbarabizna",[1,17],"Land_tovarna1",[11,23],"Land_Hangar_2",[0,1,2,3,4,5,6,7],"Land_Ind_Workshop01_04",[0,1,2],"Land_A_Crane_02a",[0,1],"Land_A_Crane_02b",[2],"Land_A_GeneralStore_01a",[0,1,2,3,4,5,6,7,9,10,12],"Land_Panelak",[1,3,4,5,7,8,10,11,12,13,14,15,16,17,18,19,20],"Land_A_BuildingWIP",[18,20,24,25,26,27,28,29,30,31],"Land_fortified_nest_small",[1,2],"Land_Mil_ControlTower",[2,3,4,6],"Land_Ind_Vysypka",[1,2,3,4,6,10],"Land_fortified_nest_big",[1,2,3,4,5,6,7,8,9,10,11,12],"Land_vez",[0]] //String Functions #define squadNumber(X) call compile toString[toArray(str X)select 7] #define squadString(X) ("Hitman1" + str squadNumber(X)) #define squadUnitStrings(X) [X+"1",X+"2",X+"3",X+"4",X+"5"] #define unitNumber(X) call compile toString[toArray(str X)select(count toArray(str X) - 1)] #define vehicleID(X) ("Hitman-1-" + str unitNumber(X)) #define vehicleSquad(X) ("Hitman1" + str unitNumber(X)) #define getName(X) (playerNames select (playerStrings find str X)) #define squadVehicle(X) (call compile ("Humv1" + str squadNumber(X))) #define squadLeader(X) (call compile (squadString(X)+"1")) #define squadVictor(X) ("Victor-1-" + str squadNumber(X)) #define squadID(X) ("Hitman-1-" + str squadNumber(X)) #define unitID(X) ("Hitman-1-" + str squadNumber(X) + "-" + str unitNumber(X)) #ifndef BAF #define ATVTYPE "ATV_US_EP1" #define HELITYPE "UH60M_EP1" #define PILOTTYPE "US_Soldier_Pilot_EP1" #define CAR1TYPE "HMMWV_M1151_M2_DES_EP1" #define CAR2TYPE "HMMWV_M998A2_SOV_DES_EP1" #define MHQTYPE "M1130_CV_EP1" #endif #ifdef BAF #define ATVTYPE "BAF_ATV_D" #define HELITYPE "BAF_Merlin_HC3_D" #define PILOTTYPE "BAF_Pilot_MTP" #define CAR1TYPE "BAF_Jackal2_GMG_D" #define CAR2TYPE "BAF_Jackal2_L2A1_D" #define MHQTYPE "M1130_CV_EP1" #endif #define victorID(X) (\ if(typeOf X == ATVTYPE)then{"ATV-1-" + str unitNumber(X)}else{\ if(typeOf X == HELITYPE)then{"Heli"}else{\ if(typeOf X == MHQTYPE)then{"MHQ"}else{\ "Victor-1-" + str unitNumber(X)}}}) //Arrays/Types #ifndef BAF #define ATTYPE "M136" #define ATMAGTYPE "M136" #endif #ifdef BAF #define ATTYPE "BAF_NLAW_Launcher" #define ATMAGTYPE "NLAW" #endif #define IEDList ["BAF_ied_v1","BAF_ied_v2","BAF_ied_v3","BAF_ied_v4"] #define cacheType "GuerillaCacheBox_EP1" #define ammoBoxType "UNBasicWeapons_EP1" #define westVehicles [humv11,humv12,humv13,humv14,atv11,atv12,atv13,atv14,heli,MHQ] #define westVehicleStrings ["humv11","humv12","humv13","humv14","atv11","atv12","atv13","atv14","heli","MHQ"] #define playerStrings ["Hitman111","Hitman112","Hitman113","Hitman114","Hitman115","Hitman121","Hitman122","Hitman123","Hitman124","Hitman125","Hitman131","Hitman132","Hitman133","Hitman134","Hitman135","Hitman141","Hitman142","Hitman143","Hitman144","Hitman145"] #define eastPlayerStrings ["east1","east2","east3","east4"] #ifndef BAF #define westSoldierClasses ["US_Soldier_TL_EP1","US_Delta_Force_Medic_EP1","US_Soldier_LAT_EP1","US_Soldier_EP1","US_Soldier_GL_EP1"] #define westVehicleClasses ["HMMWV_M1151_M2_DES_EP1","HMMWV_M998A2_SOV_DES_EP1","M1126_ICV_mk19_EP1","M1126_ICV_M2_EP1",ATVTYPE,HELITYPE] #define limitedSquadGear [["M136","Javelin"],["m240_scoped_EP1","M249_EP1","M249_TWS_EP1","M249_m145_EP1"],["M24_des_EP1"]] #define limitedGearList ["M136","Javelin","m240_scoped_EP1","M249_EP1","M249_TWS_EP1","M249_m145_EP1","M24_des_EP1"] #endif #ifdef BAF #define westSoldierClasses ["BAF_Soldier_TL_DDPM","BAF_Soldier_Medic_DDPM","BAF_Soldier_AT_DDPM","BAF_Soldier_DDPM","BAF_Soldier_GL_DDPM"] #define westVehicleClasses ["BAF_Jackal2_GMG_D","BAF_Jackal2_L2A1_D",ATVTYPE,HELITYPE] #define limitedSquadGear [["BAF_NLAW_Launcher","Javelin"],["BAF_L7A2_GPMG","BAF_L110A1_Aim"],["BAF_LRR_scoped"]] #define limitedGearList ["BAF_NLAW_Launcher","Javelin","BAF_L7A2_GPMG","BAF_L110A1_Aim","BAF_LRR_scoped"] #endif #define westAllClasses (westSoldierClasses + westVehicleClasses) #define eastStationaryGuns ["KORD_high_UN_EP1","DSHKM_TK_INS_EP1","ZU23_TK_INS_EP1","AGS_TK_INS_EP1"] #define eastVclClasses ["BRDM2_TK_EP1","M113_TK_EP1","BTR60_TK_EP1","LandRover_MG_TK_INS_EP1","LandRover_SPG9_TK_INS_EP1","T34_TK_EP1","T55_TK_EP1","KORD_high_UN_EP1","DSHKM_TK_INS_EP1","ZU23_TK_INS_EP1","AGS_TK_INS_EP1"] #define eastRanks ["CAPTAIN","LIEUTENANT","SERGEANT","CORPORAL","PRIVATE"] #define illegalHouses ["Land_trafostanica_mala","Land_SS_hangar","Land_Mil_hangar_EP1", "Land_Mil_ControlTower_EP1", "Land_Mil_Guardhouse_EP1", "Land_Mil_Repair_center_EP1","Land_Mil_Barracks_i_EP1","Land_A_Minaret_EP1","Land_Ind_Coltan_Main_EP1"] #define eastInfClasses [\ "TK_INS_Warlord_EP1",\ "TK_INS_Soldier_TL_EP1",\ "TK_INS_Bonesetter_EP1",\ "TK_INS_Soldier_AT_EP1",\ "TK_INS_Soldier_AT_EP1",\ "TK_INS_Soldier_AT_EP1",\ "TK_INS_Soldier_MG_EP1",\ "TK_INS_Soldier_AR_EP1",\ "TK_INS_Soldier_AAT_EP1",\ "TK_INS_Soldier_EP1",\ "TK_INS_Soldier_2_EP1",\ "TK_INS_Soldier_3_EP1",\ "TK_INS_Soldier_4_EP1"\ ] #define eastAllClasses (eastInfClasses + eastStationaryGuns + eastVclClasses) #define legalMagazines [\ "20Rnd_762x51_DMR",\ "10x_303",\ "5Rnd_127x99_as50",\ "5rnd_127x99_as50",\ "200Rnd_556x45_L110A1",\ "5Rnd_86x70_L115A1",\ "100Rnd_762x54_PK",\ "75Rnd_545x39_RPK",\ "10Rnd_762x54_SVD",\ "8Rnd_9x18_Makarov",\ "6Rnd_45ACP",\ "20Rnd_B_765x17_Ball",\ "30Rnd_9x19_UZI",\ "PG7V",\ "PG7VL",\ "PG7VR",\ "OG7",\ "RPG18",\ "Strela",\ "20Rnd_762x51_FNFAL",\ "30Rnd_545x39_AK",\ "30Rnd_762x39_AK47",\ "30Rnd_556x45_Stanag",\ "5Rnd_762x51_M24",\ "100Rnd_762x51_M240",\ "200Rnd_556x45_M249",\ "20Rnd_762x51_B_SCAR",\ "20rnd_762x51_B_SCAR",\ "Laserbatteries",\ "Javelin",\ "Mine",\ "PipeBomb",\ "15Rnd_9x19_M9",\ "7Rnd_45ACP_1911",\ "17Rnd_9x19_glock17",\ "HandGrenade_West",\ "HandGrenade_East",\ "SmokeShell",\ "1Rnd_HE_M203",\ "1Rnd_Smoke_M203",\ "IR_Strobe_Target",\ "IR_Strobe_Marker",\ "SmokeShellRed",\ "SmokeShellGreen",\ "SmokeShellBlue",\ "SmokeShellYellow",\ "SmokeShellOrange",\ "SmokeShellPurple",\ "FlareWhite_M203",\ "FlareYellow_M203",\ "FlareGreen_M203",\ "FlareRed_M203",\ "1Rnd_SmokeRed_M203",\ "1Rnd_SmokeGreen_M203",\ "1Rnd_SmokeYellow_M203",\ "1Rnd_HE_GP25",\ "FlareWhite_GP25",\ "FlareGreen_GP25",\ "FlareRed_GP25",\ "FlareYellow_GP25",\ "1Rnd_Smoke_GP25",\ "1Rnd_SmokeRed_GP25",\ "1Rnd_SmokeGreen_GP25",\ "1Rnd_SmokeYellow_GP25"\ ] #ifndef BAF #define humvMagazines [\ ["30Rnd_556x45_Stanag",12],\ ["5Rnd_762x51_M24",4],\ ["100Rnd_762x51_M240",3],\ ["200Rnd_556x45_M249",3],\ ["20Rnd_762x51_B_SCAR",8],\ ["PipeBomb",2],\ ["15Rnd_9x19_M9",4],\ ["HandGrenade_West",4],\ ["SmokeShell",4],\ ["1Rnd_HE_M203",6]\ ] #endif #ifdef BAF #define humvMagazines [\ ["30Rnd_556x45_Stanag",12],\ ["5rnd_127x99_as50",4],\ ["100Rnd_762x51_M240",3],\ ["200Rnd_556x45_M249",3],\ ["20Rnd_762x51_B_SCAR",8],\ ["PipeBomb",2],\ ["15Rnd_9x19_M9",4],\ ["HandGrenade_West",4],\ ["SmokeShell",4],\ ["1Rnd_HE_M203",6]\ ] #endif findHouses = { _buildings = nearestObjects [_this select 0, ["House"], _this select 1]; _minPositions = (_this select 2) - 1; _enterables = []; { if (format["%1", _x buildingPos _minPositions] != "[0,0,0]" && !(typeOf _x in illegalHouses) && alive _x) then { _enterables set [count _enterables, _x]; }; } forEach _buildings; _enterables }; setSurrendered = { if !isDedicated then { if (player distance _this <= 20) then { private "_txt"; switch (round random 1) do { case 0: { _txt = "I Surrender!"; }; case 1: { _txt = "I give up!"; }; }; _this globalChat format["%1: %2", getText (configFile >> "CfgVehicles" >> typeOf _this >> "displayName"), _txt]; }; }; if isServer then { removeAllWeapons _this; _this setUnitPos "UP"; _this disableAI "move"; _this playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; _this disableAI "anim"; }; }; getDir2 = { _dirW = screenToWorld [0.5,0.5]; _dirS = ((_dirW select 0) - (getPosATL player select 0)) atan2 ((_dirW select 1) - (getPosATL player select 1)); ((_dirS+360) % 360) }; #define getDir2 (call getDir2) nearestWeapons = { private ["_wep","_pos","_rds","_alive","_type","_x","_result"]; _wep = _this select 0; _pos = _this select 1; _rds = _this select 2; _alive = _this select 3; _type = _this select 4; if (_type == "count") then { _result = 0; } else { _result = []; }; { if (_x isKindOf "man" && (!alive _x || _alive)) then { if (_wep in weapons _x) then { if (_type == "count") then { _result = _result + 1; } else { _result = _result + [_x]; }; }; } else { if (_wep in (getWeaponCargo _x select 0)) then { if (_type == "count") then { _result = _result + 1; } else { _result = _result + [_x]; }; }; }; } forEach nearestObjects[_pos,["weaponHolder","man","ReammoBox","AllVehicles"],_rds]; _result }; #define nearestWeapons(V,W,X,Y,Z) ([V,W,X,Y,Z] call nearestWeapons) groupMembers = { private "_result"; _alive = _this select 0; _type = _this select 1; if (_type == "count") then { _result = 0; } else { _result = []; }; { if (!isNil _x) then { _plr = call compile _x; if (!isNull _plr) then { if ((alive _plr && !isDead(_plr)) || !_alive) then { if (_type == "count") then { _result = _result + 1; } else { _result = _result + [_plr]; }; }; }; }; } forEach (squadUnitStrings(squadString(player))-[str player]); _result }; #define groupMembers(Y,Z) ([Y,Z] call groupMembers) nearestPlayers = { private ["_result","_pos","_range","_type","_alive"]; _pos = _this select 0; _range = _this select 1; _alive = _this select 2; _type = _this select 3; if (_type == "count") then { _result = 0; } else { _result = []; }; { if (!isNil _x) then { _plr = call compile _x; if (!isNull _plr) then { if (_plr distance _pos <= _range && (alive _plr || !_alive)) then { if (_type == "count") then { _result = _result + 1; } else { _result = _result + [_plr]; }; }; }; }; } forEach playerStrings; _result }; #define nearestPlayers(W,X,Y,Z) ([W,X,Y,Z] call nearestPlayers) nearestInfantry = { private ["_result","_x"]; _arr = nearestObjects[_this select 0, ["Man"], _this select 1]; _alive = _this select 2; _type = _this select 3; if (_type == "count") then { _result = 0; } else { _result = []; }; { if (!(str _x in playerStrings) && ( (alive _x && primaryWeapon _x != "") || !_alive ) ) then { if (_type == "count") then { _result = _result + 1; } else { _result set [count _result, _x]; }; }; } forEach _arr; _result }; #define nearestInfantry(W,X,Y,Z) ([W,X,Y,Z] call nearestInfantry) nearestMen = { private ["_result","_x"]; _arr1 = nearestObjects[_this select 0, ["LandVehicle"], _this select 1]; _arr2 = nearestObjects[_this select 0, ["Man"], _this select 1]; _alive = _this select 2; _type = _this select 3; if (_type == "count") then { _result = 0; } else { _result = []; }; { if (typeOf _x in eastInfClasses && ( (alive _x && primaryWeapon _x != "") || !_alive ) ) then { if (_type == "count") then { _result = _result + 1; } else { _result set [count _result, _x]; }; }; } forEach _arr2; for "_i" from 0 to (count _arr1 - 1) do { { if (typeOf _x in eastInfClasses && (alive _x || !_alive) ) then { if (_type == "count") then { _result = _result + 1; } else { _result set [count _result, _x]; }; }; } forEach (crew (_arr1 select _i)); }; _result }; #define nearestMen(W,X,Y,Z) ([W,X,Y,Z] call nearestMen) #define numberOfAI nearestMen(centerPos,AORadius,false,"count") nearestMen2 = { private ["_result","_x"]; _arr1 = nearestObjects[_this select 0, ["Car","Tank"], _this select 1]; _arr2 = nearestObjects[_this select 0, ["Man"], _this select 1]; _alive = _this select 2; _type = _this select 3; if (_type == "count") then { _result = 0; } else { _result = []; }; { if (!isDead(_x) && _x isKindOf "Man" && !(str _x in playerStrings) && ( (alive _x && primaryWeapon _x != "") || !_alive ) ) then { if (_type == "count") then { _result = _result + 1; } else { _result set [count _result, _x]; }; }; } forEach _arr2; for "_i" from 0 to (count _arr1 - 1) do { { if (!(str _x in playerStrings) && (alive _x || !_alive) ) then { if (_type == "count") then { _result = _result + 1; } else { _result set [count _result, _x]; }; }; } forEach (crew (_arr1 select _i)); }; _result }; #define nearestMen2(W,X,Y,Z) ([W,X,Y,Z] call nearestMen2) knowsAboutAll = { _ai = _this select 0; _arr = _this select 1; _knows = true; for "_i" from 0 to (count _arr - 1) do { _unit = _arr select _i; if (_ai knowsAbout _unit < 1) exitWith { _knows = false; }; }; _knows }; #define knowsAboutAll(X,Y) ([X,Y] call knowsAboutAll) getBearing = { _unit = _this select 0; _obj = _this select 1; _dirTo = abs(getDirTo(_unit,_obj)); _uDir = getDir(vehicle _unit); if (abs(_dirTo - _uDir) > 180) then { _dirTo = -1*(360 - _dirTo); }; (_dirTo - _uDir) }; canSee = { private ["_unit","_obj","_arr","_dirTo","_uDir","_vcl"]; _unit = _this select 0; _obj = _this select 1; _arc = _this select 2; _dirTo = abs(getDirTo(_unit,_obj)); _uDir = getDir (vehicle _unit); if (vehicle _unit != _unit) then { _vcl = vehicle _unit; if (_vcl turretUnit [0] == _unit) then { _uDir = _vcl weaponDirection (_vcl weaponsTurret [0] select 0); _uDir = (_uDir select 0) atan2 (_uDir select 1); }; }; if (abs(_dirTo - _uDir) > 180) then { _dirTo = -1*(360 - _dirTo); }; abs(_dirTo - _uDir) <= _arc }; #define canSee(X,Y,Z) ([X,Y,Z] call canSee) arrCanSee = { private ["_arc","_pos","_arr","_rng","_unit"]; _arr = _this select 0; _pos = _this select 1; _arc = _this select 2; _rng = _this select 3; _canSee = false; for "_i" from 0 to (count _arr - 1) do { _unit = _arr select _i; if (alive _unit && (canSee(_unit,_pos,_arc) || _unit distance _pos <= _rng)) exitWith { _canSee = true; }; }; _canSee }; #define arrCanSee(W,X,Y,Z) ([W,X,Y,Z] call arrCanSee) canSeeArr = { _pos = _this select 0; _arr = _this select 1; _arc = _this select 2; _canSee = true; for "_i" from 0 to (count _arr - 1) do { _unit = _arr select _i; if !canSee(_pos,_unit,_arc) exitWith { _canSee = false; }; }; _canSee }; #define canSeeArr(X,Y,Z) ([X,Y,Z] call canSeeArr) getGroup = { _prefix = _this select 0; _name = _this select 1; _suffix = _this select 2; _side = "east"; if (count _this > 3) then { _side = _this select 3; }; call compile format[" if isNil ""%1%2%3"" exitWith { %1%2%3 = createGroup %4; %1%2%3 }; if isNull %1%2%3 exitWith { %1%2%3 = createGroup %4; %1%2%3 }; %1%2%3 ", _prefix, _name, _suffix, _side]; }; countPositions = { private "_i"; _house = _this select 0; _i = _this select 1; _hPos = format["%1", _house buildingPos _i]; if (_hPos == "[0,0,0]") exitWith { _i; }; [_house, _i+1] call countPositions; }; #define nPos(X) ([X,0] call countPositions) getGridPos = { _pos = getPosATL _this; _x = _pos select 0; _y = _pos select 1; _x = _x - (_x % 100); _y = _y - (_y % 100); [_x + 50, _y + 50, 0] }; getCaches = { private "_i"; _arr = _this select 0; _i = _this select 1; if (_i >= cacheCount) exitWith { _arr; }; _str = format["cache%1", _i+1]; _cache = call compile _str; if (!isNull _cache) then { if (alive _cache) then { _arr = _arr + [_cache]; }; }; [_arr, _i+1] call getCaches; }; #define cacheList ([[],0] call getCaches) getCacheMarkers = { private "_i"; _cache = _this select 0; _arr = _this select 1; _i = _this select 2; _mkr = format["%1intel%2", _cache, _i]; if ((getMarkerPos _mkr select 0) == 0) exitWith { _arr; }; _arr set [_i, _mkr]; [_cache, _arr, _i+1] call getCacheMarkers; }; #define cacheMarkers(X) ([X,[],0] call getCacheMarkers) createDebugMarker = { _unit = _this select 0; _mkr = createMarkerLocal["debug" + str _unit, getPosATL _unit]; _mkr setMarkerShapeLocal "ICON"; _mkr setMarkerTypeLocal "mil_triangle"; _mkr setMarkerSizeLocal [0.5,0.7]; _txt = str _unit; //if (typeName _txt == "OBJECT") then {_txt = getText (configFile >> "CfgVehicles" >> typeOf vehicle(_this select 1) >> "displayName"); }; if (str _unit in eastPlayerStrings) then { _txt = name _unit; }; _mkr setMarkerTextLocal _txt; _mkr setMarkerColorLocal "ColorRed"; _dir = getDir _unit; if (vehicle _unit != _unit) then { _dir = formationDirection _unit; }; _mkr setMarkerDirLocal _dir; if (!alive _unit) then { _mkr setMarkerColorLocal "ColorBlack"; }; [_mkr, _unit] spawn { _mkr = _this select 0; _unit = _this select 1; while{!isNull _unit && debug}do{ _mkr setMarkerPosLocal getPosATL _unit; _mkr setMarkerDirLocal getDir _unit; if !alive _unit then { _mkr setMarkerColorLocal "ColorBlack"; }; sleep 0.1; }; if !debug then { sleep 5; }; deleteMarkerLocal _mkr; }; }; // Control types #define CT_STATIC 0 #define CT_BUTTON 1 #define CT_EDIT 2 #define CT_SLIDER 3 #define CT_COMBO 4 #define CT_LISTBOX 5 #define CT_TOOLBOX 6 #define CT_CHECKBOXES 7 #define CT_PROGRESS 8 #define CT_HTML 9 #define CT_STATIC_SKEW 10 #define CT_ACTIVETEXT 11 #define CT_TREE 12 #define CT_STRUCTURED_TEXT 13 #define CT_CONTEXT_MENU 14 #define CT_CONTROLS_GROUP 15 #define CT_SHORTCUT_BUTTON 16 // Arma 2 - textured button #define CT_XKEYDESC 40 #define CT_XBUTTON 41 #define CT_XLISTBOX 42 #define CT_XSLIDER 43 #define CT_XCOMBO 44 #define CT_ANIMATED_TEXTURE 45 #define CT_OBJECT 80 #define CT_OBJECT_ZOOM 81 #define CT_OBJECT_CONTAINER 82 #define CT_OBJECT_CONT_ANIM 83 #define CT_LINEBREAK 98 #define CT_USER 99 #define CT_MAP 100 #define CT_MAP_MAIN 101 #define CT_List_N_Box 102 // Arma 2 - N columns list box // Static styles #define ST_POS 0x0F #define ST_HPOS 0x03 #define ST_VPOS 0x0C #define ST_LEFT 0x00 #define ST_RIGHT 0x01 #define ST_CENTER 0x02 #define ST_DOWN 0x04 #define ST_UP 0x08 #define ST_VCENTER 0x0c #define ST_TYPE 0xF0 #define ST_SINGLE 0 #define ST_MULTI 16 #define ST_TITLE_BAR 32 #define ST_PICTURE 48 #define ST_FRAME 64 #define ST_BACKGROUND 80 #define ST_GROUP_BOX 96 #define ST_GROUP_BOX2 112 #define ST_HUD_BACKGROUND 128 #define ST_TILE_PICTURE 144 #define ST_WITH_RECT 160 #define ST_LINE 176 #define ST_SHADOW 0x100 #define ST_NO_RECT 0x200 #define ST_KEEP_ASPECT_RATIO 0x800 #define ST_TITLE ST_TITLE_BAR + ST_CENTER // Slider styles #define SL_DIR 0x400 #define SL_VERT 0 #define SL_HORZ 0x400 #define SL_TEXTURES 0x10 // Listbox styles #define LB_TEXTURES 0x10 #define LB_MULTI 0x20 #define FontM "Zeppelin32"//--- Gear Menu. class RscGear { movingEnable = 1; idd = 16000; class controlsBackground { class Mainback : RscPicture { x = 0.04; y = 0.01; w = 1.2549; h = 1.6732; moving = 1; text = "\ca\ui\data\igui_background_gear_ca.paa"; }; }; class controls { class FilterButtonSidearm : RscClickableText { idc = 3400 + 4; style = 48 + 0x800; x = 0.300; y = 0.047; w = 0.086; h = 0.086; color[] = {1, 1, 1, 1}; colorActive[] = subcolor1; text = "\CA\warfare2\images\GearIconSidearm.paa"; action = "server setVariable ['filler', 'sidearms'];"; }; class FilterButtonMisc : FilterButtonSidearm { idc = 3400 + 5; x = 0.375; text = "\CA\warfare2\images\GearIconMisc.paa"; action = "server setVariable ['filler', 'misc'];"; }; class FilterButtonSecondary : FilterButtonSidearm { idc = 3400 + 3; x = 0.225; text = "\CA\warfare2\images\GearIconSecondary.paa"; action = "server setVariable ['filler', 'secondaries'];"; }; class FilterButtonPrimary : FilterButtonSidearm { idc = 3400 + 2; x = 0.15; text = "\CA\warfare2\images\GearIconPrimary.paa"; action = "server setVariable ['filler', 'primaries'];"; }; class FilterButtonAll : FilterButtonSidearm { idc = 3400 + 1; x = 0.075; text = "\CA\warfare2\images\GearIconAll.paa"; action = "server setVariable ['filler', 'all'];"; }; class ConClear : FilterButtonSidearm { idc = 3800; x = 0.902; y = 0.014; w = 0.032; h = 0.032; tooltip = "Gear: Clear the current loadout."; text = "Client\images\i_clear.paa"; action = "WF_Gear_Action = 'clear'"; }; class ConReload : ConClear { idc = 3800 + 1; x = 0.93; tooltip = "Gear: Reload the previous loadout."; text = "Client\images\i_reload.paa"; action = "WF_Gear_Action = 'reload'"; }; class MainList : RscListBoxA { idc = 3700; columns[] = {0.01, 0.25}; drawSideArrows = 0; idcRight = -1; idcLeft = -1; x = 0.043; y = 0.127676; w = 0.45; h = 0.52; onLBSelChanged = "lbChange = true;"; onLBDblClick = "lbMainAction = 'addWeapon';"; }; class SecondaryList : RscListBoxA { idc = 3701; columns[] = {0.01, 0.25}; drawSideArrows = 0; idcRight = -1; idcLeft = -1; x = 0.043; y = 0.66; w = 0.45; h = 0.24; onLBDblClick = "lbMainAction = 'addMagazine';"; }; class PrimaryWeapon : RscClickableText { idc = 3500; x = 0.502; y = 0.244; w = 0.286; h = 0.15; style = 48 + 0x800; soundDoubleClick[] = {"", 0.1, 1}; colorBackground[] = {0.6, 0.83, 0.47, 1}; colorBackgroundSelected[] = {0.6, 0.83, 0.47, 1}; colorFocused[] = {0, 0, 0, 0}; color[] = {0.85, 0.85, 0.85, 1}; colorText[] = {0.85, 0.85, 0.85, 1}; colorActive[] = {1, 1, 1, 1}; text = "\Ca\UI\Data\ui_gear_gun_gs.paa"; action = "primClicked = true"; }; class SecondaryWeapon : PrimaryWeapon { idc = 3500 + 1; y = 0.398; text = "\Ca\UI\Data\ui_gear_sec_gs.paa"; action = "secoClicked = true"; }; class Sidearm : PrimaryWeapon { idc = 3500 + 2; x = 0.56; y = 0.551; w = 0.113; h = 0.15; text = "\Ca\UI\Data\ui_gear_hgun_gs.paa"; action = "sideClicked = true"; }; class InventorySlot0 : PrimaryWeapon { idc = 3500 + 3; x = 0.79; y = 0.244; w = 0.055; h = 0.074; text = "\Ca\UI\Data\ui_gear_mag_gs.paa"; action = "inventoryClick = 3503"; }; class InventorySlot1 : InventorySlot0 { idc = 3500 + 4; x = 0.847; y = 0.244; action = "inventoryClick = 3504;"; }; class InventorySlot2 : InventorySlot0 { idc = 3500 + 5; x = 0.904366; y = 0.244; action = "inventoryClick = 3505"; }; class InventorySlot3 : InventorySlot0 { idc = 3500 + 6; x = 0.79; y = 0.321; action = "inventoryClick = 3506"; }; class InventorySlot4 : InventorySlot0 { idc = 3500 + 7; x = 0.847; y = 0.321; action = "inventoryClick = 3507"; }; class InventorySlot5 : InventorySlot0 { idc = 3500 + 8; x = 0.904366; y = 0.321; action = "inventoryClick = 3508"; }; class InventorySlot6 : InventorySlot0 { idc = 3500 + 9; x = 0.79; y = 0.398; action = "inventoryClick = 3509"; }; class InventorySlot7 : InventorySlot0 { idc = 3500 + 10; x = 0.847; y = 0.398; action = "inventoryClick = 3510"; }; class InventorySlot8 : InventorySlot0 { idc = 3500 + 11; x = 0.904366; y = 0.398; action = "inventoryClick = 3511"; }; class InventorySlot9 : InventorySlot0 { idc = 3500 + 12; x = 0.79; y = 0.474; action = "inventoryClick = 3512"; }; class InventorySlot10 : InventorySlot0 { idc = 3500 + 13; x = 0.847; y = 0.474; action = "inventoryClick = 3513"; }; class InventorySlot11 : InventorySlot0 { idc = 3500 + 14; x = 0.904366; y = 0.474; action = "inventoryClick = 3514"; }; class SidearmInventorySlot0 : InventorySlot0 { idc = 3500 + 15; x = 0.674; y = 0.551; w = 0.055; h = 0.074; text = "\Ca\UI\Data\ui_gear_hgunmag_gs.paa"; action = "inventoryClick = 3515"; }; class SidearmInventorySlot1 : SidearmInventorySlot0 { idc = 3500 + 16; x = 0.733; y = 0.551; action = "inventoryClick = 3516"; }; class SidearmInventorySlot2 : SidearmInventorySlot0 { idc = 3500 + 17; x = 0.79; action = "inventoryClick = 3517"; }; class SidearmInventorySlot3 : SidearmInventorySlot0 { idc = 3500 + 18; x = 0.847; action = "inventoryClick = 3518"; }; class SidearmInventorySlot4 : SidearmInventorySlot0 { idc = 3500 + 19; x = 0.674; y = 0.628; action = "inventoryClick = 3519"; }; class SidearmInventorySlot5 : SidearmInventorySlot0 { idc = 3500 + 20; x = 0.733; y = 0.628; action = "inventoryClick = 3520"; }; class SidearmInventorySlot6 : SidearmInventorySlot0 { idc = 3500 + 21; x = 0.79; y = 0.628; action = "inventoryClick = 3521"; }; class SidearmInventorySlot7 : SidearmInventorySlot0 { idc = 3500 + 22; x = 0.847; y = 0.628; action = "inventoryClick = 3522"; }; class MiscInventorySlot0 : InventorySlot0 { idc = 3500 + 23; x = 0.56; y = 0.705; w = 0.055; h = 0.074; colorActive[] = {0.85, 0.85, 0.85, 1}; text = "\Ca\UI\Data\ui_gear_eq_gs.paa"; action = "inventoryClick = 3523"; }; class MiscInventorySlot1 : MiscInventorySlot0 { idc = 3500 + 24; x = 0.617; y = 0.705; action = "inventoryClick = 3524"; }; class MiscInventorySlot2 : MiscInventorySlot0 { idc = 3500 + 25; x = 0.674; y = 0.705; action = "inventoryClick = 3525"; }; class MiscInventorySlot3 : MiscInventorySlot0 { idc = 3500 + 26; x = 0.733; y = 0.705; action = "inventoryClick = 3526"; }; class MiscInventorySlot4 : MiscInventorySlot0 { idc = 3500 + 27; x = 0.79; y = 0.705; action = "inventoryClick = 3527"; }; class MiscInventorySlot5 : MiscInventorySlot0 { idc = 3500 + 28; x = 0.847; y = 0.705; action = "inventoryClick = 3528"; }; class MiscInventorySlot6 : MiscInventorySlot0 { idc = 3500 + 29; x = 0.56; y = 0.782; action = "inventoryClick = 3529"; }; class MiscInventorySlot7 : MiscInventorySlot0 { idc = 3500 + 30; x = 0.617; y = 0.782; action = "inventoryClick = 3530"; }; class MiscInventorySlot8 : MiscInventorySlot0 { idc = 3500 + 31; x = 0.674; y = 0.782; action = "inventoryClick = 3531"; }; class MiscInventorySlot9 : MiscInventorySlot0 { idc = 3500 + 32; x = 0.733; y = 0.782; action = "inventoryClick = 3532"; }; class MiscInventorySlot10 : MiscInventorySlot0 { idc = 3500 + 33; x = 0.79; y = 0.782; action = "inventoryClick = 3533"; }; class MiscInventorySlot11 : MiscInventorySlot0 { idc = 3500 + 34; x = 0.847; y = 0.782; action = "inventoryClick = 3534"; }; class SpecialInventorySlot0 : InventorySlot0 { idc = 3500 + 35; x = 0.502; y = 0.09; w = 0.113; h = 0.15; colorActive[] = {0.85, 0.85, 0.85, 1}; text = "\Ca\UI\Data\ui_gear_eq_gs.paa"; action = "inventoryClick = 3535"; }; class SpecialInventorySlot1 : SpecialInventorySlot0 { idc = 3500 + 36; x = 0.847; y = 0.09; action = "inventoryClick = 3536"; }; class CA_Money_Value : RscText { idc = 3850; x = 0.727942; y = 0.86; SizeEx = 0.03; text = ""; colorText[] = subcolor1; }; class CA_GearLabel : CA_Money_Value { idc = 3852; style = 2; x = 0.502419; y = 0.0492156; w = 0.456; SizeEx = 0.03; text = "Respawn loadout:"; }; class Gear_Title : CA_Money_Value { idc = 3853; x = 0.047634; y = 0.01; text = "Gear Menu:"; }; class BuyButton : RscIGUIShortcutButton { idc = 3900; x = 0.0392 + 0.245*2; y = 0.897; w = 0.185; h = 0.052; text = "Save"; action = "buyLoadout = true"; }; class CloseButton : BuyButton { idc = 3901; x = 0.0392 + 0.245; text = "Close"; action = "closeDialog 0"; }; }; };class RscTitles { 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 = "Zeppelin33"; size = 0.03; colorText[] = { 0, 0.4, 0.8, 0.8}; colorBackground[] ={ 0,0,0,0.0}; text = ""; class Attributes { font = "Zeppelin33"; 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 = "Zeppelin33"; size = 0.03; colorText[] = { 0, 0.4, 0.8, 0.8}; colorBackground[] ={ 0,0,0,0.0}; text = ""; class Attributes { font = "Zeppelin33"; 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 = "Zeppelin33"; size = 0.03; colorText[] = { 1, 1, 0, 0.8}; colorBackground[] ={ 0,0,0,0.0}; text = ""; class Attributes { font = "Zeppelin33"; color = "#2B60DE"; align = "center"; valign = "middle"; shadow = "1"; shadowColor = "#000000"; size = "1"; }; }; }; }; /* Controls Definitions. */ #ifdef VANILLA /* Green */ #define subcolor1 {0.7,1,0.7,1} #define subcolor1hex "#b3ffb3" #define WFBE_SoundClick "ui\ui_ok" #define WFBE_SoundEnter "ui\ui_over" #define WFBE_SoundEscape "ui\ui_cc" #else /* Yellow */ #define subcolor1 {1,1,0.7,1} #define subcolor1hex "#ffffb3" #define WFBE_SoundClick "\ca\ui\data\sound\onclick" #define WFBE_SoundEnter "\ca\ui\data\sound\onover" #define WFBE_SoundEscape "\ca\ui\data\sound\onescape" #endif class RscPicture { type = 0; idc = -1; style = 48; colorText[] = {0.75, 0.75, 0.75, 1}; colorBackground[] = {0, 0, 0, 0}; font = "Bitstream"; sizeEx = 0.025; soundClick[] = {WFBE_SoundClick, 0.2, 1}; soundEnter[] = {WFBE_SoundEnter, 0.2, 1}; soundEscape[] = {WFBE_SoundEscape, 0.2, 1}; soundPush[] = {"", 0.2, 1}; w = 0.275; h = 0.04; text = ""; }; class RscShortcutButton { type = 16; idc = -1; style = 0; default = 0; w = 0.183825; h = 0.104575; color[] = {0.543, 0.5742, 0.4102, 1.0}; color2[] = {0.95, 0.95, 0.95, 1}; colorBackground[] = {1, 1, 1, 1}; colorbackground2[] = {1, 1, 1, 0.4}; colorDisabled[] = {1, 1, 1, 0.25}; periodFocus = 1.2; periodOver = 0.8; class HitZone { left = 0.004; top = 0.029; right = 0.004; bottom = 0.029; }; class ShortcutPos { left = 0.004; top = 0.026; w = 0.0392157; h = 0.0522876; }; class TextPos { left = 0.05; top = 0.034; right = 0.005; bottom = 0.005; }; animTextureNormal = "\ca\ui\data\ui_button_normal_ca.paa"; animTextureDisabled = "\ca\ui\data\ui_button_disabled_ca.paa"; animTextureOver = "\ca\ui\data\ui_button_over_ca.paa"; animTextureFocused = "\ca\ui\data\ui_button_focus_ca.paa"; animTexturePressed = "\ca\ui\data\ui_button_down_ca.paa"; animTextureDefault = "\ca\ui\data\ui_button_default_ca.paa"; textureNoShortcut = ""; period = 0.4; font = "Zeppelin32"; size = 0.03521; sizeEx = 0.03521; text = ""; soundEnter[] = {"\ca\ui\data\sound\mouse2", 0.09, 1}; soundPush[] = {"\ca\ui\data\sound\new1", 0.09, 1}; soundClick[] = {"\ca\ui\data\sound\mouse3", 0.07, 1}; soundEscape[] = {"\ca\ui\data\sound\mouse1", 0.09, 1}; action = ""; class Attributes { font = "Zeppelin32"; color = "#E5E5E5"; align = "left"; shadow = "true"; }; class AttributesImage { font = "Zeppelin32"; color = "#E5E5E5"; align = "left"; }; }; class RscIGUIShortcutButton : RscShortcutButton { w = 0.183825; h = 0.0522876; style = 2; color[] = {1, 1, 1, 1}; color2[] = {1, 1, 1, 0.85}; colorBackground[] = {1, 1, 1, 1}; colorbackground2[] = {1, 1, 1, 0.85}; colorDisabled[] = {1, 1, 1, 0.4}; class HitZone { left = 0.002; top = 0.003; right = 0.002; bottom = 0.016; }; class ShortcutPos { left = -0.006; top = -0.007; w = 0.0392157; h = 0.0522876; }; class TextPos { left = 0.02; top = 0.0; right = 0.002; bottom = 0.016; }; animTextureNormal = "\ca\ui\data\igui_button_normal_ca.paa"; animTextureDisabled = "\ca\ui\data\igui_button_disabled_ca.paa"; animTextureOver = "\ca\ui\data\igui_button_over_ca.paa"; animTextureFocused = "\ca\ui\data\igui_button_focus_ca.paa"; animTexturePressed = "\ca\ui\data\igui_button_down_ca.paa"; animTextureDefault = "\ca\ui\data\igui_button_normal_ca.paa"; class Attributes { font = "Zeppelin32"; color = "#E5E5E5"; align = "center"; shadow = "true"; }; }; class RscShortcutButtonMain: RscShortcutButton { w = 0.313726; h = 0.104575; color[] = {0.543, 0.5742, 0.4102, 1.0}; colorDisabled[] = {1, 1, 1, 0.25}; class HitZone { left = 0.0; top = 0.0; right = 0.0; bottom = 0.0; }; class ShortcutPos { left = 0.0204; top = 0.026; w = 0.0392157; h = 0.0522876; }; class TextPos { left = 0.08; top = 0.034; right = 0.005; bottom = 0.005; }; animTextureNormal = "\ca\ui\data\ui_button_main_normal_ca.paa"; animTextureDisabled = "\ca\ui\data\ui_button_main_disabled_ca.paa"; animTextureOver = "\ca\ui\data\ui_button_main_over_ca.paa"; animTextureFocused = "\ca\ui\data\ui_button_main_focus_ca.paa"; animTexturePressed = "\ca\ui\data\ui_button_main_down_ca.paa"; animTextureDefault = "\ca\ui\data\ui_button_main_normal_ca.paa"; period = 0.5; font = "Zeppelin32"; size = 0.03921; sizeEx = 0.03921; text = ""; soundEnter[] = {"\ca\ui\data\sound\mouse2", 0.09, 1}; soundPush[] = {"\ca\ui\data\sound\new1", 0.09, 1}; soundClick[] = {"\ca\ui\data\sound\mouse3", 0.07, 1}; soundEscape[] = {"\ca\ui\data\sound\mouse1", 0.09, 1}; action = ""; class Attributes { font = "Zeppelin32"; color = "#E5E5E5"; align = "left"; shadow = "false"; }; class AttributesImage { font = "Zeppelin32"; color = "#E5E5E5"; align = "false"; }; }; class RscListBox { idc = -1; type = 5; style = 0 + 0x10; font = "Zeppelin32"; sizeEx = 0.04221; color[] = {1, 1, 1, 1}; colorText[] = {1, 1, 1, 0.75}; colorScrollbar[] = {0.95, 0.95, 0.95, 1}; colorSelect[] = {0.95, 0.95, 0.95, 1}; colorSelect2[] = {0.95, 0.95, 0.95, 1}; colorSelectBackground[] = {0.6, 0.8392, 0.4706, 1.0}; colorSelectBackground2[] = {0.6, 0.8392, 0.4706, 1.0}; columns[] = {0.1, 0.7, 0.1, 0.1}; period = 0; colorBackground[] = {0, 0, 0, 1}; maxHistoryDelay = 1.0; autoScrollSpeed = -1; autoScrollDelay = 5; autoScrollRewind = 0; soundSelect[] = {"\ca\ui\data\sound\new1", 0.09, 1}; class ScrollBar { color[] = {1, 1, 1, 0.6}; colorActive[] = {1, 1, 1, 1}; colorDisabled[] = {1, 1, 1, 0.3}; thumb = "\ca\ui\data\igui_scrollbar_thumb_ca.paa"; arrowFull = "\ca\ui\data\igui_arrow_top_active_ca.paa"; arrowEmpty = "\ca\ui\data\igui_arrow_top_ca.paa"; border = "\ca\ui\data\igui_border_scroll_ca.paa"; }; }; class RscListBoxA : RscListBox { type = 102; lineSpacing = 1; sizeEx = 0.029; rowHeight = 0.03; style = 16; arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; }; class RscText { idc = -1; type = 0; x = 0; y = 0; h = 0.037; w = 0.3; style = 256; font = "Zeppelin32"; text = ""; SizeEx = 0.03921; colorText[] = {0.543, 0.5742, 0.4102, 1.0}; colorBackground[] = {0, 0, 0, 0}; }; class RscStructuredText { type = 13; idc = -1; style = 0; x = 0; y = 0; h = 0.035; w = 0.1; text = ""; size = 0.03421; colorText[] = subcolor1; class Attributes { font = "Zeppelin32"; color = subcolor1hex; align = "left"; shadow = true; }; }; class RscXSliderH { idc = -1; type = 43; style = 0x400 + 0x10; x = 0; y = 0; h = 0.029412; w = 0.4; color[] = {1, 1, 1, 0.4}; colorActive[] = {1, 1, 1, 1}; colorDisabled[] = {1, 1, 1, 0.2}; arrowEmpty = "\ca\ui\data\ui_arrow_left_ca.paa"; arrowFull = "\ca\ui\data\ui_arrow_left_active_ca.paa"; border = "\ca\ui\data\ui_border_frame_ca.paa"; thumb = "\ca\ui\data\ui_slider_bar_ca.paa"; }; class RscCombo { idc = -1; type = 4; style = 1; x = 0; y = 0; w = 0.3; h = 0.035; colorSelect[] = {0.023529, 0, 0.0313725, 1}; colorText[] = {0.023529, 0, 0.0313725, 1}; colorBackground[] = {0.95, 0.95, 0.95, 1}; colorSelectBackground[] = {0.543, 0.5742, 0.4102, 1.0}; colorScrollbar[] = {0.023529, 0, 0.0313725, 1}; arrowEmpty = "\ca\ui\data\ui_arrow_combo_ca.paa"; arrowFull = "\ca\ui\data\ui_arrow_combo_active_ca.paa"; wholeHeight = 0.45; color[] = {0, 0, 0, 0.6}; colorActive[] = {0, 0, 0, 1}; colorDisabled[] = {0, 0, 0, 0.3}; font = "Zeppelin32"; sizeEx = 0.031; soundSelect[] = {"\ca\ui\data\sound\new1", 0.09, 1}; soundExpand[] = {"\ca\ui\data\sound\new1", 0.09, 1}; soundCollapse[] = {"\ca\ui\data\sound\new1", 0.09, 1}; maxHistoryDelay = 1.0; class ScrollBar { color[] = {1, 1, 1, 0.6}; colorActive[] = {1, 1, 1, 1}; colorDisabled[] = {1, 1, 1, 0.3}; thumb = "\ca\ui\data\ui_scrollbar_thumb_ca.paa"; arrowFull = "\ca\ui\data\ui_arrow_top_active_ca.paa"; arrowEmpty = "\ca\ui\data\ui_arrow_top_ca.paa"; border = "\ca\ui\data\ui_border_scroll_ca.paa"; }; }; class RscClickableText { idc = -1; type = 11; style = 48 + 0x800; color[] = {0.75,0.75,0.75,1}; colorActive[] = {1,1,1,1}; colorBackground[] = {0.6, 0.8392, 0.4706, 1.0}; colorBackgroundSelected[] = {0.6, 0.8392, 0.4706, 1.0}; colorFocused[] = {0.0, 0.0, 0.0, 0}; font = "Zeppelin32"; sizeEx = 0.03921; soundClick[] = {WFBE_SoundClick,0.2,1}; soundDoubleClick[] = {"", 0.1, 1}; soundEnter[] = {WFBE_SoundEnter,0.2,1}; soundEscape[] = {WFBE_SoundEscape,0.2,1}; soundPush[] = {, 0.2, 1}; w = 0.275; h = 0.04; text = ""; }; class RscMapControl { type = 101; moveOnEdges = 1; sizeEx = 0.025; style = 48; x = 0.2; y = 0.2; w = 0.2; h = 0.2; ptsPerSquareSea = 8; ptsPerSquareTxt = 10; ptsPerSquareCLn = 10; ptsPerSquareExp = 10; ptsPerSquareCost = 10; ptsPerSquareFor = "6.0f"; ptsPerSquareForEdge = "15.0f"; ptsPerSquareRoad = "3f"; ptsPerSquareObj = 15; showCountourInterval = "false"; maxSatelliteAlpha = 0.75; alphaFadeStartScale = 0.15; alphaFadeEndScale = 0.29; colorLevels[] = {0.65, 0.6, 0.45, 1}; colorSea[] = {0.46, 0.65, 0.74, 0.5}; colorForest[] = {0.45, 0.64, 0.33, 0.5}; colorRocks[] = {0, 0, 0, 0.3}; colorCountlines[] = {0.85, 0.8, 0.65, 1}; colorMainCountlines[] = {0.45, 0.4, 0.25, 1}; colorCountlinesWater[] = {0.25, 0.4, 0.5, 0.3}; colorMainCountlinesWater[] = {0.25, 0.4, 0.5, 0.9}; colorPowerLines[] = {0.1, 0.1, 0.1, 1}; colorRailWay[] = {0.8, 0.2, 0, 1}; colorForestBorder[] = {0, 0, 0, 0}; colorRocksBorder[] = {0, 0, 0, 0}; colorNames[] = {0.1, 0.1, 0.1, 0.9}; colorInactive[] = {1, 1, 1, 0.5}; colorText[] = {0, 0, 0, 1}; colorBackground[] = {0.8, 0.8, 0.8, 1}; font = "EtelkaNarrowMediumPro"; colorOutside[] = {0, 0, 0, 1}; fontLabel = "Zeppelin32"; sizeExLabel = 0.034; fontGrid = "Zeppelin32"; sizeExGrid = 0.03; fontUnits = "Zeppelin32"; sizeExUnits = 0.034; fontNames = "Zeppelin32"; sizeExNames = 0.056; fontInfo = "Zeppelin32"; sizeExInfo = 0.034; fontLevel = "Zeppelin32"; sizeExLevel = 0.024; text = "\ca\ui\data\map_background2_co.paa"; class Task { icon = "\ca\ui\data\ui_taskstate_current_CA.paa"; iconCreated = "\ca\ui\data\ui_taskstate_new_CA.paa"; iconCanceled = "#(argb,8,8,3)color(0,0,0,0)"; iconDone = "\ca\ui\data\ui_taskstate_done_CA.paa"; iconFailed = "\ca\ui\data\ui_taskstate_failed_CA.paa"; color[] = {0.863, 0.584, 0.0, 1}; colorCreated[] = {0.95, 0.95, 0.95, 1}; colorCanceled[] = {0.606, 0.606, 0.606, 1}; colorDone[] = {0.424, 0.651, 0.247, 1}; colorFailed[] = {0.706, 0.0745, 0.0196, 1}; size = 27; importance = 1; coefMin = 1; coefMax = 1; }; class CustomMark { icon = "\ca\ui\data\map_waypoint_ca.paa"; color[] = {0.6471, 0.6706, 0.6235, 1.0}; size = 18; importance = 1; coefMin = 1; coefMax = 1; }; class Legend { x = "SafeZoneX"; y = "SafeZoneY"; w = 0.34; h = 0.152; font = "Zeppelin32"; sizeEx = 0.03921; colorBackground[] = {0.906, 0.901, 0.88, 0}; color[] = {0, 0, 0, 1}; }; class Bunker { icon = "\ca\ui\data\map_bunker_ca.paa"; size = 14; color[] = {0, 0, 1, 1}; importance = 1.5 * 14 * 0.05; coefMin = 0.25; coefMax = 4; }; class Bush { icon = "\ca\ui\data\map_bush_ca.paa"; color[] = {0.55, 0.64, 0.43, 1}; size = 14; importance = 0.2 * 14 * 0.05; coefMin = 0.25; coefMax = 4; }; class BusStop { icon = "\ca\ui\data\map_busstop_ca.paa"; color[] = {0, 0, 1, 1}; size = 12; importance = 1 * 10 * 0.05; coefMin = 0.25; coefMax = 4; }; class Command { icon = "\ca\ui\data\map_waypoint_ca.paa"; color[] = {0, 0.9, 0, 1}; size = 18; importance = 1; coefMin = 1; coefMax = 1; }; class Cross { icon = "\ca\ui\data\map_cross_ca.paa"; size = 16; color[] = {0, 0.9, 0, 1}; importance = 0.7 * 16 * 0.05; coefMin = 0.25; coefMax = 4; }; class Fortress { icon = "\ca\ui\data\map_bunker_ca.paa"; size = 16; color[] = {0, 0.9, 0, 1}; importance = 2 * 16 * 0.05; coefMin = 0.25; coefMax = 4; }; class Fuelstation { icon = "\ca\ui\data\map_fuelstation_ca.paa"; size = 16; color[] = {0, 0.9, 0, 1}; importance = 2 * 16 * 0.05; coefMin = 0.75; coefMax = 4; }; class Fountain { icon = "\ca\ui\data\map_fountain_ca.paa"; color[] = {0.2, 0.45, 0.7, 1}; size = 11; importance = 1 * 12 * 0.05; coefMin = 0.25; coefMax = 4; }; class Hospital { icon = "\ca\ui\data\map_hospital_ca.paa"; color[] = {0.78, 0, 0.05, 1}; size = 16; importance = 2 * 16 * 0.05; coefMin = 0.5; coefMax = 4; }; class Chapel { icon = "\ca\ui\data\map_chapel_ca.paa"; color[] = {0, 0, 1, 1}; size = 16; importance = 1 * 16 * 0.05; coefMin = 0.9; coefMax = 4; }; class Church { icon = "\ca\ui\data\map_church_ca.paa"; size = 16; color[] = {0, 0.9, 0, 1}; importance = 2 * 16 * 0.05; coefMin = 0.9; coefMax = 4; }; class Lighthouse { icon = "\ca\ui\data\map_lighthouse_ca.paa"; size = 14; color[] = {0, 0.9, 0, 1}; importance = 3 * 16 * 0.05; coefMin = 0.9; coefMax = 4; }; class Quay { icon = "\ca\ui\data\map_quay_ca.paa"; size = 16; color[] = {0, 0.9, 0, 1}; importance = 2 * 16 * 0.05; coefMin = 0.5; coefMax = 4; }; class Rock { icon = "\ca\ui\data\map_rock_ca.paa"; color[] = {0.1, 0.1, 0.1, 0.8}; size = 12; importance = 0.5 * 12 * 0.05; coefMin = 0.25; coefMax = 4; }; class Ruin { icon = "\ca\ui\data\map_ruin_ca.paa"; size = 16; color[] = {0, 0.9, 0, 1}; importance = 1.2 * 16 * 0.05; coefMin = 1; coefMax = 4; }; class SmallTree { icon = "\ca\ui\data\map_smalltree_ca.paa"; color[] = {0.45, 0.64, 0.33, 0.4}; size = 12; importance = 0.6 * 12 * 0.05; coefMin = 0.25; coefMax = 4; }; class Stack { icon = "\ca\ui\data\map_stack_ca.paa"; size = 20; color[] = {0, 0.9, 0, 1}; importance = 2 * 16 * 0.05; coefMin = 0.9; coefMax = 4; }; class Tree { icon = "\ca\ui\data\map_tree_ca.paa"; color[] = {0.45, 0.64, 0.33, 0.4}; size = 12; importance = 0.9 * 16 * 0.05; coefMin = 0.25; coefMax = 4; }; class Tourism { icon = "\ca\ui\data\map_tourism_ca.paa"; size = 16; color[] = {0.78, 0, 0.05, 1}; importance = 1 * 16 * 0.05; coefMin = 0.7; coefMax = 4; }; class Transmitter { icon = "\ca\ui\data\map_transmitter_ca.paa"; color[] = {0, 0.9, 0, 1}; size = 20; importance = 2 * 16 * 0.05; coefMin = 0.9; coefMax = 4; }; class ViewTower { icon = "\ca\ui\data\map_viewtower_ca.paa"; color[] = {0, 0.9, 0, 1}; size = 16; importance = 2.5 * 16 * 0.05; coefMin = 0.5; coefMax = 4; }; class Watertower { icon = "\ca\ui\data\map_watertower_ca.paa"; color[] = {0.2, 0.45, 0.7, 1}; size = 20; importance = 1.2 * 16 * 0.05; coefMin = 0.9; coefMax = 4; }; class Waypoint { icon = "\ca\ui\data\map_waypoint_ca.paa"; color[] = {0, 0, 1, 1}; size = 14; importance = 2.5 * 16 * 0.05; coefMin = 0.5; coefMax = 4; }; class WaypointCompleted { icon = "\ca\ui\data\map_waypoint_completed_ca.paa"; color[] = {0, 0, 1, 1}; size = 14; importance = 2.5 * 16 * 0.05; coefMin = 0.5; coefMax = 4; }; class ActiveMarker { icon = ""; color[] = {0, 0, 1, 1}; size = 14; importance = 2.5 * 16 * 0.05; coefMin = 0.5; coefMax = 4; }; }; //Vars westDeaths = 0; publicVariable "westDeaths"; //Caches #define cacheRadius 500 //AI #define intelRadius 400 #define vclCrewClass "TK_INS_Soldier_AT_EP1" #define staticClass "TK_INS_Soldier_3_EP1" #define eastVehiclesFreq ["BRDM2_TK_EP1","BRDM2_TK_EP1","M113_TK_EP1","M113_TK_EP1","BTR60_TK_EP1","BTR60_TK_EP1","LandRover_MG_TK_INS_EP1","LandRover_MG_TK_INS_EP1","LandRover_MG_TK_INS_EP1","LandRover_SPG9_TK_INS_EP1","LandRover_SPG9_TK_INS_EP1","T34_TK_EP1","T55_TK_EP1"] #define eastLightVehicles ["LandRover_MG_TK_INS_EP1","LandRover_SPG9_TK_INS_EP1"] #define stationaryGunsHigh ["KORD_high_UN_EP1","DSHKM_TK_INS_EP1"] #define stationaryGunsMed ["ZU23_TK_INS_EP1"] #define stationaryGunsLow ["AGS_TK_INS_EP1","ZU23_TK_INS_EP1"] #define eastVclRspnTime 600 #define eastVehicleNum 6 #define gunRoofPositions ["Land_dum_istan3",[[1,0.1]],"Land_dum_istan3_hromada2",[[7,0.1]],"Land_Barn_Metal", [[11,0.2],[10,0.1],[8,0.1]]] #define eastInfCount (count(centerPos nearObjects [eastInfClasses, AORadius])) #define maxStaticGuns 18 //Markers #define intelMarkerType "hd_unknown" //Misc #define isEast(X) (typeOf X in eastInfClasses) #define isWest(X) (typeOf X in westSoldierClasses) _time = time; _serviceTarget = objNull; serverLoadHint = false; _pGroup = group pilotController; _wCTime = time; _bCTime = time; while { true } do { call westVehicleChecker; call pilotAI; call vehicleService; call quickCleanup; call longCleanup; if (livesLeft == 0 && time > 30) then { if (nearestPlayers(centerPos,AORadius,true,"count") == 0) then { endMission "LOSER"; }; }; sleep 0.1; }; createHeliPilot = { call compile format[' %1 = _pGroup createUnit [PILOTTYPE, spawnPos, [], 0, "NONE"]; %1 setVehicleVarName "%1"; %1 ', _this]; }; pilotAI = { _pilot = "heliPilot"; if isNil _pilot then { _pilot call createHeliPilot; }; _pilot = call compile _pilot; if isNull _pilot then { _pilot = _pilot call createHeliPilot; }; if !alive _pilot then { deleteVehicle _pilot; _pilot = _pilot call createHeliPilot; }; _units = units group _pilot; if (!(pilotController in _units) && count _units == 1) then { [_pilot] join _pGroup; }; _vcl = vehicle _pilot; if (_vcl == _pilot) then { if (alive heli && heli distance startPos < 300) then { heli setDamage 0; heli setFuel 1; heli lockDriver false; _pilot assignAsDriver heli; _pilot moveInDriver heli; heli lockDriver true; }; } else { _stopped = _vcl getVariable "stopped"; _landing = _vcl getVariable "landing"; if !(pilotController in _units) exitWith { if !isNil "_stopped" then { _vcl setVariable ["stopped", nil]; }; if !isNil "_landing" then { _vcl setVariable ["landing", nil]; }; }; if (getPosATL _vcl select 2 < 5 && count crew _vcl > 1 && isEngineOn _vcl) exitWith { if !isNil "_stopped" exitWith {}; doStop _pilot; _vcl flyInHeight (getPosATL _vcl select 2); _vcl setVariable ["stopped", true]; }; if !isNil "_stopped" then { _vcl setVariable ["stopped", nil]; }; _movePos = expectedDestination _pilot select 0; if (_movePos select 0 == 0 && _vcl distance helipad > 200) exitWith { _vcl flyInHeight 30; _vcl doMove getPosATL helipad; }; if (_vcl distance helipad <= 200 && isEngineOn _vcl) exitWith { if (getPosATL _vcl select 2 < 2) exitWith { _pilot action ["EngineOff", _vcl]; }; if !isNil "_landing" exitWith {}; _vcl land "land"; _vcl setVariable ["landing", true]; }; if !isNil "_landing" then { _vcl setVariable ["landing", nil]; }; }; }; spawnAIVehicles = { for "_i" from 1 to eastVehicleNum do { call spawnVehicle; }; }; spawnVehicle = { _num = _i % 3; if (_num == 0) then { _num = 3; }; _grp = ["","vclGrp",_i+1,"east"] call getGroup; _type = eastVehiclesFreq select round(random (count eastVehiclesFreq - 1)); _obj = call compile ("vclSpawn" + str(_num)); _mkr = str _i; _pos = getPosATL _obj; _vcl = createVehicle [_type, _pos, [], 0, "None"]; _vcl setDir getDir _obj; _ai = _grp createUnit [vclCrewClass, _pos, [], 0, "None"]; _ai setRank (eastRanks select 2); _ai moveInDriver _vcl; _ai = _grp createUnit [vclCrewClass, _pos, [], 0, "None"]; _ai setRank (eastRanks select 3); _ai moveInGunner _vcl; if !(typeOf _vcl in eastLightVehicles) then { _vcl lockDriver true; _vcl lockTurret [[0], true]; }; _speed = "slow"; _track = ""; if (debug) then { _track = "track"; }; if (typeOf _vcl in eastLightVehicles) then { _speed = "noslow"; }; [leader _grp, _mkr, _speed, "nowait", _track] execVM "server\AI\UPS.sqf"; }; spawnAIGuns = { private "_id"; _houses = [centerPos,AORadius, 4] call findHouses; _gCount = 0; while{ _gCount < maxStaticGuns && count _houses > 0}do{ _house = _houses select random(count _houses - 1); _id = gunRoofPositions find (typeOf _house); if (_id != -1 && _house distance startLocation > 500) then { if (count nearestObjects[getPosATL _house, eastStationaryGuns, 800] == 0) then { call createRoofGun; _gCount = _gCount + 1; }; }; _houses = _houses - [_house]; }; _gCount }; createRoofGun = { private "_class"; _housePositions = gunRoofPositions select (_id+1); _housePosition = (_housePositions select random (count _housePositions - 1)) select 0; _classId = (_housePositions select random (count _housePositions - 1)) select 1; if (_classId <= 0.2) then { _class = stationaryGunsLow select random(count stationaryGunsLow - 1); }; if (_classId > 0.2 && _classId < 0.5) then { _class = stationaryGunsMed select random(count stationaryGunsMed - 1); }; if (_classId >= 0.5) then { _class = stationaryGunsHigh select random(count stationaryGunsHigh - 1); }; _gun = createVehicle [_class, spawnPos, [], 0, "None"]; for "_j" from 0 to 10 do { _gun addMagazine (magazines _gun select 0); }; _gun setPosATL (_house buildingPos _housePosition); _dir = ((getPosATL startLocation select 0) - (getPosATL _gun select 0)) atan2 ((getPosATL startLocation select 1) - (getPosATL _gun select 1)); _gun setDir _dir; _grp = ["static","Grp",str _gCount] call getGroup; _ai = _grp createUnit [staticClass, spawnPos, [], 0, "NONE"]; _ai assignAsGunner _gun; _ai moveInGunner _gun; _grp setFormDir _dir; if debug then { [_house, _ai] call createDebugMarker; }; }; // find a random position within a radius KRON_randomPos = { private["_cx","_cy","_rx","_ry","_cd","_sd","_ad","_tx","_ty","_xout","_yout"]; _cx=_this select 0; _cy=_this select 1; _rx=_this select 2; _ry=_this select 3; _cd=_this select 4; _sd=_this select 5; _ad=_this select 6; _tx=random (_rx*2)-_rx; _ty=random (_ry*2)-_ry; _xout=if (_ad!=0) then { _cx+ (_cd*_tx - _sd*_ty)} else { _cx+_tx}; _yout=if (_ad!=0) then { _cy+ (_sd*_tx + _cd*_ty)} else { _cy+_ty}; [_xout,_yout] }; // find any building (and its possible building positions) near a position KRON_PosInfo = { private["_pos","_lst","_bld","_bldpos"]; _pos=_this select 0; _lst= nearestObjects [_pos,["House","vbs2_house"],20]; if (count _lst==0) then { _bld=0; _bldpos=0} else { _bld=_lst select 0; _bldpos=[_bld] call KRON_BldPos}; [_bld,_bldpos]}; /// find the highest building position KRON_BldPos = { private ["_bld","_bi","_bldpos","_maxZ","_bp","_bz","_higher"]; _bld=_this select 0; _maxZ=0; _bi=0; _bldpos=0; while { _bi>=0} do { _bp = _bld BuildingPos _bi; if ((_bp select 0)==0) then { _bi=-99} else { _bz=_bp select 2; _higher = ((_bz>_maxZ) || ((abs(_bz-_maxZ)<.5) && (random 1>.5))); if ((_bz>4) && _higher) then { _maxZ=_bz; _bldpos=_bi}}; _bi=_bi+1}; _bldpos}; KRON_OnRoad = { private["_pos","_car","_tries","_lst"]; _pos=_this select 0; _car=_this select 1; _tries=_this select 2; _lst=_pos nearRoads 4; if ((count _lst!=0) && (_car || !(surfaceIsWater _pos))) then { _tries=99}; (_tries+1)}; KRON_getDirPos = { private["_a","_b","_from","_to","_return"]; _from = _this select 0; _to = _this select 1; _return = 0; _a = ((_to select 0) - (_from select 0)); _b = ((_to select 1) - (_from select 1)); if (_a != 0 || _b != 0) then { _return = _a atan2 _b}; if ( _return < 0 ) then { _return = _return + 360}; _return}; KRON_distancePosSqr = { (((_this select 0) select 0)-((_this select 1) select 0))^2 + (((_this select 0) select 1)-((_this select 1) select 1))^2}; KRON_relPos = { private["_p","_d","_a","_x","_y","_xout","_yout"]; _p=_this select 0; _x=_p select 0; _y=_p select 1; _d=_this select 1; _a=_this select 2; _xout=_x + sin(_a)*_d; _yout=_y + cos(_a)*_d; [_xout,_yout,0]}; KRON_rotpoint = { private["_cp","_a","_tx","_ty","_cd","_sd","_cx","_cy","_xout","_yout"]; _cp=_this select 0; _cx=_cp select 0; _cy=_cp select 1; _a=_this select 1; _cd=cos(_a*-1); _sd=sin(_a*-1); _tx=_this select 2; _ty=_this select 3; _xout=if (_a!=0) then { _cx+ (_cd*_tx - _sd*_ty)} else { _cx+_tx}; _yout=if (_a!=0) then { _cy+ (_sd*_tx + _cd*_ty)} else { _cy+_ty}; [_xout,_yout,0]}; KRON_stayInside = { private["_np","_nx","_ny","_cp","_cx","_cy","_rx","_ry","_d","_tp","_tx","_ty","_fx","_fy"]; _np=_this select 0; _nx=_np select 0; _ny=_np select 1; _cp=_this select 1; _cx=_cp select 0; _cy=_cp select 1; _rx=_this select 2; _ry=_this select 3; _d=_this select 4; _tp = [_cp,_d,(_nx-_cx),(_ny-_cy)] call KRON_rotpoint; _tx = _tp select 0; _fx=_tx; _ty = _tp select 1; _fy=_ty; if (_tx<(_cx-_rx)) then { _fx=_cx-_rx}; if (_tx>(_cx+_rx)) then { _fx=_cx+_rx}; if (_ty<(_cy-_ry)) then { _fy=_cy-_ry}; if (_ty>(_cy+_ry)) then { _fy=_cy+_ry}; if ((_fx!=_tx) || (_fy!=_ty)) then { _np = [_cp,_d*-1,(_fx-_cx),(_fy-_cy)] call KRON_rotpoint}; _np; }; KRON_getArg = { private["_cmd","_arg","_list","_a","_v"]; _cmd=_this select 0; _arg=_this select 1; _list=_this select 2; _a=-1; { _a=_a+1; _v=format["%1",_list select _a]; if (_v==_cmd) then { _arg=(_list select _a+1)}; } foreach _list; _arg }; KRON_deleteDead = { private["_u","_s"]; _u=_this select 0; _s= _this select 1; _u removeAllEventHandlers "killed"; sleep _s; hideBody _u; sleep 5; deletevehicle _u; }; KRON_AllWest=[]; KRON_AllEast=[]; KRON_AllRes=[]; KRON_KnownEnemy=[objNull,objNull]; { _s = side _x; switch (_s) do { case west: { KRON_AllWest=KRON_AllWest+[_x]; }; case east: { KRON_AllEast=KRON_AllEast+[_x]; }; case resistance: { KRON_AllRes=KRON_AllRes+[_x]; }; }; }forEach allUnits; if (isNil("KRON_UPS_Debug")) then { KRON_UPS_Debug=0}; KRON_HQ="Logic" createUnit [[0,0], group Server]; KRON_UPS_Instances=0; KRON_UPS_Total=0; KRON_UPS_Exited=0; // ========================================================================================================= // Urban Patrol Script // Version: 2.1.0 // Author: Kronzky (www.kronzky.info / kronzky@gmail.com) // Modified by pogoman for insurgency // --------------------------------------------------------------------------------------------------------- // Required parameters: // unit = Unit to patrol area (1st argument) // markername = Name of marker that covers the active area. (2nd argument) // (e.g. nul=[this,"town"] execVM "ups.sqf") // // Optional parameters: // nomove = Unit will stay at start position until enemy is spotted. // nofollow = Unit will only follow an enemy within the marker area. // delete:n = Delete dead units after 'n' seconds. // nowait = Do not wait at patrol end points. // noslow = Keep default behaviour of unit (don't change to "safe" and "limited"). // noai = Don't use enhanced AI for evasive and flanking maneuvers. // trigger = Display a message when no more units are left in sector. // empty:n = Consider area empty, even if 'n' units are left. // track = Display a position and destination marker for each unit. // // ========================================================================================================= // how far opfors should move away if they're under attack // set this to 200-300, when using the script in open areas (rural surroundings) #define SAFEDIST 75 // how close unit has to be to target to generate a new one #define CLOSEENOUGH 10 // how close units have to be to each other to share information #define SHAREDIST 100 // how long AI units should be in alert mode after initially spotting an enemy #define ALERTTIME 180 #define playerStrings ["Hitman111","Hitman112","Hitman113","Hitman114","Hitman115","Hitman121","Hitman122","Hitman123","Hitman124","Hitman125","Hitman131","Hitman132","Hitman133","Hitman134","Hitman135","Hitman141","Hitman142","Hitman143","Hitman144","Hitman145"] nearestPlayers = { private ["_result","_pos","_range","_type","_alive"]; _pos = _this select 0; _range = _this select 1; _alive = _this select 2; _type = _this select 3; if (_type == "count") then { _result = 0; } else { _result = []; }; { if (!isNil _x) then { _plr = call compile _x; if (!isNull _plr) then { if (_plr distance _pos <= _range && (alive _plr || !_alive)) then { if (_type == "count") then { _result = _result + 1; } else { _result = _result + [_plr]; }; }; }; }; } forEach playerStrings; _result }; #define nearestPlayers(W,X,Y,Z) ([W,X,Y,Z] call nearestPlayers) // --------------------------------------------------------------------------------------------------------- //echo format["[K] %1",_this]; // convert argument list to uppercase _UCthis = []; for [{ _i=0},{ _i0) then { { if (alive _x) then { _npc = _x; _exit = false; }} forEach _obj; }; }; // give this group a unique index _grpidx = format["%1",KRON_UPS_Instances]; _grpname = format["%1_%2",(side _npc),_grpidx]; // remember the original group members, so we can later find a new leader, in case he dies _members = units _npc; KRON_UPS_Total = KRON_UPS_Total + (count _members); // what type of "vehicle" is unit ? _isman = _npc isKindOf "Man"; _iscar = _npc isKindOf "vbs2_LandVehicles"; _isboat = _npc isKindOf "Ship"; _isplane = _npc isKindOf "Air"; // check to see whether group is an enemy of the player (for attack and avoidance maneuvers) // since countenemy doesn't count vehicles, and also only counts enemies if they're known, // we just have to brute-force it for now, and declare *everyone* an enemy who isn't a civilian _issoldier = side _npc != civilian; _friends=[]; _enemies=[]; _sharedenemy=0; //TODO: FIND A WAY TO DETERMINE ASSOCIATION OF RESISTANCE UNITS if (_issoldier) then { switch (side _npc) do { case west: { _friends=_friends+KRON_AllWest; _enemies=_enemies+KRON_AllEast+KRON_AllRes; _sharedenemy=0; }; case east: { _friends=_friends+KRON_AllEast; _enemies=_enemies+KRON_AllWest+KRON_AllRes; _sharedenemy=1; }; case resistance: { _enemies=_enemies+KRON_AllEast+KRON_AllWest; _sharedenemy=2; }; }; { _friends=_friends-[_x]; _x disableAI "autotarget"; } forEach _members; }; // global unit variable to externally influence script _named = false; _npcname = str(side _npc); if ("NAMED" in _UCthis) then { _named = true; _npcname = format["%1",_npc]; _grpidx = _npcname; }; // create global variable for this group call compile format ["KRON_UPS_%1=1",_npcname]; // store some trig calculations _cosdir=cos(_areadir); _sindir=sin(_areadir); // minimum distance of new target position if (_rangeX==0) exitWith { hint format["UPS: Cannot patrol Sector: %1\nArea Marker doesn't exist",_areaname]; }; _mindist=(_rangeX^2+_rangeY^2)/4; // remember the original mode & speed _orgMode = behaviour _npc; _orgSpeed = speedmode _npc; _speedmode = _orgSpeed; // set first target to current position (so we'll generate a new one right away) _currPos = getPosATL _npc; _orgPos = _currPos; _orgWatch=[_currPos,50,getDir _npc] call KRON_relPos; _orgDir = getDir _npc; _avoidPos = [0,0]; _flankPos = [0,0]; _attackPos = [0,0]; _dist = 0; _lastdist = 0; _lastmove1 = 0; _lastmove2 = 0; _maxmove=0; _moved=0; _damm=0; _dammchg=0; _lastdamm = 0; _timeontarget = 0; _fightmode = "walk"; _fm=0; _gothit = false; _hitPos=[0,0,0]; _react = 99; _lastdamage = 0; _lastknown = 0; _opfknowval = 0; _sin90=1; _cos90=0; _sin270=-1; _cos270=0; // set target tolerance high for choppers & planes _closeenough=CLOSEENOUGH*CLOSEENOUGH; if (_isplane) then { _closeenough=5000}; // ***************************************** optional arguments ***************************************** // wait at patrol end points _pause = if ("NOWAIT" in _UCthis) then { "NOWAIT"} else { "WAIT"}; // don't move until an enemy is spotted _nomove = if ("NOMOVE" in _UCthis) then { "NOMOVE"} else { "MOVE"}; // don't follow outside of marker area _nofollow = if ("NOFOLLOW" in _UCthis) then { "NOFOLLOW"} else { "FOLLOW"}; // share enemy info _shareinfo = if ("NOSHARE" in _UCthis) then { "NOSHARE"} else { "SHARE"}; // "area cleared" trigger activator _usetrigger = if ("TRIGGER" in _UCthis) then { "TRIGGER"} else { if ("NOTRIGGER" in _UCthis) then { "NOTRIGGER"} else { "SILENTTRIGGER"}}; // suppress fight behaviour if ("NOAI" in _UCthis) then { _issoldier=false}; // adjust cycle delay _cycle = ["CYCLE:",5,_UCthis] call KRON_getArg; // drop units at random positions _initpos = "ORIGINAL"; if ("RANDOM" in _UCthis) then { _initpos = "RANDOM"}; if ("RANDOMUP" in _UCthis) then { _initpos = "RANDOMUP"}; if ("RANDOMDN" in _UCthis) then { _initpos = "RANDOMDN"}; // don't position groups or vehicles on rooftops if ((_initpos!="ORIGINAL") && ((!_isman) || (count _members)>1)) then { _initpos="RANDOMDN"}; // set behaviour modes (or not) _noslow = if ("NOSLOW" in _UCthis) then { "NOSLOW"} else { "SLOW"}; if (_noslow!="NOSLOW") then { _npc setbehaviour "safe"; _npc setSpeedMode "limited"; _speedmode = "limited"; }; // track unit _track = if (("TRACK" in _UCthis) || (KRON_UPS_Debug>0)) then { "TRACK"} else { "NOTRACK"}; _trackername = ""; _destname = ""; if (_track=="TRACK") then { _track = "TRACK"; _trackername=format["trk_%1",_grpidx]; _markerobj = createMarker[_trackername,[0,0]]; _markerobj setMarkerShape "ICON"; _markertype = if (isClass(configFile >> "cfgMarkers" >> "WTF_Dot")) then { "WTF_DOT"} else { "DOT"}; _trackername setMarkerType _markertype; _markercolor = switch (side _npc) do { case west: { "ColorGreen"}; case east: { "ColorRed"}; case resistance: { "ColorBlue"}; default { "ColorBlack"}; }; _trackername setMarkerColor _markercolor; _trackername setMarkerText format["%1",_grpidx]; _trackername setmarkerpos _currPos; _trackername setMarkerSize [.5,.5]; _destname=format["dest_%1",_grpidx]; _markerobj = createMarker[_destname,[0,0]]; _markerobj setMarkerShape "ICON"; _markertype = if (isClass(configFile >> "cfgMarkers" >> "WTF_Flag")) then { "WTF_FLAG"} else { "FLAG"}; _destname setMarkerType _markertype; _destname setMarkerColor _markercolor; _destname setMarkerText format["%1",_grpidx]; _destname setMarkerSize [.5,.5]; }; // delete dead units _deletedead = ["DELETE:",0,_UCthis] call KRON_getArg; if (_deletedead>0) then { { _x addEventHandler['killed',format["[_this select 0,%1] spawn KRON_deleteDead",_deletedead]]}forEach _members; }; // init done _makenewtarget=true; _newpos=false; _targetPos = _currPos; _swimming = false; _waiting = if (_nomove=="NOMOVE") then { 9999} else { 0}; // exit if something went wrong during initialization (or if unit is on roof) if (_exit) exitWith { if ((KRON_UPS_DEBUG>0) && !_onroof) then { hint "Initialization aborted"}; }; _vcl = vehicle _npc; _grp = group _npc; // *********************************************************************************************************** // ************************************************ MAIN LOOP ************************************************ _loop=true; _currcycle=_cycle; while { _loop} do { sleep .01; // keep track of how long we've been moving towards a destination _timeontarget=_timeontarget+_currcycle; _react=_react+_currcycle; // did anybody in the group got hit? _newdamage=0; { if ((damage _x)>0.2) then { _newdamage=_newdamage+(damage _x); // damage has increased since last round if (_newdamage>_lastdamage) then { _lastdamage=_newdamage; _gothit=true; }; _hitPos= getPosATL _x; if (!alive _x) then { _members=_members-[_x]; _friends=_friends-[_x]; }; }; if (primaryWeapon _x == "") then { _members=_members-[_x]; _friends=_friends-[_x]; }; } forEach _members; sleep .01; // nobody left alive, exit routine if (count _members==0) then { _exit=true; server globalChat format["UPS group %1 all dead or surrendered", _grpidx]; } else { // did the leader die? if (!alive _npc || primaryWeapon _npc == "") then { _npc = _members select 0; group _npc selectLeader _npc; if (isPlayer _npc) then { _exit=true}; }; }; // current position _currPos = getPosATL _npc; _currX = _currPos select 0; _currY = _currPos select 1; if (_track=="TRACK") then { _trackername setmarkerpos _currPos; }; // if the AI is a civilian we don't have to bother checking for enemy encounters if ((_issoldier) && ((count _enemies)>0) && !(_exit)) then { // if the leader comes across another unit that's either injured or dead, go into combat mode as well. // If the other person is still alive, share enemy information. if ((_shareinfo=="SHARE") && (behaviour _npc=="SAFE")) then { _others=_friends-_members; { if ((!(isNull _x) && (_npc distance _x.5) || (behaviour _x in ["AWARE","COMBAT"]))) exitWith { _npc setBehaviour "aware"; _gothit=true; if ((_hitPos select 0)==0) then { _hitPos = getPosATL _x}; if (_npc knowsabout _x>3) then { if (alive _x) then { _npc reveal (KRON_KnownEnemy select _sharedenemy)}; }; }; }forEach _others; }; sleep .01; // did the group spot an enemy? _lastknown=_opfknowval; _opfknowval=0; _maxknowledge=0; { _knows=_npc knowsabout _x; if ((alive _x) && (_knows>0.2) && (_knows>_maxknowledge)) then { KRON_KnownEnemy set [_sharedenemy,_x]; _opfknowval=_opfknowval+_knows; _maxknowledge=_knows; }; if (!alive _x) then { _enemies=_enemies-[_x]}; if (_maxknowledge==4) exitWith {}; }forEach _enemies; sleep .01; _pursue=false; _accuracy=100; // opfor spotted an enemy or got shot, so start pursuit if (_opfknowval>_lastknown || _gothit) then { _npc setbehaviour "combat"; _pursue=true; // make the exactness of the target dependent on the knowledge about the shooter _accuracy=21-(_maxknowledge*5); }; if (isNull (KRON_KnownEnemy select _sharedenemy)) then { _pursue=false; }; // don't react to new fatalities if less than 60 seconds have passed since the last one if ((_react<60) && (_fightmode!="walk")) then { _pursue=false}; if (_pursue) then { // get position of spotted unit in player group, and watch that spot _offsx=_accuracy/2-random _accuracy; _offsY=_accuracy/2-random _accuracy; _targetPos = getPosATL (KRON_KnownEnemy select _sharedenemy); _targetPos = [(_targetPos select 0) + _offsX, (_targetPos select 1) + _offsY]; _targetX = _targetPos select 0; _targetY = _targetPos select 1; { _x dowatch _targetPos} foreach units _npc; sleep .01; // also go into "combat mode" _npc setSpeedMode "full"; _speedmode = "full"; _npc setbehaviour "combat"; _pause="NOWAIT"; _waiting=0; // angle from unit to target _dir1 = [_currPos,_targetPos] call KRON_getDirPos; // angle from target to unit (reverse direction) _dir2 = (_dir1+180) mod 360; // angle from fatality to target _dir3 = if (_hitPos select 0!=0) then { [_hitPos,_targetPos] call KRON_getDirPos} else { _dir1}; _dd=(_dir1-_dir3); // unit position offset straight towards target _relUX = sin(_dir1)*SAFEDIST; _relUY = cos(_dir1)*SAFEDIST; // target position offset straight towards unit _relTX = sin(_dir2)*SAFEDIST; _relTY = cos(_dir2)*SAFEDIST; // go either left or right (depending on location of fatality - or randomly if no fatality) _sinU=_sin90; _cosU=_cos90; _sinT=_sin270; _cosT=_cos270; if ((_dd<0) || (_dd==0 && (random 1)>.5)) then { _sinU=_sin270; _cosU=_cos270; _sinT=_sin90; _cosT=_cos90}; // avoidance position (right or left of unit) _avoidX = _currX + _cosU*_relUX - _sinU*_relUY; _avoidY = _currY + _sinU*_relUX + _cosU*_relUY; _avoidPos = [_avoidX,_avoidY]; // flanking position (right or left of target) _flankX = _targetX + _cosT*_relTX - _sinT*_relTY; _flankY = _targetY + _sinT*_relTX + _cosT*_relTY; _flankPos = [_flankX,_flankY]; // final target position _attackPos = _targetPos; // for now we're stepping a bit to the side _targetPos = _avoidPos; if (_nofollow=="NOFOLLOW") then { _avoidPos = [_avoidPos,_centerpos,_rangeX,_rangeY,_areadir] call KRON_stayInside; _flankPos = [_flankPos,_centerpos,_rangeX,_rangeY,_areadir] call KRON_stayInside; _attackPos = [_attackPos,_centerpos,_rangeX,_rangeY,_areadir] call KRON_stayInside; _targetPos = [_targetPos,_centerpos,_rangeX,_rangeY,_areadir] call KRON_stayInside; }; _react=0; _fightmode="fight"; _timeontarget=0; _fm=1; if (KRON_UPS_Debug!=0) then { "dead" setmarkerpos _hitPos; "avoid" setmarkerpos _avoidPos; "flank" setmarkerpos _flankPos; "target" setmarkerpos _attackPos; }; _newpos=true; // speed up the cycle duration after an incident if (_currcycle>=_cycle) then { _currcycle=1}; }; }; sleep .01; if !(_newpos) then { // calculate new distance // if we're waiting at a waypoint, no calculating necessary if (_waiting<=0) then { // distance to target _dist = [_currPos,_targetPos] call KRON_distancePosSqr; if (_lastdist==0) then { _lastdist=_dist}; _moved = abs(_dist-_lastdist); // adjust the target tolerance for fast moving vehicles if (_moved>_maxmove) then { _maxmove=_moved; if ((_maxmove/40) > _closeenough) then { _closeenough=_maxmove/40}}; // how much did we move in the last three cycles? _totmove=_moved+_lastmove1+_lastmove2; _damm = damage _npc; // is our damage changing (increasing)? _dammchg = abs(_damm - _lastdamm); // we're either close enough, seem to be stuck, or are getting damaged, so find a new target if ((!_swimming) && ((_dist<=_closeenough) || (_totmove<.2) || (_dammchg>0.01) || (_timeontarget>ALERTTIME))) then { _makenewtarget=true; }; // in 'attack (approach) mode', so follow the flanking path (don't make it too predictable though) if ((_fightmode!="walk") && (_dist<=_closeenough)) then { if ((random 1)<.95) then { if (_flankPos select 0!=0) then { _targetPos=_flankPos; _flankPos=[0,0]; _makenewtarget=false; _newpos=true; _fm=1; } else { if (_attackPos select 0!=0) then { _targetPos=_attackPos; _attackPos=[0,0]; _makenewtarget=false; _newpos=true; _fm=2; }; }; }; }; sleep .01; // make new target if (_makenewtarget) then { if ((_nomove=="NOMOVE") && (_timeontarget>ALERTTIME)) then { if (([_currPos,_orgPos] call KRON_distancePosSqr)<_closeenough) then { _newpos = false; } else { _targetPos=_orgPos; }; } else { // re-read marker position/size _npc call _getAreaInfo; // find a new target that's not too close to the current position _targetPos=_currPos; _tries=0; while { ((([_currPos,_targetPos] call KRON_distancePosSqr) < _mindist)) && (_tries<20)} do { _tries=_tries+1; // generate new target position (on the road) _tries=0; while { _tries<20} do { _targetPos=[_centerX,_centerY,_rangeX,_rangeY,_cosdir,_sindir,_areadir] call KRON_randomPos; _roadlist = _targetPos nearRoads 2000; if (count _roadlist>0) then { _targetPos = getPosATL (_roadlist select 0); }; _tries=99; //_road=[_targetPos,(_isplane||_isboat),_road] call KRON_OnRoad; sleep .01; }; }; }; _avoidPos = [0,0]; _flankPos = [0,0]; _attackPos = [0,0]; _gothit=false; _hitPos=[0,0,0]; _fm=0; _npc setSpeedMode _orgSpeed; _newpos=true; // if we're waiting at patrol end points then don't create a new target right away. Keep cycling though to check for enemy encounters if ((_pause!="NOWAIT") && (_waiting<0)) then { _waiting = (15 + random 20)}; }; }; }; sleep .01; // if in water, get right back out of it again if (surfaceIsWater _currPos) then { if (_isman && !_swimming) then { _drydist=999; // look around, to find a dry spot for [{ _a=0}, { _a<=270}, { _a=_a+90}] do { _dp=[_currPos,30,_a] call KRON_relPos; if !(surfaceIsWater _dp) then { _targetPos=_dp}; }; _newpos=true; _swimming=true; }; } else { _swimming=false; }; _waiting = _waiting - _currcycle; if ((_waiting<=0) && _newpos) then { // tell unit about new target position if (_fightmode!="walk") then { // reset patrol speed after following enemy for a while if (_timeontarget>ALERTTIME) then { _fightmode="walk"; _speedmode = _orgSpeed; { _vcl = vehicle _npc; if (_vcl != _npc && !(_x in _vcl)) then { _x moveInCargo _vcl; _x assignAsCargo _vcl; }; _x setSpeedMode _speedmode; _x setBehaviour _orgMode; }forEach _members; }; // use individual doMoves if pursuing enemy, // as otherwise the group breaks up too much { _x doMove _targetPos}forEach _members; } else { (group _npc) move _targetPos; (group _npc) setSpeedMode _speedmode; }; if (_track=="TRACK") then { switch (_fm) do { case 1: { _destname setmarkerSize [.4,.4]}; case 2: { _destname setmarkerSize [.6,.6]}; default { _destname setmarkerSize [.5,.5]}; }; _destname setMarkerPos _targetPos; }; _dist=0; _moved=0; _lastmove1=10; _waiting=-1; _newpos=false; _swimming=false; _timeontarget = 0; }; // move on _lastdist = _dist; _lastmove2 = _lastmove1; _lastmove1 = _moved; _lastdamm = _damm; // check external loop switch _cont = (call compile format ["KRON_UPS_%1",_npcname]); if (_cont==0) then { _exit=true}; _makenewtarget=false; if ((_exit) || (isNil("_npc"))) then { _loop=false; } else { // slowly increase the cycle duration after an incident if (_currcycle<_cycle) then { _currcycle=_currcycle+.5}; sleep _currcycle; }; }; if !(isNil("_npc")) then { { doStop _x; _x domove getPosATL _x; _x move getPosATL _x} forEach _members; }; KRON_UPS_Exited=KRON_UPS_Exited+1; if (_track=="TRACK") then { _trackername setMarkerType "Dot"; _destname setMarkerType "Empty"; }; _friends=nil; _enemies=nil; if (_vcl isKindOf "LandVehicle") then { sleep 300; _i = call compile _areamarker; call spawnVehicle; }; cacheKilled = { _pos = getPosATL(_this); _time = time; _dur = 5 + random 5; "ARTY_R_227mm_HE" createVehicle _pos; while{ true }do{ "Warfare82mmMortar" createVehicle _pos; if (random 100 > 70) then { "Sh_125_HE" createVehicle _pos; }; if ((time - _time) > _dur) exitWith { "ARTY_R_227mm_HE" createVehicle _pos; }; sleep random 1; }; { deleteMarker _x; } forEach cacheMarkers(_this); deleteVehicle _this; sleep 1; _count = count cacheList; [nil,nil,rHINT, parseText format["%1/%2 ammo cache's have been destroyed!", cacheCount - _count, cacheCount]] call RE; if (_count == 0) then { [nil,nil,rSPAWN,[],{ titleText["All ammo cache's have been destroyed! Superman mode enabled...", "PLAIN"]; debug = true; }] call RE; }; }; setupCaches = { private ["_cachePos", "_cacheHouse","_i","_cache"]; _cacheHouses = [centerPos, AORadius, 6] call findHouses; for "_i" from 1 to cacheCount do { server globalChat format["cache%1 spawning...", _i]; _cache = createVehicle [cacheType, spawnPos, [], 0, "None"]; call compile format[' _cache setVehicleInit " this setVehicleVarName ""cache%1""; cache%1 = this; clearWeaponCargo this; clearMagazineCargo this; "; ', _i]; _cache addEventHandler["Killed", { (_this select 0) spawn cacheKilled; }]; while { true } do { _cacheHouse = _cacheHouses select random(count _cacheHouses - 1); _type = typeOf _cacheHouse; _nWestUnits = nearestObjects[getPosATL _cacheHouse, westSoldierClasses+[cacheType], cacheRadius]; if (count _nWestUnits == 0 && _type in cacheHousePositions) exitWith { _id = cacheHousePositions find _type; _positions = cacheHousePositions select (_id+1); _cachePos = _cacheHouse buildingPos (_positions select random(count _positions - 1)); }; _cacheHouses = _cacheHouses - [_cacheHouse]; }; _cache setPosATL _cachePos; _cacheHouse addEventHandler ["handleDamage", { _damage = _this select 2; _cache = getPosATL (_this select 0) nearestObject cacheType; if (_damage > 0.9) then { _cache setDamage 1; }; _damage }]; if debug then { [_cache, format["cache%1", _i]] call createDebugMarker; }; }; processInitCommands; }; quickCleanup = { if (time - _wCTime < 10) exitWith {}; _wCTime = time; { if (nearestPlayers(getPosATL _x,wepDespawnRange,true,"count") == 0 && nearestMen(getPosATL _x,wepDespawnRange,true,"count") == 0) then { if (typeOf _x == "Suitcase") exitWith { deleteVehicle _x; }; if (typeOf _x == "WeaponHolder") exitWith { deleteVehicle _x; }; if (typeOf _x == "Land_BagFenceRound") exitWith { _x setPosATL spawnPos; }; if ((_x isKindOf "StaticWeapon" || typeOf _x == "CraterLong") && nearestPlayers(getPosATL _x,spawnRange,true,"count") == 0) exitWith { deleteVehicle _x; }; if (!alive _x && (_x isKindOf "LandVehicle" || _x isKindOf "Air") && nearestPlayers(getPosATL _x,spawnRange,false,"count") == 0) exitWith { deleteVehicle _x; }; if (locked _x) exitWith {}; _cargoTypes = (getWeaponCargo _x) select 0; for "_i" from 0 to (count _cargoTypes - 1) do { _wep = _cargoTypes select _i; if (_wep in limitedGearList) then { [_x,_wep,0] call setWeaponCargo; }; }; }; sleep 0.005; } forEach nearestObjects[centerPos,["CraterLong","Suitcase","WeaponHolder","ReammoBox","AllVehicles","Land_BagFenceRound"],AORadius]; }; longCleanup = { if (time - _bCTime < 600) exitWith {}; _bCTime = time; { if (damage _x > 0.1 && damage _x < 1) then { _wUnits = nearestPlayers(getPosATL _x,spawnRange,true,"array"); if (count _wUnits > 0 && arrCanSee(_wUnits,getPosATL _x,45,200)) exitWith {}; _x setDamage 1; sleep 0.001; }; } forEach nearestObjects[centerPos,["House"],AORadius]; { if !alive _x then { if (nearestPlayers(getPosATL _x,spawnRange,true,"count") == 0) then { deleteVehicle _x; }; sleep 0.001; }; } forEach nearestObjects[centerPos,["Man"],AORadius]; { if (count units _x == 0) then { deleteGroup _x; }; sleep 0.001; } forEach allGroups; };gunRoofPositions retrieved using: gunPositions = []; _gunHouses = [getPosATL center, AORadius, 4] call findHouses; for "_i" from 0 to (count _gunHouses - 1) do { _house = _gunHouses select _i; _type = typeOf _house; _highPosList = highPosList(_house); _arr = []; if!(_type in gunPositions) then { for "_j" from 0 to (count _highPosList - 1) do { _checkPos = _house buildingPos (_highPosList select _j); _dir = ((getPosATL startLocation select 0) - (_checkPos select 0)) atan2 ((getPosATL startLocation select 1) - (_checkPos select 1)); if (call posIsOutdoors && !([_checkPos, _dir, 1] call viewBlocked)) then { _class = -1; for "_h" from 0 to 1 step 0.1 do { if!([_checkPos, _dir, _h] call viewBlocked) exitWith { _class = _h; }; }; _arr = _arr + [[(_highPosList select _j),_class]]; }; }; if (count _arr > 0) then { gunPositions = gunPositions + [_type] + [_arr]; }; }; server globalChat format["gunHouse %1 of %2 done", _i+1, count _gunHouses]; copyToClipboard str gunPositions; }; for "_i" from 0 to (count gunRoofPositions - 1) step 2 do { _type = gunRoofPositions select _i; _arr = gunRoofPositions select (_i+1); _hse = nearestObjects[getPosATL player, [_type], 3000] select 0; for "_j" from 0 to (count _arr - 1) do { _arr2 = _arr select _j; _id = _arr2 select 0; _h = _arr2 select 1; player setPosATL (_hse buildingPos _id); player groupChat str _h; waitUntil { !wait}; wait=true; }; }; cacheInsidePositions retrieved using: cachePositions = []; _cacheHouses = [centerPos, AORadius, 3] call findHouses; for "_i" from 0 to (count _cacheHouses - 1) do { _house = _cacheHouses select _i; _type = typeOf _house; _nPos = nPos(_house); _highPosList = highPosList(_house); _arr = []; if!(_type in cachePositions || ((boundingBox _house select 1) select 2) > 15 || _type in cacheHousePositions) then { for "_j" from 0 to (count _highPosList - 1) do { _checkPos = _house buildingPos (_highPosList select _j); if (call posIsIndoors) then { _arr = _arr + [(_highPosList select _j)]; }; }; if (count _arr <= 1) then { for "_j" from 0 to (_nPos - 1) do { if!(_j in _highPosList) then { _checkPos = _house buildingPos _j; if!(_j in _arr) then { if (call posIsIndoors) then { _arr = _arr + [_j]; }; }; }; }; }; if (count _arr > 0) then { cachePositions = cachePositions + [_type] + [_arr]; }; }; server globalChat format["cacheHouse %1 of %2 done (%3)", _i+1, count _cacheHouses, _type]; copyToClipboard str cachePositions; }; some functions used: findHighPositions = { private "_i"; _house = _this select 0; _arr = _this select 1; _i = _this select 2; _hPos = format["%1", _house buildingPos _i]; if (_hPos == "[0,0,0]") exitWith { _arr}; _hPos = call compile _hPos; if (_hPos select 2 > 2) then { _arr set [count _arr, _i]; }; [_house, _arr, _i+1] call findHighPositions; }; #define highPosList(X) ([X,[],0] call findHighPositions) posIsIndoors = { private "_i"; _indoors = true; _dir = getDir _house; for "_i" from 0 to 360 step 90 do { _bullet = createVehicle ["B_9x18_Ball", [0,0,100], [], 0, "NONE"]; _bullet setPosATL [_checkPos select 0,_checkPos select 1,(_checkPos select 2) + 0.1]; _bullet setVelocity [(sin (_i+_dir))*25,(cos (_i+_dir))*25,30]; _d = 0; waitUntil { if (getPosATL _bullet select 0 != 0) then { _d = getPosATL _bullet select 2; }; _d >= 10 || getPosATL _bullet select 0 == 0}; if (_d >= 10) then { _bullet = createVehicle ["B_9x18_Ball", [0,0,100], [], 0, "NONE"]; _bullet setPosATL [_checkPos select 0,_checkPos select 1,(_checkPos select 2) + 0.3]; _bullet setVelocity [(sin (_i+_dir))*25,(cos (_i+_dir))*25,0]; _d = 0; waitUntil { if (getPosATL _bullet select 0 != 0) then { _d = _bullet distance _checkPos; }; _d >= 4 || getPosATL _bullet select 0 == 0}; if (_d >= 4) then { _indoors = false; }; }; if (!_indoors) exitWith {}; }; _indoors }; posIsOutdoors = { private "_i"; _outdoors = true; for "_i" from 0 to 360 step 90 do { _bullet = createVehicle ["B_9x18_Ball", [0,0,100], [], 0, "NONE"]; _bullet setPosATL _checkPos; _bullet setVelocity [(sin _i)*10,(cos _i)*10,30]; _d = 0; waitUntil { if (getPosATL _bullet select 0 != 0) then { _d = getPosATL _bullet select 2; }; _d >= 10 || getPosATL _bullet select 0 == 0}; if (_d < 10) exitWith { _outdoors = false; }; }; _outdoors }; viewBlocked = { _pos = _this select 0; _dir = _this select 1; _lvl = _this select 2; _blocked = 0; for "_i" from (_dir - 22.5) to (_dir + 22.5) step 22.5 do { _bullet = createVehicle ["B_9x18_Ball", [0,0,100], [], 0, "NONE"]; _bullet setPosATL [(_pos select 0)-(sin _i)*2, (_pos select 1)-(sin _i)*2, (_pos select 2)+_lvl]; _bullet setVelocity [(sin _i)*30, (cos _i)*30, 0]; _d = 0; waitUntil { if (getPosATL _bullet select 0 > 0) then { _d = _bullet distance _pos; }; _d >= 10 || isNull _bullet}; if (_d < 10) then { _blocked = _blocked + 1; }; }; if (_blocked <= 1) then { false} else { true}; }; createIntel = { _cache = _this; _i = 0; while{ (getMarkerPos format["%1intel%2", _cache, _i] select 0) != 0}do{ _i = _i + 1; }; _sign = 1; if (random 100 > 50) then { _sign = -1; }; _sign2 = 1; if (random 100 > 50) then { _sign2 = -1; }; _radius = intelRadius-_i*50; if (_radius < 50) then { _radius = 50; }; _pos = [ (getPosATL _cache select 0) + _sign*(random _radius), (getPosATL _cache select 1) + _sign2*(random _radius)]; _mkr = createMarker[format["%1intel%2", _cache, _i], _pos]; _mkr setMarkerType intelMarkerType; _range = round sqrt(_radius^2*2); _range = _range - (_range % 50); _mkr setMarkerText format["%1m", _range]; _mkr setMarkerColor "ColorRed"; _mkr setMarkerSize [0.5,0.5]; }; westVehicleChecker = { if (!alive MHQ && startLocation == MHQ) exitWith { _vcl = createVehicle [MHQTYPE, spawnPos, [], 0, "None"]; _vcl setVehicleInit format["this setVehicleVarName ""%1""; %1 = this;", "MHQ"]; processInitCommands; HQ setDir (getDir vehicleServicePoint + 90); _pos = vehicleServicePoint modelToWorld [10,0,0]; _pos set [2,0]; HQ setPosATL _pos; }; private ["_i","_vcl"]; for "_i" from 0 to (count westVehicleStrings - 2) do { _str = westVehicleStrings select _i; if (startLocation != HQ) exitWith {}; if isNil _str then { call initWestVehicle; } else { _vcl = call compile _str; if (isNull _vcl || !alive _vcl) then { call initWestVehicle; } else { scopeName "main"; _range = 400; if (typeOf _vcl == ATVTYPE) then { _range = 30; }; _plrs = nearestPlayers(getPosATL _vcl,spawnRange,false,"array"); if (alive _vcl && !arrCanSee(_plrs,_vcl,45,_range) && _vcl distance startLocation > 100) then { _driver = driver _vcl; if (!isNull _driver) then { if (side _driver != EAST && alive _driver) exitWith { breakTo "main"; }; }; { moveOut _x; } forEach (crew _vcl); call initWestVehicle; }; }; }; sleep 0.01; }; if (startLocation != HQ) exitWith {}; _pos = startLocation modelToWorld [0,15,0]; _pos set [2,0]; if (helipad distance _pos > 1) then { helipad setPosATL _pos; helipad setDir (getDir startLocation - 90); }; _pos = startLocation modelToWorld [0,-10,0]; _pos set [2,0]; if (vehicleServicePoint distance _pos > 1) then { vehicleServicePoint setPosATL _pos; vehicleServicePoint setDir (getDir startLocation - 90); }; _pos = startLocation modelToWorld [6,0,0]; _pos set [2,0]; if (fieldHospital distance _pos > 1) then { fieldHospital setPosATL _pos; fieldHospital setDir (getDir startLocation); }; }; initWestVehicle = { _id = _i % 4; _type = if (_id % 2 == 1) then { CAR1TYPE } else { CAR2TYPE }; _pos = startLocation modelToWorld [-10,-10+_id*6,0]; _dir = getDir startLocation - 90; if (_i >= 4) then { _type = ATVTYPE; _pos = startLocation modelToWorld [-10,-7+_id*6,0]; }; if (_i >= 8) then { _type = HELITYPE; _pos = getPosATL helipad; _pos set [2,0]; _dir = getDir helipad; }; _bool = isNil _str; if !_bool then { _bool = isNull _vcl || !alive _vcl; }; if _bool then { _objs = nearestObjects[_pos,["LandVehicle","Air","CraterLong"],20]; if (count _objs > 0) then { { if (!(_x isKindOf "AllVehicles") || !alive _x) then { deleteVehicle _x; }; } forEach _objs; }; _vcl = createVehicle [_type, spawnPos, [], 0, "None"]; _vcl setVehicleInit format["this setVehicleVarName ""%1""; %1 = this;", _str]; _vcl setDir _dir; _vcl setPosATL _pos; if (_i < 4) then { _vcl call setVclAmmoCargo; }; processInitCommands; } else { _vcl setDamage 0; _vcl setFuel 1; _vcl engineOn false; _vcl setDir _dir; _vcl setPosATL _pos; }; }; setWeaponCargo = { _vcl = _this select 0; _wep = _this select 1; _num = _this select 2; _cargo = getWeaponCargo _vcl; _arr1 = _cargo select 0; _id = _arr1 find _wep; if (_id == -1) exitWith {}; _arr1 set[_id, str _wep]; _arr2 = (_cargo select 1); _arr2 set[_id, 0]; _cargo = [_arr1,_arr2]; _count = count _arr2; call compile format[' _vcl setVehicleInit " clearWeaponCargo this; for ""_i"" from 0 to (%2 - 1) do { _wep = (%1 select 0) select _i; _num = (%1 select 1) select _i; this addWeaponCargo [_wep,_num]; }; "; processInitCommands; ', _cargo, _count]; }; vehicleService = { _vcls = nearestObjects [(vehicleServicePoint modelToWorld [-6,0,1]), westVehicleClasses, 4]; if (count _vcls == 0) exitWith { if !isNull _serviceTarget then { _serviceTarget = objNull; }; }; if (_vcls select 0 == _serviceTarget || speed (_vcls select 0) != 0) exitWith {}; _serviceTarget = _vcls select 0; _serviceTarget call setVclAmmoCargo; processInitCommands; }; setVclAmmoCargo = { _this setVehicleInit ' this setVehicleAmmo 1; this setFuel 1; this setDamage 0; clearWeaponCargo this; clearMagazineCargo this; { this addMagazineCargo [_x select 0, _x select 1]; } forEach humvMagazines; if (player in crew this) then { titleText["Vehicle serviced.", "PLAIN DOWN"]; }; '; };