├── .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