├── .github └── ISSUE_TEMPLATE.md ├── Data └── Co_ops_loadingImage.paa ├── GitHub_data └── Co-ops_logo.png ├── Init.sqf ├── LICENSE ├── README.md ├── defines.hpp ├── description.ext ├── functions ├── core │ ├── AI │ │ ├── fn_AIOccupyBuilding.sqf │ │ ├── fn_AISkill.sqf │ │ └── fn_mainAOSpawnHandler.sqf │ ├── airReinforcements.sqf │ ├── fn_sideMissionSelection.sqf │ ├── getAllTownsAndVillages.sqf │ ├── missionSelection.sqf │ ├── serverSide_functions_compile.sqf │ └── smRewards.sqf ├── functions.hpp ├── misc │ ├── commonGUIDefines.hpp │ ├── crewNameDefines.hpp │ ├── fn_VA_filter.sqf │ ├── fn_arrayShuffle.sqf │ ├── fn_baseCleaning.sqf │ ├── fn_cleaner.sqf │ ├── fn_crewNames.sqf │ ├── fn_curatorPingedEH.sqf │ ├── fn_daytime.sqf │ ├── fn_diary.sqf │ ├── fn_findItemList.sqf │ ├── fn_gearLimitations.sqf │ ├── fn_globalHint_handler.sqf │ ├── fn_hintC.sqf │ ├── fn_mapLinesHandler.sqf │ ├── fn_paradrop.sqf │ ├── fn_pilotCheck.sqf │ ├── fn_randomPos.sqf │ ├── fn_remoteAddCuratorEditableObjects.sqf │ └── fn_shortNights.sqf ├── missions │ └── mission1 │ │ └── mission1_clearTown.sqf ├── portedFuncs │ └── cba │ │ ├── fn_addPerFrameHandler.sqf │ │ ├── fn_directCall.sqf │ │ ├── fn_execNextFrame.sqf │ │ ├── fn_getTurret.sqf │ │ ├── fn_pfhPostInit.sqf │ │ ├── fn_pfhPreInit.sqf │ │ ├── fn_removePerFrameHandler.sqf │ │ ├── fn_waitAndExecute.sqf │ │ ├── fn_waitUntilAndExecute.sqf │ │ └── init_perFrameHandler.sqf ├── revive │ ├── fn_ace3Check.sqf │ ├── fn_adjustForTerrain.sqf │ ├── fn_animChanged.sqf │ ├── fn_carrying.sqf │ ├── fn_diaryEntries.sqf │ ├── fn_dragging.sqf │ ├── fn_drawDowned.sqf │ ├── fn_dropPerson.sqf │ ├── fn_executeTemplates.sqf │ ├── fn_handleDamage.sqf │ ├── fn_heartBeatPFH.sqf │ ├── fn_hotkeyHandler.sqf │ ├── fn_onPlayerKilled.sqf │ ├── fn_onPlayerRespawn.sqf │ ├── fn_reviveActions.sqf │ ├── fn_reviveTimer.sqf │ ├── fn_startCarrying.sqf │ ├── fn_startDragging.sqf │ ├── fn_switchState.sqf │ ├── fn_syncAnim.sqf │ └── fn_uiElements.sqf ├── side missions │ ├── cachesSM.sqf │ ├── comTowerSM.sqf │ ├── droppedCargoSM.sqf │ ├── droppedCargoSM_actionPFH.sqf │ ├── fn_droppedCargoSM_action.sqf │ ├── officerMurderSM.sqf │ ├── specOpsSM.sqf │ ├── truckRetrievalSM.sqf │ └── uavDownedSM.sqf ├── taw_vd │ ├── GUI.h │ ├── defines.h │ ├── fn_onChar.sqf │ ├── fn_onSavePressed.sqf │ ├── fn_onSaveSelectionChanged.sqf │ ├── fn_onSliderChanged.sqf │ ├── fn_onTerrainChanged.sqf │ ├── fn_openMenu.sqf │ ├── fn_openSaveManager.sqf │ ├── fn_stateTracker.fsm │ └── fn_updateViewDistance.sqf └── vehicle_handler │ ├── fn_quadInit.sqf │ ├── fn_quadPFH.sqf │ ├── fn_vehicleInit.sqf │ ├── fn_vehiclePFH.sqf │ └── fn_vehicleSetup.sqf ├── initPlayerLocal.sqf ├── initServer.sqf ├── mission.sqm ├── onPlayerRespawn.sqf └── scripts └── misc ├── QS_icons.sqf ├── groundService.sqf ├── heloService.sqf ├── planeService.sqf └── uavService.sqf /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Arma 3 Version:** `x.xx` (stable / rc / dev)
2 | **Co-ops version** `x.xx` (beta / release) 3 | 4 | **Client mods:** 5 | 6 | 7 | **Server mods:** 8 | 9 | 10 | **Description:** 11 | - Add a detailed description of the error. Pleeeeease add details. 12 | 13 | **Steps to reproduce:** 14 | - Add the steps needed to reproduce the issue. 15 | 16 | **Where did the issue occur?** 17 | - Dedicated / Self-Hosted Multiplayer / Singleplayer / Editor (Singleplayer) / Editor (Multiplayer) 18 | 19 | **RPT log file:** 20 | - Add a link ([gist](https://gist.github.com) or [pastebin](http://pastebin.com)) to the client and/or server RPT file. An instruction to find your RPT files can be found [here](https://community.bistudio.com/wiki/Crash_Files#Arma_3). 21 | - **DON'T SEND SERVER RPTS PLEASE, JUST CLIENTS** 22 | -------------------------------------------------------------------------------- /Data/Co_ops_loadingImage.paa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alganthe/Co-ops/5a2e4bb51c5a080de7c7ba8228a9f6124ce32540/Data/Co_ops_loadingImage.paa -------------------------------------------------------------------------------- /GitHub_data/Co-ops_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alganthe/Co-ops/5a2e4bb51c5a080de7c7ba8228a9f6124ce32540/GitHub_data/Co-ops_logo.png -------------------------------------------------------------------------------- /Init.sqf: -------------------------------------------------------------------------------- 1 | enableSaving [false, false]; 2 | 3 | //---------------------------------- Mission vars (for all clients) 4 | derp_PARAM_AOSize = "AOSize" call BIS_fnc_getParamValue; 5 | derp_PARAM_AOFinishEnemyPercentage = "AOFinishEnemyPercentage" call BIS_fnc_getParamValue; 6 | derp_PARAM_AntiAirAmount = "AntiAirAmount" call BIS_fnc_getParamValue; 7 | derp_PARAM_MRAPAmount = "MRAPAmount" call BIS_fnc_getParamValue; 8 | derp_PARAM_InfantryGroupsAmount = "InfantryGroupsAmount" call BIS_fnc_getParamValue; 9 | derp_PARAM_AAGroupsAmount = "AAGroupsAmount" call BIS_fnc_getParamValue; 10 | derp_PARAM_ATGroupsAmount = "ATGroupsAmount" call BIS_fnc_getParamValue; 11 | derp_PARAM_RandomVehcsAmount = "RandomVehcsAmount" call BIS_fnc_getParamValue; 12 | 13 | derp_PARAM_AIAimingAccuracy = "AIAimingAccuracy" call BIS_fnc_getParamValue; 14 | derp_PARAM_AIAimingShake = "AIAimingShake" call BIS_fnc_getParamValue; 15 | derp_PARAM_AIAimingSpeed = "AIAimingSpeed" call BIS_fnc_getParamValue; 16 | derp_PARAM_AISpotingDistance = "AISpotingDistance" call BIS_fnc_getParamValue; 17 | derp_PARAM_AISpottingSpeed = "AISpottingSpeed" call BIS_fnc_getParamValue; 18 | derp_PARAM_AICourage = "AICourage" call BIS_fnc_getParamValue; 19 | derp_PARAM_AIReloadSpeed = "AIReloadSpeed" call BIS_fnc_getParamValue; 20 | derp_PARAM_AICommandingSkill = "AICommandingSkill" call BIS_fnc_getParamValue; 21 | derp_PARAM_AIGeneralSkill = "AIGeneralSkill" call BIS_fnc_getParamValue; 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |

6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

23 | 24 | Co-ops is a vanilla mission based on PFHs being ported to vanilla. 25 | Features: 26 | - A custom revive system 27 | - A custom vehicle handler 28 | - A custom set of functions to limit equipment 29 | - Easy to install 30 | - Highly customizable 31 | - Automatic AO generation using towns, cities and villages already present on the map 32 | - 6 different types of side missions 33 | - Easy to port to other maps 34 | - Made with performance in mind 35 | 36 | Credits: 37 | - The [CBA team](https://github.com/CBATeam/CBA_A3) for the glorious PFHs. 38 | - Quicksilver for the player tracker. 39 | -------------------------------------------------------------------------------- /description.ext: -------------------------------------------------------------------------------- 1 | //-------------------------On Load 2 | author = "alganthe"; // Visible when loading mission 3 | onLoadName = "Co-ops"; // Visible when loading mission 4 | OnLoadMission = ""; 5 | loadScreen = ""; 6 | overviewPicture = "Data\Co_ops_loadingImage.paa"; 7 | 8 | onLoadIntro = ""; // Displays a message while the intro is loading. 9 | onLoadIntroTime = 0; // Time and date displayed while the intro loads. 1 visible, 0 hidden. 10 | onLoadMissionTime = 0; // Time and date displayed while the mission loads. 1 visible, 0 hidden. 11 | 12 | class Header { 13 | gameType = COOP; // Unknown, COOP, DM, TDM, CTF, SC, CTI, RPG, Sandbox, Seize, Defend. 14 | minPlayers = 1; // Min # of players the MISSION supports 15 | maxPlayers = 69; // Max # of players the MISSION supports, not server slots. Make sure # is greater than server slots. 16 | }; 17 | 18 | //-------------------------Misc 19 | disableChannels[] = {{0, true, true}, {1, false, true}, {2, true, true}, {6, true, true}}; // 0 = Global, 1 = Side, 2 = Command, 3 = Group, 4 = Vehicle, 5 = Direct, 6 = System. Admin/server/BattlEye can still use Global. 20 | disabledAI = 1; // No AI in playable units 21 | aiKills = 0; // disable scorelist for AI players 22 | enableItemsDropping = 0; // disabled with 0 23 | joinUnassigned = 1; // 0 = players forced into role on join 24 | enableDebugConsole = 1; // 0 = editor default behavior, 1 = SP / Hosts / Logged admin, 2 = everyone 25 | 26 | //-------------------------Respawn 27 | class CfgRespawnTemplates { 28 | class derp_revive { 29 | // Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file 30 | onPlayerKilled = "derp_revive_fnc_onPlayerKilled"; 31 | // Function or script executed upon respawn. Parameters passed into it are the same as are passed into onPlayerRespawn.sqf file 32 | onPlayerRespawn = "derp_revive_fnc_onPlayerRespawn"; 33 | // Default respawn delay (can be overwitten by description.ext entry of the same name) 34 | respawnDelay = 10; 35 | // 1 to respawn player when he joins the game. Available only for INSTANT and BASE respawn types 36 | // Can be overridden by description.ext attribute of the same name 37 | respawnOnStart = -1; 38 | }; 39 | }; 40 | 41 | respawn = 3; 42 | respawnDelay = 10; 43 | respawnOnStart = 0; 44 | respawnTemplates[] = {"MenuPosition", __EVAL(call compile preprocessFileLineNumbers "functions\revive\fn_ace3Check.sqf")}; 45 | // Remove the eval if you desire to use an other vanilla revive system, it's used to detect the ACE3 revive system and enable or not derp_revive 46 | 47 | derp_revive_bleedOutTimer = 300; 48 | derp_revive_maxSafeDamage = 0.95; 49 | derp_revive_downedDamageTreshold = 1.5; // Downed state can only be entered between 1 and this treshold, over it you die 50 | derp_revive_everyoneCanRevive = 0; // 0 = medics only, 1 = everyone 51 | derp_revive_reviveItem = 0; // 0 = first aid kit, 1 = medikit 52 | derp_revive_removeFAKOnUse = 1; // 0 = don't remove on use, 1 = remove on use 53 | 54 | //-------------------------Functions 55 | #include "functions\misc\commonGUIDefines.hpp" 56 | #include "functions\taw_vd\GUI.h" 57 | 58 | class CfgFunctions { 59 | #include "functions\functions.hpp" 60 | }; 61 | 62 | //---------------------------Mission Parameters 63 | class Params { 64 | 65 | class Daytime { 66 | title = $STR_a3_cfgvehicles_moduledate_f_arguments_hour_0; 67 | values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}; 68 | texts[] = {"00:00", "01:00","02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"}; 69 | default = 5; 70 | function = "derp_fnc_daytime"; 71 | }; 72 | 73 | class DayDuration { 74 | title = "Day duration"; 75 | values[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 36, 48}; 76 | texts[] = {"24 hours", "12 hours", "8 hours", "6 hours", "4 hours", "3 hours", "2 hours", "1 hour 30 minutes", "1 hour", "40 minutes", "30 minutes"}; 77 | default = 6; 78 | }; 79 | 80 | class ShortNights { 81 | title = "Enable shorter nights?"; 82 | texts[] = {"No", "Yes"}; 83 | values[] = {0, 1}; 84 | default = 0; 85 | }; 86 | 87 | class staminaEnabled { 88 | title = "Enable player stamina ?"; 89 | texts[] = {"No", "Yes"}; 90 | values[] = {0, 1}; 91 | default = 1; 92 | }; 93 | 94 | class EnableRespawn { 95 | title = "Enable respawn?"; 96 | texts[] = {"No", "Yes"}; 97 | values[] = {0, 1}; 98 | default = 1; 99 | }; 100 | 101 | class ArsenalFilter { 102 | title = "Filter mode of the arsenal"; 103 | texts[] = {"Arsenal disabled", "Arsenal enabled but filtered", "Arsenal enabled"}; 104 | values[] = {0, 1, 2}; 105 | default = 1; 106 | }; 107 | 108 | class paraJumpEnabled { 109 | title = "Enable para jumps on AO?"; 110 | texts[] = {"No", "Yes"}; 111 | values[] = {0, 1}; 112 | default = 1; 113 | }; 114 | 115 | class mapDrawingEnabled { 116 | title = "Enable map drawing?"; 117 | texts[] = {"No", "Yes"}; 118 | values[] = {0, 1}; 119 | default = 0; 120 | }; 121 | 122 | class VehicleRespawnDistance { 123 | title = "Distance from players that vehicles won't respawn"; 124 | values[] = {10, 50, 100, 200, 300, 400, 500, 1000, 2000, 5000, 10000}; 125 | texts[] = {"10m", "50m", "100m", "200m", "300m", "400m", "500m", "1km", "2km", "5km", "10km"}; 126 | default = 1000; 127 | }; 128 | 129 | class AOSize { 130 | title = "Size of the AOs"; 131 | values[] = {500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 1800, 2000}; 132 | texts[] = {"500m", "600m", "700m", "800m", "900m", "1km", "1.2km", "1.4km", "1.6km", "1.8km", "2km"}; 133 | default = 1000; 134 | }; 135 | 136 | class AOFinishEnemyPercentage { 137 | title = "Percentage of enemies left to complete the AO"; 138 | values[] = {50, 40, 30, 20, 15, 10, 5}; 139 | texts[] = {"50%", "40%", "30%", "20%", "15%", "10%", "5%"}; 140 | default = 10; 141 | }; 142 | 143 | class MissionAmount { 144 | title = "Amount of AOs before mission ends"; 145 | values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 146 | texts[] = {"Disabled", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; 147 | default = 0; 148 | }; 149 | 150 | class smRewardAfter { 151 | title = "Amount of side missions before recieving a reward"; 152 | values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 153 | texts[] = {"Rewards disabled", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; 154 | default = 1; 155 | }; 156 | 157 | class AntiAirAmount { 158 | title = "Amount of AA vehicles on the main AO"; 159 | default = 2; 160 | values[] = {0, 1, 2, 3, 4, 5, 6}; 161 | texts[] = {"0", "1", "2", "3", "4", "5", "6"}; 162 | }; 163 | 164 | class MRAPAmount { 165 | title = "Amount of MRAPs on the main AO"; 166 | values[] = {0 ,1, 2, 3, 4, 5, 6}; 167 | texts[] = {"0" ,"1", "2", "3", "4", "5", "6"}; 168 | default = 2; 169 | }; 170 | 171 | class RandomVehcsAmount { 172 | title = "Amount of random vehicles on the main AO"; 173 | values[] = {0 ,1, 2, 3, 4, 5, 6}; 174 | texts[] = {"1", "2", "3", "4", "5", "6"}; 175 | default = 2; 176 | }; 177 | 178 | class InfantryGroupsAmount { 179 | title = "Amount of infantry groups on the main AO"; 180 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 181 | texts[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; 182 | default = 8; 183 | }; 184 | 185 | class AAGroupsAmount { 186 | title = "Amount of AA groups on the main AO"; 187 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 188 | texts[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; 189 | default = 4; 190 | }; 191 | 192 | class ATGroupsAmount { 193 | title = "Amount of AT groups on the main AO"; 194 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 195 | texts[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; 196 | default = 2; 197 | }; 198 | 199 | class airReinforcementTimer { 200 | title = "Enemy air reinforcements timer"; 201 | values[] = {300, 600, 900}; 202 | texts[] = {"5 minutes", "10 minutes", "15 minutes"}; 203 | default = 600; 204 | }; 205 | 206 | class AIAimingAccuracy { 207 | title = "AI aiming accuracy"; 208 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 209 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 210 | default = 2; 211 | }; 212 | 213 | class AIAimingShake { 214 | title = "AI aiming shake"; 215 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 216 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 217 | default = 2; 218 | }; 219 | 220 | class AIAimingSpeed { 221 | title = "AI aiming speed"; 222 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 223 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 224 | default = 2; 225 | }; 226 | 227 | class AISpotingDistance { 228 | title = "AI spotting distance"; 229 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 230 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 231 | default = 5; 232 | }; 233 | 234 | class AISpottingSpeed { 235 | title = "AI spotting speed"; 236 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 237 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 238 | default = 2; 239 | }; 240 | 241 | class AICourage { 242 | title = "AI courage"; 243 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 244 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 245 | default = 10; 246 | }; 247 | 248 | class AIReloadSpeed { 249 | title = "AI reload speed"; 250 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 251 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 252 | default = 5; 253 | }; 254 | 255 | class AICommandingSkill { 256 | title = "AI commanding skill"; 257 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 258 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 259 | default = 7; 260 | }; 261 | 262 | class AIGeneralSkill { 263 | title = "AI general skill"; 264 | values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 265 | texts[] = {"0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1"}; 266 | default = 8; 267 | }; 268 | }; 269 | 270 | //-------------------------UI stuff 271 | class RscTitles { 272 | #include "functions\misc\crewNameDefines.hpp" // Occupants HUD for vehicles 273 | }; 274 | 275 | //---------------------------Tasks 276 | class CfgTaskEnhancements { 277 | enable = 1; //0: disable new task features (default), 1: enable new task features & add new task markers and task widgets into the map 278 | 3d = 0; //0: do not use new 3D markers (default), 1: replace task waypoints with new 3D markers 279 | 3dDrawDist = 2000; //3d marker draw distance (default: 2000) 280 | share = 0; //0: do not count assigned players (default), 1: count how many players have the task assigned 281 | propagate = 0; //0: do not propagate (default), 1: propagate shared tasks to subordinates 282 | }; 283 | 284 | class CfgSounds { 285 | sounds[] = {}; 286 | class derp_heartBeat1 { 287 | name = "derp_heart1"; 288 | sound[] = {"@A3\sounds_f\characters\human-sfx\other\heart_4_1", 1, 1}; 289 | titles[] = {0, ""}; 290 | }; 291 | 292 | class derp_heartBeat2 { 293 | name = "derp_heart2"; 294 | sound[] = {"@A3\sounds_f\characters\human-sfx\other\heart_4_3", 1, 1}; 295 | titles[] = {0, ""}; 296 | }; 297 | 298 | class derp_heartBeat3 { 299 | name = "derp_heart3"; 300 | sound[] = {"@A3\sounds_f\characters\human-sfx\other\heart_4_4", 1, 1}; 301 | titles[] = {0, ""}; 302 | }; 303 | 304 | class derp_heartBeat4 { 305 | name = "derp_heart4"; 306 | sound[] = {"@A3\sounds_f\characters\human-sfx\other\heart_4_5", 1, 1}; 307 | titles[] = {0, ""}; 308 | }; 309 | }; 310 | -------------------------------------------------------------------------------- /functions/core/AI/fn_AIOccupyBuilding.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Garrison function used to garrison AI inside buildings. 4 | * 5 | * Arguments: 6 | * 0: The building(s) nearest this position are used 7 | * 1: Limit the building search to those type of building 8 | * 2: Units that will be garrisoned 9 | * 3: Radius to fill building(s) default: 50 10 | * 4: 0: even filling, 1: building by building, 2: random filling default: 0 11 | * 5: True to fill building(s) from top to bottom default: false 12 | * Return Value: 13 | * Array of units not garrisoned 14 | * 15 | * Public: Yes 16 | * 17 | * Example: 18 | * [position, nil, [unit1, unit2, unit3, unitN], 200, 1, false] call ace_common_fnc_garrison 19 | */ 20 | params [["_startingPos",[0,0,0], [[]], 3], ["_buildingTypes", ["Building"], [[]]], ["_unitsArray", [], [[]]], ["_fillingRadius", 50, [0]], ["_fillingType", 0, [0]], ["_topDownFilling", false, [true]]]; 21 | 22 | _unitsArray = _unitsArray select {alive _x && {!isPlayer _x}}; 23 | 24 | if (_startingPos isEqualTo [0,0,0]) exitWith { 25 | diag_log "[derp_AIOccupyBuilding] Error: Position provided is invalid"; 26 | }; 27 | 28 | if (count _unitsArray == 0 || {isNull (_unitsArray select 0)}) exitWith { 29 | diag_log "[derp_AIOccupyBuilding] Error: No unit provided"; 30 | }; 31 | 32 | private _buildings = []; 33 | 34 | if (_fillingRadius < 50) then { 35 | _buildings = nearestObjects [_startingPos, _buildingTypes, 50]; 36 | } else { 37 | _buildings = nearestObjects [_startingPos, _buildingTypes, _fillingRadius]; 38 | _buildings = _buildings call BIS_fnc_arrayShuffle; 39 | }; 40 | 41 | if (count _buildings == 0) exitWith { 42 | diag_log "[derp_AIOccupyBuilding] Error: No valid building found"; 43 | }; 44 | 45 | private _buildingsIndexes = []; 46 | 47 | if (_topDownFilling) then { 48 | { 49 | private _buildingPos = _x buildingPos -1; 50 | 51 | // Those reverse are necessary, as dumb as it is there's no better way to sort those subarrays in sqf 52 | { 53 | reverse _x; 54 | } foreach _buildingPos; 55 | 56 | _buildingPos sort false; 57 | 58 | { 59 | reverse _x; 60 | } foreach _buildingPos; 61 | 62 | _buildingsIndexes pushBack _buildingPos; 63 | } foreach _buildings; 64 | } else { 65 | { 66 | _buildingsIndexes pushBack (_x buildingPos -1); 67 | } foreach _buildings; 68 | }; 69 | 70 | // Remove buildings without positions 71 | { 72 | _buildingsIndexes deleteAt (_buildingsIndexes find _x); 73 | } foreach (_buildingsIndexes select {count _x == 0}); 74 | 75 | // Warn the user that there's not enough positions to place all units 76 | private _count = 0; 77 | {_count = _count + count _x} foreach _buildingsIndexes; 78 | private _leftOverAICount = (count _unitsArray) - _count; 79 | if (_leftOverAICount > 0) then { 80 | diag_log "[derp_AIOccupyBuilding] Warning: not enough positions to place all units"; 81 | }; 82 | 83 | private _placedUnits = []; 84 | 85 | // Do the placement 86 | switch (_fillingType) do { 87 | case 0: { 88 | while {count _unitsArray > 0} do { 89 | if (count _buildingsIndexes == 0) exitWith {}; 90 | 91 | private _building = _buildingsIndexes select 0; 92 | 93 | if (_building isEqualTo []) then { 94 | _buildingsIndexes deleteAt 0; 95 | } else { 96 | private _pos = _building select 0; 97 | 98 | private _nearestUnits = (_pos nearEntities ["CAManBase", 1]); 99 | if (count _nearestUnits > 0 && {count (_nearestUnits select {getPos _x select 2 == _pos select 2}) > 0}) then { 100 | _buildingsIndexes set [0, _building - [_pos]]; 101 | 102 | } else { 103 | private _unit = _unitsArray select 0; 104 | _unit setPos _pos; 105 | _placedUnits pushBack _unit; 106 | _unitsArray deleteAt (_unitsArray find _unit); 107 | _building deleteAt 0; 108 | _buildingsIndexes deleteAt 0; 109 | _buildingsIndexes pushBackUnique _building; 110 | }; 111 | }; 112 | }; 113 | }; 114 | 115 | case 1: { 116 | while {count _unitsArray > 0} do { 117 | if (count _buildingsIndexes == 0) exitWith {}; 118 | 119 | private _building = _buildingsIndexes select 0; 120 | 121 | if (_building isEqualTo []) then { 122 | _buildingsIndexes deleteAt 0; 123 | } else { 124 | private _pos = _building select 0; 125 | 126 | private _nearestUnits = (_pos nearEntities ["CAManBase", 1]); 127 | if (count _nearestUnits > 0 && {count (_nearestUnits select {getPos _x select 2 == _pos select 2}) > 0}) then { 128 | _buildingsIndexes set [0, _building - [_pos]]; 129 | 130 | } else { 131 | private _unit = _unitsArray select 0; 132 | _unit setPos _pos; 133 | _placedUnits pushBack _unit; 134 | _unitsArray deleteAt (_unitsArray find _unit); 135 | _buildingsIndexes set [0, _building - [_pos]]; 136 | }; 137 | }; 138 | }; 139 | }; 140 | 141 | case 2: { 142 | while {count _unitsArray > 0} do { 143 | if (count _buildingsIndexes == 0) exitWith {}; 144 | 145 | private _building = selectRandom _buildingsIndexes; 146 | 147 | if (_building isEqualTo []) then { 148 | _buildingsIndexes deleteAt (_buildingsIndexes find _building); 149 | } else { 150 | private _pos = selectRandom _building; 151 | 152 | private _nearestUnits = (_pos nearEntities ["CAManBase", 1]); 153 | if (count _nearestUnits > 0 && {count (_nearestUnits select {getPos _x select 2 == _pos select 2}) > 0}) then { 154 | _buildingsIndexes set [(_buildingsIndexes find _building), _building - [_pos]]; 155 | 156 | } else { 157 | private _unit = _unitsArray select 0; 158 | _unit setPos _pos; 159 | _unitsArray deleteAt (_unitsArray find _unit); 160 | _placedUnits pushBack _unit; 161 | _buildingsIndexes set [(_buildingsIndexes find _building), _building - [_pos]]; 162 | }; 163 | }; 164 | }; 165 | }; 166 | }; 167 | 168 | { 169 | _x disableAI "AUTOCOMBAT"; 170 | _x disableAI "PATH"; 171 | } foreach _placedUnits; 172 | 173 | _unitsArray 174 | -------------------------------------------------------------------------------- /functions/core/AI/fn_AISkill.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Set the mission parameter defined skill values for an array of units. 4 | * 5 | * Arguments: 6 | * 0: Array of units to change 7 | * 8 | * Return Value: 9 | * NOTHING 10 | */ 11 | params ["_AIArray"]; 12 | 13 | { 14 | _x setSkill ["general", (derp_PARAM_AIGeneralSkill / 10)]; 15 | _x setSkill ["aimingAccuracy", (derp_PARAM_AIAimingAccuracy / 10)]; 16 | _x setSkill ["aimingShake", (derp_PARAM_AIAimingShake / 10)]; 17 | _x setSkill ["aimingSpeed", (derp_PARAM_AIAimingSpeed / 10)]; 18 | _x setSkill ["spotDistance", (derp_PARAM_AISpotingDistance / 10)]; 19 | _x setSkill ["spotTime", (derp_PARAM_AISpottingSpeed / 10)]; 20 | _x setSkill ["courage", (derp_PARAM_AICourage / 10)]; 21 | _x setSkill ["reloadSpeed", (derp_PARAM_AIReloadSpeed / 10)]; 22 | _x setSkill ["commanding", (derp_PARAM_AICommandingSkill / 10)]; 23 | } foreach _AIArray; 24 | -------------------------------------------------------------------------------- /functions/core/AI/fn_mainAOSpawnHandler.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Handles creating the AI 5 | * 6 | * Arguments: 7 | * 0: Position of the mission 8 | * 1: 9 | * 1: Place AA vehicles 10 | * 2: Place MRAPS 11 | * 3: Place random vehcs 12 | * 4: Place infantry groups 13 | * 5: Place AA groups 14 | * 6: Place AT groups 15 | * 7: Place urban groups 16 | * 8: Place infantry in milbuildings 17 | * 2: AA vehicles amount (OPTIONNAL) 18 | * 3: MRAPs amount (OPTIONNAL) 19 | * 4: Random vehcs amount (OPTIONNAL) 20 | * 5: Infantry groups amount (OPTIONNAL) 21 | * 6: AA groups amount (OPTIONNAL) 22 | * 7: AT groups amount (OPTIONNAL) 23 | * 8: Urban groups amount (OPTIONNAL) 24 | * 25 | * Return Value: 26 | * Array of units created if executed on the server 27 | * Nothing if executed anywhere else (it publicVarServer the array of spawned units instead) 28 | * 29 | * Example: 30 | * 31 | *[_pos, [true, true, false, true, true, true, true, false], 2, 1, 3, 5, 1, 1, 3] call derp_fnc_mainAOSpawnHandler; 32 | */ 33 | params ["_AOpos", "_settingsArray", ["_radiusSize", derp_PARAM_AOSize], ["_AAAVehcAmount", derp_PARAM_AntiAirAmount], ["_MRAPAmount", derp_PARAM_MRAPAmount], ["_randomVehcsAmount", derp_PARAM_RandomVehcsAmount], ["_infantryGroupsAmount", derp_PARAM_InfantryGroupsAmount], ["_AAGroupsAmount", derp_PARAM_AAGroupsAmount], ["_ATGroupsAmount", derp_PARAM_ATGroupsAmount], ["_urbanInfantryAmount", 2]]; 34 | 35 | _settingsArray params [["_AAAVehcSetting", false], ["_MRAPSetting", false], ["_randomVehcsSetting", false], ["_infantryGroupsSetting", false], ["_AAGroupsSetting", false], ["_ATGroupsSetting", false], ["_urbanInfantrySetting", false], ["_milbuildingInfantry", false]]; 36 | 37 | private _spawnedUnits = []; 38 | private _AISkillUnitsArray = []; 39 | 40 | //-------------------------------------------------- AA vehicles 41 | if (_AAAVehcSetting) then { 42 | for "_x" from 1 to _AAAVehcAmount do { 43 | private _randomPos = ([_AOpos, _radiusSize / 1.2, "(1 + meadow) * (1 - sea) * (1 - houses)"] call derp_fnc_randomPos) param [0]; 44 | private _AAVehicle = (selectRandom AAVehicleList) createVehicle _randomPos; 45 | 46 | _AAVehicle allowCrewInImmobile true; 47 | 48 | _AAVehicle lock 2; 49 | createVehicleCrew _AAVehicle; 50 | 51 | _spawnedUnits pushBack _AAVehicle; 52 | 53 | { 54 | _spawnedUnits pushBack _x; 55 | } foreach (crew _AAVehicle); 56 | 57 | private _group = group _AAVehicle; 58 | 59 | [_group, _AOpos, _radiusSize / 2] call BIS_fnc_taskPatrol; 60 | _group setSpeedMode "LIMITED"; 61 | }; 62 | }; 63 | 64 | //-------------------------------------------------- MRAP 65 | if (_MRAPSetting) then { 66 | for "_x" from 1 to _MRAPAmount do { 67 | private _randomPos = ([_AOpos, _radiusSize / 1.2, "(1 + meadow) * (1 - sea) * (1 - houses)"] call derp_fnc_randomPos) param [0]; 68 | private _MRAP = (selectRandom MRAPList) createVehicle _randompos; 69 | 70 | _MRAP allowCrewInImmobile true; 71 | _MRAP lock 2; 72 | 73 | createVehicleCrew _MRAP; 74 | _spawnedUnits pushBack _MRAP; 75 | 76 | { 77 | _spawnedUnits pushBack _x; 78 | } foreach (crew _MRAP); 79 | 80 | private _group = group _MRAP; 81 | 82 | [_group, _AOpos, _radiusSize / 2] call BIS_fnc_taskPatrol; 83 | _group setSpeedMode "LIMITED"; 84 | }; 85 | }; 86 | 87 | //-------------------------------------------------- random vehcs 88 | if (_randomVehcsSetting) then { 89 | for "_x" from 1 to _randomVehcsAmount do { 90 | private _randomPos = ([_AOpos, _radiusSize / 1.2, "(1 + meadow) * (1 - sea) * (1 - houses)"] call derp_fnc_randomPos) param [0]; 91 | private _vehc = (selectRandom RandomVehicleList) createVehicle _randompos; 92 | 93 | _vehc allowCrewInImmobile true; 94 | _vehc lock 2; 95 | 96 | createVehicleCrew _vehc; 97 | _spawnedUnits pushBack _vehc; 98 | { 99 | _spawnedUnits pushBack _x; 100 | } foreach (crew _vehc); 101 | private _group = group _vehc; 102 | 103 | [_group, _AOpos, _radiusSize / 2] call BIS_fnc_taskPatrol; 104 | }; 105 | }; 106 | 107 | //-------------------------------------------------- main infantry groups 108 | if (_infantryGroupsSetting) then { 109 | for "_x" from 1 to _infantryGroupsAmount do { 110 | private _randomPos = ([_AOpos, _radiusSize / 1.2, "(1 - sea)"] call derp_fnc_randomPos) param [0]; 111 | private _infantryGroup = [_randomPos, EAST, (configfile InfantryGroupsCFGPATH (selectRandom InfantryGroupList))] call BIS_fnc_spawnGroup; 112 | 113 | [_infantryGroup, _AOpos, _radiusSize / 2] call BIS_fnc_taskPatrol; 114 | 115 | { 116 | _spawnedUnits pushBack _x; 117 | _AISkillUnitsArray pushBack _x; 118 | } foreach (units _infantryGroup); 119 | }; 120 | }; 121 | 122 | //-------------------------------------------------- AA groups 123 | if (_AAGroupsSetting) then { 124 | for "_x" from 1 to _AAGroupsAmount do { 125 | private _randomPos = ([_AOpos, _radiusSize / 1.2, "(1 - sea)"] call derp_fnc_randomPos) param [0]; 126 | private _infantryGroup = [_randomPos, EAST, (configfile InfantryGroupsCFGPATH (selectRandom AAGroupsList))] call BIS_fnc_spawnGroup; 127 | 128 | [_infantryGroup, _AOpos, _radiusSize / 2] call BIS_fnc_taskPatrol; 129 | 130 | { 131 | _spawnedUnits pushBack _x; 132 | _AISkillUnitsArray pushBack _x; 133 | } foreach (units _infantryGroup); 134 | }; 135 | }; 136 | 137 | //-------------------------------------------------- AT groups 138 | if (_ATGroupsSetting) then { 139 | for "_x" from 1 to _ATGroupsAmount do { 140 | private _randomPos = ([_AOpos, _radiusSize / 1.2, "(1 - sea)"] call derp_fnc_randomPos) param [0]; 141 | private _infantryGroup = [_randomPos, EAST, (configfile InfantryGroupsCFGPATH (selectRandom ATGroupsList))] call BIS_fnc_spawnGroup; 142 | 143 | [_infantryGroup, _AOpos, _radiusSize / 2] call BIS_fnc_taskPatrol; 144 | 145 | { 146 | _spawnedUnits pushBack _x; 147 | _AISkillUnitsArray pushBack _x; 148 | } foreach (units _infantryGroup); 149 | }; 150 | }; 151 | 152 | //-------------------------------------------------- Indoors infantry 153 | if (_urbanInfantrySetting) then { 154 | for "_x" from 1 to _urbanInfantryAmount do { 155 | 156 | private _group = [_AOpos, east, (configfile UrbanGroupsCFGPATH (selectRandom UrbanGroupsList))] call BIS_fnc_spawnGroup; 157 | private _returnedUnits = [_AOpos, nil, (units _group), (_radiusSize / 3), 2, false] call derp_fnc_AIOccupyBuilding; 158 | 159 | { deleteVehicle _x } foreach _returnedUnits; 160 | 161 | { 162 | _spawnedUnits pushBack _x; 163 | _AISkillUnitsArray pushBack _x; 164 | } foreach (units _group); 165 | }; 166 | }; 167 | 168 | //-------------------------------------------------- Military area 169 | if (_milbuildingInfantry) then { 170 | private _milBuildings = nearestObjects [_AOpos, MilitaryBuildings, (_radiusSize + 100)]; 171 | 172 | _milBuildingCount = count _milBuildings; 173 | if (_milBuildingCount > 0 ) then { 174 | 175 | for "_x" from 1 to 3 do { 176 | 177 | private _group = [_AOpos, east, (configfile UrbanGroupsCFGPATH (selectRandom UrbanGroupsList))] call BIS_fnc_spawnGroup; 178 | private _returnedUnits= [_AOpos, MilitaryBuildings, (units _group), (_radiusSize + 100), 2, false] call derp_fnc_AIOccupyBuilding; 179 | 180 | { deleteVehicle _x } foreach _returnedUnits; 181 | 182 | { 183 | _spawnedUnits pushBack _x; 184 | _AISkillUnitsArray pushBack _x; 185 | } foreach (units _group); 186 | }; 187 | }; 188 | }; 189 | 190 | //-------------------------------------------------- SetSkill + network operations 191 | [_AISkillUnitsArray] call derp_fnc_AISkill; 192 | 193 | if (isServer) then { 194 | { 195 | _x addCuratorEditableObjects [_spawnedUnits, true]; 196 | } foreach allCurators; 197 | _spawnedUnits 198 | } else { 199 | [_spawnedUnits, true] remoteExec ["derp_fnc_remoteAddCuratorEditableObjects", 2]; 200 | spawnedUnits = _spawnedUnits; 201 | publicVariableServer "spawnedUnits"; 202 | spawnedUnits = nil; 203 | }; 204 | -------------------------------------------------------------------------------- /functions/core/airReinforcements.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Handles the CSAT air support. 5 | * 6 | * Arguments: 7 | * 0: The AO position 8 | * 9 | * Return Value: 10 | * nothing 11 | * 12 | */ 13 | params ["_AOPos"]; 14 | 15 | if ((!alive derp_airReinforcement) && {derp_lastAirReinforcementTime <= (time - derp_PARAM_airReinforcementTimer)}) then { 16 | _AOPos params ["_xPos", "_yPos"]; 17 | 18 | derp_airReinforcement = createVehicle [(selectRandom AirReinforcementVehicleList), getMarkerPos "opforAirSpawn_marker1", ["opforAirSpawn_marker2", "opforAirSpawn_marker3", "opforAirSpawn_marker4"], 50, "FLY"]; 19 | createVehicleCrew derp_airReinforcement; 20 | derp_airReinforcement lock 2; 21 | 22 | {_x addCuratorEditableObjects [[derp_airReinforcement], true]} forEach allCurators; 23 | 24 | private _wp = (group derp_airReinforcement) addWaypoint [[_xPos, _yPos, 1000], 0]; 25 | _wp setWaypointType "SAD"; 26 | 27 | derp_lastAirReinforcementTime = time; 28 | }; 29 | -------------------------------------------------------------------------------- /functions/core/fn_sideMissionSelection.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Side mission selector. 5 | * 6 | * Arguments: 7 | * 0: Position of the AO marker 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | */ 13 | params ["_AOPos", "_missionID"]; 14 | 15 | derp_sideMissionInProgress = true; 16 | 17 | private _sideMissionArray = [ 18 | derp_fnc_officerMurderSM, 19 | derp_fnc_truckRetrievalSM, 20 | derp_fnc_cachesSM, 21 | derp_fnc_uavDownedSM, 22 | derp_fnc_specOpsSM, 23 | derp_fnc_droppedCargoSM 24 | ]; 25 | 26 | private _nearComTowers = nearestObjects [_AOPos, COMTOWERSMArray, derp_PARAM_AOSize * 1.5]; 27 | if ({alive _x} count _nearComTowers > 0) then { 28 | [_AOPos, _nearComTowers, _missionID] call derp_fnc_comTowerSM; 29 | 30 | } else { 31 | [_AOPos, _missionID] call (selectRandom _sideMissionArray); 32 | }; 33 | -------------------------------------------------------------------------------- /functions/core/getAllTownsAndVillages.sqf: -------------------------------------------------------------------------------- 1 | private _locationList = nearestLocations [[worldSize/2, worldSize/2 , 0], ["NameCityCapital", "NameCity", "NameVillage"], worldSize * sqrt 2]; 2 | 3 | _locationList =_locationList apply { 4 | [(text _x), (position _x)]; 5 | }; 6 | 7 | _locationList 8 | -------------------------------------------------------------------------------- /functions/core/missionSelection.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handle the mission selection, this should only be called on server init, or in a mission PFH. 4 | * 5 | * Arguments: 6 | * 0: First call or not 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_firstCall"]; 12 | 13 | if (derp_PARAM_enableRespawn) then { 14 | [0] remoteExec ["setPlayerRespawnTime", 0, true]; 15 | [{[9999] remoteExec ["setPlayerRespawnTime", 0, true]}, [], 300] call derp_fnc_waitAndExecute; 16 | }; 17 | 18 | if ((!isNil "_firstCall") && {_firstCall}) Then { 19 | derp_missionSelectionArray = 20 | [ 21 | derp_fnc_mission_clearTown 22 | ]; 23 | }; 24 | //------------------- Check if the mission amount has been reached. 25 | 26 | if ((derp_PARAM_missionAmount > 0) && {!isNil "derp_missionCounter"} && {derp_PARAM_missionAmount == derp_missionCounter}) then { 27 | "Won" call BIS_fnc_EndMissionServer; 28 | 29 | } else { 30 | private _nextMission = selectRandom derp_missionSelectionArray; 31 | 32 | [] call _nextMission; 33 | }; 34 | -------------------------------------------------------------------------------- /functions/core/serverSide_functions_compile.sqf: -------------------------------------------------------------------------------- 1 | // Core functions 2 | derp_fnc_missionSelection = compileFinal preprocessFileLineNumbers "functions\core\missionSelection.sqf"; 3 | derp_fnc_sideMissionSelection = compileFinal preprocessFileLineNumbers "functions\core\fn_sideMissionSelection.sqf"; 4 | derp_fnc_smRewards = compileFinal preprocessFileLineNumbers "functions\core\smRewards.sqf"; 5 | derp_fnc_airReinforcements = compileFinal preprocessFileLineNumbers "functions\core\airReinforcements.sqf"; 6 | derp_fnc_getAllTownsAndVillages = compile preprocessFileLineNumbers "functions\core\getAllTownsAndVillages.sqf"; 7 | // Missions 8 | derp_fnc_mission_clearTown = compileFinal preprocessFileLineNumbers "functions\missions\mission1\mission1_clearTown.sqf"; 9 | 10 | // Side missions 11 | derp_fnc_comTowerSM = compileFinal preprocessFileLineNumbers "functions\side missions\comTowerSM.sqf"; 12 | derp_fnc_officerMurderSM = compileFinal preprocessFileLineNumbers "functions\side missions\officerMurderSM.sqf"; 13 | derp_fnc_truckRetrievalSM = compileFinal preprocessFileLineNumbers "functions\side missions\truckRetrievalSM.sqf"; 14 | derp_fnc_cachesSM = compileFinal preprocessFileLineNumbers "functions\side missions\cachesSM.sqf"; 15 | derp_fnc_uavDownedSM = compileFinal preprocessFileLineNumbers "functions\side missions\uavDownedSM.sqf"; 16 | derp_fnc_specOpsSM = compileFinal preprocessFileLineNumbers "functions\side missions\specOpsSM.sqf"; 17 | derp_fnc_droppedCargoSM = compileFinal preprocessFileLineNumbers "functions\side missions\droppedCargoSM.sqf"; 18 | derp_fnc_droppedCargoSM_actionPFH = compileFinal preprocessFileLineNumbers "functions\side missions\droppedCargoSM_actionPFH.sqf"; 19 | -------------------------------------------------------------------------------- /functions/core/smRewards.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Called only after a successful side mission, this gives a reward if the number of successfully completed SMs is equal to the mission param 5 | * 6 | * Arguments: 7 | * None 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | if (derp_successfulSMs != 0 && {derp_successfulSMs == derp_PARAM_smRewardAfter}) then { 13 | private _smRewardList = [ SMRewards ]; 14 | 15 | private _selectRandomArray = []; 16 | 17 | _smRewardList apply { 18 | _x params ["_element", "_amount"]; 19 | 20 | for "_i" from 1 to _amount do { 21 | _selectRandomArray pushback _element; 22 | }; 23 | }; 24 | 25 | _smRewardList call derp_fnc_arrayShuffle; 26 | 27 | private _reward = selectRandom _selectRandomArray; 28 | private _rewardVehicle = ""; 29 | 30 | if (_reward isKindOf "Helicopter") then { 31 | _rewardVehicle = createVehicle [_reward, getMarkerPos "smReward_Helo", [], 0, "NONE"]; 32 | _rewardVehicle setDir (markerDir "smReward_Helo"); 33 | _rewardVehicle call derp_vehicleHandler_fnc_vehicleSetup; 34 | } else { 35 | if (_reward isKindOf "Plane") then { 36 | _rewardVehicle = createVehicle [_reward, getMarkerPos "smReward_Plane", [], 0, "NONE"]; 37 | _rewardVehicle setDir (markerDir "smReward_Plane"); 38 | _rewardVehicle call derp_vehicleHandler_fnc_vehicleSetup; 39 | } else { 40 | if (_reward isKindOf "LandVehicle") then { 41 | _rewardVehicle = createVehicle [_reward, getMarkerPos "smReward_Ground", [], 20, "NONE"]; 42 | _rewardVehicle setDir (random 360); 43 | _rewardVehicle call derp_vehicleHandler_fnc_vehicleSetup; 44 | }; 45 | }; 46 | }; 47 | 48 | {_x addCuratorEditableObjects [[_rewardVehicle], false]} forEach allCurators; 49 | 50 | derp_successfulSMs = 0; 51 | 52 | format ["The HQ has delivered a reward:
%1", getText (configFile >> "CfgVehicles" >> _reward >> "displayName")] remoteExec ["derp_fnc_globalHint_Handler", -2]; 53 | }; 54 | -------------------------------------------------------------------------------- /functions/functions.hpp: -------------------------------------------------------------------------------- 1 | class derp { 2 | 3 | class CBA { 4 | file = "functions\portedFuncs\cba"; 5 | class pfhPreInit { preInit = 1; }; 6 | class addPerFrameHandler {}; 7 | class removePerFrameHandler {}; 8 | class execNextFrame {}; 9 | class waitAndExecute {}; 10 | class waitUntilAndExecute {}; 11 | class pfhPostInit { postInit = 1; }; 12 | class getTurret {}; 13 | class directCall {}; 14 | }; 15 | 16 | class misc { 17 | file = "functions\misc"; 18 | class VA_filter {}; 19 | class daytime {}; 20 | class diary {}; 21 | class findItemList {}; 22 | class globalHint_handler {}; 23 | class pilotCheck {}; 24 | class curatorPingedEH {}; 25 | class hintC {}; 26 | class arrayShuffle {}; 27 | class paradrop {}; 28 | class gearLimitations {}; 29 | class remoteAddCuratorEditableObjects {}; 30 | class mapLinesHandler {}; 31 | class baseCleaning {}; 32 | class cleaner {}; 33 | class crewNames {}; 34 | class shortNights {}; 35 | class randomPos {}; 36 | }; 37 | 38 | class AI { 39 | file = "functions\core\AI"; 40 | class mainAOSpawnHandler {}; 41 | class AISkill {}; 42 | class AIOccupyBuilding {}; 43 | }; 44 | 45 | class SM { 46 | file = "functions\side missions"; 47 | class droppedCargoSM_action {}; 48 | }; 49 | }; 50 | 51 | class derp_revive { 52 | 53 | class Revive { 54 | file = "functions\revive"; 55 | class onPlayerKilled {}; 56 | class onPlayerRespawn {}; 57 | class executeTemplates {}; 58 | class switchState {}; 59 | class reviveTimer {}; 60 | class reviveActions {}; 61 | class startDragging {}; 62 | class startCarrying {}; 63 | class dragging {}; 64 | class carrying {}; 65 | class dropPerson {}; 66 | class hotkeyHandler {}; 67 | class uiElements {}; 68 | class animChanged {}; 69 | class drawDowned {}; 70 | class handleDamage {}; 71 | class ace3Check {}; 72 | class diaryEntries {}; 73 | class adjustForTerrain {}; 74 | class syncAnim {}; 75 | class heartBeatPFH {}; 76 | }; 77 | }; 78 | 79 | class derp_vehicleHandler { 80 | 81 | class vehicleHandler { 82 | file = "functions\vehicle_handler"; 83 | class quadInit {}; 84 | class quadPFH {}; 85 | class vehicleInit {}; 86 | class vehiclePFH {}; 87 | class vehicleSetup {}; 88 | }; 89 | }; 90 | 91 | class TAW_VD { 92 | tag = "TAWVD"; 93 | 94 | class Initialize { 95 | file = "functions\taw_vd"; 96 | class stateTracker { 97 | ext = ".fsm"; 98 | postInit = 1; 99 | headerType = -1; 100 | }; 101 | 102 | class onSliderChanged {}; 103 | class onTerrainChanged {}; 104 | class updateViewDistance {}; 105 | class openMenu {}; 106 | class onChar {}; 107 | class openSaveManager {}; 108 | class onSavePressed {}; 109 | class onSaveSelectionChanged {}; 110 | }; 111 | }; 112 | -------------------------------------------------------------------------------- /functions/misc/crewNameDefines.hpp: -------------------------------------------------------------------------------- 1 | #define names_idc 99999 2 | 3 | class HudNames { 4 | idd = -1; 5 | fadeout=0; 6 | fadein=0; 7 | duration = 0.1; 8 | name= "HudNames"; 9 | onLoad = "uiNamespace setVariable ['HudNames', _this select 0]"; 10 | 11 | class controlsBackground { 12 | class HudNames_1:RscStructuredText 13 | { 14 | idc = names_idc; 15 | type = CT_STRUCTURED_TEXT; 16 | size = 0.040; 17 | style = ST_LEFT; 18 | x = (SafeZoneX + 0.015); 19 | y = (SafeZoneY + 0.60); 20 | w = 0.4; h = 0.65; 21 | colorText[] = {1,1,1,1}; 22 | lineSpacing = 3; 23 | colorBackground[] = {0,0,0,0}; 24 | text = ""; 25 | font = "PuristaLight"; 26 | shadow = 2; 27 | class Attributes { 28 | align = "left"; 29 | }; 30 | }; 31 | }; 32 | }; 33 | -------------------------------------------------------------------------------- /functions/misc/fn_VA_filter.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Filter the arsenal for a given box and add an unfucked arsenal action 5 | * 6 | * Arguments: 7 | * 0: Array of objects 8 | * 1: filter 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Example: 14 | * [_this, 1] call derp_fnc_VA_filter; 15 | */ 16 | params ["_arsenalBoxes", "_filter"]; 17 | 18 | switch (_filter) do { 19 | 20 | case 0: { 21 | { 22 | [_x, [true], false] call BIS_fnc_removeVirtualItemCargo; 23 | [_x, [true], false] call BIS_fnc_removeVirtualWeaponCargo; 24 | } foreach _arsenalBoxes; 25 | }; 26 | 27 | case 1: { 28 | { 29 | if (isServer) then { 30 | ["AmmoboxInit", [_x, true]] call BIS_fnc_arsenal; 31 | }; 32 | 33 | [_x, [true], false] call BIS_fnc_removeVirtualItemCargo; 34 | [_x, [true], false] call BIS_fnc_removeVirtualWeaponCargo; 35 | [_x, [true], false] call BIS_fnc_removeVirtualBackpackCargo; 36 | } foreach _arsenalBoxes; 37 | 38 | if (isServer && isDedicated) exitWith {}; 39 | 40 | private _availableItems = [] call derp_fnc_findItemList; 41 | 42 | _availableItems = (((((((_availableItems - ArsenalWeaponBlacklist) - ArsenalBlacklistedItems) - ArsenalBlacklistedUniforms) - ArsenalBlacklistedHelmets) - ArsenalBlacklistedGlasses) - ArsenalBlacklistedBackpacks) - ArsenalBlacklistedVests); 43 | 44 | private _restrictedItems = []; 45 | _restrictedItems pushBack GearLimitationMarksman; 46 | _restrictedItems pushBack GearLimitationAT; 47 | _restrictedItems pushBack GearLimitationSniper; 48 | _restrictedItems pushBack GearLimitationMMG; 49 | _restrictedItems pushBack GearLimitationUAVOperator; 50 | _restrictedItems pushBack GearLimitationGrenadier; 51 | 52 | { 53 | _x params ["_classCode", "_testedArray"]; 54 | private _unit = player; 55 | if !(call _classCode) then { 56 | _availableItems = _availableItems - _testedArray; 57 | }; 58 | } foreach _restrictedItems; 59 | 60 | { 61 | [_x, _availableItems, false] call BIS_fnc_addVirtualItemCargo; 62 | [_x, _availableItems, false] call BIS_fnc_addVirtualWeaponCargo; 63 | [_x, _availableItems, false] call BIS_fnc_addVirtualBackpackCargo; 64 | } foreach _arsenalBoxes; 65 | 66 | { 67 | _x removeAction (_x getVariable "bis_fnc_arsenal_action"); 68 | _action = _x addaction [ 69 | localize "STR_A3_Arsenal", 70 | 71 | { 72 | params ["_box", "_unit"]; 73 | ["Open", [nil, _box, _unit]] call bis_fnc_arsenal; 74 | 75 | [_unit] spawn { 76 | params ["_unit"]; 77 | 78 | uiSleep 2; 79 | (uinamespace getvariable "bis_fnc_arsenal_display") displayAddEventHandler ["Unload", { 80 | [player, 0] call derp_fnc_gearLimitations; 81 | }]; 82 | }; 83 | }, 84 | [], 85 | 6, 86 | true, 87 | false, 88 | "", 89 | " 90 | _cargo = _target getvariable ['bis_addVirtualWeaponCargo_cargo',[[],[],[],[]]]; 91 | if ({count _x > 0} count _cargo == 0) then { 92 | _target removeaction (_target getvariable ['bis_fnc_arsenal_action',-1]); 93 | _target setvariable ['bis_fnc_arsenal_action',nil]; 94 | }; 95 | _condition = _target getvariable ['bis_fnc_arsenal_condition',{true}]; 96 | alive _target && {_target distance _this < 5} && {call _condition} 97 | " 98 | ]; 99 | _x setvariable ["bis_fnc_arsenal_action", _action]; 100 | } foreach _arsenalBoxes; 101 | }; 102 | 103 | case 2: { 104 | { 105 | if (isServer) then { 106 | ["AmmoboxInit", [_x, true]] call BIS_fnc_arsenal; 107 | }; 108 | } foreach _arsenalBoxes; 109 | }; 110 | }; 111 | -------------------------------------------------------------------------------- /functions/misc/fn_arrayShuffle.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Shuffles the provided array. 4 | * 5 | * Arguments: 6 | * 0: Array to be shuffled 7 | * 8 | * Return Value: 9 | * Shuffled array 10 | */ 11 | private _cnt = count _this; 12 | 13 | for "_i" from 1 to _cnt do { 14 | _this pushBack (_this deleteAt floor random _cnt); 15 | }; 16 | 17 | _this 18 | -------------------------------------------------------------------------------- /functions/misc/fn_baseCleaning.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Base cleanup 4 | * 5 | * Arguments: 6 | * Nothing 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | [{ 12 | params ["_args", "_pfhID"]; 13 | 14 | ((getMarkerPos "BASE") nearObjects ["WeaponHolder", 300]) apply {deleteVehicle _x}; 15 | ((getMarkerPos "BASE") nearObjects ["WeaponHolderSimulated", 300]) apply {deleteVehicle _x}; 16 | ((getMarkerPos "BASE") nearObjects ["CraterLong", 300]) apply {deleteVehicle _x}; 17 | }, 30, []] call derp_fnc_addPerFrameHandler; 18 | -------------------------------------------------------------------------------- /functions/misc/fn_cleaner.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Corpse / wreck cleaner 4 | * 5 | * Arguments: 6 | * None 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | [{ 12 | params ["_args", "_pfhID"]; 13 | 14 | //-------------------------------Groups 15 | // Remove already null groups 16 | { 17 | derp_cleaner_groupArray deleteAt (derp_cleaner_groupArray find _x); 18 | } foreach (derp_cleaner_groupArray select {isNull (_x select 0)}); 19 | 20 | // Remove non empty groups from the array. 21 | { 22 | derp_cleaner_groupArray deleteAt (derp_cleaner_groupArray find _x); 23 | } foreach (derp_cleaner_groupArray select {count (units (_x select 0)) > 0}); 24 | 25 | // Check the rest 26 | { 27 | deleteGroup (_x select 0); 28 | derp_cleaner_groupArray deleteAt (derp_cleaner_groupArray find _x); 29 | } foreach (derp_cleaner_groupArray select {time >= (_x select 1)}); 30 | 31 | // Add empty groups 32 | private _groupCompareArray = derp_cleaner_groupArray apply {_x select 0}; 33 | private _groupArray = allGroups select {count (units _x) == 0 && {!(_x in _groupCompareArray)}}; 34 | _groupArray = _groupArray apply {[_x, time + 60]}; 35 | derp_cleaner_groupArray append _groupArray; 36 | 37 | //-------------------------------Bodies and wrecks 38 | // Remove already deleted bodies / wrecks 39 | { 40 | derp_cleaner_bodyArray deleteAt (derp_cleaner_bodyArray find _x); 41 | } foreach (derp_cleaner_bodyArray select {isNull (_x select 0)}); 42 | 43 | // Remove bodies / wrecks 44 | { 45 | deleteVehicle (_x select 0); 46 | derp_cleaner_bodyArray deleteAt (derp_cleaner_bodyArray find _x); 47 | } foreach (derp_cleaner_bodyArray select {time >= (_x select 1)}); 48 | 49 | // Add new bodies / wrecks 50 | private _bodyCompareArray = derp_cleaner_bodyArray apply {_x select 0}; 51 | private _bodyArray = allDead select {!(_x in _bodyCompareArray)}; 52 | _bodyArray = _bodyArray apply {[_x, time + 300]}; 53 | derp_cleaner_bodyArray append _bodyArray; 54 | 55 | }, 20, []] call derp_fnc_addPerFrameHandler; 56 | -------------------------------------------------------------------------------- /functions/misc/fn_crewNames.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: unknown 3 | * Rewrote by: alganthe 4 | * Display the crew and vehicle heading / target 5 | * 6 | * Arguments: 7 | * Nothing 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | [{ 13 | params ["_args", "_pfhID"]; 14 | 15 | if (isNull objectParent player) then { 16 | _pfhID call derp_fnc_removePerFrameHandler; 17 | } else { 18 | disableSerialization; 19 | 20 | 1000 cutRsc ["HudNames","PLAIN"]; 21 | private _ui = uiNameSpace getVariable "HudNames"; 22 | private _HudNames = _ui displayCtrl 99999; 23 | 24 | private _name = ""; 25 | private _vehicle = assignedVehicle player; 26 | private _weap = currentWeapon vehicle player; 27 | 28 | { 29 | if ((driver _vehicle == _x) || (gunner _vehicle == _x)) then { 30 | if (driver _vehicle == _x) then { 31 | _name = format ["%1 %2
", _name, (name _x)]; 32 | } else { 33 | private _target = cursorTarget; 34 | private _picture = getText (configFile >> "cfgVehicles" >> typeOf _target >> "displayname"); 35 | private _vehtarget = format ["%1",_picture]; 36 | private _wepdir = (vehicle player) weaponDirection _weap; 37 | private _Azimuth = round (((_wepdir select 0) ) atan2 ((_wepdir select 1) ) + 360) % 360; 38 | _name = format ["%1 %2
Heading : %3
Target : %4
", _name, (name _x), _Azimuth, _vehtarget]; 39 | }; 40 | } else { 41 | _name = format ["%1 %2
", _name, (name _x)]; 42 | }; 43 | 44 | } forEach crew _vehicle; 45 | 46 | _HudNames ctrlSetStructuredText parseText _name; 47 | _HudNames ctrlCommit 0; 48 | 49 | }; 50 | }, 0, []] call derp_fnc_addPerFrameHandler; 51 | -------------------------------------------------------------------------------- /functions/misc/fn_curatorPingedEH.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Check if the player is spamming the fucking zeus ping and kills him if he does (5 times without waiting 15s between any of the pings). 4 | * One module linked to all players or linked to an addEditableObjects module linked to all players with the EH is enough. 5 | * This is called by the curatorPinged eventhandler and thus should only be added to zeus modules. 6 | * 7 | * Arguments: 8 | * 0: Curator module 9 | * 1: Unit doing the ping 10 | * 11 | * Return Value: 12 | * Nothing 13 | * 14 | * Example: 15 | * this addEventHandler ["curatorPinged",{_this call derp_fnc_curatorPingedEH}]; // in the zeus module init field 16 | */ 17 | params ["_curator", "_unit"]; 18 | 19 | private _pingCount = _unit getVariable "derp_curatorPingCount"; 20 | private _lastPingTime = _unit getVariable "derp_lastPingTime"; 21 | 22 | if (isnil "_pingCount") then { 23 | _unit setVariable ["derp_curatorPingCount", 1, false]; 24 | _unit setVariable ["derp_lastPingTime", time, false]; 25 | 26 | } else { 27 | _pingCount = _pingCount + 1; 28 | 29 | if (_lastPingTime <= time - 15) then { 30 | _unit setVariable ["derp_lastPingTime", time, false]; 31 | _unit setVariable ["derp_curatorPingCount", 1, false]; 32 | 33 | } else { 34 | if (_pingCount == 4) then { 35 | ["You have angered Zeus", "wait 15s before pressing the zeus ping button again, or else you'll die."] remoteExecCall ["derp_fnc_hintC", _unit]; 36 | }; 37 | if (_pingCount >= 5) then { 38 | _unit setDamage 1; 39 | _unit setVariable ["derp_curatorPingCount", nil, false]; 40 | _unit setVariable ["derp_lastPingTime", nil, false]; 41 | 42 | } else { 43 | _unit setVariable ["derp_lastPingTime", time, false]; 44 | _unit setVariable ["derp_curatorPingCount", _pingCount, false]; 45 | 46 | }; 47 | }; 48 | }; 49 | -------------------------------------------------------------------------------- /functions/misc/fn_daytime.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Set time of the day. 4 | * 5 | * Arguments: 6 | * None: this is called via mission parameters and shouldn't be called by anything else. 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | private ["_hour", "_date"]; 12 | _hour = "Daytime" call BIS_fnc_getParamValue; 13 | 14 | _date = date; 15 | _date set [3, _hour]; 16 | _date set [4, 0]; 17 | [_date] call bis_fnc_setDate; 18 | -------------------------------------------------------------------------------- /functions/misc/fn_diary.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Adds the required briefing entries. 4 | * 5 | * Arguments: 6 | * >NONE 7 | * 8 | * Return Value: 9 | * nothing 10 | */ 11 | player createDiarySubject ["rules", "Rules"]; 12 | player createDiarySubject ["teamspeak", "Teamspeak"]; 13 | player createDiarySubject ["Co-ops", "Co-ops"]; 14 | 15 | //-------------------------------------------------- Rules 16 | player createDiaryRecord ["rules", ["Enforcement", 17 | "your rules here" 18 | ]]; 19 | 20 | //-------------------------------------------------- Teamspeak 21 | player createDiaryRecord ["teamspeak", ["TS3", 22 | " 23 |
Teamspeak: http://www.teamspeak.com/?page=downloads 24 |
25 |
your adress here 26 | " 27 | ]]; 28 | 29 | //-------------------------------------------------- Mission related, don't touch 30 | player createDiaryRecord ["Co-ops", ["FAQ", 31 | " 32 |
Q: How do I paradrop? 33 |
A: If it's enabled talk to the arsenal guy when an AO is up, an action will show up. 34 |
If a pilot is present on the server a helo will be necessary to be around the ao to paradrop.
35 |
36 |
Q: Why is my view distance really low even when my video options says it's high? 37 |
A: Scroll down and click on view settings. 38 |
39 |
Q: How long do vehicles take to respawn? 40 |
A: It can vary from server to server, it's highly configurable, ask on side chat. 41 |
42 | " 43 | ]]; 44 | 45 | player createDiaryRecord ["Co-ops", ["Credits", 46 | " 47 |
Player icons on map: Quicksilver 48 |
Glorious PFHs: The CBA_A3 team, check the headers of the functions for more specific informations 49 |
TAW VD: Bryan 'Tonic' Boardwine 50 |
The rest: Alganthe 51 |
52 |
Contributors: 53 |
yourstruly 54 | " 55 | ]]; 56 | 57 | player createDiaryRecord ["Co-ops", ["Issues", 58 | " 59 |
You have issues to report? https://github.com/alganthe/Co-ops/issues 60 |
61 |
Known issues: None at the moment! 62 | " 63 | ]]; 64 | -------------------------------------------------------------------------------- /functions/misc/fn_findItemList.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Search for CfgWeapons and CfgGlasses entries with scope = 2 4 | * 5 | * Arguments: 6 | * Nothing 7 | * 8 | * Return Value: 9 | * Array of strings !!! WARNING VERY LONG ARRAYS !!! 10 | * 11 | * Example: 12 | * copyToClipboard ([true] call derp_fnc_findItemList); 13 | */ 14 | private _returnArray = []; 15 | 16 | private _cfgArray = "getNumber (_x >> 'scope') >= 2" configClasses (configFile >> "CfgWeapons"); 17 | {_returnArray pushBack (configName _x)} forEach _cfgArray; 18 | 19 | _cfgArray = "getNumber (_x >> 'scope') >= 2" configClasses (configFile >> "CfgGlasses"); 20 | {_returnArray pushBack (configName _x)} forEach _cfgArray; 21 | 22 | _cfgArray = "(901 in (getArray (_x >> 'allowedSlots')))" configClasses (configFile >> "CfgVehicles"); 23 | {_returnArray pushBack (configName _x)} forEach _cfgArray; 24 | 25 | _returnArray 26 | -------------------------------------------------------------------------------- /functions/misc/fn_gearLimitations.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Enforce gear restriction, check and remove whatever need to be removed from the unit's inventory. 5 | * 6 | * Arguments: 7 | * 0: unit to check 8 | * 1: Mode to run in, 0: Called from arsenal / inventoryClosed EH 1: Called from take EH. 9 | * 2: Item (OPTIONNAL) 10 | * 3: Container the item was taken from 11 | * 12 | * Return Value: 13 | * Nothing 14 | */ 15 | params ["_unit", ["_mode", 0], ["_item", objNull], ["_container", objNull]]; 16 | 17 | private _unitClass = typeof _unit; 18 | 19 | private _restrictedItems = []; 20 | _restrictedItems pushBack GearLimitationMarksman; 21 | _restrictedItems pushBack GearLimitationAT; 22 | _restrictedItems pushBack GearLimitationSniper; 23 | _restrictedItems pushBack GearLimitationMMG; 24 | _restrictedItems pushBack GearLimitationUAVOperator; 25 | _restrictedItems pushBack GearLimitationGrenadier; 26 | _restrictedItems pushBack [{_unit getUnitTrait 'gud'}, (ArsenalBlacklistedItems + ArsenalBlacklistedUniforms + ArsenalBlacklistedHelmets + ArsenalBlacklistedBackpacks + ArsenalBlacklistedVests), "This is blacklisted"]; 27 | 28 | private _assignedItems = assignedItems _unit; 29 | private _weapons = []; 30 | _weapons pushBack (primaryWeapon _unit); 31 | _weapons pushBack (secondaryWeapon _unit); 32 | {_weapons pushBack _x} foreach (primaryWeaponItems _unit); 33 | 34 | private _items = []; 35 | _items = (_items + (uniformItems _unit) + (vestItems _unit) + (backpackItems _unit) + _assignedItems + _weapons + [uniform _unit] + [vest _unit] + [backpack _unit] + [headgear _unit]); 36 | {_items pushBack _x} foreach _primaryWeaponItems; 37 | 38 | _ITEM_MACRO_assignedItem = { 39 | params ["_unit", "_item", "_testedClass", "_container"]; 40 | _unit unlinkItem _item; 41 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 42 | 43 | if (_mode == 1) then { 44 | _container addItemCargoGlobal [_item, 1]; 45 | }; 46 | }; 47 | 48 | _ITEM_MACRO_weapon = { 49 | params ["_unit", "_item", "_testedClass", "_container"]; 50 | _unit removeWeapon _item; 51 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 52 | 53 | if (_mode == 1) then { 54 | _container addItemCargoGlobal [_item, 1]; 55 | }; 56 | }; 57 | 58 | _ITEM_MACRO_weaponItem = { 59 | params ["_unit", "_item", "_testedClass", "_container"]; 60 | _unit removePrimaryWeaponItem _item; 61 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 62 | 63 | if (_mode == 1) then { 64 | _container addItemCargoGlobal [_item, 1]; 65 | }; 66 | }; 67 | 68 | _ITEM_MACRO_item = { 69 | params ["_unit", "_item", "_testedClass", "_container"]; 70 | _unit removeItem _item; 71 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 72 | 73 | if (_mode == 1) then { 74 | _container addItemCargoGlobal [_item, 1]; 75 | }; 76 | }; 77 | 78 | _ITEM_MACRO_helmet = { 79 | params ["_unit", "_item", "_testedClass", "_container"]; 80 | removeHeadgear _unit; 81 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 82 | 83 | if (_mode == 1) then { 84 | _container addItemCargoGlobal [_item, 1]; 85 | }; 86 | }; 87 | 88 | _ITEM_MACRO_backpack = { 89 | params ["_unit", "_item", "_testedClass", "_container"]; 90 | removeBackpack _unit; 91 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 92 | 93 | if (_mode == 1) then { 94 | _container addItemCargoGlobal [_item, 1]; 95 | }; 96 | }; 97 | 98 | _ITEM_MACRO_uniform = { 99 | params ["_unit", "_item", "_testedClass", "_container"]; 100 | removeUniform _unit; 101 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 102 | 103 | if (_mode == 1) then { 104 | _container addItemCargoGlobal [_item, 1]; 105 | }; 106 | }; 107 | 108 | _ITEM_MACRO_vest = { 109 | params ["_unit", "_item", "_testedClass", "_container"]; 110 | removeVest _unit; 111 | systemChat format ["%1 was removed, switch to %2 to use it.", getText (configFile >> "CfgWeapons" >> _item >> "displayName"), _testedClass]; 112 | 113 | if (_mode == 1) then { 114 | _container addItemCargoGlobal [_item, 1]; 115 | }; 116 | }; 117 | 118 | { 119 | _x params ["_classCode", "_testedArray", "_testedClass"]; 120 | 121 | if !(call _classCode) then { 122 | { 123 | if (_x in _testedArray) then { 124 | if (_x in _assignedItems) then { 125 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_assignedItem; 126 | } else { 127 | if (_x in _weapons) then { 128 | if ((_unit getUnitTrait "derp_sniper") && {_testedClass == "Marksman"}) then { 129 | } else { 130 | if (_x == (primaryWeapon _unit) || {_x == (secondaryWeapon _unit)}) then { 131 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_weapon; 132 | } else { 133 | if (_x in (primaryWeaponItems _unit)) then { 134 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_weaponItem; 135 | }; 136 | }; 137 | }; 138 | } else { 139 | if (_x == headgear _unit) then { 140 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_helmet; 141 | } else { 142 | if (_x == backpack _unit) then { 143 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_backpack; 144 | } else { 145 | if (_x == uniform _unit) then { 146 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_uniform; 147 | } else { 148 | if (_x == vest _unit) then { 149 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_vest; 150 | } else { 151 | [_unit, _x, _testedClass, _container] call _ITEM_MACRO_item; 152 | }; 153 | }; 154 | }; 155 | }; 156 | }; 157 | }; 158 | }; 159 | } foreach _items; 160 | }; 161 | } foreach _restrictedItems; 162 | -------------------------------------------------------------------------------- /functions/misc/fn_globalHint_handler.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Pop a hint with the parsed text passed as argument 4 | * 5 | * Arguments: 6 | * 0: parsed text, can be anything. 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_parsedText"]; 12 | 13 | hint parseText format ["%1", _parsedText]; 14 | -------------------------------------------------------------------------------- /functions/misc/fn_hintC.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Pop a hint without the top right corner second one. 4 | * 5 | * Arguments: 6 | * 0: title 7 | * 1: text 8 | * 9 | * Return Value: 10 | * nothing 11 | */ 12 | params ["_title", "_text"]; 13 | 14 | _title hintC _text; 15 | hintC_EH = findDisplay 72 displayAddEventHandler ["unload", { 16 | 0 = _this spawn { 17 | _this select 0 displayRemoveEventHandler ["unload", hintC_EH]; 18 | hintSilent ""; 19 | }; 20 | }]; 21 | -------------------------------------------------------------------------------- /functions/misc/fn_mapLinesHandler.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Stop doodling on the map based on mission setting 4 | * 5 | * Arguments: 6 | * 7 | * Return Value: 8 | * Nothing 9 | */ 10 | if !(getMissionConfigValue ["mapDrawingEnabled", false]) then { 11 | 12 | ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["draw", { 13 | {if (markerShape _x == 'POLYLINE') then {deleteMarker _x}} forEach allMapMarkers; 14 | }]; 15 | }; 16 | -------------------------------------------------------------------------------- /functions/misc/fn_paradrop.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: yourstruly 3 | * Allow player to choose the paradrop point (within specified radius of derp_paraPos). 4 | * Click within that area initiates paradrop. 5 | * 6 | * Arguments: 7 | * 0: Unit requesting paradrop 8 | * 1: Size of the AO 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Example: 14 | * [player, 500] call derp_fnc_paradrop; 15 | */ 16 | params ["_unit", "_radius"]; 17 | 18 | private _markerName = ["max_range_", name _unit] joinString ""; 19 | private _marker = createMarkerLocal [_markerName, derp_paraPos]; 20 | _marker setMarkerShapeLocal "ELLIPSE"; 21 | _marker setMarkerSizeLocal [_radius, _radius]; 22 | _marker setMarkerBrushLocal "SolidBorder"; 23 | _marker setMarkerColorLocal "ColorBlue"; 24 | _marker setMarkerAlphaLocal 0.5; 25 | 26 | openMap true; 27 | 28 | ["derp_paradrop_mapclick", "onMapSingleClick", { 29 | _this params ["_unit", "_radius"]; 30 | 31 | scopeName "main"; 32 | if (leader group _unit == _unit) then { 33 | private _dist = _pos distance2D derp_paraPos; 34 | 35 | if (_dist > _radius) exitWith {hint "Select position within the marked area."}; 36 | 37 | if ({_x getUnitTrait "derp_pilot"}count allPlayers > 0) then { 38 | if ({side ((crew _x) select 0) == playerSide && {alive ((crew _x ) select 0)} && {speed _x > 10}} count (derp_paraPos nearEntities ["Helicopter", _radius]) == 0) then { 39 | hint "No helicopter near the AO"; 40 | breakOut "main"; 41 | }; 42 | }; 43 | 44 | _unit setPos [_pos select 0, _pos select 1, 1000]; 45 | _unit addAction [ 46 | "Open parachute", 47 | { 48 | _this params ["_target", "", "_id"]; 49 | 50 | private _parachute = createVehicle ["Steerable_Parachute_F", [(getPos _target) select 0, (getPos _target) select 1, ((getPos _target )select 2) + 1], [], 0, "NONE"]; 51 | _target moveInDriver _parachute; 52 | _target removeAction _id; 53 | } 54 | ]; 55 | openMap false; 56 | 57 | } else { 58 | private _dist = _pos distance2D derp_paraPos; 59 | 60 | if (_dist > _radius) exitWith {hint "Select position within the marked area."}; 61 | if ((leader _unit distance2D derp_paraPos) > _radius) exitWith {hint "your leader isn't near the AO"}; 62 | if (leader _unit getVariable ["derp_revive_downed", false] || {!alive leader _unit}) exitWith {hint "Your leader is downed or dead"}; 63 | 64 | if ({_x getUnitTrait "derp_pilot"}count allPlayers > 0) then { 65 | if ({side ((crew _x) select 0) == playerSide && {alive ((crew _x ) select 0)} && {speed _x > 10}} count (derp_paraPos nearEntities ["Helicopter", _radius]) == 0) then { 66 | hint "No helicopter near the AO"; 67 | breakOut "main"; 68 | }; 69 | }; 70 | 71 | _pos = getPos leader _unit; 72 | _unit setPos [_pos select 0, _pos select 1, 1000]; 73 | _unit addAction [ 74 | "Open parachute", 75 | { 76 | _this params ["_target", "", "_id"]; 77 | 78 | private _parachute = createVehicle ["Steerable_Parachute_F", [(getPos _target) select 0, (getPos _target) select 1, ((getPos _target )select 2) + 1], [], 0, "NONE"]; 79 | _target moveInDriver _parachute; 80 | _target removeAction _id; 81 | } 82 | ]; 83 | openMap false; 84 | 85 | hint "We're dropping you near your leader."; 86 | }; 87 | }, [_unit, _radius]] call BIS_fnc_addStackedEventHandler; 88 | 89 | [{ 90 | params ["_args", "_pfhID"]; 91 | _args params ["_markerName"]; 92 | 93 | if (!missionInProgress) then { 94 | deleteMarkerLocal _markerName; 95 | ["derp_paradrop_mapclick", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; 96 | openMap false; 97 | hint "The AO changed"; 98 | _pfhID call derp_fnc_removePerFrameHandler; 99 | }; 100 | 101 | if !(visibleMap) then { 102 | deleteMarkerLocal _markerName; 103 | ["derp_paradrop_mapclick", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; 104 | _pfhID call derp_fnc_removePerFrameHandler; 105 | }; 106 | }, 0, [_markerName]] call derp_fnc_addPerFrameHandler; 107 | -------------------------------------------------------------------------------- /functions/misc/fn_pilotCheck.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Check if the unit is authorized to enter the pilot / copilot slot of the vehicle, if not they are kicked out. 4 | * This is called by the getInMan and seatSwitched ehs. 5 | * 6 | * Arguments: 7 | * 0: Unit performing the action 8 | * 1: position in which the unit is entering 9 | * 2: vehicle being entered 10 | * 3: turretIndex of the position < [] for driver and [0] to n number of seats> 11 | * 12 | * Return Value: 13 | * Nothing 14 | * 15 | * Example: 16 | * 17 | * yourVehicle addEventHandler ["GetInMan", {_this call derp_fnc_pilotCheck}]; 18 | */ 19 | params ["_unit", "_position", "_vehicle", "_turretIndex"]; 20 | 21 | if !(_vehicle isKindOf "Air" && {!(_vehicle isKindOf "ParachuteBase")}) exitwith {}; 22 | 23 | if (!(player getUnitTrait "derp_pilot")) then { 24 | if (_position == "driver") then { 25 | moveOut _unit; 26 | ["What are you doing?", "You're not a pilot, you're not allowed to do that."] remoteExec ["derp_fnc_hintC", _unit]; 27 | 28 | } else { 29 | private _coPilotTurret = [_vehicle] call { 30 | 31 | params [["_vehicle", objNull, [objNull]]]; 32 | 33 | fullCrew [_vehicle, "turret", true] apply {_x select 3} select { 34 | getNumber ([_vehicle, _x] call derp_fnc_getTurret >> "isCopilot") == 1 35 | } param [0, []] 36 | }; 37 | 38 | if (_coPilotTurret isEqualTo _turretIndex) then { 39 | moveOut _unit; 40 | ["What are you doing?", "You're not a pilot, you're not allowed to do that."] remoteExec ["derp_fnc_hintC", _unit]; 41 | }; 42 | }; 43 | }; 44 | -------------------------------------------------------------------------------- /functions/misc/fn_randomPos.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Find a randomPos 4 | * 5 | * Arguments: 6 | * 0: Center position to check from 7 | * 1: Radius of the search 8 | * 2: algorithm for selectBestPlaces 9 | * 10 | * Return Value: 11 | * Best result selected by selectBestPlaces in the format <[pos, algorithm result]> 12 | * 13 | * Example: 14 | * [[0,0,0], 1000, "(1 - sea)"] call derp_fnc_randomPos 15 | */ 16 | params [["_pos", [0, 0, 0]], ["_radius", 0], ["_mathsRHard", ""]]; 17 | 18 | if (_pos isEqualTo [] || {_pos isEqualTo [0, 0, 0]}) exitWith {systemChat "randomPos: wrong position array type supplied"}; 19 | 20 | if (_radius < 20) exitWith {systemChat "randomPos: radius size too small"}; 21 | 22 | if (_mathsRHard isEqualTo "") exitWith {systemChat "randomPos: no arithmetic operation supplied"}; 23 | 24 | private _returnValue = selectBestPlaces [_pos, _radius, _mathsRHard, 60, 10]; 25 | 26 | _returnValue select 0 27 | -------------------------------------------------------------------------------- /functions/misc/fn_remoteAddCuratorEditableObjects.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * addCuratorEditableObjects doesn't work client side, so remoteExc it is. 4 | * 5 | * Arguments: 6 | * 0: Array of objects to add 7 | * 1: Add crew or not 8 | * 9 | * Return Value: 10 | * Nothing 11 | * 12 | * Example: 13 | * 14 | * [[_myOject1, _myObject2, _myObjectN], true] call derp_fnc_remoteAddCuratorEditableObjects; 15 | */ 16 | params ["_objects", ["_addCrew", true]]; 17 | 18 | if !(isServer) then { 19 | [_objects, _addCrew] remoteExec ["derp_fnc_remoteAddCuratorEditableObjects", 2]; 20 | } else { 21 | { 22 | _x addCuratorEditableObjects [_objects, _addCrew]; 23 | } forEach allCurators; 24 | }; 25 | -------------------------------------------------------------------------------- /functions/misc/fn_shortNights.sqf: -------------------------------------------------------------------------------- 1 | [{ 2 | params ["_args", "_pfhID"]; 3 | 4 | if (isNil "derp_shortNightActivated") then { 5 | if (daytime >= 18 || {daytime <= 6}) then { 6 | setTimeMultiplier (timeMultiplier * 2); 7 | derp_shortNightActivated = true; 8 | }; 9 | } else { 10 | if (daytime <= 18 && {daytime >= 6}) then { 11 | setTimeMultiplier (timeMultiplier / 2); 12 | derp_shortNightActivated = nil; 13 | }; 14 | }; 15 | }, 60, []] call derp_fnc_addPerFrameHandler; 16 | -------------------------------------------------------------------------------- /functions/missions/mission1/mission1_clearTown.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * 4 | * Arguments: 5 | * Nothing 6 | * 7 | * Return Value: 8 | * Nothing 9 | * 10 | * Mission1: Clear a town out of any enemy presence. 11 | * 12 | * Phases: NONE 13 | * 14 | * Conditions: 15 | * Win: No opfor left inside the marker and side mission completed or failed. 16 | * Fail: None 17 | */ 18 | missionInProgress = true; 19 | publicVariable "missionInProgress"; 20 | 21 | private _mainAOUnits = []; 22 | private _selectedLocation = selectRandom derp_mission1Locations; 23 | 24 | //------------------- Get random mission loc based on existing markers 25 | while {(count ((_selectedLocation select 1) nearEntities [["CAManBase", "Air", "Car", "Tank"], derp_PARAM_AOSize * 2])) > 0 || {((getMarkerPos "BASE") distance2D (_selectedLocation select 1)) < (derp_PARAM_AOSize * 2)}} do { 26 | _selectedLocation = selectRandom derp_mission1Locations; 27 | 28 | }; 29 | 30 | //------------------- Sort the AO location 31 | derp_mission1Locations = derp_mission1Locations - [_selectedLocation]; 32 | if (count derp_mission1Locations <= 6) then { 33 | derp_mission1Locations = call derp_fnc_getAllTownsAndVillages; 34 | }; 35 | _selectedLocation params ["_townName", "_pos"]; 36 | 37 | //------------------- Para jump location 38 | if (derp_PARAM_paraJumpEnabled) then { 39 | derp_paraPos = _pos; 40 | publicVariable "derp_paraPos"; 41 | }; 42 | 43 | //------------------- Spawn In enemies 44 | if (derp_HCAOsConnected) then { 45 | [_pos, [true, true, true, true, true, true, true, true]] remoteExecCall ["derp_fnc_mainAOSpawnHandler", derp_HCAOs]; 46 | _mainAOUnits = spawnedUnits; 47 | spawnedUnits = nil; 48 | 49 | } else { 50 | _mainAOUnits = [_pos, [true, true, true, true, true, true, true, true]] call derp_fnc_mainAOSpawnHandler; 51 | }; 52 | 53 | private _mainAOUnitCount = count _mainAOUnits; 54 | 55 | //------------------- AO boundaries + task 56 | _marker = createMarker ["mission1_mrk", _pos]; 57 | "mission1_mrk" setMarkerShape "ICON"; 58 | "mission1_mrk" setMarkerType "selector_selectable"; 59 | "mission1_mrk" setMarkerColor "ColorBLUFOR"; 60 | 61 | _marker2 = createMarker ["mission1_1_mrk", _pos]; 62 | "mission1_1_mrk" setMarkerShape "ELLIPSE"; 63 | "mission1_1_mrk" setMarkerSize [derp_PARAM_AOSize, derp_PARAM_AOSize]; 64 | "mission1_1_mrk" setMarkerBrush "Border"; 65 | "mission1_1_mrk" setMarkerColor "ColorOPFOR"; 66 | 67 | derp_mission1ID = derp_mission1ID + 1; 68 | _missionID = "mission1" + str derp_mission1ID; 69 | 70 | [west, _missionID, [format ["%1 has been captured, you need to clear it out! Good luck and don't forget to complete the side mission we're assigning you.",_townName ], ["Clear ", _townName] joinString "", ""], _pos, true, 5, true, "Attack", true] call BIS_fnc_taskCreate; 71 | 72 | 73 | //------------------- PFH checking every 10s if the mission has been completed 74 | [{ 75 | params ["_pos", "_missionID", "_mainAOUnits", "_mainAOUnitCount"]; 76 | [_pos, _missionID] call derp_fnc_sideMissionSelection; 77 | 78 | [{ 79 | params ["_args", "_pfhID"]; 80 | _args params ["_pos", "_missionID", "_mainAOUnits" ,"_mainAOUnitCount"]; 81 | 82 | if (floor ((({position _x inArea "mission1_1_mrk" && {side _x == east} && {alive _x}} count allUnits) / _mainAOUnitCount) * 100) <= ceil ((derp_PARAM_AOFinishEnemyPercentage / 100) * _mainAOUnitCount) && {!derp_sideMissionInProgress}) then { 83 | 84 | deleteMarker "mission1_mrk"; 85 | deleteMarker "mission1_1_mrk"; 86 | [_missionID, 'Succeeded', true] call BIS_fnc_taskSetState; 87 | missionWin = nil; 88 | missionInProgress = false; 89 | publicVariable "missionInProgress"; 90 | 91 | if (derp_PARAM_paraJumpEnabled) then { 92 | derp_paraPos = nil; 93 | publicVariable "derp_paraPos"; 94 | }; 95 | 96 | [{ 97 | params ["_mainAOUnits", "_missionID"]; 98 | 99 | { 100 | if (!(isNull _x) && {alive _x}) then { 101 | deleteVehicle _x; 102 | }; 103 | } foreach _mainAOUnits; 104 | 105 | [_missionID, true] call BIS_fnc_deleteTask; 106 | }, [_mainAOUnits, _missionID], 300] call derp_fnc_waitAndExecute; 107 | 108 | derp_missionCounter = derp_missionCounter + 1; 109 | false call derp_fnc_missionSelection; 110 | 111 | _pfhID call derp_fnc_removePerFrameHandler; 112 | }; 113 | }, 10, [_pos, _missionID, _mainAOUnits, _mainAOUnitCount]] call derp_fnc_addPerFrameHandler; 114 | }, [_pos, _missionID, _mainAOUnits, _mainAOUnitCount], 30] call derp_fnc_waitAndExecute; 115 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_addPerFrameHandler.sqf: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | Function: CBA_fnc_addPerFrameHandler 3 | Description: 4 | Add a handler that will execute every frame, or every x number of seconds. 5 | Parameters: 6 | _function - The function you wish to execute. 7 | _delay - The amount of time in seconds between executions, 0 for every frame. [optional] (default: 0) 8 | _args - Parameters passed to the function executing. This will be the same array every execution. [optional] 9 | Returns: 10 | _handle - a number representing the handle of the function. Use this to remove the handler. 11 | Examples: 12 | (begin example) 13 | _handle = [{player sideChat format ["every frame! _this: %1", _this];}, 0, ["some","params",1,2,3]] call CBA_fnc_addPerFrameHandler; 14 | (end) 15 | Author: 16 | Nou & Jaynus, donated from ACRE project code for use by the community; commy2 17 | ---------------------------------------------------------------------------- */ 18 | params [["_function", {}, [{}]], ["_delay", 0, [0]], ["_args", []]]; 19 | 20 | if (_function isEqualTo {}) exitWith {-1}; 21 | 22 | if (isNil "derp_PFHhandles") then { 23 | derp_PFHhandles = []; 24 | }; 25 | 26 | if (count derp_PFHhandles >= 999999) exitWith { 27 | diag_log "Maximum amount of per frame handlers reached!"; 28 | diag_log _function; 29 | -1 30 | }; 31 | 32 | private _handle = derp_PFHhandles pushBack count derp_perFrameHandlerArray; 33 | 34 | derp_perFrameHandlerArray pushBack [_function, _delay, diag_tickTime, diag_tickTime, _args, _handle]; 35 | 36 | _handle 37 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_directCall.sqf: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | Function: derp_fnc_directCall 3 | Description: 4 | Executes a piece of code in unscheduled environment. 5 | Parameters: 6 | _code - Code to execute 7 | _arguments - Parameters to call the code with. (optional) 8 | Returns: 9 | _return - Return value of the function 10 | Examples: 11 | (begin example) 12 | 0 spawn { {systemChat str canSuspend} call derp_fnc_directCall; }; 13 | -> false 14 | (end) 15 | Author: 16 | commy2 17 | ---------------------------------------------------------------------------- */ 18 | params [["_derp_code", {}, [{}]], ["_derp_arguments", []]]; 19 | 20 | private "_derp_return"; 21 | 22 | isNil { 23 | _derp_return = _derp_arguments call _derp_code; 24 | }; 25 | 26 | if (!isNil "_derp_return") then {_derp_return}; 27 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_execNextFrame.sqf: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | Function: CBA_fnc_execNextFrame 3 | Description: 4 | Executes a code once in non sched environment on the next frame. 5 | Parameters: 6 | _function - The function to run. 7 | _args - Parameters passed to the function executing. This will be the same array every execution. [optional] 8 | Returns: 9 | Nothing 10 | Examples: 11 | (begin example) 12 | [{player sideChat format ["This is frame %1, not %2", diag_frameno, _this select 0];}, [diag_frameno]] call CBA_fnc_execNextFrame; 13 | (end) 14 | Author: 15 | esteldunedain and PabstMirror, donated from ACE3 16 | ---------------------------------------------------------------------------- */ 17 | params [["_function", {}, [{}]], ["_args", []]]; 18 | 19 | if (diag_frameno != derp_nextFrameNo) then { 20 | derp_nextFrameBufferA pushBack [_args, _function]; 21 | } else { 22 | derp_nextFrameBufferB pushBack [_args, _function]; 23 | }; 24 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_getTurret.sqf: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | Function: CBA_fnc_getTurret 3 | Description: 4 | A function used to find out which config turret is turretpath. 5 | Parameters: 6 | _vehicle - Vehicle or vehicle class name 7 | _turretPath - Turret path 8 | Example: 9 | (begin example) 10 | _config = [vehicle player, [0]] call CBA_fnc_getTurret 11 | (end) 12 | Returns: 13 | Turret Config entry 14 | Author: 15 | Sickboy, commy2 16 | ---------------------------------------------------------------------------- */ 17 | params [["_vehicle", "", ["", objNull]], ["_turretPath", [], [[]]]]; 18 | 19 | if (_vehicle isEqualType objNull) then { 20 | _vehicle = typeOf _vehicle; 21 | }; 22 | 23 | private _config = configFile >> "CfgVehicles" >> _vehicle; 24 | 25 | // this is used by BI to indicate "driver turrets" 26 | if (_turretPath isEqualTo [-1]) exitWith {_config}; 27 | 28 | { 29 | if (_x < 0) exitWith { 30 | _config = configNull; 31 | }; 32 | 33 | // config classes ignores inherited classes, just like the engine does with turrets 34 | _config = ("true" configClasses (_config >> "turrets")) param [_x, configNull]; 35 | } forEach _turretPath; 36 | 37 | _config 38 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_pfhPostInit.sqf: -------------------------------------------------------------------------------- 1 | addMissionEventHandler ["EachFrame", derp_fnc_onFrame]; 2 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_pfhPreInit.sqf: -------------------------------------------------------------------------------- 1 | // band-aid fix for onPlayerConnected 2 | [derp_OPC_FIX, "onPlayerConnected", {}] call BIS_fnc_addStackedEventHandler; 3 | [derp_OPC_FIX, "onPlayerConnected"] call BIS_fnc_removeStackedEventHandler; 4 | 5 | // PFH stuff 6 | call compile preprocessFileLineNumbers 'functions\portedFuncs\cba\init_perFrameHandler.sqf'; 7 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_removePerFrameHandler.sqf: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | Function: CBA_fnc_removePerFrameHandler 3 | Description: 4 | Remove a handler that you have added using CBA_fnc_addPerFrameHandler. 5 | Parameters: 6 | _handle - The function handle you wish to remove. 7 | Returns: 8 | None 9 | Examples: 10 | (begin example) 11 | _handle = [{player sideChat format["every frame! _this: %1", _this];}, 0, ["some","params",1,2,3]] call CBA_fnc_addPerFrameHandler; 12 | sleep 10; 13 | [_handle] call CBA_fnc_removePerFrameHandler; 14 | (end) 15 | Author: 16 | Nou & Jaynus, donated from ACRE project code for use by the community; commy2 17 | ---------------------------------------------------------------------------- */ 18 | params [["_handle", -1, [0]]]; 19 | 20 | if (_handle < 0 || {_handle >= count derp_PFHhandles}) exitWith {}; 21 | 22 | [{ 23 | params ["_handle"]; 24 | 25 | derp_perFrameHandlerArray deleteAt (derp_PFHhandles select _handle); 26 | derp_PFHhandles set [_handle, nil]; 27 | 28 | { 29 | _x params ["", "", "", "", "", "_handle"]; 30 | derp_PFHhandles set [_handle, _forEachIndex]; 31 | } forEach derp_perFrameHandlerArray; 32 | }, _handle] call derp_fnc_directCall; 33 | 34 | nil 35 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_waitAndExecute.sqf: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | Function: CBA_fnc_waitAndExecute 3 | Description: 4 | Executes a code once in non sched environment with a given game time delay. 5 | Parameters: 6 | _function - The function you wish to execute. 7 | _args - Parameters passed to the function executing. This will be the same array every execution. [optional] 8 | _delay - The amount of time in seconds between executions, 0 for every frame. [optional] (default: 0) 9 | Returns: 10 | Nothing 11 | Examples: 12 | (begin example) 13 | [{player sideChat format ["5s later! _this: %1", _this];}, ["some","params",1,2,3], 5] call CBA_fnc_waitAndExecute; 14 | (end) 15 | Author: 16 | esteldunedain and PabstMirror, donated from ACE3 17 | ---------------------------------------------------------------------------- */ 18 | params [["_function", {}, [{}]], ["_args", []], ["_delay", 0, [0]]]; 19 | 20 | derp_waitAndExecArray pushBack [derp_missionTime + _delay, _function, _args]; 21 | derp_waitAndExecArrayIsSorted = false; 22 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/fn_waitUntilAndExecute.sqf: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | Function: CBA_fnc_waitUntilAndExecute 3 | Description: 4 | Executes a code once in non sched environment after a condition is true. 5 | Parameters: 6 | _conditionFunction - The function to evaluate as condition. 7 | _statementFunction - The function to run once the condition is true. 8 | _args - Parameters passed to the function executing. This will be the same array every execution. [optional] 9 | Returns: 10 | Nothing 11 | Examples: 12 | (begin example) 13 | [{(_this select 0) == vehicle (_this select 0)}, {(_this select 0) setDamage 1;}, [player]] call CBA_fnc_waitUntilAndExecute; 14 | (end) 15 | Author: 16 | joko // Jonas, donated from ACE3 17 | ---------------------------------------------------------------------------- */ 18 | params [["_condition", {}, [{}]], ["_statement", {}, [{}]], ["_args", []]]; 19 | 20 | derp_waitUntilAndExecArray pushBack [_condition, _statement, _args]; 21 | 22 | nil 23 | -------------------------------------------------------------------------------- /functions/portedFuncs/cba/init_perFrameHandler.sqf: -------------------------------------------------------------------------------- 1 | #define DELAY_MONITOR_THRESHOLD 1 // Frames 2 | 3 | derp_perFrameHandlerArray = []; 4 | derp_lastTickTime = diag_tickTime; 5 | 6 | derp_waitAndExecArray = []; 7 | derp_waitAndExecArrayIsSorted = false; 8 | derp_nextFrameNo = diag_frameno + 1; 9 | // PostInit can be 2 frames after preInit, need to manually set nextFrameNo, so new items get added to buffer B while processing A for the first time: 10 | derp_nextFrameBufferA = [[[], {derp_nextFrameNo = diag_frameno;}]]; 11 | derp_nextFrameBufferB = []; 12 | derp_waitUntilAndExecArray = []; 13 | 14 | // per frame handler system 15 | derp_fnc_onFrame = { 16 | private _tickTime = diag_tickTime; 17 | call derp_fnc_missionTimePFH; 18 | 19 | // Execute per frame handlers 20 | { 21 | _x params ["_function", "_delay", "_delta", "", "_args", "_handle"]; 22 | 23 | if (diag_tickTime > _delta) then { 24 | _x set [2, _delta + _delay]; 25 | [_args, _handle] call _function; 26 | false 27 | }; 28 | } count derp_perFrameHandlerArray; 29 | 30 | 31 | // Execute wait and execute functions 32 | // Sort the queue if necessary 33 | if (!derp_waitAndExecArrayIsSorted) then { 34 | derp_waitAndExecArray sort true; 35 | derp_waitAndExecArrayIsSorted = true; 36 | }; 37 | private _delete = false; 38 | { 39 | if (_x select 0 > derp_missionTime) exitWith {}; 40 | 41 | (_x select 2) call (_x select 1); 42 | 43 | // Mark the element for deletion so it's not executed ever again 44 | derp_waitAndExecArray set [_forEachIndex, objNull]; 45 | _delete = true; 46 | } forEach derp_waitAndExecArray; 47 | if (_delete) then { 48 | derp_waitAndExecArray = derp_waitAndExecArray - [objNull]; 49 | }; 50 | 51 | 52 | // Execute the exec next frame functions 53 | { 54 | (_x select 0) call (_x select 1); 55 | false 56 | } count derp_nextFrameBufferA; 57 | // Swap double-buffer: 58 | derp_nextFrameBufferA = derp_nextFrameBufferB; 59 | derp_nextFrameBufferB = []; 60 | derp_nextFrameNo = diag_frameno + 1; 61 | 62 | 63 | // Execute the waitUntilAndExec functions: 64 | _delete = false; 65 | { 66 | // if condition is satisfied call statement 67 | if ((_x select 2) call (_x select 0)) then { 68 | (_x select 2) call (_x select 1); 69 | 70 | // Mark the element for deletion so it's not executed ever again 71 | derp_waitUntilAndExecArray set [_forEachIndex, objNull]; 72 | _delete = true; 73 | }; 74 | } forEach derp_waitUntilAndExecArray; 75 | if (_delete) then { 76 | derp_waitUntilAndExecArray = derp_waitUntilAndExecArray - [objNull]; 77 | }; 78 | }; 79 | 80 | // fix for save games. subtract last tickTime from ETA of all PFHs after mission was loaded 81 | addMissionEventHandler ["Loaded", { 82 | private _tickTime = diag_tickTime; 83 | 84 | { 85 | _x set [2, (_x select 2) - derp_lastTickTime + _tickTime]; 86 | } forEach derp_perFrameHandlerArray; 87 | 88 | derp_lastTickTime = _tickTime; 89 | }]; 90 | 91 | derp_missionTime = 0; 92 | derp_lastTime = time; 93 | 94 | // increase derp_missionTime variable every frame 95 | if (isMultiplayer) then { 96 | // multiplayer - no accTime in MP 97 | if (isServer) then { 98 | // multiplayer server 99 | derp_fnc_missionTimePFH = { 100 | if (time != derp_lastTime) then { 101 | derp_missionTime = derp_missionTime + (_tickTime - derp_lastTickTime); 102 | derp_lastTime = time; // used to detect paused game 103 | }; 104 | 105 | derp_lastTickTime = _tickTime; 106 | }; 107 | 108 | addMissionEventHandler ["PlayerConnected", { 109 | (_this select 4) publicVariableClient "derp_missionTime"; 110 | }]; 111 | } else { 112 | derp_missionTime = -1; 113 | 114 | // multiplayer client 115 | 0 spawn { 116 | "derp_missionTime" addPublicVariableEventHandler { 117 | derp_missionTime = _this select 1; 118 | 119 | derp_lastTickTime = diag_tickTime; // prevent time skip on clients 120 | 121 | derp_fnc_missionTimePFH = { 122 | if (time != derp_lastTime) then { 123 | derp_missionTime = derp_missionTime + (_tickTime - derp_lastTickTime); 124 | derp_lastTime = time; // used to detect paused game 125 | }; 126 | 127 | derp_lastTickTime = _tickTime; 128 | }; 129 | }; 130 | }; 131 | }; 132 | } else { 133 | // single player 134 | derp_fnc_missionTimePFH = { 135 | if (time != derp_lastTime) then { 136 | derp_missionTime = derp_missionTime + (_tickTime - derp_lastTickTime) * accTime; 137 | derp_lastTime = time; // used to detect paused game 138 | }; 139 | 140 | derp_lastTickTime = _tickTime; 141 | }; 142 | }; 143 | -------------------------------------------------------------------------------- /functions/revive/fn_ace3Check.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Checks if ACE3 is loaded 4 | * 5 | * Arguments: 6 | * None 7 | * 8 | * Return Value: 9 | * BOOL 10 | */ 11 | private _returnValue = ""; 12 | 13 | if !("ace_medical" in activatedAddons) then { 14 | _returnValue = "derp_revive"; 15 | }; 16 | 17 | _returnValue 18 | -------------------------------------------------------------------------------- /functions/revive/fn_adjustForTerrain.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Adjust the downed animation for terrain 4 | * 5 | * Arguments: 6 | * 0: Unit to adjust 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_unit"]; 12 | 13 | if (local _unit) then { 14 | _unit setVectorDir surfaceNormal position _unit; 15 | _unit setVectorUp surfaceNormal position _unit; 16 | } else { 17 | [_unit] remoteExec ["derp_revive_fnc_adjustForTerrain", _unit]; 18 | }; 19 | -------------------------------------------------------------------------------- /functions/revive/fn_animChanged.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handles the animChanged revive event in MP 4 | * 5 | * Arguments: 6 | * 0: Unit to add the EH to 7 | * 1: Mode to run in (true to add, false to remove) 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_unit", "_mode"]; 13 | 14 | if (_mode) then { 15 | private _derp_revive_animChangedID = _unit addEventHandler ["AnimChanged", { 16 | params ["_unit", "_anim"]; 17 | 18 | if (_unit getVariable ["derp_revive_downed", false] && {isNull objectParent _unit} && {!(_unit getVariable ["derp_revive_isDragged",false]) || {!(_unit getVariable ["derp_revive_isCarried", false])}} && {animationState _unit != "AinjPfalMstpSnonWrflDf_carried_fallwc"}) then { 19 | [_unit, "acts_injuredlyingrifle02_180"] remoteExec ["switchMove", 0]; 20 | }; 21 | }]; 22 | 23 | _unit setVariable ["_derp_revive_animChangedID", _derp_revive_animChangedID]; 24 | } else { 25 | _unit removeEventHandler ["AnimChanged", (_unit getVariable "_derp_revive_animChangedID")]; 26 | _unit setVariable ["_derp_revive_animChangedID", nil]; 27 | 28 | }; 29 | -------------------------------------------------------------------------------- /functions/revive/fn_carrying.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Initiate the carrying animations, when done will call the proper function to actually start the carrying 4 | * 5 | * Arguments: 6 | * 0: Unit doing the carrying 7 | * 1: Unit being carried 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_dragger", "_dragged"]; 13 | 14 | [_dragger] allowGetIn false; 15 | 16 | private _timer = derp_missionTime + 5; 17 | 18 | 19 | [_dragged, (getDir _dragger)] remoteExec ["setDir", _dragged]; 20 | _dragged setPosASL (getPosASL _dragger vectorAdd (vectorDir _dragger)); 21 | 22 | [_dragger, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon"] call derp_revive_fnc_syncAnim; 23 | [_dragged, "AinjPfalMstpSnonWrflDnon_carried_Up"] call derp_revive_fnc_syncAnim; 24 | 25 | private _timer = derp_missionTime + 15; 26 | 27 | [{ 28 | params ["_args", "_idPFH"]; 29 | _args params ["_dragger", "_dragged", "_timeOut"]; 30 | 31 | if ((_dragger getVariable ["derp_revive_downed", false]) || {!alive _dragger} || {!alive _dragged} || {_dragger distance _dragged > 10} || {!(_dragger getVariable ["derp_revive_isCarrying", false])} || {!(_dragged setVariable ["derp_revive_isCarried", false])}) exitWith { 32 | _dragger setVariable ["derp_revive_isCarrying", false, true]; 33 | _dragged setVariable ["derp_revive_isCarried", false, true]; 34 | [_dragged, "acts_injuredlyingrifle02_180"] call derp_revive_fnc_syncAnim; 35 | [_dragged] call derp_revive_fnc_adjustForTerrain; 36 | [_dragger, ""] call derp_revive_fnc_syncAnim; 37 | [_idPFH] call derp_fnc_removePerFrameHandler; 38 | }; 39 | 40 | if (derp_missionTime > _timeOut) exitWith { 41 | [_dragger, _dragged] call derp_revive_fnc_startCarrying; 42 | [_idPFH] call derp_fnc_removePerFrameHandler; 43 | }; 44 | }, 0.2, [_dragger, _dragged, derp_missionTime + 5]] call derp_fnc_addPerFrameHandler; 45 | -------------------------------------------------------------------------------- /functions/revive/fn_diaryEntries.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Adds derp_revive diary entries 4 | * 5 | * Arguments: 6 | * none 7 | * 8 | * Return Value: 9 | * nothing 10 | */ 11 | player createDiarySubject ["derp_revive", "Derp revive"]; 12 | player createDiaryRecord ["derp_revive", ["Credits", " 13 |
Author: Alganthe 14 |
PFH code: CBA's team, authors for each functions in the headers. 15 | 16 | "]]; 17 | 18 | private _everyoneCanRevive = "everyone"; 19 | if (getMissionConfigValue ["derp_revive_everyoneCanRevive", 0] isEqualTo 0) then { 20 | _everyoneCanRevive = "medics only"; 21 | }; 22 | 23 | private _reviveItem = "Medikit"; 24 | if (getMissionConfigValue ["derp_revive_reviveItem", 0] isEqualTo 0) then { 25 | _reviveItem = "FAK"; 26 | }; 27 | 28 | private _removeFakOnUse = "true"; 29 | if (getMissionConfigValue ["derp_revive_removeFAKOnUse", 0] isEqualTo 0) then { 30 | _removeFakOnUse = "false"; 31 | }; 32 | 33 | player createDiaryRecord ["derp_revive", ["Parameters", format [ 34 | " 35 |
Bleed out timer: %1 36 |
Who can revive: %2 37 |
Revive item: %3 38 |
Remove FAK on use: %4 39 | ", 40 | (getMissionConfigValue ["derp_revive_bleedOutTimer", 300]), 41 | _everyoneCanRevive, 42 | _reviveItem, 43 | _removeFakOnUse 44 | ]]]; 45 | 46 | player createDiaryRecord ["derp_revive", ["Having an issue?", " 47 |
Issue tracker: https://github.com/alganthe/Co-ops/issues 48 | "]]; 49 | 50 | player createDiaryRecord ["derp_revive", ["FAQ", " 51 |
Q:Why do I sometimes die straight away instead of entering the downed state? 52 |
A: Entering the downed state or not is based on the amount of damage you took, if you get shot in the head you'll die straight away, same for a tank shell to the torso, or even 5.56 to the pelvis. 53 |
54 | "]]; 55 | -------------------------------------------------------------------------------- /functions/revive/fn_dragging.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Initiate dragging animations, when done will call the proper function to actually start the dragging 4 | * 5 | * Arguments: 6 | * 0: Unit doing the dragging 7 | * 1: Unit being dragged 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_dragger", "_dragged"]; 13 | 14 | [_dragger] allowGetIn false; 15 | 16 | // Reverse dir needed because of the downed animation being reversed itself 17 | [_dragged, ((getDir _dragger) + 180)] remoteExec ["setDir", _dragged]; 18 | _dragged setPosASL (getPosASL _dragger vectorAdd (vectorDir _dragger vectorMultiply 1.5)); 19 | 20 | _dragger playActionNow "grabDrag"; 21 | [_dragged, "AinjPpneMrunSnonWnonDb_grab"] call derp_revive_fnc_syncAnim; 22 | 23 | [{ 24 | params ["_args", "_idPFH"]; 25 | _args params ["_dragger", "_dragged", "_timeOut"]; 26 | 27 | if ((_dragger getVariable ["derp_revive_downed", false]) || {!alive _dragger} || {!alive _dragged} || {derp_missionTime > _timeOut} || {!(_dragger getVariable ["derp_revive_isDragging", false])} || {!(_dragged setVariable ["derp_revive_isDragged", false])}) exitWith { 28 | _dragger setVariable ["derp_revive_isDragging", false ,true]; 29 | _dragged setVariable ["derp_revive_isDragged", false ,true]; 30 | [_dragged, "acts_injuredlyingrifle02_180"] call derp_revive_fnc_syncAnim; 31 | [_dragged] call derp_revive_fnc_adjustForTerrain; 32 | [_dragger, ""] call derp_revive_fnc_syncAnim; 33 | [_idPFH] call derp_fnc_removePerFrameHandler; 34 | }; 35 | 36 | // unit is ready to start dragging 37 | if (animationState _dragger in ["amovpercmstpslowwrfldnon_acinpknlmwlkslowwrfldb_2", "amovpercmstpsraswpstdnon_acinpknlmwlksnonwpstdb_2", "amovpercmstpsnonwnondnon_acinpknlmwlksnonwnondb_2", "acinpknlmstpsraswrfldnon", "acinpknlmstpsnonwpstdnon", "acinpknlmstpsnonwnondnon", "acinpknlmwlksraswrfldb", "acinpknlmwlksnonwnondb"]) exitWith { 38 | [_dragger, _dragged] call derp_revive_fnc_startDragging; 39 | [_idPFH] call derp_fnc_removePerFrameHandler; 40 | }; 41 | }, 0.2, [_dragger, _dragged, derp_missionTime + 5]] call derp_fnc_addPerFrameHandler; 42 | -------------------------------------------------------------------------------- /functions/revive/fn_drawDowned.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Event handling the drawing of icons on downed units for medics or for everyone (depending on setting) 4 | * DO NOT CALL THIS. This should only be called once on player init 5 | * 6 | * Arguments: 7 | * Nothing 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | addMissionEventHandler ["Draw3D", { 13 | { 14 | drawIcon3D [ 15 | "\A3\ui_f\data\igui\cfg\actions\heal_ca.paa", 16 | [0.74, 0.06, 0.06, 1 * (1 - ((player distance2d _x ) / 1000))], 17 | visiblePosition _x, 18 | 1 * (1 - ((player distance2d _x ) / 1000)), 19 | 1 * (1 - ((player distance2d _x) / 1000)), 20 | 0, 21 | "", 22 | 2 * (1 - ((player distance2d _x) / 1000)), 23 | 0.04 * (1 - ((player distance2d _x) / 1000)) 24 | ]; 25 | } forEach (position player nearEntities ["CAManBase", 1000] select {_x != player && {_x getVariable ["derp_revive_downed", false]} && {(_x getVariable ['derp_revive_side', west]) == side player}}); 26 | }]; 27 | -------------------------------------------------------------------------------- /functions/revive/fn_dropPerson.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Drop the person from carrying / dragging 4 | * 5 | * Arguments: 6 | * 0: Unit doing the dragging / carrying 7 | * 1: Unit being dragged / carried 8 | * 2: State 9 | * 10 | * Return Value: 11 | * Nothing 12 | */ 13 | params ["_dragger", "_dragged", "_state", ["_vehicle", objNull]]; 14 | 15 | _state = toUpper _state; 16 | if !(_state in ["DRAGGING", "CARRYING", "VEHICLE"]) exitWith {}; 17 | 18 | switch (_state) do { 19 | case "DRAGGING": { 20 | 21 | _dragger setVariable ["derp_revive_isDragging", false, true]; 22 | _dragged setVariable ["derp_revive_isDragged", false, true]; 23 | 24 | detach _dragged; 25 | 26 | if (alive _dragged && {vehicle _dragged == _dragged}) then { 27 | [_dragged, "acts_injuredlyingrifle02_180"] call derp_revive_fnc_syncAnim; 28 | [_dragged] call derp_revive_fnc_adjustForTerrain; 29 | }; 30 | 31 | if (alive _dragger && {!(_dragger getVariable ["derp_revive_downed", false])} && {vehicle _dragger == _dragger}) then { 32 | _dragger playAction "released"; 33 | }; 34 | }; 35 | 36 | case "CARRYING": { 37 | 38 | _dragger setVariable ["derp_revive_isCarrying", false, true]; 39 | _dragged setVariable ["derp_revive_isCarried", false, true]; 40 | 41 | detach _dragged; 42 | 43 | if (alive _dragged && {vehicle _dragged == _dragged}) then { 44 | true remoteExec ["disableUserInput", _dragged]; 45 | [_dragged, "AinjPfalMstpSnonWrflDf_carried_fallwc"] call derp_revive_fnc_syncAnim; 46 | 47 | [{ 48 | params ["_dragged"]; 49 | false remoteExec ["disableUserInput", _dragged]; 50 | [_dragged] call derp_revive_fnc_adjustForTerrain; 51 | }, [_dragged], 5] call derp_fnc_waitAndExecute; 52 | }; 53 | 54 | if (alive _dragger && {!(_dragger getVariable ["derp_revive_downed", false])} && {vehicle _dragger == _dragger}) then { 55 | [_dragger, "AcinPercMrunSnonWnonDf_AmovPercMstpSnonWnonDnon"] call derp_revive_fnc_syncAnim; 56 | }; 57 | }; 58 | 59 | case "VEHICLE": { 60 | detach _dragged; 61 | 62 | _dragger setVariable ["derp_revive_isDragging", false, true]; 63 | _dragged setVariable ["derp_revive_isDragged", false, true]; 64 | _dragger setVariable ["derp_revive_isCarrying", false, true]; 65 | _dragged setVariable ["derp_revive_isCarried", false, true]; 66 | 67 | [_dragger, "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"] call derp_revive_fnc_syncAnim; 68 | 69 | [_dragged, _vehicle] remoteExec ["moveInCargo", _dragged]; 70 | [{ 71 | (vehicle (_this select 0) != _this select 0) 72 | }, 73 | { 74 | [_this select 0, "Die"] remoteExec ["playAction", 0]; 75 | }, [_dragged]] call derp_fnc_waitUntilAndExecute; 76 | 77 | }; 78 | }; 79 | -------------------------------------------------------------------------------- /functions/revive/fn_executeTemplates.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Jiri Wainar 3 | Rewrote by: alganthe 4 | 5 | Description: 6 | Execute the defined templates for a specific unit. 7 | 8 | Parameters: 9 | _this: OBJECT - Unit 10 | 11 | Returns: 12 | True if successful, false if not. 13 | */ 14 | params [["_unit", objNull]]; 15 | 16 | if (isNull _unit) exitWith {false}; 17 | 18 | 19 | private _executeTemplates = { 20 | params ["_unit", "_templates"]; 21 | 22 | //execute supported templates 23 | if ({_x == "MenuPosition"} count _templates > 0) then {if (alive _unit) then {[_unit, nil, nil, nil, true] call bis_fnc_respawnMenuPosition} else {[_unit, nil, nil, nil, true] spawn bis_fnc_respawnMenuPosition}}; 24 | if ({_x == "MenuInventory"} count _templates > 0) then {if (alive _unit) then {[_unit, nil, nil, nil, true] call bis_fnc_respawnMenuInventory} else {[_unit, nil, nil, nil, true] spawn bis_fnc_respawnMenuInventory}}; 25 | 26 | //reset respawn time 27 | setPlayerRespawnTime (missionNamespace getVariable ["bis_selectRespawnTemplate_delay", getMissionConfigValue "respawnDelay"]); 28 | }; 29 | 30 | //execute side templates only, if they are defined 31 | private _templates = missionNamespace getVariable [format["derp_revive_templates%1",_unit call bis_fnc_objectSide],[]]; 32 | _templates = _templates - ["derp_revive"]; 33 | 34 | if (count _templates > 0) exitWith {[_unit, _templates] call _executeTemplates; true}; 35 | 36 | //otherwise, execute global templates 37 | if (isNil "derp_revive_templates") then { 38 | derp_revive_templates = getArray (missionConfigFile >> "respawnTemplates"); 39 | }; 40 | 41 | _templates = derp_revive_templates; 42 | _templates = _templates - ["derp_revive"]; 43 | if (count _templates > 0) exitWith {[_unit, _templates] call _executeTemplates; true}; 44 | 45 | true 46 | -------------------------------------------------------------------------------- /functions/revive/fn_handleDamage.sqf: -------------------------------------------------------------------------------- 1 | player addEventHandler ["HandleDamage", { 2 | params ["_unit", "_selection", "_damage", "_source", "", "_index"]; 3 | 4 | private _maxSafeDamage = getMissionConfigValue ["derp_revive_maxSafeDamage", 0.95]; 5 | private _downedDamageTreshold = getMissionConfigValue ["derp_revive_downedDamageTreshold", 1.5]; 6 | private _damageReturned = 0; 7 | 8 | if (alive _unit) then { 9 | // If the unit is inside a dead vehicle, kill it 10 | if (!isNull objectParent _unit && {!alive vehicle _unit}) exitWith { 11 | _damageReturned = 1; 12 | 13 | forceRespawn _unit; 14 | }; 15 | 16 | // Handles the source of the damage 17 | if (isNull _source) then { 18 | _source = missionNamespace getVariable ["derp_revive_lastDamageSource",objNull]; 19 | } else { 20 | derp_revive_lastDamageSource = _source; 21 | }; 22 | 23 | if (_index > -1) then { 24 | if (_damage < 0.1) then { 25 | _damageReturned = (_unit getHit _selection) min _maxSafeDamage; 26 | 27 | } else { 28 | 29 | // Kill the unit if it's alive and received damage above the treshold 30 | if (_damage >= _downedDamageTreshold && {alive _unit}) then { 31 | _damageReturned = 1; 32 | _unit setVariable ["derp_revive_loadout", getUnitLoadout _unit]; 33 | forceRespawn _unit; 34 | [_source] call bis_fnc_reviveAwardKill; 35 | 36 | } else { 37 | // Check if the damage received is above the vanilla death treshold 38 | if (_damage >= 1 && {!(_unit getVariable ["derp_revive_downed", false])}) then { 39 | _damageReturned = 0.95; 40 | 41 | // Check if the player is on foot and above water, if so put it into downed state 42 | if (vehicle _unit == _unit && {(getPosASL _unit) select 2 > 0}) then { 43 | _unit setUnconscious true; 44 | [_unit, "DOWNED"] call derp_revive_fnc_switchState; 45 | cutText ["","BLACK", 1]; 46 | _unit allowDamage false; 47 | 48 | } else { 49 | 50 | // If the unit is under water kill it 51 | if (vehicle _unit == _unit && {(getPosASL _unit) select 2 < 0}) then { 52 | _damageReturned = 1; 53 | _unit setVariable ["derp_revive_loadout", getUnitLoadout _unit]; 54 | forceRespawn _unit; 55 | [_source] call bis_fnc_reviveAwardKill; 56 | 57 | } else { 58 | // Check if the vehicle is inside a vehicle, and if that vehicle ejects dead corpses (like the quadbike), in that case kill the unit 59 | private _seat = ((fullCrew vehicle _unit) select {_x select 0 == _unit}) select 0; 60 | 61 | if ( (_seat select 1 == "driver" && {getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle _unit) >> "ejectDeadDriver") == 1}) || {(_seat select 1 in ["cargo", "turret", "gunner"]) && {getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle _unit) >> "ejectDeadCargo") == 1}} || {(getPosASL _unit) select 2 < 0}) then { 62 | _damageReturned = 1; 63 | _unit setVariable ["derp_revive_loadout", getUnitLoadout _unit]; 64 | forceRespawn _unit; 65 | [_source] call bis_fnc_reviveAwardKill; 66 | 67 | } else { 68 | [_unit, "DOWNED"] call derp_revive_fnc_switchState; 69 | cutText ["","BLACK", 1]; 70 | _unit allowDamage false; 71 | }; 72 | }; 73 | }; 74 | } else { 75 | _damageReturned = _maxSafeDamage min _damage; 76 | }; 77 | }; 78 | }; 79 | }; 80 | }; 81 | 82 | _damageReturned 83 | }]; 84 | -------------------------------------------------------------------------------- /functions/revive/fn_heartBeatPFH.sqf: -------------------------------------------------------------------------------- 1 | 2 | [{ 3 | params ["_args", "_pfhID"]; 4 | 5 | if (!alive player || {!(player getVariable ["derp_revive_downed", false])}) then { 6 | _pfhID call derp_fnc_removePerFrameHandler; 7 | } else { 8 | playSound (selectRandom ["derp_heartBeat1", "derp_heartBeat2", "derp_heartBeat3", "derp_heartBeat4"]); 9 | }; 10 | }, 2, []] call derp_fnc_addPerFrameHandler; 11 | -------------------------------------------------------------------------------- /functions/revive/fn_hotkeyHandler.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handles hotkey presses in the downed state 4 | * 5 | * Arguments: 6 | * 7 | * Return Value: 8 | * Nothing 9 | */ 10 | derp_reviveKeyDownID = (findDisplay 46) displayAddEventHandler ["KeyDown", { 11 | params ["", "_key"]; 12 | 13 | if (_key == 1 && {alive player}) then { 14 | createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer); 15 | 16 | disableSerialization; 17 | 18 | private _dlg = findDisplay 49; 19 | 20 | for "_index" from 100 to 2000 do { 21 | (_dlg displayCtrl _index) ctrlEnable false; 22 | }; 23 | 24 | private _ctrl = _dlg displayctrl 103; 25 | _ctrl ctrlSetEventHandler ["buttonClick","{closeDialog 0}; failMission 'LOSER';"]; 26 | _ctrl ctrlEnable true; 27 | _ctrl ctrlSetText "ABORT"; 28 | _ctrl ctrlSetTooltip "Abort."; 29 | 30 | _ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer); 31 | _ctrl ctrlSetEventHandler ["buttonClick", "closeDialog 0; player setDamage 1; "]; 32 | _ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); 33 | _ctrl ctrlSetText "RESPAWN"; 34 | _ctrl ctrlSetTooltip "Respawn."; 35 | }; 36 | 37 | if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then { 38 | private _acc = accTime; 39 | teamSwitch; 40 | setAccTime _acc; 41 | }; 42 | 43 | if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then { 44 | openCuratorInterface; 45 | }; 46 | 47 | if (_key in actionKeys "ShowMap") then { 48 | if (visibleMap) then { 49 | openMap false; 50 | } else { 51 | openMap true; 52 | }; 53 | }; 54 | 55 | // Revive 56 | if (_key == 57 && {player getVariable ["derp_revive_downed", false]}) then { 57 | if (isNil "derp_revive_keyDown") then { 58 | [{ 59 | params ["_args", "_idPFH"]; 60 | _args params ["_timeOut"]; 61 | 62 | if (isNil "derp_revive_keyDown") then { 63 | [_idPFH] call derp_fnc_removePerFrameHandler; 64 | } else { 65 | if (ceil derp_missionTime >= ceil _timeOut + 3) then { 66 | player setDamage 1; 67 | [_idPFH] call derp_fnc_removePerFrameHandler; 68 | } else { 69 | titleText ["Respawn in " + str ((ceil _timeOut + 3) - ceil derp_missionTime), "PLAIN", 0.1]; // The use of ceil is to avoid weird numbers 70 | }; 71 | }; 72 | }, 1, [derp_missionTime]] call derp_fnc_addPerFrameHandler; 73 | derp_revive_keyDown = true; 74 | }; 75 | }; 76 | 77 | if (isServer || {serverCommandAvailable "#kick"}) then { 78 | if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then { 79 | _key = 0; 80 | }; 81 | }; 82 | 83 | _key > 0 84 | }]; 85 | 86 | derp_reviveKeyUpID = (findDisplay 46) displayAddEventHandler ["KeyUp", { 87 | derp_revive_keyDown = nil; 88 | 89 | if (_key == 57 && {player getVariable ["derp_revive_downed", false]}) then { 90 | } else { 91 | true 92 | }; 93 | }]; 94 | -------------------------------------------------------------------------------- /functions/revive/fn_onPlayerKilled.sqf: -------------------------------------------------------------------------------- 1 | params ["_unit", "_killer", "_respawn", "_respawnDelay"]; 2 | 3 | // Remove the interactions from the corpse (revive, drag etc) to avoid duplicates 4 | removeAllActions _unit; 5 | // Set it as not downed to avoid the above interactions to be available 6 | _unit setVariable ["derp_revive_downed", false, true]; 7 | // Call the rest of the templates, not doing so will result in the respawn screen breaking badly 8 | player call derp_revive_fnc_executeTemplates; 9 | -------------------------------------------------------------------------------- /functions/revive/fn_onPlayerRespawn.sqf: -------------------------------------------------------------------------------- 1 | params ["_newUnit", "_corpse", "_respawn", "_respawnDelay"]; 2 | 3 | [player] call derp_revive_fnc_reviveActions; // Add back the action, since we can't fucking keep it 4 | 5 | [_newUnit, "ALIVE"] call derp_revive_fnc_switchState; 6 | -------------------------------------------------------------------------------- /functions/revive/fn_reviveActions.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Add the proper actions on unit init, those use cursorObject and are added to the player, no need to add them back after death 4 | * 5 | * Arguments: 6 | * 0: Unit the actions are added to 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_unit"]; 12 | 13 | private _whoCanRevive = ""; 14 | if (getMissionConfigValue ["derp_revive_everyoneCanRevive", 0] == 0) then { 15 | _whoCanRevive = "{_this getUnitTrait 'medic'} &&"; 16 | }; 17 | 18 | private _itemUsed = "{('FirstAidKit' in items _this) || {'FirstAidKit' in items cursorObject}} &&"; 19 | 20 | if (getMissionConfigValue ["derp_revive_reviveItem", 0] == 1) then { 21 | _itemUsed = "{'Medikit' in items _this} &&"; 22 | }; 23 | 24 | // Reviving 25 | _unit addAction [ 26 | " Revive ", 27 | { 28 | params ["", "_caller", "", "_args"]; 29 | _caller playAction "medicStart"; 30 | _caller setVariable ["derp_revive_reviving", true]; 31 | 32 | [{ 33 | params ["_args", "_pfhID"]; 34 | _args params ["_startingTIme", "_unit", "_target"]; 35 | 36 | if !((_caller distance _target < 5) && {(alive _caller) && {alive _target}} && {_caller getVariable ["derp_revive_reviving", false]} && {_target getVariable ['derp_revive_downed', false]} && {vehicle _target == _target} && {!(_target getVariable ['derp_revive_isDragged', false])} && {!(_target getVariable ['derp_revive_isCarried', false])} && {!(_caller getVariable ['derp_revive_isDragging', false])} && {!(_caller getVariable ['derp_revive_isCarrying', false])}) then { 37 | _caller playAction "medicStop"; 38 | _unit setVariable ["derp_revive_reviving", false]; 39 | _pfhID call derp_fnc_removePerFrameHandler; 40 | 41 | }; 42 | 43 | if (_startingTIme + 6 <= time) then { 44 | if (getMissionConfigValue ["derp_revive_removeFAKOnUse", 1] == 1 && {getMissionConfigValue ["derp_revive_reviveItem", 0] == 0}) then { 45 | 46 | if ('FirstAidKit' in items _unit) then { 47 | _unit removeItem "FirstAidKit"; 48 | 49 | } else { 50 | _target removeItem "FirstAidKit"; 51 | }; 52 | 53 | [_target, "REVIVED"] remoteExecCall ["derp_revive_fnc_switchState", _target]; 54 | 55 | if (group _target isEqualTo group _unit) then { 56 | [_unit, 2] remoteExec ["addScore", 2]; 57 | 58 | } else { 59 | [_unit, 1] remoteExec ["addScore", 2]; 60 | }; 61 | 62 | _unit playAction "medicStop"; 63 | _unit setVariable ["derp_revive_reviving", false]; 64 | _pfhID call derp_fnc_removePerFrameHandler; 65 | }; 66 | }; 67 | }, 1, [time, _caller, cursorObject]] call derp_fnc_addPerFrameHandler; 68 | }, 69 | [], 70 | 10, 71 | true, 72 | true, 73 | "", 74 | "(_this distance cursorObject < 5) && {!(_this getVariable ['derp_revive_reviving', false])} && {cursorObject getVariable ['derp_revive_downed', false]} && {(cursorObject getVariable ['derp_revive_side', west]) == side _this} && {vehicle _this == _this} && {vehicle cursorObject == cursorObject} &&" + _whoCanRevive + _itemUsed + "{!(cursorObject getVariable ['derp_revive_isDragged', false])} && {!(cursorObject getVariable ['derp_revive_isCarried', false])} && {!(_this getVariable ['derp_revive_isDragging', false])} && {!(_this getVariable ['derp_revive_isCarrying', false])}" 75 | ]; 76 | 77 | // Stop reviving 78 | _unit addAction [ 79 | " Stop reviving ", 80 | { 81 | params ["", "_caller", "", "_args"]; 82 | _caller setVariable ["derp_revive_reviving", false]; 83 | _caller playAction "medicStop"; 84 | 85 | }, 86 | [], 87 | 10, 88 | true, 89 | true, 90 | "", 91 | "(_this getVariable ['derp_revive_reviving', false])" 92 | ]; 93 | 94 | // Dragging 95 | _unit addAction [ 96 | " Drag ", 97 | { 98 | params ["", "_caller", "", "_args"]; 99 | _caller setVariable ["derp_revive_isDragging", true ,true]; 100 | cursorObject setVariable ["derp_revive_isDragged", true ,true]; 101 | [_caller, cursorObject] call derp_revive_fnc_dragging; 102 | }, 103 | [], 104 | 10, 105 | true, 106 | true, 107 | "", 108 | "(_this distance cursorObject < 5) && {!(_this getVariable ['derp_revive_reviving', false])} && {cursorObject getVariable ['derp_revive_downed', false]} && {(cursorObject getVariable ['derp_revive_side', west]) == side _this} && {vehicle _this == _this} && {vehicle cursorObject == cursorObject} && {!(cursorObject getVariable ['derp_revive_isDragged', false])} && {!(_this getVariable ['derp_revive_isDragging', false])} && {!(_this getVariable ['derp_revive_isCarrying', false])} && {!(cursorObject getVariable ['derp_revive_isCarried', false])}" 109 | ]; 110 | 111 | // Carrying 112 | _unit addAction [ 113 | " Carry ", 114 | { 115 | params ["", "_caller", "", "_args"]; 116 | _caller setVariable ["derp_revive_isCarrying", true ,true]; 117 | cursorObject setVariable ["derp_revive_isCarried", true ,true]; 118 | [_caller, cursorObject] call derp_revive_fnc_carrying; 119 | }, 120 | [], 121 | 10, 122 | true, 123 | true, 124 | "", 125 | "(_this distance cursorObject < 5) && {!(_this getVariable ['derp_revive_reviving', false])} && {cursorObject getVariable ['derp_revive_downed', false]} && {(cursorObject getVariable ['derp_revive_side', west]) == side _this} && {isNull objectParent _this} && {vehicle cursorObject == cursorObject} && {!(_this getVariable ['derp_revive_isDragging', false])} && {!(_this getVariable ['derp_revive_isCarrying', false])} && {!(cursorObject getVariable ['derp_revive_isDragged', false])} && {!(cursorObject getVariable ['derp_revive_isCarried', false])}" 126 | ]; 127 | 128 | // Stop dragging 129 | _unit addAction [ 130 | " Stop dragging ", 131 | { 132 | params ["", "_caller", "", "_args"]; 133 | { 134 | detach _x; 135 | } foreach ((attachedObjects _caller) select {isNull _x}); 136 | 137 | private _dragged = ((attachedObjects _caller) select {_x isKindOf "CAManBase"}); 138 | if (_dragged isEqualTo []) then { 139 | _caller setVariable ["derp_revive_isDragging", false ,true]; 140 | } else { 141 | [_caller, _dragged select 0, "DRAGGING"] call derp_revive_fnc_dropPerson; 142 | }; 143 | }, 144 | [], 145 | 10, 146 | true, 147 | true, 148 | "", 149 | "(_this getVariable ['derp_revive_isDragging', false])" 150 | ]; 151 | 152 | // Stop carrying 153 | _unit addAction [ 154 | " Stop carrying ", 155 | { 156 | params ["", "_caller", "", "_args"]; 157 | { 158 | detach _x; 159 | } foreach ((attachedObjects _caller) select {isNull _x}); 160 | 161 | private _dragged = ((attachedObjects _caller) select {_x isKindOf "CAManBase"}); 162 | if (_dragged isEqualTo []) then { 163 | _caller setVariable ["derp_revive_isCarrying", false ,true]; 164 | } else { 165 | [_caller, _dragged select 0, "CARRYING"] call derp_revive_fnc_dropPerson; 166 | }; 167 | 168 | }, 169 | [], 170 | 10, 171 | true, 172 | true, 173 | "", 174 | "(_this getVariable ['derp_revive_isCarrying', false])" 175 | ]; 176 | 177 | // Put in 178 | _unit addAction [ 179 | " Put injured in vehicle ", 180 | { 181 | params ["", "_caller", "", "_args"]; 182 | { 183 | detach _x; 184 | } foreach ((attachedObjects _caller) select {isNull _x}); 185 | 186 | private _dragged = ((attachedObjects _caller) select {_x isKindOf "CAManBase"}) select 0; 187 | if (_dragged isEqualTo []) then { 188 | _caller setVariable ["derp_revive_isDragging", false ,true]; 189 | _caller setVariable ["derp_revive_isCarrying", false ,true]; 190 | } else { 191 | [_caller, _dragged, "VEHICLE", cursorObject] call derp_revive_fnc_dropPerson; 192 | }; 193 | 194 | }, 195 | [], 196 | 10, 197 | true, 198 | true, 199 | "", 200 | "(_this distance cursorObject < 5) && {!(_this getVariable ['derp_revive_reviving', false])} && {(_this getVariable ['derp_revive_isCarrying', false]) || {_this getVariable ['derp_revive_isDragging', false]}} && {!(((attachedObjects _this) select {_x isKindOf 'CAManBase'}) isEqualTo [])} && {(cursorObject emptyPositions 'cargo' > 0)} " 201 | ]; 202 | 203 | // Pull out 204 | _unit addAction [ 205 | " Pull injured from vehicle ", 206 | { 207 | params ["", "_caller", "", "_args"]; 208 | 209 | private _injured = ((crew cursorObject) select {(_x getVariable ['derp_revive_downed', false])}) select 0; 210 | moveOut _injured; 211 | }, 212 | [], 213 | 10, 214 | true, 215 | true, 216 | "", 217 | "(_this distance cursorObject < 5) && {!(_this getVariable ['derp_revive_reviving', false])} && {!(_this getVariable ['derp_revive_isCarrying', false]) || {!(_this getVariable ['derp_revive_isDragging', false])}} && {!(cursorObject isKindof 'CAManBase')} && {{(_x getVariable ['derp_revive_downed', false]) && {(_x getVariable ['derp_revive_side', west]) == side _this}} count (crew cursorObject) > 0}" 218 | ]; 219 | -------------------------------------------------------------------------------- /functions/revive/fn_reviveTimer.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handles the bleeding timer 4 | * 5 | * Arguments: 6 | * Unit the timer follows, should always be the local player 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_unit"]; 12 | 13 | derp_revive_bleedOutTimer = 0; 14 | 15 | [{ 16 | params ["_args", "_pfhID"]; 17 | _args params ["_unit", "_timerLength"]; 18 | 19 | // Check if unit is still downed 20 | if (!alive _unit || {!(_unit getVariable ["derp_revive_downed", false])}) then { 21 | 22 | derp_revive_bleedOutTimer = nil; // For the next death 23 | _pfhID call derp_fnc_removePerFrameHandler; 24 | }; 25 | 26 | // Check if timer reached 0 27 | if (derp_revive_bleedOutTimer >= _timerLength) then { 28 | 29 | derp_revive_bleedOutTimer = nil; // For the next death 30 | _unit setDamage 1; 31 | _pfhID call derp_fnc_removePerFrameHandler; 32 | 33 | } else { 34 | // draw timer 35 | 99 cutText [format ["Timer: %1 \n Hold space to respawn", _timerLength - derp_revive_bleedOutTimer], "PLAIN DOWN", 0.1]; 36 | derp_revive_bleedOutTimer = derp_revive_bleedOutTimer + 1; 37 | }; 38 | }, 1, [_unit, (getMissionConfigValue ["derp_revive_bleedOutTimer", 300])]] call derp_fnc_addPerFrameHandler; 39 | -------------------------------------------------------------------------------- /functions/revive/fn_startCarrying.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Actually start the carrying 4 | * 5 | * Arguments: 6 | * 0: Unit doing the carrying 7 | * 1: Unit being carried 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_dragger", "_dragged"]; 13 | 14 | [_dragger, "AcinPercMstpSnonWnonDnon"] call derp_revive_fnc_syncAnim; 15 | [_dragged, "AinjPfalMstpSnonWrflDnon_carried_still"] call derp_revive_fnc_syncAnim; 16 | 17 | _dragged attachTo [_dragger, [0.4, 0, -1.2], "LeftShoulder"]; 18 | 19 | [{ 20 | params ["_args", "_idPFH"]; 21 | _args params ["_dragger","_dragged", "_startTime"]; 22 | 23 | if !(_dragged getVariable "derp_revive_isCarried") then { 24 | [_idPFH] call derp_fnc_removePerFrameHandler; 25 | }; 26 | 27 | if (!alive _dragged || {!alive _dragger} || {_dragger getVariable ["derp_revive_downed", false]} || {vehicle _dragger != _dragger} || {_dragger distance _dragged > 10}) then { 28 | if ((_dragger distance _dragged > 10) && {(derp_missionTime - _startTime) < 1}) exitWith {}; 29 | [_dragger, _dragged, "CARRYING"] call derp_revive_fnc_dropPerson; 30 | [_idPFH] call derp_fnc_removePerFrameHandler; 31 | }; 32 | } , 0.5, [_dragger, _dragged, derp_missionTime]] call derp_fnc_addPerFrameHandler; 33 | -------------------------------------------------------------------------------- /functions/revive/fn_startDragging.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Actually start the dragging 4 | * 5 | * Arguments: 6 | * 0: Unit doing the dragging 7 | * 1: Unit being dragged 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_dragger", "_dragged"]; 13 | 14 | _dragged setPosASL (getPosASL _dragger vectorAdd (vectorDir _dragger vectorMultiply 1.5)); 15 | 16 | _dragged attachTo [_dragger, [0, 1, 0]]; 17 | [_dragged, 180] remoteExec ["setDir", _dragged]; 18 | [_dragged, "AinjPpneMrunSnonWnonDb_still"] call derp_revive_fnc_syncAnim; 19 | 20 | [{ 21 | params ["_args", "_idPFH"]; 22 | _args params ["_dragger","_dragged", "_startTime"]; 23 | 24 | if !(_dragged getVariable "derp_revive_isDragged") then { 25 | [_idPFH] call derp_fnc_removePerFrameHandler; 26 | }; 27 | 28 | if (!alive _dragged || {!alive _dragger}|| {_dragger getVariable ["derp_revive_downed", false]} || {vehicle _dragger != _dragger} || {_dragger distance _dragged > 10}) then { 29 | if ((_dragger distance _dragged > 10) && {(derp_missionTime - _startTime) < 1}) exitWith {}; 30 | [_dragger, _dragged, "DRAGGING"] call derp_revive_fnc_dropPerson; 31 | [_idPFH] call derp_fnc_removePerFrameHandler; 32 | }; 33 | } , 0.5, [_dragger, _dragged, derp_missionTime]] call derp_fnc_addPerFrameHandler; 34 | -------------------------------------------------------------------------------- /functions/revive/fn_switchState.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handles the revive states 4 | * 5 | * Arguments: 6 | * 0: Unit to switch state 7 | * 1: State 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_unit", "_state"]; 13 | 14 | if (isNull _unit) exitWith {}; 15 | 16 | _state = toUpper _state; 17 | if !(_state in ["ALIVE", "DOWNED", "REVIVED"]) exitWith {}; 18 | 19 | switch (_state) do { 20 | case "DOWNED": { 21 | // Disable player's action menu 22 | if (isPlayer _unit) then {{inGameUISetEventHandler [_x, "true"]} forEach ["PrevAction", "Action", "NextAction"]}; 23 | 24 | // Save the side before using setCaptive. 25 | _unit setVariable ["derp_revive_side", side _unit, true]; 26 | _unit setCaptive true; 27 | 28 | [{ 29 | params ["_unit"]; 30 | 31 | _unit setVariable ["derp_revive_downed", true, true]; 32 | _unit setVariable ["derp_revive_loadout", getUnitLoadout _unit]; 33 | derp_revive_actionID = (_unit addAction ["", {}, "", 0, false, true, "DefaultAction"]); 34 | 35 | [_unit] call derp_revive_fnc_reviveTimer; 36 | call derp_revive_fnc_hotkeyHandler; 37 | call derp_revive_fnc_uiElements; 38 | 39 | if (vehicle _unit == _unit) then { 40 | _unit setUnconscious false; 41 | [_unit, "acts_injuredlyingrifle02_180"] call derp_revive_fnc_syncAnim; 42 | 43 | [_unit] call derp_revive_fnc_adjustForTerrain; 44 | 45 | call derp_revive_fnc_heartBeatPFH; 46 | 47 | } else { 48 | [_unit, "Die"] remoteExec ["playAction", 0]; 49 | }; 50 | 51 | [_unit, true] call derp_revive_fnc_animChanged; 52 | 53 | //fade in 54 | _unit switchCamera "external"; 55 | cutText ["","BLACK IN",1]; 56 | 57 | _unit allowDamage true; 58 | 59 | }, [_unit], 2] call derp_fnc_waitAndExecute; 60 | }; 61 | 62 | case "ALIVE": { 63 | _unit setVariable ["derp_revive_downed", false, true]; 64 | 65 | // Enable player's action menu 66 | if (isPlayer _unit) then {{inGameUISetEventHandler [_x, ""]} forEach ["PrevAction", "Action", "NextAction"]}; 67 | 68 | _unit setVariable ["derp_revive_downed", false, true]; 69 | 70 | // Remove revive EHs and effects 71 | if !(isNil "derp_reviveKeyDownID") then {(findDisplay 46) displayRemoveEventHandler ["KeyDown", derp_reviveKeyDownID]}; 72 | if !(isNil "derp_reviveKeyUpID") then {(findDisplay 46) displayRemoveEventHandler ["KeyUp", derp_reviveKeyUpID]}; 73 | if !(isNil "derp_revive_animChangedID") then {_unit removeEventHandler ["AnimChanged",derp_revive_animChangedID]}; 74 | if !(isNil "derp_revive_drawIcon3DID") then {removeMissionEventHandler ["Draw3D", derp_revive_drawIcon3DID]}; 75 | if !(isNil "derp_revive_actionID") then {_unit removeAction derp_revive_actionID}; 76 | 77 | if !(isNil "derp_revive_ppColor") then { 78 | {_x ppEffectEnable false} forEach [derp_revive_ppColor, derp_revive_ppVig, derp_revive_ppBlur]; 79 | }; 80 | 81 | showHUD [true, true, true, true, false, true, true, true]; 82 | 83 | _unit setCaptive false; 84 | remoteExec ["", (str _unit + "animChangedJIPID")]; 85 | }; 86 | 87 | case "REVIVED": { 88 | _unit setVariable ["derp_revive_downed", false, true]; 89 | 90 | // Enable player's action menu 91 | if (isPlayer _unit) then {{inGameUISetEventHandler [_x, ""]} forEach ["PrevAction", "Action", "NextAction"]}; 92 | 93 | // Remove revive EHs 94 | if !(isNil "derp_reviveKeyDownID") then {(findDisplay 46) displayRemoveEventHandler ["KeyDown", derp_reviveKeyDownID]}; 95 | if !(isNil "derp_reviveKeyUpID") then {(findDisplay 46) displayRemoveEventHandler ["KeyUp", derp_reviveKeyUpID]}; 96 | if !(isNil "derp_revive_animChangedID") then {_unit removeEventHandler ["AnimChanged",derp_revive_animChangedID]}; 97 | if !(isNil "derp_revive_drawIcon3DID") then {removeMissionEventHandler ["Draw3D", derp_revive_drawIcon3DID]}; 98 | if !(isNil "derp_revive_actionID") then {_unit removeAction derp_revive_actionID}; 99 | 100 | if !(isNil "derp_revive_ppColor") then { 101 | {_x ppEffectEnable false} forEach [derp_revive_ppColor, derp_revive_ppVig, derp_revive_ppBlur]; 102 | }; 103 | 104 | showHUD [true, true, true, true, false, true, true, true]; 105 | 106 | _unit setCaptive false; 107 | 108 | [_unit, "amovppnemstpsnonwnondnon"] call derp_revive_fnc_syncAnim; 109 | }; 110 | }; 111 | -------------------------------------------------------------------------------- /functions/revive/fn_syncAnim.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Sync an animation across all clients 4 | * 5 | * Arguments: 6 | * 0: Unit on which the action is going to be played 7 | * 1: Animation to be played 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_unit", "_animation"]; 13 | 14 | // Try playMoveNow 15 | if (_unit == vehicle _unit) then { 16 | _unit playMoveNow _animation; 17 | }; 18 | 19 | // Didn't worked, remoteExec switchMove then 20 | if (animationState _unit != _animation) then { 21 | // Execute on all machines. SwitchMove has local effects. 22 | [_unit, _animation] remoteExec ["switchMove", 0]; 23 | }; 24 | -------------------------------------------------------------------------------- /functions/revive/fn_uiElements.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handles UI elements such as medic icons on medics and PP effects 4 | * 5 | * Arguments: 6 | * 7 | * Return Value: 8 | * Nothing 9 | */ 10 | derp_revive_drawIcon3DID = addMissionEventHandler ["Draw3D", { 11 | { 12 | drawIcon3D [ 13 | "\A3\ui_f\data\igui\cfg\actions\heal_ca.paa", 14 | [0.1, 0.47, 0.83, 1], 15 | visiblePosition _x, 16 | 1, 17 | 1, 18 | 0, 19 | format ["%1 meters away", ceil (player distance2D _x)], 20 | 2, 21 | 0.04 22 | ]; 23 | } foreach ((player nearEntities ["Man", 1000]) select {side _x == playerSide && {_x getUnitTrait "Medic"}}); 24 | }]; 25 | 26 | if (isNil "derp_revive_ppColor") then { 27 | derp_revive_ppColor = ppEffectCreate ["ColorCorrections", 1632] 28 | }; 29 | if (isNil "derp_revive_ppVig") then { 30 | derp_revive_ppVig = ppEffectCreate ["ColorCorrections", 1633] 31 | }; 32 | if (isNil "derp_revive_ppBlur") then { 33 | derp_revive_ppBlur = ppEffectCreate ["DynamicBlur", 525] 34 | }; 35 | 36 | // Start effects 37 | derp_revive_ppColor ppEffectAdjust [1,1,0.15,[0.3,0.3,0.3,0],[0.3,0.3,0.3,0.3],[1,1,1,1]]; 38 | derp_revive_ppVig ppEffectAdjust [1,1,0,[0.15,0,0,1],[1.0,0.5,0.5,1],[0.587,0.199,0.114,0],[1,1,0,0,0,0.2,1]]; 39 | derp_revive_ppBlur ppEffectAdjust [0]; 40 | { 41 | _x ppEffectCommit 0; _x ppEffectEnable true; _x ppEffectForceInNVG true 42 | } forEach [derp_revive_ppColor, derp_revive_ppVig, derp_revive_ppBlur]; 43 | 44 | // PFH for the progression of the revive effects 45 | [{ 46 | params ["_args", "_pfhID"]; 47 | _args params ["_timer"]; 48 | 49 | //grab blood level 50 | if (player getVariable ["derp_revive_downed", false] && {alive player}) then { 51 | private _blood = (_timer - derp_revive_bleedOutTimer) / _timer; 52 | 53 | //calculate desaturation 54 | private _bright = 0.2 + (0.1 * _blood); 55 | derp_revive_ppColor ppEffectAdjust [1,1, 0.15 / _blood,[0.3,0.3,0.3,0],[_bright,_bright,_bright,_bright],[1,1,1,1]]; 56 | 57 | //calculate intensity of vignette 58 | private _intense = 0.6 + (0.4 * _blood); 59 | derp_revive_ppVig ppEffectAdjust [1,1,0,[0.15,0,0,1],[1.0,0.5,0.5,1],[0.587,0.199,0.114,0],[_intense,_intense,0,0,0,0.2,1]]; 60 | 61 | //calculate intensity of blur 62 | private _blur = 0.7 * (1 - _blood); 63 | derp_revive_ppBlur ppEffectAdjust [_blur]; 64 | 65 | //smoothly transition 66 | {_x ppEffectCommit 1} forEach [derp_revive_ppColor, derp_revive_ppVig, derp_revive_ppBlur]; 67 | } else { 68 | _pfhID call derp_fnc_removePerFrameHandler; 69 | }; 70 | }, 1, [(getMissionConfigValue ["derp_revive_bleedOutTimer", 300])]] call derp_fnc_addPerFrameHandler; 71 | 72 | showHUD [true, false, false, false, false, false, false, true]; 73 | -------------------------------------------------------------------------------- /functions/side missions/cachesSM.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Caches side mission 5 | * 6 | * Arguments: 7 | * 0: Position of the AO marker 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Conditions: 14 | * Win: Destroy all the caches. 15 | * Fail: None 16 | */ 17 | params ["_AOPos", "_missionID"]; 18 | 19 | //------------------- Task 20 | derp_SMID = derp_SMID + 1; 21 | private _smID = "caches" + str derp_SMID; 22 | 23 | [west, [_smID, _missionID], ["Our enemies have found three ammo caches around the town, find and destroy them.", "Find and destroy ammo caches", ""], objNull, "Created", 5, true, "destroy", true] call BIS_fnc_taskCreate; 24 | 25 | private _ammoCaches = []; 26 | 27 | for "_i" from 1 to 3 do { 28 | private _box = (selectRandom CACHESMCacheArray) createVehicle ([[[_AOpos, 150], []], ["water", "out"]] call BIS_fnc_randomPos); 29 | 30 | _ammoCaches pushback _box; 31 | }; 32 | 33 | { 34 | _x addCuratorEditableObjects [_ammoCaches, false]; 35 | } forEach allCurators; 36 | 37 | //------------------- PFH 38 | [{ 39 | params ["_args", "_pfhID"]; 40 | _args params ["_AOPos", "_ammoCaches", "_smID"]; 41 | 42 | if ({alive _x} count _ammoCaches == 0) then { 43 | derp_sideMissionInProgress = false; 44 | 45 | [_smID, 'Succeeded', true] call BIS_fnc_taskSetState; 46 | 47 | [{ 48 | params ["_ammoCaches", "_smID"]; 49 | 50 | { 51 | if !(isNull _x) then { 52 | deleteVehicle _x; 53 | }; 54 | } foreach _ammoCaches; 55 | 56 | [_smID, true] call BIS_fnc_deleteTask; 57 | 58 | }, [_ammoCaches, _smID], 300] call derp_fnc_waitAndExecute; 59 | 60 | derp_successfulSMs = derp_successfulSMs + 1; 61 | call derp_fnc_smRewards; 62 | _pfhID call derp_fnc_removePerFrameHandler; 63 | 64 | } else { 65 | [_AOPos] call derp_fnc_airReinforcements; 66 | }; 67 | }, 10, [_AOPos, _ammoCaches, _smID]] call derp_fnc_addPerFrameHandler; 68 | -------------------------------------------------------------------------------- /functions/side missions/comTowerSM.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Com towers side mission 4 | * 5 | * Arguments: 6 | * 0: Position of the AO marker 7 | * 1: Com towers array 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Conditions: 14 | * Win: Destroy all communication antennas. 15 | * Fail: None 16 | */ 17 | params ["_AOPos", "_comTowers", "_missionID"]; 18 | 19 | //------------------- Task 20 | derp_SMID = derp_SMID + 1; 21 | private _smID = "antennaTask" + str derp_SMID; 22 | 23 | [west, [_smID, _missionID], ["Our enemies have took control of a few antennas, destroy them or they'll call air support. We've marked their locations on your map.", "Destroy enemy com array", ""], objNull, "Created", 5, true, "destroy", true] call BIS_fnc_taskCreate; 24 | 25 | //------------------- Markers + mines 26 | private _towerMines = []; 27 | private _markerNumber = 0; 28 | private _markerArray = []; 29 | { 30 | _markerNumber = _markerNumber + 1; 31 | private _marker = createMarker ["comTowerMarker" + str _markerNumber, (getPosWorld _x)]; 32 | _marker setMarkerShape "ICON"; 33 | _marker setMarkerType "loc_Transmitter"; 34 | _markerArray pushback _marker; 35 | 36 | for "_x" from 0 to 19 do { 37 | private _mine = createMine ["APERSBoundingMine", (getMarkerPos _marker), [_marker], 20]; 38 | _towerMines pushback _mine; 39 | }; 40 | } foreach _comTowers; 41 | 42 | //------------------- PFH 43 | [{ 44 | params ["_args", "_pfhID"]; 45 | _args params ["_comTowers", "_AOPos", "_markerArray", "_towerMines", "_smID"]; 46 | 47 | { 48 | if (!alive _x) then { 49 | private _arrayPos = (_comTowers find _x); 50 | _comTowers deleteAt _arrayPos; 51 | deleteMarker (_markerArray select _arrayPos); 52 | _markerArray deleteAt _arrayPos; 53 | }; 54 | } foreach _comTowers; 55 | 56 | if (count _comTowers == 0) then { 57 | derp_sideMissionInProgress = false; 58 | {deleteMarker _x} foreach _markerArray; 59 | 60 | [_smID, 'Succeeded', true] call BIS_fnc_taskSetState; 61 | 62 | [{ 63 | params ["_towerMines", "_smID"]; 64 | 65 | {deleteVehicle _x} foreach _towerMines; 66 | 67 | [_smID, true] call BIS_fnc_deleteTask; 68 | 69 | }, [_towerMines, _smID], 300] call derp_fnc_waitAndExecute; 70 | 71 | derp_successfulSMs = derp_successfulSMs + 1; 72 | call derp_fnc_smRewards; 73 | _pfhID call derp_fnc_removePerFrameHandler; 74 | 75 | } else { 76 | [_AOPos] call derp_fnc_airReinforcements; 77 | }; 78 | }, 10, [_comTowers, _AOPos, _markerArray, _towerMines, _smID]] call derp_fnc_addPerFrameHandler; 79 | -------------------------------------------------------------------------------- /functions/side missions/droppedCargoSM.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Dropped cargo SM 5 | * 6 | * Arguments: 7 | * 0: Position of the AO marker 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Conditions: 14 | * Win: Destroy all the caches. 15 | * Fail: None 16 | */ 17 | params ["_AOPos", "_missionID"]; 18 | 19 | //------------------- Task 20 | derp_SMID = derp_SMID + 1; 21 | private _smID = "droppedCargo" + str derp_SMID; 22 | 23 | // Try to get an underwater pos 24 | private _randomPosArray = [_AOPos, derp_PARAM_AOSize, "(1 + sea) * (1 + (waterDepth factor [0.1, 0.5]))"] call derp_fnc_randomPos; 25 | private _randomPos = _randomPosArray select 0; 26 | 27 | private _cargoPlane = ""; 28 | private _cargoBox = ""; 29 | private _spawnedUnits = []; 30 | 31 | // no underwater pos available, switch to land pos 32 | if (_randomPosArray select 1 <= 2) then { 33 | _randomPos = ([_AOPos, derp_PARAM_AOSize, "(1 + meadow) * (1 - sea) * (1 - houses)"] call derp_fnc_randomPos) param [0]; 34 | _cargoPlane = CARGOSMPlane createVehicle _randomPos; 35 | _cargoBox = CARGOSMBox createVehicle (_randomPos findEmptyPosition [5, 20, CARGOSMBox]); 36 | 37 | for "_derpSMgrpLand" from 0 to 2 step 1 do { 38 | private _infantryGroup = [([(position _cargoBox), 30, "(1 + meadow) * (1 - sea) * (1 - houses)"] call derp_fnc_randomPos) param [0], EAST, (configFile InfantryGroupsCFGPATH (selectRandom InfantryGroupList))] call BIS_fnc_spawnGroup; 39 | 40 | [_infantryGroup, _cargoBox, 50] call BIS_fnc_taskPatrol; 41 | 42 | { 43 | _spawnedUnits pushBack _x; 44 | } foreach (units _infantryGroup); 45 | }; 46 | } else { 47 | _cargoPlane = CARGOSMPlane createVehicle _randomPos; 48 | _cargoBox = createVehicle [CARGOSMBox, _randomPos, [], 20, "NONE"]; 49 | 50 | for "_derpSMgrp" from 0 to 3 step 1 do { 51 | private _scubaGroup = [([(position _cargoBox), 30, "(1 + sea) * (1 + (waterDepth factor [0.1, 0.5]))"] call derp_fnc_randomPos) param [0], EAST, (configFile CARGOSMScubaGroup)] call BIS_fnc_spawnGroup; 52 | 53 | deleteWaypoint [_scubaGroup, 0]; 54 | for "_derpWp" from 1 to 3 step 1 do { 55 | private _waypoint = _scubaGroup addWaypoint [([_cargoBox, 150, "(1 + sea)"] call derp_fnc_randomPos) param [0], 10]; 56 | _waypoint setWaypointType "MOVE"; 57 | _waypoint setWaypointCompletionRadius 20; 58 | }; 59 | 60 | private _waypoint = _scubaGroup addWaypoint [_cargoBox, 0]; 61 | _waypoint setWaypointType "CYCLE"; 62 | 63 | { 64 | _spawnedUnits pushBack _x; 65 | } foreach (units _scubaGroup); 66 | }; 67 | }; 68 | 69 | { 70 | _x addCuratorEditableObjects [([_cargoPlane, _cargoBox] + _spawnedUnits), false]; 71 | } forEach allCurators; 72 | 73 | [true, _cargoBox] remoteExecCall ["derp_fnc_droppedCargoSM_action", 0, "droppedCargoSM_action"]; 74 | 75 | // Create the task after because we're placing it on an object this time 76 | [west, [_smID, _missionID], ["One of our cargo planes got shot down, but unfortunately the box it was carrying survived. Do not let our enemies get their hands on it, destroy it.", "Find and destroy lost cargo"], _cargoBox, "Created", 5, true, "destroy", true] call BIS_fnc_taskCreate; 77 | 78 | //------------------- PFH 79 | [{ 80 | params ["_args", "_pfhID"]; 81 | _args params ["_AOPos", "_smID", "_cargoPlane", "_cargoBox", "_spawnedUnits"]; 82 | 83 | if (!alive _cargoBox) then { 84 | 85 | if !(isNull _box) then { 86 | [false] remoteExecCall ["derp_fnc_droppedCargoSM_action", -2, "droppedCargoSM_action"]; 87 | // Remove remoteExec'd action from the JIP queue 88 | remoteExecCall ["", "droppedCargoSM_action"]; 89 | }; 90 | 91 | derp_sideMissionInProgress = false; 92 | 93 | [_smID, 'Succeeded', true] call BIS_fnc_taskSetState; 94 | 95 | [{ 96 | params ["_cargoBox", "_cargoPlane", "_spawnedUnits", "_smID"]; 97 | 98 | { 99 | if !(isNull _x) then { 100 | deleteVehicle _x; 101 | }; 102 | } foreach ([_cargoBox, _cargoPlane] + _spawnedUnits); 103 | 104 | [_smID, true] call BIS_fnc_deleteTask; 105 | }, [_cargoBox, _cargoPlane, _spawnedUnits, _smID], 300] call derp_fnc_waitAndExec; 106 | 107 | derp_successfulSMs = derp_successfulSMs + 1; 108 | call derp_fnc_smRewards; 109 | _pfhID call derp_fnc_removePerFrameHandler; 110 | 111 | } else { 112 | [_AOPos] call derp_fnc_airReinforcements; 113 | }; 114 | }, 10, [_AOPos, _smID, _cargoPlane, _cargoBox, _spawnedUnits]] call derp_fnc_addPerFrameHandler; 115 | -------------------------------------------------------------------------------- /functions/side missions/droppedCargoSM_actionPFH.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * PFH handling the cargoSM box explosion 5 | * 6 | * Arguments: 7 | * 0: SM objective 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params [["_box", objNull]]; 13 | 14 | if !(isServer || {_box isEqualTo objNull}) exitWith {}; 15 | 16 | private _charge = "DemoCharge_Remote_Ammo_Scripted" createVehicle (position _box); 17 | _charge attachTo [_box, CARGOSMBoxAttachOffset]; 18 | 19 | [{ 20 | params ["_args", "_pfhID"]; 21 | _args params ["_box", "_timerLegnth", "_startTime", "_demoCharge"]; 22 | 23 | if (time >= _startTime + _timerLegnth || {!alive _box}) then { 24 | 25 | detach _demoCharge; 26 | 27 | 28 | // Exec destruction next frame 29 | [{ 30 | params ["_demoCharge", "_box"]; 31 | 32 | _demoCharge setDamage 1; 33 | 34 | if !(isNull _box) then { 35 | deleteVehicle _box; 36 | }; 37 | }, [_demoCharge, _box]] call derp_fnc_execNextFrame; 38 | 39 | } else { 40 | format ["SM charge detonation in: %1s",round ((_startTime + _timerLegnth) - time)] remoteExec ["systemChat", 0]; 41 | }; 42 | 43 | }, 5, [_box, 30, time, _charge]] call derp_fnc_addPerFrameHandler; 44 | -------------------------------------------------------------------------------- /functions/side missions/fn_droppedCargoSM_action.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Add / delete the cargoSM box action 4 | * 5 | * Arguments: 6 | * 0: Add action 7 | * 1: cargoSM objective 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | 13 | params [["_add", false], ["_box", objNull]]; 14 | 15 | if (_box isEqualTo objNull && {_add}) exitWith {}; 16 | 17 | if (_add) then { 18 | derp_droppedCargoSM_actionID = _box addAction 19 | [ 20 | "Place explosives", 21 | { 22 | params ["_object", "_caller", "_id", ""]; 23 | 24 | [_object] remoteExecCall ["derp_fnc_droppedCargoSM_actionPFH", 2]; 25 | 26 | _object removeAction _id; 27 | [false] remoteExecCall ["derp_fnc_droppedCargoSM_action", -2, "droppedCargoSM_action"]; 28 | // Remove remoteExec'd action from the JIP queue 29 | remoteExecCall ["", "droppedCargoSM_action"]; 30 | }, 31 | [], 32 | 10, 33 | true, 34 | true 35 | ]; 36 | } else { 37 | if !(isNil "derp_droppedCargoSM_actionID") then { 38 | _box removeAction derp_droppedCargoSM_actionID 39 | }; 40 | }; 41 | -------------------------------------------------------------------------------- /functions/side missions/officerMurderSM.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Kill an officer. 5 | * 6 | * Arguments: 7 | * 0: Position of the AO marker 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Conditions: 14 | * Win: Kill the officer. 15 | * Fail: none. 16 | */ 17 | params ["_AOPos", "_missionID"]; 18 | 19 | //------------------- Task 20 | derp_SMID = derp_SMID + 1; 21 | private _smID = "officerKill" + str derp_SMID; 22 | 23 | [west, [_smID, _missionID], ["We have intel that an enemy officer is in the AO, find him and take him out. We currently have no information on his exact location, good luck.", "Kill the enemy officer", ""], objNull, "Created", 5, true, "kill", true] call BIS_fnc_taskCreate; 24 | 25 | private _randomPos = ([_AOPos, derp_PARAM_AOSize / 2, "(1 - sea)"] call derp_fnc_randomPos) param [0]; 26 | private _officerGroup = [_randomPos, EAST, (configfile InfantryGroupsCFGPATH (selectRandom InfantryGroupList))] call BIS_fnc_spawnGroup; 27 | private _officer = _officerGroup createUnit [(selectRandom OFFICERSMTarget), _randomPos, [], 0, "NONE"]; 28 | _officerGroup selectLeader _officer; 29 | [_officerGroup, _AOpos, derp_PARAM_AOSize / 2] call BIS_fnc_taskPatrol; 30 | 31 | { 32 | _x addCuratorEditableObjects [(units _officerGroup), false]; 33 | } forEach allCurators; 34 | 35 | //------------------- PFH 36 | [{ 37 | params ["_args", "_pfhID"]; 38 | _args params ["_AOPos", "_officer", "_officerGroup", "_smID"]; 39 | 40 | if (!alive _officer) then { 41 | derp_sideMissionInProgress = false; 42 | 43 | [_smID, 'Succeeded', true] call BIS_fnc_taskSetState; 44 | 45 | [{ 46 | params ["_officerGroup", "_smID"]; 47 | 48 | { 49 | if !(isNull _x) then { 50 | deleteVehicle _x; 51 | }; 52 | } foreach (units _officerGroup); 53 | 54 | [_smID, true] call BIS_fnc_deleteTask; 55 | 56 | }, [_officerGroup, _smID], 300] call derp_fnc_waitAndExecute; 57 | 58 | derp_successfulSMs = derp_successfulSMs + 1; 59 | call derp_fnc_smRewards; 60 | _pfhID call derp_fnc_removePerFrameHandler; 61 | 62 | } else { 63 | [_AOPos] call derp_fnc_airReinforcements; 64 | }; 65 | }, 10, [_AOPos, _officer, _officerGroup, _smID]] call derp_fnc_addPerFrameHandler; 66 | -------------------------------------------------------------------------------- /functions/side missions/specOpsSM.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Kill the spec-ops squad 5 | * 6 | * Arguments: 7 | * 0: Position of the AO marker 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Conditions: 14 | * Win: All members of the squad are dead 15 | * Fail: none. 16 | */ 17 | params ["_AOPos", "_missionID"]; 18 | 19 | //------------------- Task 20 | derp_SMID = derp_SMID + 1; 21 | private _smID = "specOps" + str derp_SMID; 22 | 23 | [west, [_smID, _missionID], ["An enemy spec-ops squad has been spotted around the AO, you'll have to deal with them, good luck", "Defeat spec-ops squad"], objNull, "Created", 5, true, "kill", true] call BIS_fnc_taskCreate; 24 | 25 | private _randomPos = ([_AOPos, derp_PARAM_AOSize / 2, "(1 - sea)"] call derp_fnc_randomPos) param [0]; 26 | private _squad = [_randomPos, EAST, (configfile SPECOPSSMGroup)] call BIS_fnc_spawnGroup; 27 | [_squad, _AOpos, derp_PARAM_AOSize / 2] call BIS_fnc_taskPatrol; 28 | 29 | { 30 | _x addCuratorEditableObjects [(units _squad), false]; 31 | } forEach allCurators; 32 | 33 | //------------------- PFH 34 | [{ 35 | params ["_args", "_pfhID"]; 36 | _args params ["_AOPos", "_squad", "_smID"]; 37 | 38 | if ({alive _x} count (units _squad) == 0) then { 39 | derp_sideMissionInProgress = false; 40 | 41 | [_smID, 'Succeeded', true] call BIS_fnc_taskSetState; 42 | 43 | [{ 44 | params ["_smID"]; 45 | 46 | [_smID, true] call BIS_fnc_deleteTask; 47 | 48 | }, [_smID], 300] call derp_fnc_waitAndExecute; 49 | 50 | derp_successfulSMs = derp_successfulSMs + 1; 51 | call derp_fnc_smRewards; 52 | _pfhID call derp_fnc_removePerFrameHandler; 53 | 54 | } else { 55 | [_AOPos] call derp_fnc_airReinforcements; 56 | }; 57 | }, 10, [_AOPos, _squad, _smID]] call derp_fnc_addPerFrameHandler; 58 | -------------------------------------------------------------------------------- /functions/side missions/truckRetrievalSM.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Retrieve a truck full of ammo. 5 | * 6 | * Arguments: 7 | * 0: Position of the AO marker 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Conditions: 14 | * Win: Bring the truck to the recover point. 15 | * Fail: Truck destroyed. 16 | */ 17 | params ["_AOPos", "_missionID"]; 18 | 19 | //------------------- Task 20 | derp_SMID = derp_SMID + 1; 21 | private _smID = "truckRetrieval" + str derp_SMID; 22 | 23 | [west, [_smID, _missionID], ["A truck full GBUs got spotted in the AO, secure it and bring it back to the return point so we can dismantle them. The destruction of the vehicle will result in the failure of the mission.", "Retrieve ammo truck", ""], objNull, "Created", 5, true, "search", true] call BIS_fnc_taskCreate; 24 | 25 | private _spawnPos = _AOPos findEmptyPosition [10, 200, TRUCKSMTruck]; 26 | private _ammoTruck = TRUCKSMTruck createVehicle _spawnPos; 27 | private _boxes = []; 28 | 29 | if !(TRUCKSMBoxes isEqualTo []) then { 30 | { 31 | _x params ["_boxType", "_offset"]; 32 | private _box = _boxType createVehicle [0,0,0]; 33 | _box attachTo [_ammoTruck, _offset]; 34 | _boxes pushback _box; 35 | } foreach TRUCKSMBoxes; 36 | }; 37 | 38 | if !(TRUCKSMLockedCargoSeats isEqualTo []) then { 39 | {_ammoTruck lockCargo [_x, true]} foreach TRUCKSMLockedCargoSeats; 40 | }; 41 | 42 | { 43 | _x addCuratorEditableObjects [[_ammoTruck], false]; 44 | } forEach allCurators; 45 | 46 | _ammoTruck addEventHandler ["Killed", { 47 | params ["_vehicle"]; 48 | "Bo_GBU12_LGB" createVehicle (getPos _vehicle); 49 | }]; 50 | 51 | //------------------- PFH 52 | [{ 53 | params ["_args", "_pfhID"]; 54 | _args params ["_AOPos", "_ammoTruck", "_boxes", "_smID"]; 55 | 56 | if (alive _ammoTruck && {_ammoTruck distance2D (getMarkerPos "returnPointMarker") < 2}) then { 57 | derp_sideMissionInProgress = false; 58 | 59 | [_smID, 'SUCCEEDED', true] call BIS_fnc_taskSetState; 60 | 61 | {moveOut _x} foreach (crew _ammoTruck); 62 | _ammoTruck lock 2; 63 | 64 | [{ 65 | params ["_ammoTruck", "_boxes", "_smID"]; 66 | 67 | { 68 | if !(isNull _x) then { 69 | deleteVehicle _x; 70 | }; 71 | } foreach (_boxes + [_ammoTruck]); 72 | 73 | [_smID, true] call BIS_fnc_deleteTask; 74 | 75 | }, [_ammoTruck, _boxes, _smID], 300] call derp_fnc_waitAndExec; 76 | 77 | derp_successfulSMs = derp_successfulSMs + 1; 78 | call derp_fnc_smRewards; 79 | _pfhID call derp_fnc_removePerFrameHandler; 80 | }; 81 | 82 | if (!alive _ammoTruck) then { 83 | derp_sideMissionInProgress = false; 84 | 85 | [_smID, 'FAILED', true] call BIS_fnc_taskSetState; 86 | 87 | [{ 88 | params ["_ammoTruck", "_boxes", "_smID"]; 89 | 90 | { 91 | deleteVehicle _x; 92 | } foreach (_boxes + [_ammoTruck]); 93 | 94 | [_smID, true] call BIS_fnc_deleteTask; 95 | 96 | }, [_ammoTruck, _boxes, _smID], 300] call derp_fnc_waitAndExecute; 97 | _pfhID call derp_fnc_removePerFrameHandler; 98 | }; 99 | }, 10, [_AOPos, _ammoTruck, _boxes, _smID]] call derp_fnc_addPerFrameHandler; 100 | -------------------------------------------------------------------------------- /functions/side missions/uavDownedSM.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Download intel from a downed uav and destroy it 5 | * 6 | * Arguments: 7 | * 0: Position of the AO marker 8 | * 1: ID of the main mission 9 | * 10 | * Return Value: 11 | * Nothing 12 | * 13 | * Conditions: 14 | * Win: Uav download finished and uav destroyed 15 | * Fail: Uav destroyed before download finished. 16 | */ 17 | params ["_AOPos", "_missionID"]; 18 | 19 | //------------------- Task 20 | derp_SMID = derp_SMID + 1; 21 | private _smID = "uavDownloadAndKill" + str derp_SMID; 22 | 23 | [west, [_smID, _missionID], ["We have shot down an enemy UAV above the current AO but we got intel that it is still in one piece. We may be able to recover some intel from it. Download the intel and then destroy the UAV", "Download intel from the UAV"], objNull, "Created", 5, true, "upload", true] call BIS_fnc_taskCreate; 24 | 25 | private _spawnPos = _AOPos findEmptyPosition [10, 200, "CraterLong"]; 26 | private _dirtHump = "CraterLong" createVehicle _spawnPos; 27 | private _uav = (selectRandom UAVSMUav) createVehicle _spawnPos; 28 | _uav setDamage 0.5; 29 | 30 | _uav setPos (_dirtHump modelToWorld [-1, -1]); 31 | { 32 | _x addCuratorEditableObjects [[_dirtHump, _uav], false]; 33 | } forEach allCurators; 34 | 35 | //------------------- PFH 36 | [{ 37 | params ["_args", "_pfhID"]; 38 | _args params ["_AOPos", "_uav", "_dirtHump", "_smID"]; 39 | 40 | private _isPlayersNear = count ((_uav nearEntities ["CAManBase", 15]) select {isPlayer _x}); 41 | 42 | // Download not started, players near start it. 43 | if (_isPlayersNear > 0 && {isNil "derp_uavSM_downloadProgress"} && {isNil "derp_uavSM_isDownloadDone"}) then { 44 | derp_uavSM_downloadProgress = 0; 45 | [[west, "HQ"], "Intel download started"] remoteExec ["sideChat", 0]; 46 | } else { 47 | // Downlaod started and players still near it. 48 | if (_isPlayersNear > 0 && {!(isNil "derp_uavSM_downloadProgress")} && {isNil "derp_uavSM_isDownloadDone"}) then { 49 | derp_uavSM_downloadProgress = derp_uavSM_downloadProgress + 10; 50 | 51 | 52 | if (derp_uavSM_downloadProgress == 100) then { 53 | derp_uavSM_downloadProgress = nil; 54 | derp_uavSM_isDownloadDone = true; 55 | [[west, "HQ"],"Intel download completed, destroy the uav"] remoteExec ["sideChat", 0]; 56 | 57 | } else { 58 | [[west, "HQ"],(format ["Intel download at: %1",derp_uavSM_downloadProgress]) + "%"] remoteExec ["sideChat", 0]; 59 | }; 60 | 61 | } else { // Players aren't near the objective anymore 62 | if (_isPlayersNear == 0 && {!(isNil "derp_uavSM_downloadProgress")} && {isNil "derp_uavSM_isDownloadDone"}) then { 63 | derp_uavSM_downloadProgress = nil; 64 | [[west, "HQ"], "Intel download failed, start again"] remoteExec ["sideChat", 0]; 65 | }; 66 | }; 67 | }; 68 | 69 | if (!alive _uav && {!(isNil "derp_uavSM_isDownloadDone")}) then { 70 | derp_sideMissionInProgress = false; 71 | derp_uavSM_isDownloadDone = nil; 72 | 73 | [_smID, 'SUCCEEDED', true] call BIS_fnc_taskSetState; 74 | 75 | [{ 76 | params ["_uav", "_dirtHump", "_smID"]; 77 | 78 | detach _uav; 79 | deleteVehicle _uav; 80 | deleteVehicle _dirtHump; 81 | [_smID, true] call BIS_fnc_deleteTask; 82 | 83 | }, [_uav, _dirtHump, _smID], 300] call derp_fnc_waitAndExecute; 84 | 85 | derp_successfulSMs = derp_successfulSMs + 1; 86 | call derp_fnc_smRewards; 87 | _pfhID call derp_fnc_removePerFrameHandler; 88 | } else { 89 | if (!alive _uav && {isNil "derp_uavSM_isDownloadDone"}) then { 90 | derp_sideMissionInProgress = false; 91 | derp_uavSM_isDownloadDone = nil; 92 | 93 | [_smID, 'FAILED', true] call BIS_fnc_taskSetState; 94 | 95 | [{ 96 | params ["_uav", "_dirtHump", "_smID"]; 97 | 98 | detach _uav; 99 | deleteVehicle _uav; 100 | deleteVehicle _dirtHump; 101 | [_smID, true] call BIS_fnc_deleteTask; 102 | 103 | }, [_uav, _dirtHump, _smID], 300] call derp_fnc_waitAndExecute; 104 | 105 | _pfhID call derp_fnc_removePerFrameHandler; 106 | 107 | } else { 108 | [_AOPos] call derp_fnc_airReinforcements; 109 | }; 110 | }; 111 | }, 10, [_AOPos, _uav, _dirtHump, _smID]] call derp_fnc_addPerFrameHandler; 112 | -------------------------------------------------------------------------------- /functions/taw_vd/GUI.h: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | 3 | 4 | class RscXSliderH { 5 | style = 1024; 6 | type = 43; 7 | shadow = 2; 8 | x = 0; 9 | y = 0; 10 | h = 0.029412; 11 | w = 0.400000; 12 | color[] = { 13 | 1, 1, 1, 0.7 14 | }; 15 | colorActive[] = { 16 | 1, 1, 1, 1 17 | }; 18 | colorDisabled[] = { 19 | 1, 1, 1, 0.500000 20 | }; 21 | arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; 22 | arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; 23 | border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; 24 | thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa"; 25 | }; 26 | 27 | class RscTitle:RscText { 28 | style = 0; 29 | shadow = 0; 30 | sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; 31 | colorText[] = {0.95, 0.95, 0.95, 1}; 32 | }; 33 | 34 | class RscControlsGroupNoScrollbars : RscControlsGroup { 35 | class VScrollbar : VScrollbar { 36 | width = 0; 37 | }; 38 | 39 | class HScrollbar : HScrollbar { 40 | height = 0; 41 | }; 42 | }; 43 | 44 | class TAW_VDMenu { 45 | idd = MENU_IDD; 46 | name = "TAW_VDMenu"; 47 | movingEnabled = 0; 48 | enableSimulation = 1; 49 | 50 | onLoad = "((_this select 0) displayCtrl 2999) ctrlSetFade 1; ((_this select 0) displayCtrl 2999) ctrlCommit 0;"; 51 | 52 | class controlsBackground { 53 | class TitleBackground : RscText { 54 | colorBackground[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])" }; 55 | idc = -1; 56 | x = .3; 57 | y = .2; 58 | w = .5; 59 | h = (1 / 25); 60 | }; 61 | 62 | class MainBackground : RscText { 63 | colorBackground[] = { 0, 0, 0, .7 }; 64 | idc = -1; 65 | x = .3; 66 | y = .2 + (11 / 250); 67 | w = .5; 68 | h = .57 - (22 / 250); 69 | }; 70 | 71 | class Title : RscTitle { 72 | colorBackround[] = { 0, 0, 0, 0 }; 73 | idc = -1; 74 | text = "View Settings (SCRIPT)"; 75 | x = .3; 76 | y = .2; 77 | w = .8; 78 | h = (1 / 25); 79 | }; 80 | 81 | class OnFootText : RscText { 82 | idc = -1; 83 | text = "Infantry:"; 84 | x = .32; 85 | y = .258; 86 | w = .275; 87 | h = .04; 88 | }; 89 | 90 | class inCarText : OnFootText { 91 | text = "Ground:"; 92 | y = .305; 93 | }; 94 | 95 | class inAirText : OnFootText { 96 | text = "Air:"; 97 | y = .355; 98 | }; 99 | 100 | class ObjectText : OnFootText { 101 | text = "Object:"; 102 | y = .655; 103 | }; 104 | 105 | class DroneText : OnFootText { 106 | text = "Drone:"; 107 | y = .405; 108 | }; 109 | 110 | class TerrainBackground : TitleBackground { 111 | text = "Grass Settings"; 112 | shadow = 0; 113 | y = .46; 114 | }; 115 | 116 | class ObjectBackground : TitleBackground { 117 | text = "Object Settings"; 118 | y = .55; 119 | }; 120 | 121 | class ButtonClose : RscButtonMenu { 122 | idc = -1; 123 | text = "Close"; 124 | onButtonClick = "closeDialog 0;"; 125 | x = 0.3; 126 | y = 0.77 - (1 / 25); 127 | w = (6.25 / 40); 128 | h = (1 / 25); 129 | }; 130 | 131 | class SaveManagerBtn:ButtonClose { 132 | text = "Saves"; 133 | onButtonClick = "[] call tawvd_fnc_openSaveManager;"; 134 | x = .465; 135 | }; 136 | }; 137 | 138 | class controls { 139 | 140 | //Sliders 141 | class VD_onFoot_slider : RscXSliderH { 142 | idc = INFANTRY_SLIDER; 143 | text = ""; 144 | onSliderPosChanged = "[0, _this select 1] call TAWVD_fnc_onSliderChanged;"; 145 | toolTip = "View Distance while on foot"; 146 | x = .42; 147 | y = .30 - (1 / 25); 148 | w = "9 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; 149 | h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; 150 | }; 151 | 152 | class VD_inCar_slider : VD_onFoot_slider { 153 | idc = GROUND_SLIDER; 154 | toolTip = "View distance while in a ground vehicle"; 155 | onSliderPosChanged = "[1, _this select 1] call TAWVD_fnc_onSliderChanged;"; 156 | y = .35 - (1 / 25); 157 | }; 158 | 159 | class VD_inAir_slider : VD_onFoot_slider { 160 | idc = AIR_SLIDER; 161 | toolTip = "View distance while in an aircraft"; 162 | onSliderPosChanged = "[2, _this select 1] call TAWVD_fnc_onSliderChanged;"; 163 | y = .40 - (1 / 25); 164 | }; 165 | 166 | class VD_Object_slider : VD_onFoot_slider { 167 | idc = OBJECT_SLIDER; 168 | toolTip = "Object rendering distance"; 169 | onSliderPosChanged = "[3, _this select 1] call TAWVD_fnc_onSliderChanged;"; 170 | y = .7 - (1 / 25); 171 | }; 172 | 173 | class VD_Drone_slider:VD_onFoot_slider { 174 | idc = DRONE_SLIDER; 175 | toolTip = "View distance while operating a UAV/UGV"; 176 | onSliderPosChanged = "[4, _this select 1] call TAWVD_fnc_onSliderChanged;"; 177 | y = .45 - (1 / 25); 178 | } 179 | 180 | //Values (RscEdit Butons) 181 | class VD_onFoot_Edit : RscEdit { 182 | idc = INFANTRY_EDIT; 183 | text = ""; 184 | onKeyUp = "[_this select 0, _this select 1, 'ground',true] call TAWVD_fnc_onChar;"; 185 | 186 | x = .7; 187 | y = .258; 188 | w = .08; 189 | h = .04; 190 | }; 191 | 192 | class VD_inCar_Edit : VD_onFoot_Edit { 193 | idc = GROUND_EDIT; 194 | onKeyUp = "[_this select 0, _this select 1, 'vehicle',true] call TAWVD_fnc_onChar;"; 195 | y = .31; 196 | }; 197 | 198 | class VD_inAir_Edit : VD_onFoot_Edit { 199 | idc = AIR_EDIT; 200 | onKeyUp = "[_this select 0, _this select 1, 'air',true] call TAWVD_fnc_onChar;"; 201 | y = .36; 202 | }; 203 | 204 | class VD_inDrone_Edit:VD_onFoot_Edit { 205 | idc = DRONE_EDIT; 206 | onKeyUp = "[_this select 0, _this select 1, 'drone',true] call TAWVD_fnc_onChar;"; 207 | y = .41; 208 | }; 209 | 210 | class VD_Object_Edit : VD_onFoot_Edit { 211 | idc = OBJECT_EDIT; 212 | onKeyUp = "[_this select 0, _this select 1, 'object',true] call TAWVD_fnc_onChar;"; 213 | y = .656; 214 | }; 215 | 216 | //Grass Settings 217 | class VD_terrain_none { 218 | idc = TERRAIN_NONE; 219 | type = 11; 220 | style = 0; 221 | font = "PuristaLight"; 222 | color[] = { 1, 1, 1, 1 }; 223 | colorActive[] = { 1, 0.2, 0.2, 1 }; 224 | colorDisabled[] = {0, 0, 0, 1}; 225 | soundEnter[] = { "\A3\ui_f\data\sound\onover", 0.09, 1 }; 226 | soundPush[] = { "\A3\ui_f\data\sound\new1", 0.0, 0 }; 227 | soundClick[] = { "\A3\ui_f\data\sound\onclick", 0.07, 1 }; 228 | soundEscape[] = { "\A3\ui_f\data\sound\onescape", 0.09, 1 }; 229 | text = "None"; 230 | action = "['none'] call TAWVD_fnc_onTerrainChanged;"; 231 | sizeEx = 0.04; 232 | 233 | x = .38; y = .505; 234 | w = .275; h = .04; 235 | }; 236 | 237 | class VD_terrain_low : VD_terrain_none { 238 | idc = -1; 239 | text = "Low"; 240 | action = "['low'] call TAWVD_fnc_onTerrainChanged;"; 241 | x = .47; 242 | }; 243 | 244 | class VD_terrain_normal : VD_terrain_none { 245 | idc = -1; 246 | text = "Normal"; 247 | action = "['norm'] call TAWVD_fnc_onTerrainChanged;"; 248 | x = .56; 249 | }; 250 | 251 | class VD_terrain_high : VD_terrain_none { 252 | idc = -1; 253 | text = "High"; 254 | action = "['high'] call TAWVD_fnc_onTerrainChanged;"; 255 | x = .67; 256 | }; 257 | 258 | class ObjectSyncCheckbox : RscCheckbox 259 | { 260 | idc = 2931; 261 | x = .32; y = .6; 262 | tooltip = "Sync object rendering with view rendering"; 263 | onCheckedChanged = "if((_this select 1) == 1) then {tawvd_syncObject = true;ctrlEnable [2941,false]; ctrlEnable [2942,false];} else {tawvd_syncObject = false; ctrlEnable [2942,true]; ctrlEnable [2941,true];};"; 264 | w = 1 * GUI_GRID_CENTER_W; 265 | h = 1 * GUI_GRID_CENTER_H; 266 | }; 267 | 268 | class ObjectSynctext : RscText { 269 | idc = -1; 270 | text = "Sync with view"; 271 | x = .345; y = .596; 272 | w = .35; h = .04; 273 | }; 274 | 275 | class Manager:RscControlsGroup { 276 | idc = MANAGER_GROUP; 277 | 278 | x = -0.21; y = .2; 279 | w = .5; h = 3; 280 | class Controls { 281 | class SaveLoadGroup:RscControlsGroupNoScrollbars { 282 | idc = SAVELOAD_GROUP; 283 | 284 | x = 0; 285 | y = 0; 286 | w = .5; 287 | h = 3; 288 | 289 | class Controls { 290 | class MyTitleBackground:RscText { 291 | colorBackground[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])" }; 292 | idc = -1; 293 | x = 0; 294 | y = 0; 295 | w = .5; 296 | h = (1 / 25); 297 | }; 298 | 299 | class Title : RscTitle { 300 | colorBackround[] = { 0, 0, 0, 0 }; 301 | idc = -1; 302 | text = "Save Manager"; 303 | x = 0; 304 | y = 0; 305 | w = .8; 306 | h = (1 / 25); 307 | }; 308 | 309 | class MainBackground:RscText { 310 | colorBackground[] = { 0, 0, 0, .7 }; 311 | idc = -1; 312 | x = 0; 313 | y = 0 + (11 / 250); 314 | w = .5; 315 | h = .57 - (22 / 250); 316 | }; 317 | 318 | class SaveList:RscListBox { 319 | idc = SAVES_LIST; 320 | sizeEx = 0.04; 321 | colorBackground[] = {0.1,0.1,0.1,0.9}; 322 | x = 0; y = 0 + (11 / 250); 323 | w = .5; h = .49 - (22 / 250); 324 | 325 | onLBSelChanged = "_this call TAWVD_fnc_onSaveSelectionChanged;"; 326 | }; 327 | 328 | class SaveSlotName:VD_onFoot_Edit { 329 | idc = SLOT_NAME; 330 | text = "SAVE NAME"; 331 | colorBackground[] = {0,0,0,0.6}; 332 | onKeyUp = ""; 333 | 334 | x = .025; y = .42 + (11 / 250); 335 | w = .45; 336 | }; 337 | 338 | class SaveButton:RscButtonMenu { 339 | text = "Save"; 340 | onButtonClick = "[] call TAWVD_fnc_onSavePressed;"; 341 | x = 0; 342 | y = 0.57 - (1 / 25); 343 | w = (6.25 / 40); 344 | h = (1 / 25); 345 | }; 346 | 347 | class HideButton:RscButtonMenu { 348 | text = "Hide"; 349 | onButtonClick = "((findDisplay 2900) displayCtrl 2999) ctrlSetFade 1; ((findDisplay 2900) displayCtrl 2999) ctrlCommit 0.3;"; 350 | x = .16; 351 | y = 0.57 - (1 / 25); 352 | w = (6.25 / 40); 353 | h = (1 / 25); 354 | }; 355 | }; 356 | }; 357 | }; 358 | }; 359 | }; 360 | }; 361 | -------------------------------------------------------------------------------- /functions/taw_vd/defines.h: -------------------------------------------------------------------------------- 1 | /* Main display IDD & IDC's */ 2 | #define MENU_IDD 2900 3 | #define INFANTRY_SLIDER 2901 4 | #define INFANTRY_EDIT 2902 5 | #define GROUND_SLIDER 2911 6 | #define GROUND_EDIT 2912 7 | #define AIR_SLIDER 2921 8 | #define AIR_EDIT 2922 9 | #define OBJECT_SLIDER 2941 10 | #define OBJECT_EDIT 2942 11 | #define DRONE_SLIDER 2951 12 | #define DRONE_EDIT 2952 13 | #define TERRAIN_NONE 2950 14 | #define GUI_GRID_CENTER_WAbs ((safezoneW / safezoneH) min 1.2) 15 | #define GUI_GRID_CENTER_HAbs (GUI_GRID_CENTER_WAbs / 1.2) 16 | #define GUI_GRID_CENTER_W (GUI_GRID_CENTER_WAbs / 40) 17 | #define GUI_GRID_CENTER_H (GUI_GRID_CENTER_HAbs / 25) 18 | #define GUI_GRID_CENTER_X (safezoneX + (safezoneW - GUI_GRID_CENTER_WAbs)/2) 19 | #define GUI_GRID_CENTER_Y (safezoneY + (safezoneH - GUI_GRID_CENTER_HAbs)/2) 20 | #define ST_LEFT 0x00 21 | #define ST_MULTI 0x10 22 | #define SEL(ARRAY,INDEX) (ARRAY select INDEX) 23 | 24 | /* Save / Load Manager */ 25 | #define MANAGER_GROUP 2999 26 | #define SAVELOAD_GROUP 3000 27 | #define SAVES_LIST 3001 28 | #define SLOT_NAME 3002 29 | 30 | /* Namespace Macros */ 31 | #define SVAR_MNS missionNamespace setVariable 32 | #define SVAR_UINS uiNamespace setVariable 33 | #define SVAR_PNS parsingNamespace setVariable 34 | #define GVAR_MNS missionNamespace getVariable 35 | #define GVAR_UINS uiNamespace getVariable 36 | #define GVAR_PNS parsingNamespace getVariable 37 | 38 | /* Condition Macros */ 39 | #define EQUAL(condition1,condition2) condition1 isEqualTo condition2 40 | 41 | /* Display Macros */ 42 | #define CONTROL(disp,ctrl) ((findDisplay ##disp) displayCtrl ##ctrl) 43 | #define CONTROL_DATA(ctrl) (lbData[ctrl,lbCurSel ctrl]) 44 | #define CONTROL_DATAI(ctrl,index) ctrl lbData index -------------------------------------------------------------------------------- /functions/taw_vd/fn_onChar.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | When a character is entered it is validated and changes the 7 | correct slider it is associated with. I probably over-complicated 8 | this more then I had to but onChar behaves weird. 9 | 10 | PARAMS: 11 | 0: CONTROL 12 | 1: SCALAR (INT) 13 | 2: STRING (Case option) 14 | */ 15 | private["_value","_varName","_maxRange"]; 16 | params ["_control","_code","_slider"]; 17 | 18 | disableSerialization; 19 | if(isNull _control) exitWith {}; //POOOOOP 20 | 21 | _maxRange = if(!isNil "tawvd_maxRange") then {tawvd_maxRange} else {20000}; 22 | _value = parseNumber (ctrlText _control); 23 | if(_value > _maxRange OR _value < 100) exitwith {[] call TAWVD_fnc_openMenu;}; 24 | 25 | _varName = switch (_slider) do { 26 | case "ground": {"tawvd_foot"}; 27 | case "vehicle": {"tawvd_car"}; 28 | case "air": {"tawvd_air"}; 29 | case "object": {"tawvd_object"}; 30 | case "drone": {"tawvd_drone"}; 31 | default {"tawvd_foot"}; 32 | }; 33 | 34 | SVAR_MNS [_varName,_value]; 35 | [] call TAWVD_fnc_updateViewDistance; 36 | [] call TAWVD_fnc_openMenu; -------------------------------------------------------------------------------- /functions/taw_vd/fn_onSavePressed.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | Updates the view distance dependant on whether the player 7 | is on foot, a car or an aircraft. 8 | */ 9 | private ["_saveIndex","_saveName"]; 10 | _saveIndex = lbCurSel SAVES_LIST; 11 | _saveName = ctrlText SLOT_NAME; 12 | 13 | SVAR_PNS [format["tawvd_slot_%1",_saveIndex], 14 | [ 15 | _saveName, 16 | tawvd_foot, 17 | tawvd_car, 18 | tawvd_air, 19 | tawvd_drone, 20 | tawvd_object, 21 | tawvd_syncObject 22 | ] 23 | ]; 24 | 25 | saveProfileNamespace; 26 | [] call TAWVD_fnc_openSaveManager; 27 | -------------------------------------------------------------------------------- /functions/taw_vd/fn_onSaveSelectionChanged.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | Updates the view distance dependant on whether the player 7 | is on foot, a car or an aircraft. 8 | */ 9 | private "_saveData"; 10 | params [["_control",controlNull,[controlNull]],["_index",-1,[0]]]; 11 | 12 | /* Error checks */ 13 | if(EQUAL(_index,-1) OR isNull _control) exitWith {}; 14 | _saveData = GVAR_PNS format["tawvd_slot_%1",_index]; 15 | if(isNil "_saveData") exitWith {}; 16 | 17 | /* Set variables to chosen slot data */ 18 | CONTROL(MENU_IDD,SLOT_NAME) ctrlSetText (SEL(_saveData,0)); 19 | SVAR_MNS ["tawvd_foot",SEL(_saveData,1)]; 20 | SVAR_MNS ["tawvd_car",SEL(_saveData,2)]; 21 | SVAR_MNS ["tawvd_air",SEL(_saveData,3)]; 22 | SVAR_MNS ["tawvd_drone",SEL(_saveData,4)]; 23 | SVAR_MNS ["tawvd_object",SEL(_saveData,5)]; 24 | SVAR_MNS ["tawvd_syncObject",SEL(_saveData,6)]; 25 | 26 | /* Update Menu & View Distance */ 27 | [] call TAWVD_fnc_updateViewDistance; 28 | [] call TAWVD_fnc_openMenu; -------------------------------------------------------------------------------- /functions/taw_vd/fn_onSliderChanged.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | Called when the slider is changed for any field and 7 | updates the view distance for it. 8 | */ 9 | private "_varData"; 10 | params [["_mode",-1,[0]],["_value",-1,[0]]]; 11 | 12 | if(EQUAL(_mode,-1) OR EQUAL(_value,-1)) exitWith {}; 13 | 14 | disableSerialization; 15 | 16 | _varData = switch(_mode) do { 17 | case 0: {["tawvd_foot",INFANTRY_EDIT]}; 18 | case 1: {["tawvd_car",GROUND_EDIT]}; 19 | case 2: {["tawvd_air",AIR_EDIT]}; 20 | case 3: {["tawvd_object",OBJECT_EDIT]}; 21 | case 4: {["tawvd_drone",DRONE_EDIT]}; 22 | }; 23 | 24 | SVAR_MNS [SEL(_varData,0),round(_value)]; 25 | ctrlSetText[SEL(_varData,1),str(GVAR_MNS SEL(_varData,0))]; 26 | [] call TAWVD_fnc_updateViewDistance; 27 | 28 | if(EQUAL(_mode,3)) then { 29 | setObjectViewDistance [tawvd_object,100]; 30 | }; 31 | 32 | if(tawvd_syncObject) then { 33 | sliderSetPosition[OBJECT_SLIDER, tawvd_object]; 34 | ctrlSetText[OBJECT_EDIT,str(tawvd_object)]; 35 | }; -------------------------------------------------------------------------------- /functions/taw_vd/fn_onTerrainChanged.sqf: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | Updates the players terraingrid when called. 7 | */ 8 | private "_type"; 9 | _type = param [0,"",[""]]; 10 | if(_type == "") exitWith {}; 11 | 12 | switch (_type) do { 13 | case "none": {if(isNil "tawvd_disablenone") then {setTerrainGrid 50;};}; 14 | case "low": {setTerrainGrid 30;}; 15 | case "norm": {setTerrainGrid 12.5;}; 16 | case "high": {setTerrainGrid 3.125;}; 17 | }; -------------------------------------------------------------------------------- /functions/taw_vd/fn_openMenu.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | Called via addAction and opens the TAW View Distance Menu 7 | */ 8 | if(isNull (findDisplay MENU_IDD)) then { 9 | if(!createDialog "TAW_VDMenu") exitWith {hint "Something went wrong, the menu won't open?"}; 10 | }; 11 | disableSerialization; 12 | 13 | { 14 | ctrlSetText[SEL(_x,0),str(SEL(_x,1))]; 15 | } foreach [[INFANTRY_EDIT,tawvd_foot],[GROUND_EDIT,tawvd_car],[AIR_EDIT,tawvd_air],[OBJECT_EDIT,tawvd_object],[DRONE_EDIT,tawvd_drone]]; 16 | 17 | //Setup the sliders 18 | { 19 | if(!isNil "tawvd_maxRange") then { 20 | slidersetRange [_x select 0,100,tawvd_maxRange]; 21 | } else { 22 | slidersetRange [_x select 0,100,20000]; 23 | }; 24 | ((findDisplay MENU_IDD) displayCtrl (_x select 0)) sliderSetSpeed [100,100,100]; 25 | sliderSetPosition[_x select 0, _x select 1]; 26 | } foreach [[INFANTRY_SLIDER,tawvd_foot],[GROUND_SLIDER,tawvd_car],[AIR_SLIDER,tawvd_air],[OBJECT_SLIDER,tawvd_object],[DRONE_SLIDER,tawvd_drone]]; 27 | 28 | ((findDisplay MENU_IDD) displayCtrl 2931) cbSetChecked tawvd_syncObject; 29 | 30 | if(tawvd_syncObject) then { 31 | ctrlEnable [OBJECT_SLIDER,false]; 32 | ctrlEnable [OBJECT_EDIT,false]; 33 | } else { 34 | ctrlEnable [OBJECT_SLIDER,true]; 35 | ctrlEnable [OBJECT_EDIT,true]; 36 | }; 37 | 38 | //Lets disable it.. 39 | if(!isNil "tawvd_disablenone") then { 40 | ctrlEnable [TERRAIN_NONE,false]; 41 | }; -------------------------------------------------------------------------------- /functions/taw_vd/fn_openSaveManager.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | Updates the view distance dependant on whether the player 7 | is on foot, a car or an aircraft. 8 | */ 9 | private ["_controlGrp","_saveList"]; 10 | disableSerialization; 11 | 12 | /* Store displays */ 13 | _controlGrp = CONTROL(MENU_IDD,MANAGER_GROUP); 14 | _saveList = CONTROL(MENU_IDD,SAVES_LIST); 15 | lbClear _saveList; //Purge the list 16 | 17 | /* Make the Saves manager group visible */ 18 | _controlGrp ctrlSetfade 0; 19 | _controlGrp ctrlCommit .3; 20 | 21 | /* Fill the listbox */ 22 | for "_i" from 0 to 9 do { 23 | _varData = GVAR_PNS format["tawvd_slot_%1",_i]; 24 | if(!isNil "_varData") then { 25 | _saveList lbAdd SEL(_varData,0); 26 | _saveList lbSetData [(lbSize _saveList)-1,"true"]; 27 | } else { 28 | _saveList lbAdd format["Save Slot %1",_i]; 29 | _saveList lbSetData [(lbSize _saveList)-1,"false"]; 30 | }; 31 | }; -------------------------------------------------------------------------------- /functions/taw_vd/fn_stateTracker.fsm: -------------------------------------------------------------------------------- 1 | /*%FSM*/ 2 | /*%FSM*/ 3 | /* 4 | item0[] = {"init",0,4346,-39.234997,-157.457230,50.765003,-107.457222,0.000000,"init"}; 5 | item1[] = {"true",8,218,-39.286701,-67.901810,50.713299,-17.901814,0.000000,"true"}; 6 | item2[] = {"I_am_a_loop__",2,250,-37.913574,2.551729,52.086441,52.551727,0.000000,"I am a loop.."}; 7 | item3[] = {"Dead_Player",4,218,-137.117889,56.721581,-47.117889,106.721581,0.000000,"Dead Player"}; 8 | item4[] = {"I_am_dead_Set_my",2,250,-215.837250,109.620483,-125.837227,159.620499,0.000000,"I am dead" \n "Set my corpse"}; 9 | item5[] = {"Alive_player",4,218,-215.185760,16.088562,-125.185867,66.088623,0.000000,"Alive player"}; 10 | item6[] = {"Re_add_my_action",2,250,-215.481354,-68.055023,-125.481308,-18.054995,0.000000,"Re-add my" \n "action please"}; 11 | item7[] = {"State_changed",4,218,107.007217,1.512135,197.007202,51.512016,0.000000,"State changed"}; 12 | item8[] = {"Update_me",2,250,107.804337,-67.884735,197.804352,-17.884773,0.000000,"Update me"}; 13 | link0[] = {0,1}; 14 | link1[] = {1,2}; 15 | link2[] = {2,3}; 16 | link3[] = {2,7}; 17 | link4[] = {3,4}; 18 | link5[] = {4,5}; 19 | link6[] = {5,6}; 20 | link7[] = {6,1}; 21 | link8[] = {7,8}; 22 | link9[] = {8,1}; 23 | globals[] = {0.000000,0,0,0,0,640,480,1,12,6316128,1,-604.631348,604.623535,286.974182,-497.663422,1404,911,1}; 24 | window[] = {2,-1,-1,-32000,-32000,785,25,1465,25,3,1422}; 25 | *//*%FSM*/ 26 | class FSM 27 | { 28 | fsmName = "TAW_VD State Tracker"; 29 | class States 30 | { 31 | /*%FSM*/ 32 | class init 33 | { 34 | name = "init"; 35 | init = /*%FSM*/"private [""_playerState"",""_corpse"",""_actionID"",""_droneState""];" \n 36 | "" \n 37 | "_playerState = vehicle player;" \n 38 | "_droneState = UAVControl (getConnectedUAV player) select 1;" \n 39 | "tawvd_addon_disable = true;" \n 40 | "" \n 41 | "if(isNil {profileNamespace getVariable ""tawvd_foot""}) then {" \n 42 | " profileNamespace setVariable [""tawvd_foot"",viewDistance];" \n 43 | " profileNamespace setVariable [""tawvd_car"",viewDistance];" \n 44 | " profileNamespace setVariable [""tawvd_air"",viewDistance];" \n 45 | " profileNamespace setVariable [""tawvd_drone"",viewDistance];" \n 46 | " profileNamespace setVariable [""tawvd_object"",viewDistance];" \n 47 | " saveProfileNamespace;" \n 48 | "};" \n 49 | "" \n 50 | "tawvd_foot = profileNamespace getVariable [""tawvd_foot"",viewDistance];" \n 51 | "tawvd_car = profileNamespace getVariable [""tawvd_car"",viewDistance];" \n 52 | "tawvd_air = profileNamespace getVariable [""tawvd_air"",viewDistance];" \n 53 | "tawvd_drone = profileNamespace getVariable [""tawvd_drone"",viewDistance];" \n 54 | "tawvd_object = profileNamespace getVariable [""tawvd_object"",viewDistance];" \n 55 | "" \n 56 | "tawvd_syncObject = true;" \n 57 | "_actionID = player addAction[""View Settings"",TAWVD_fnc_openMenu,[],-99,false,false,"""",''];"/*%FSM*/; 58 | precondition = /*%FSM*/""/*%FSM*/; 59 | class Links 60 | { 61 | /*%FSM*/ 62 | class true 63 | { 64 | priority = 0.000000; 65 | to="I_am_a_loop__"; 66 | precondition = /*%FSM*/""/*%FSM*/; 67 | condition=/*%FSM*/"true"/*%FSM*/; 68 | action=/*%FSM*/""/*%FSM*/; 69 | }; 70 | /*%FSM*/ 71 | }; 72 | }; 73 | /*%FSM*/ 74 | /*%FSM*/ 75 | class I_am_a_loop__ 76 | { 77 | name = "I_am_a_loop__"; 78 | init = /*%FSM*/""/*%FSM*/; 79 | precondition = /*%FSM*/""/*%FSM*/; 80 | class Links 81 | { 82 | /*%FSM*/ 83 | class State_changed 84 | { 85 | priority = 0.000000; 86 | to="Update_me"; 87 | precondition = /*%FSM*/""/*%FSM*/; 88 | condition=/*%FSM*/"(vehicle player != _playerState OR (UAVControl getConnectedUAV player select 1) != _droneState)"/*%FSM*/; 89 | action=/*%FSM*/""/*%FSM*/; 90 | }; 91 | /*%FSM*/ 92 | /*%FSM*/ 93 | class Dead_Player 94 | { 95 | priority = 0.000000; 96 | to="I_am_dead_Set_my"; 97 | precondition = /*%FSM*/""/*%FSM*/; 98 | condition=/*%FSM*/"!alive player"/*%FSM*/; 99 | action=/*%FSM*/""/*%FSM*/; 100 | }; 101 | /*%FSM*/ 102 | }; 103 | }; 104 | /*%FSM*/ 105 | /*%FSM*/ 106 | class I_am_dead_Set_my 107 | { 108 | name = "I_am_dead_Set_my"; 109 | init = /*%FSM*/"_corpse = player;" \n 110 | "_corpse removeAction _actionID;"/*%FSM*/; 111 | precondition = /*%FSM*/""/*%FSM*/; 112 | class Links 113 | { 114 | /*%FSM*/ 115 | class Alive_player 116 | { 117 | priority = 0.000000; 118 | to="Re_add_my_action"; 119 | precondition = /*%FSM*/""/*%FSM*/; 120 | condition=/*%FSM*/"alive player"/*%FSM*/; 121 | action=/*%FSM*/""/*%FSM*/; 122 | }; 123 | /*%FSM*/ 124 | }; 125 | }; 126 | /*%FSM*/ 127 | /*%FSM*/ 128 | class Re_add_my_action 129 | { 130 | name = "Re_add_my_action"; 131 | init = /*%FSM*/"_actionID = player addAction[""View Settings"",TAWVD_fnc_openMenu,[],-99,false,false,"""",''];"/*%FSM*/; 132 | precondition = /*%FSM*/""/*%FSM*/; 133 | class Links 134 | { 135 | /*%FSM*/ 136 | class true 137 | { 138 | priority = 0.000000; 139 | to="I_am_a_loop__"; 140 | precondition = /*%FSM*/""/*%FSM*/; 141 | condition=/*%FSM*/"true"/*%FSM*/; 142 | action=/*%FSM*/""/*%FSM*/; 143 | }; 144 | /*%FSM*/ 145 | }; 146 | }; 147 | /*%FSM*/ 148 | /*%FSM*/ 149 | class Update_me 150 | { 151 | name = "Update_me"; 152 | init = /*%FSM*/"[] call TAWVD_fnc_updateViewDistance;" \n 153 | "_playerState = vehicle player;" \n 154 | "_droneState = UAVControl (getConnectedUAV player) select 1;"/*%FSM*/; 155 | precondition = /*%FSM*/""/*%FSM*/; 156 | class Links 157 | { 158 | /*%FSM*/ 159 | class true 160 | { 161 | priority = 0.000000; 162 | to="I_am_a_loop__"; 163 | precondition = /*%FSM*/""/*%FSM*/; 164 | condition=/*%FSM*/"true"/*%FSM*/; 165 | action=/*%FSM*/""/*%FSM*/; 166 | }; 167 | /*%FSM*/ 168 | }; 169 | }; 170 | /*%FSM*/ 171 | }; 172 | initState="init"; 173 | finalStates[] = 174 | { 175 | }; 176 | }; 177 | /*%FSM*/ 178 | -------------------------------------------------------------------------------- /functions/taw_vd/fn_updateViewDistance.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.h" 2 | /* 3 | Author: Bryan "Tonic" Boardwine 4 | 5 | Description: 6 | Updates the view distance dependant on whether the player 7 | is on foot, a car or an aircraft. 8 | */ 9 | private "_dist"; 10 | switch (true) do { 11 | case (!(EQUAL(SEL(UAVControl getConnectedUAV player,1),""))): { 12 | setViewDistance tawvd_drone; 13 | _dist = tawvd_drone; 14 | }; 15 | 16 | case ((vehicle player) isKindOf "Man"): { 17 | setViewDistance tawvd_foot; 18 | _dist = tawvd_foot; 19 | }; 20 | 21 | case ((vehicle player) isKindOf "LandVehicle"): { 22 | setViewDistance tawvd_car; 23 | _dist = tawvd_car; 24 | }; 25 | 26 | case ((vehicle player) isKindOf "Air"): { 27 | setViewDistance tawvd_air; 28 | _dist = tawvd_air; 29 | }; 30 | }; 31 | 32 | if(tawvd_syncObject) then { 33 | setObjectViewDistance [_dist,100]; 34 | tawvd_object = _dist; 35 | }; -------------------------------------------------------------------------------- /functions/vehicle_handler/fn_quadInit.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Add a quad with the required parameters to the quad handling PFH. 4 | * 5 | * Arguments: 6 | * 0: quad to be added 7 | * 1: Respawn timer (in seconds) 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_vehicle", "_timer"]; 13 | 14 | derp_vehicleHandler_quadHandlingArray pushBack [_vehicle, typeOf _vehicle, getPosATL _vehicle, getDir _vehicle, _timer]; 15 | -------------------------------------------------------------------------------- /functions/vehicle_handler/fn_quadPFH.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * PFEH handling quads respawning / abandon 4 | * DO NOT CALL THIS. This should only be called once on server init. 5 | * 6 | * Arguments: 7 | * Nothing 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | [{ 13 | { 14 | _x params ["_vehicle", "_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 15 | 16 | private _distanceCheckResult = { 17 | { 18 | if ((_vehicle distance2D _x) < 10 || {_vehicle distance2D _spawnPos < 5}) exitWith {false}; 19 | true; 20 | } foreach allPlayers; 21 | }; 22 | 23 | if (call _distanceCheckResult) then { 24 | [{ 25 | params ["_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 26 | private _newVehicle = createVehicle [_vehicleClass, _spawnPos, [], 0, "NONE"]; 27 | _newVehicle setDir _spawnDir; 28 | 29 | derp_vehicleHandler_quadHandlingArray pushBack [_newVehicle, _vehicleClass, _spawnPos, _spawnDir, _timer]; 30 | [_newVehicle] call derp_vehicleHandler_fnc_vehicleSetup; 31 | 32 | }, [_vehicleClass, _spawnPos, _spawnDir, _timer], _timer] call derp_fnc_waitAndExecute; 33 | deleteVehicle _vehicle; 34 | derp_vehicleHandler_quadHandlingArray deleteAt (derp_vehicleHandler_quadHandlingArray find _x); 35 | } else { 36 | [{ 37 | params ["_oldVehicle", "_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 38 | 39 | if (!isNull _oldVehicle) then { 40 | deleteVehicle _oldVehicle; 41 | }; 42 | 43 | private _newVehicle = createVehicle [_vehicleClass, _spawnPos, [], 0, "NONE"]; 44 | _newVehicle setDir _spawnDir; 45 | 46 | derp_vehicleHandler_quadHandlingArray pushBack [_newVehicle, _vehicleClass, _spawnPos, _spawnDir, _timer]; 47 | [_newVehicle] call derp_vehicleHandler_fnc_vehicleSetup; 48 | 49 | }, [_vehicle, _vehicleClass, _spawnPos, _spawnDir, _timer], _timer] call derp_fnc_waitAndExecute; 50 | derp_vehicleHandler_quadHandlingArray deleteAt (derp_vehicleHandler_quadHandlingArray find _x); 51 | }; 52 | } forEach (derp_vehicleHandler_quadHandlingArray select { 53 | _x params ["_vehicle", "_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 54 | 55 | private _distanceCheckResult = { 56 | { 57 | if ((_vehicle distance2D _x) < 10 || {_vehicle distance2D _spawnPos < 5}) exitWith {false}; 58 | true; 59 | } foreach allPlayers; 60 | }; 61 | 62 | if (isNull _vehicle || {!alive _vehicle} || {call _distanceCheckResult}) then { 63 | true 64 | }; 65 | }); 66 | }, 10, []] call derp_fnc_addPerFrameHandler; 67 | -------------------------------------------------------------------------------- /functions/vehicle_handler/fn_vehicleInit.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Add a vehicle with the required parameters to the vehicle handling PFH. 4 | * 5 | * Arguments: 6 | * 0: Vehicle to be added 7 | * 1: Respawn timer (in seconds) 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_vehicle", "_timer"]; 13 | 14 | derp_vehicleHandler_vehicleHandlingArray pushBack [_vehicle, typeOf _vehicle, getPosATL _vehicle, getDir _vehicle, _timer]; 15 | -------------------------------------------------------------------------------- /functions/vehicle_handler/fn_vehiclePFH.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * PFEH handling vehicle respawning / abandon 5 | * DO NOT CALL THIS. This should only be called once on server init. 6 | * 7 | * Arguments: 8 | * Nothing 9 | *'' 10 | * Return Value: 11 | * Nothing 12 | */ 13 | [{ 14 | { 15 | _x params ["_vehicle", "_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 16 | 17 | private _distanceCheckResult = { 18 | { 19 | if ((_vehicle distance2D _x) < derp_PARAM_VehicleRespawnDistance || {_vehicle distance2D _spawnPos < 5}) exitWith {false}; 20 | true; 21 | } foreach allPlayers; 22 | }; 23 | 24 | if (call _distanceCheckResult) then { 25 | [{ 26 | params ["_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 27 | private _newVehicle = createVehicle [_vehicleClass, _spawnPos, [], 0, "CAN_COLLIDE"]; 28 | _newVehicle setDir _spawnDir; 29 | 30 | derp_vehicleHandler_vehicleHandlingArray pushBack [_newVehicle, _vehicleClass, _spawnPos, _spawnDir, _timer]; 31 | [_newVehicle] call derp_vehicleHandler_fnc_vehicleSetup; 32 | 33 | }, [_vehicleClass, _spawnPos, _spawnDir, _timer], _timer] call derp_fnc_waitAndExecute; 34 | deleteVehicle _vehicle; 35 | derp_vehicleHandler_vehicleHandlingArray deleteAt (derp_vehicleHandler_vehicleHandlingArray find _x); 36 | } else { 37 | [{ 38 | params ["_oldVehicle", "_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 39 | 40 | if (!isNull _oldVehicle) then { 41 | deleteVehicle _oldVehicle; 42 | }; 43 | 44 | private _newVehicle = createVehicle [_vehicleClass, _spawnPos, [], 0, "CAN_COLLIDE"]; 45 | _newVehicle setDir _spawnDir; 46 | 47 | derp_vehicleHandler_vehicleHandlingArray pushBack [_newVehicle, _vehicleClass, _spawnPos, _spawnDir, _timer]; 48 | [_newVehicle] call derp_vehicleHandler_fnc_vehicleSetup; 49 | 50 | }, [_vehicle, _vehicleClass, _spawnPos, _spawnDir, _timer], _timer] call derp_fnc_waitAndExecute; 51 | derp_vehicleHandler_vehicleHandlingArray deleteAt (derp_vehicleHandler_vehicleHandlingArray find _x); 52 | }; 53 | 54 | } forEach (derp_vehicleHandler_vehicleHandlingArray select { 55 | _x params ["_vehicle", "_vehicleClass", "_spawnPos", "_spawnDir", "_timer"]; 56 | 57 | private _distanceCheckResult = { 58 | { 59 | if ((_vehicle distance2D _x) < derp_PARAM_VehicleRespawnDistance || {_vehicle distance2D _spawnPos < 5}) exitWith {false}; 60 | true; 61 | } foreach allPlayers; 62 | }; 63 | 64 | if (isNull _vehicle || {!alive _vehicle} || {!(_vehicleClass in VHCrewedVehicles) && {call _distanceCheckResult}}) then { 65 | true 66 | }; 67 | }); 68 | }, 10, []] call derp_fnc_addPerFrameHandler; 69 | -------------------------------------------------------------------------------- /functions/vehicle_handler/fn_vehicleSetup.sqf: -------------------------------------------------------------------------------- 1 | #include "..\..\defines.hpp" 2 | /* 3 | * Author: alganthe 4 | * Serve as an init for the specified vehicle with whatever variable / code needed. 5 | * 6 | * Arguments: 7 | * 0: Vehicle to be init 8 | * 9 | * Return Value: 10 | * Nothing 11 | */ 12 | params ["_vehicle"]; 13 | 14 | private _vehicleType = typeOf _vehicle; 15 | 16 | if (isNull _vehicle) exitWith {}; 17 | 18 | // Add UAV crew 19 | if (_vehicleType in VHCrewedVehicles) then { 20 | createVehicleCrew _vehicle; 21 | }; 22 | 23 | // remove ammo cargo 24 | if (_vehicleType in NoAmmoCargoVehc) then { 25 | _vehicle setAmmoCargo 0; 26 | }; 27 | 28 | // EH 29 | _vehicle addEventHandler ["Fired", { 30 | params ["_unit", "_weapon", "", "", "", "", "_projectile"]; 31 | 32 | if ((_weapon != "CMFlareLauncher") && {_unit distance2D (getMarkerPos "BASE") < 300}) then { 33 | deleteVehicle _projectile; 34 | ["Don't goof at base", "Hold your horses soldier, don't throw, fire or place anything inside the base."] remoteExecCall ["derp_fnc_hintC", _unit]; 35 | } 36 | }]; 37 | 38 | // Add to zeus 39 | {_x addCuratorEditableObjects [[_vehicle], false]} forEach allCurators; 40 | -------------------------------------------------------------------------------- /initPlayerLocal.sqf: -------------------------------------------------------------------------------- 1 | disableRemoteSensors true; 2 | 3 | //------------------------------ Headless Client 4 | if !(isServer or hasInterface) then { 5 | if (profileName == "HCAOs") then { 6 | 7 | derp_HCAOsConnected = true; 8 | publicVariableServer "HCAOsConnected"; 9 | format ["HCAOs connected: %1", derp_HCAOsConnected] remoteExec ["diag_log", 2]; 10 | }; 11 | } else {//-------------------------------- Player stuff 12 | 13 | #include "defines.hpp" 14 | enableSentences false; 15 | [] call derp_fnc_diary; // Diary 16 | 17 | [{!isNull (findDisplay 46)}, {call derp_fnc_mapLinesHandler}, []] call derp_fnc_waitUntilAndExecute; // No more penii 18 | 19 | ["InitializePlayer", [player]] call BIS_fnc_dynamicGroups; // Dynamic groups init 20 | 21 | [] execVM "scripts\misc\QS_icons.sqf"; // Map icons 22 | 23 | [[player], false] call derp_fnc_remoteAddCuratorEditableObjects; // Add unit to zeus. 24 | //---------------- mission params 25 | if (("staminaEnabled" call BIS_fnc_getParamValue) == 0) then { 26 | player enableStamina false; 27 | }; 28 | 29 | if (("paraJumpEnabled" call BIS_fnc_getParamValue) == 1) then { 30 | derp_PARAM_paraJumpEnabled = true; 31 | } else { 32 | derp_PARAM_paraJumpEnabled = false; 33 | }; 34 | 35 | //---------------- class specific stuff 36 | if (player getUnitTrait "derp_pilot") then { 37 | [player, pilotRespawnMarker] call BIS_fnc_addRespawnPosition; 38 | }; 39 | 40 | // Disable arty computer for non FSG members 41 | if (player getUnitTrait "derp_mortar") then { 42 | enableEngineArtillery true; 43 | } else { 44 | enableEngineArtillery false; 45 | }; 46 | 47 | if ("derp_revive" in (getMissionConfigValue "respawnTemplates")) then { 48 | if (getMissionConfigValue "derp_revive_everyoneCanRevive" == 0) then { 49 | if (player getUnitTrait "medic") then { 50 | call derp_revive_fnc_drawDowned; 51 | }; 52 | } else { 53 | call derp_revive_fnc_drawDowned; 54 | }; 55 | call derp_revive_fnc_handleDamage; 56 | call derp_revive_fnc_diaryEntries; 57 | if (getMissionConfigValue "respawnOnStart" == -1) then {[player] call derp_revive_fnc_reviveActions}; 58 | }; 59 | 60 | //---------------- EHs and addactions 61 | player addEventHandler ["GetInMan", { 62 | _this call derp_fnc_pilotCheck; 63 | call derp_fnc_crewNames; 64 | }]; 65 | 66 | player addEventHandler ["SeatSwitchedMan", { 67 | if !((_this select 3) isKindOf "Air") exitWith {}; 68 | _this params ["_unit1", "", "_vehicle"]; 69 | private _seat = ((fullCrew _vehicle) select {_x select 0 == _unit1}) select 0; 70 | [(_seat select 0), (_seat select 1), _vehicle, (_seat select 3)] call derp_fnc_pilotCheck; 71 | 72 | }]; 73 | 74 | player addEventHandler ["Fired", { 75 | params ["_unit", "_weapon", "", "", "", "", "_projectile"]; 76 | 77 | if (_unit distance2D (getMarkerPos "BASE") < 300) then { 78 | deleteVehicle _projectile; 79 | ["Don't goof at base", "Hold your horses soldier, don't throw, fire or place anything inside the base."] remoteExecCall ["derp_fnc_hintC", _unit]; 80 | }}]; 81 | 82 | if ("ArsenalFilter" call BIS_fnc_getParamValue == 1) then { 83 | player addEventHandler ["Take", { 84 | params ["_unit", "_container", "_item"]; 85 | 86 | [_unit, 1, _item, _container] call derp_fnc_gearLimitations; 87 | }]; 88 | 89 | player addEventHandler ["InventoryClosed", { 90 | params ["_unit"]; 91 | 92 | [_unit, 0] call derp_fnc_gearLimitations; 93 | }]; 94 | }; 95 | 96 | { 97 | _x addAction [ 98 | "Save gear", 99 | { 100 | player setVariable ["derp_savedGear", (getUnitLoadout player)]; 101 | systemChat "gear saved"; 102 | } 103 | ]; 104 | 105 | if (derp_PARAM_paraJumpEnabled) then { 106 | _x addAction [ 107 | "Paradrop on AO", 108 | { 109 | [player, 110 | 2 * ("AOSize" call BIS_fnc_getParamValue) 111 | ] call derp_fnc_paradrop; 112 | }, 113 | nil, 114 | 0, 115 | true, 116 | true, 117 | "", 118 | "(!isNil 'missionInProgress') && {missionInProgress} && {!isNil 'derp_paraPos'}", 119 | 5, 120 | false 121 | ]; 122 | }; 123 | } foreach ArsenalBoxes; 124 | }; 125 | 126 | // Init arsenal boxes, waitAndExec needed for players present at mission start to wait for the server remoteExec 127 | [{[_this select 0, ("ArsenalFilter" call BIS_fnc_getParamValue)] call derp_fnc_VA_filter}, [ArsenalBoxes], 3] call derp_fnc_waitAndExecute; 128 | -------------------------------------------------------------------------------- /initServer.sqf: -------------------------------------------------------------------------------- 1 | #include "defines.hpp" 2 | //---------------------------------- Functions compiling 3 | call compile preprocessFileLineNumbers "functions\core\serverSide_functions_compile.sqf"; 4 | 5 | //---------------------------------- Dynamic groups init 6 | ["Initialize"] call BIS_fnc_dynamicGroups; 7 | 8 | //---------------------------------- Mission vars 9 | derp_HCAOsConnected = false; 10 | derp_HCAmbiantConnected = false; 11 | derp_missionCounter = 0; 12 | derp_successfulSMs = 0; 13 | derp_sideMissionInProgress = false; 14 | derp_airReinforcement = objNull; 15 | derp_lastAirReinforcementTime = 0; 16 | derp_vehicleHandler_vehicleHandlingArray = []; 17 | derp_vehicleHandler_quadHandlingArray = []; 18 | derp_mission1Locations = call derp_fnc_getAllTownsAndVillages; 19 | derp_SMID = 0; 20 | derp_mission1ID = 0; 21 | derp_cleaner_bodyArray = []; 22 | derp_cleaner_groupArray = []; 23 | 24 | derp_PARAM_missionAmount = "MissionAmount" call BIS_fnc_getParamValue; 25 | derp_PARAM_smRewardAfter = "smRewardAfter" call BIS_fnc_getParamValue; 26 | derp_PARAM_vehicleRespawnDistance = "VehicleRespawnDistance" call BIS_fnc_getParamValue; 27 | derp_PARAM_airReinforcementTimer = "airReinforcementTimer" call BIS_fnc_getParamValue; 28 | 29 | if (("EnableRespawn" call BIS_fnc_getParamValue) == 0) then { 30 | derp_PARAM_enableRespawn = true; 31 | } else { 32 | derp_PARAM_enableRespawn = false; 33 | }; 34 | 35 | if (("paraJumpEnabled" call BIS_fnc_getParamValue) == 1) then { 36 | derp_PARAM_paraJumpEnabled = true; 37 | } else { 38 | derp_PARAM_paraJumpEnabled = false; 39 | }; 40 | //---------------------------------- EHs 41 | addMissionEventHandler ["HandleDisconnect", { 42 | _this params ["_unit", "", "", "_name"]; 43 | 44 | if (_name == "HCAOs") then { 45 | derp_HCAOsConnected = false; 46 | diag_log format ["HCAOs connected: %1", derp_HCAOsConnected]; 47 | }; 48 | 49 | if ("derp_revive" in (getMissionConfigValue "respawnTemplates")) then { 50 | _unit setVariable ["derp_revive_downed", false, true]; 51 | }; 52 | }]; 53 | 54 | //---------------------------------- Scripts and functions calls. 55 | [{[true] call derp_fnc_missionSelection}, [], 30] call derp_fnc_waitAndExecute; // STart mission selection 56 | 57 | //-------------- vehicle handling 58 | { 59 | _x params ["_vehicle", "_timer"]; 60 | [_vehicle, _timer] call derp_vehicleHandler_fnc_vehicleInit; 61 | _vehicle call derp_vehicleHandler_fnc_vehicleSetup; 62 | 63 | } forEach VehicleHandlerArray; 64 | [] call derp_vehicleHandler_fnc_vehiclePFH; 65 | 66 | //-------------- quads handling 67 | { 68 | _x params ["_vehicle", "_timer"]; 69 | [_vehicle, _timer] call derp_vehicleHandler_fnc_quadInit; 70 | _vehicle call derp_vehicleHandler_fnc_vehicleSetup; 71 | 72 | } forEach VehicleHandlerArrayQuads; 73 | [] call derp_vehicleHandler_fnc_quadPFH; 74 | 75 | call derp_fnc_baseCleaning; 76 | call derp_fnc_cleaner; 77 | setTimeMultiplier ("DayDuration" call BIS_fnc_getParamValue); 78 | 79 | if ("ShortNights" call BIS_fnc_getParamValue == 1) then { 80 | call derp_fnc_shortNights; 81 | }; 82 | 83 | [ArsenalBoxes, ("ArsenalFilter" call BIS_fnc_getParamValue)] call derp_fnc_VA_filter; // Init arsenal boxes. 84 | -------------------------------------------------------------------------------- /onPlayerRespawn.sqf: -------------------------------------------------------------------------------- 1 | if (("staminaEnabled" call BIS_fnc_getParamValue) == 0) then { 2 | player enableStamina false; 3 | }; 4 | 5 | [[player], false] call derp_fnc_remoteAddCuratorEditableObjects; 6 | 7 | if !(player getVariable ["derp_revive_downed", false]) then { 8 | if (!isNil {player getVariable "derp_savedGear"}) then { 9 | player setUnitLoadout [(player getVariable "derp_savedGear"), true]; 10 | } else { 11 | if (!isNil {player getVariable "derp_revive_loadout"}) then { 12 | player setUnitLoadout [(player getVariable "derp_revive_loadout"), true]; 13 | }; 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /scripts/misc/groundService.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handler for the vehicle service pad (Ground) 4 | * 5 | * Arguments: 6 | * 0: Vehicle to be serviced 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_vehicle"]; 12 | 13 | if (_vehicle isKindOf "Car" || _vehicle isKindOf "Tank") then { 14 | 15 | _vehicle setFuel 0; 16 | _vehicle vehicleChat "Servicing started, this process should be finished in 45s"; 17 | 18 | //---------- RE-ARMING 19 | sleep 10; 20 | _vehicle vehicleChat "Re-arming ..."; 21 | 22 | //---------- REPAIRING 23 | sleep 10; 24 | _vehicle vehicleChat "Repairing ..."; 25 | 26 | //---------- REFUELING 27 | sleep 10; 28 | _vehicle vehicleChat "Refueling ..."; 29 | 30 | //---------- FINISHED 31 | sleep 10; 32 | _vehicle setDamage 0; 33 | _vehicle vehicleChat "Repaired (100%)."; 34 | 35 | _vehicle setVehicleAmmo 1; 36 | _vehicle vehicleChat "Re-armed (100%)."; 37 | 38 | _vehicle setFuel 1; 39 | _vehicle vehicleChat "Refuelled (100%)."; 40 | 41 | sleep 2; 42 | _vehicle vehicleChat "Service complete."; 43 | 44 | } else { 45 | _vehicle vehicleChat "This pad is for ground sevice only"; 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /scripts/misc/heloService.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handler for the vehicle service pad (Helos) 4 | * 5 | * Arguments: 6 | * 0: Vehicle to be serviced 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_vehicle"]; 12 | 13 | if (_vehicle isKindOf "Helicopter") then { 14 | 15 | _vehicle setFuel 0; 16 | _vehicle vehicleChat "Servicing started, this process should be finished in 45s"; 17 | 18 | //---------- RE-ARMING 19 | sleep 10; 20 | _vehicle vehicleChat "Re-arming ..."; 21 | 22 | //---------- REPAIRING 23 | sleep 10; 24 | _vehicle vehicleChat "Repairing ..."; 25 | 26 | //---------- REFUELING 27 | sleep 10; 28 | _vehicle vehicleChat "Refueling ..."; 29 | 30 | //---------- FINISHED 31 | sleep 10; 32 | 33 | _vehicle setDamage 0; 34 | _vehicle vehicleChat "Repaired (100%)."; 35 | 36 | _vehicle setVehicleAmmo 1; 37 | _vehicle vehicleChat "Re-armed (100%)."; 38 | 39 | _vehicle setFuel 1; 40 | _vehicle vehicleChat "Refuelled (100%)."; 41 | 42 | sleep 2; 43 | _vehicle vehicleChat "Service complete."; 44 | 45 | } else { 46 | _vehicle vehicleChat "This pad is for helicopter sevice only"; 47 | 48 | }; 49 | -------------------------------------------------------------------------------- /scripts/misc/planeService.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handler for the vehicle service pad (Planes) 4 | * 5 | * Arguments: 6 | * 0: Vehicle to be serviced 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_vehicle"]; 12 | 13 | if (_vehicle isKindOf "Plane") then { 14 | 15 | _vehicle setFuel 0; 16 | _vehicle vehicleChat "Servicing started, this process should be finished in 5 minutes"; 17 | 18 | //---------- RE-ARMING 19 | sleep 100; 20 | _vehicle vehicleChat "Re-arming ..."; 21 | 22 | //---------- REPAIRING 23 | sleep 100; 24 | _vehicle vehicleChat "Repairing ..."; 25 | 26 | //---------- REFUELING 27 | sleep 100; 28 | _vehicle vehicleChat "Refueling ..."; 29 | 30 | //---------- FINISHED 31 | sleep 10; 32 | _vehicle setDamage 0; 33 | _vehicle vehicleChat "Repaired (100%)."; 34 | 35 | _vehicle setVehicleAmmo 1; 36 | _vehicle vehicleChat "Re-armed (100%)."; 37 | 38 | _vehicle setFuel 1; 39 | _vehicle vehicleChat "Refuelled (100%)."; 40 | 41 | sleep 2; 42 | _vehicle vehicleChat "Service complete."; 43 | 44 | } else { 45 | _vehicle vehicleChat "This pad is for plane sevice only"; 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /scripts/misc/uavService.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: alganthe 3 | * Handler for the vehicle service pad (UAVs) 4 | * 5 | * Arguments: 6 | * 0: Vehicle to be serviced 7 | * 8 | * Return Value: 9 | * Nothing 10 | */ 11 | params ["_vehicle"]; 12 | 13 | if (_vehicle isKindOf "UAV") then { 14 | 15 | _vehicle setFuel 0; 16 | _vehicle vehicleChat "Servicing started, this process should be finished in 45s"; 17 | 18 | //---------- RE-ARMING 19 | sleep 10; 20 | _vehicle vehicleChat "Re-arming ..."; 21 | 22 | //---------- REPAIRING 23 | sleep 10; 24 | _vehicle vehicleChat "Repairing ..."; 25 | 26 | //---------- REFUELING 27 | sleep 10; 28 | _vehicle vehicleChat "Refueling ..."; 29 | 30 | //---------- FINISHED 31 | sleep 10; 32 | _vehicle setDamage 0; 33 | _vehicle vehicleChat "Repaired (100%)."; 34 | 35 | _vehicle setVehicleAmmo 1; 36 | _vehicle vehicleChat "Re-armed (100%)."; 37 | 38 | _vehicle setFuel 1; 39 | _vehicle vehicleChat "Refuelled (100%)."; 40 | 41 | sleep 2; 42 | _vehicle vehicleChat "Service complete."; 43 | 44 | } else { 45 | _vehicle vehicleChat "This pad is for uav sevice only"; 46 | 47 | }; 48 | --------------------------------------------------------------------------------