From 86287dc31da72b4ef005dc759c0ae3e02af38781 Mon Sep 17 00:00:00 2001 From: Ultranoobian Date: Sat, 30 Dec 2017 10:43:55 +1000 Subject: [PATCH 01/27] Partially added new function to generate support menus 'dynamic_menu.sqf' checks against purchased supports, creates and updates global menus --- source/dynamic_menu.sqf | 82 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 source/dynamic_menu.sqf diff --git a/source/dynamic_menu.sqf b/source/dynamic_menu.sqf new file mode 100644 index 0000000..e1caf5f --- /dev/null +++ b/source/dynamic_menu.sqf @@ -0,0 +1,82 @@ + /** +* Dynamically (re)create the support menus +* +* Generates and updates the Support menus so that they can be displayed by +* +* Params: None. +* +* Return: None. +*/ + +// MY_SUBMENU_inCommunication = +// [ +// ["User submenu",true], +// ["Option-1", [2], "", -5, [["expression", "player sidechat ""-1"" "]], "0", "0", "\ca\ui\data\cursor_support_ca"], +// ["Option 0", [3], "", -5, [["expression", "player sidechat "" 0"" "]], "1", "0", "\ca\ui\data\cursor_support_ca"], +// ["Option 1", [4], "", -5, [["expression", "player sidechat "" 1"" "]], "1", "CursorOnGround", "\ca\ui\data\cursor_support_ca"] +// ]; + +_itemsCount = 0; +_offensiveItems = []; +_logisticsItems = []; +_transportItems = []; + +_Ucode = "dyn_menu = [[""User menu"",false],"; + + +if(support_mortar_available) then { + _text = "[""Mortar"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _offensiveItems pushBack _text; +} else { + // code is same as above, BUT 'isActive' is false. + _text = "[""Mortar"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _offensiveItems pushBack _text; +}; + +if(support_arty_available) then { + _text = "[""Artillery"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _offensiveItems pushBack _text; +} else { + _text = "[""Artillery"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _offensiveItems pushBack _text; +}; + +if(support_cluster_available) then { + _text = "[""Cluster Bomb"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _offensiveItems pushBack _text; +} else { + _text = "[""Cluster Bomb"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _offensiveItems pushBack _text; +}; + +if(support_jdam_available) then { + _text = "[""JDAM"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _offensiveItems pushBack _text; +} else { + _text = "[""JDAM"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _offensiveItems pushBack _text; +}; + +_finalString = "offensive_SubMenu = [[""Offensive Supports"",true],"; +_finalString += _offensiveItems joinString ","; + +diag_log format ["DUWS-R: Compiling this string (%1)",_finalString]; +_myCode = call compile _finalString; + +// if(support_supplydrop_available) then { +// } +// support_paradrop_available = false; +// support_pFLIR_available = false; +// support_uav_recon_available = false; +// support_veh_refit_available = false; + +// support_helotaxi_available = false; +// support_boattaxi_available = false; + +if(count _itemsCount > 0) then { + //_Ucode = + //call compile _Ucode; + //showCommandingMenu "#USER:MY_MENU_inCommunication"; +} else { + player commandChat "No support items available at this time!"; +} \ No newline at end of file From 0d34aaf312b5843e24bd90bf8904a327301c95c3 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Thu, 4 Jan 2018 18:29:20 +1100 Subject: [PATCH 02/27] Populated dynamic_menu script with all menus and functions Populated root menu, submenus (offensive, logistics and transports), with both active and inactive menu types. Included proper function triggering for each support. --- source/INIT.sqf | 3 + source/dynamic_menu.sqf | 171 ++++++++++++++++++++++++++++++---------- 2 files changed, 131 insertions(+), 43 deletions(-) diff --git a/source/INIT.sqf b/source/INIT.sqf index 09546c1..e9603fb 100644 --- a/source/INIT.sqf +++ b/source/INIT.sqf @@ -280,6 +280,9 @@ for[{_x = 2},{_x <= 20},{_x = _x + 1}] do { }; }; +//DEBUG - REMOVE BEFORE MERGING +player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; + //Loading player position and gear. //TODO: Add bought supports. /* diff --git a/source/dynamic_menu.sqf b/source/dynamic_menu.sqf index e1caf5f..b522faa 100644 --- a/source/dynamic_menu.sqf +++ b/source/dynamic_menu.sqf @@ -1,82 +1,167 @@ - /** -* Dynamically (re)create the support menus -* -* Generates and updates the Support menus so that they can be displayed by -* -* Params: None. -* -* Return: None. -*/ +/* + Author: UltraNoobian (Brenden Cai) + + Description: + Dynamically generate and update the Support menus, then display the root menu. + + Parameter(s): + None. -// MY_SUBMENU_inCommunication = -// [ -// ["User submenu",true], -// ["Option-1", [2], "", -5, [["expression", "player sidechat ""-1"" "]], "0", "0", "\ca\ui\data\cursor_support_ca"], -// ["Option 0", [3], "", -5, [["expression", "player sidechat "" 0"" "]], "1", "0", "\ca\ui\data\cursor_support_ca"], -// ["Option 1", [4], "", -5, [["expression", "player sidechat "" 1"" "]], "1", "CursorOnGround", "\ca\ui\data\cursor_support_ca"] -// ]; + Usage: + [] call "dynamic_menu.sqf"; + + Returns: + - Nil - +*/ +menuItemFormatter = { + format [ + "[""%1"", [0], """", -5, [[""expression"", ""%2""]], ""1"", ""%3""]", + _this select 0, + _this select 1, + _this select 2 + ]; +}; _itemsCount = 0; _offensiveItems = []; _logisticsItems = []; _transportItems = []; -_Ucode = "dyn_menu = [[""User menu"",false],"; +// Critical note: If you use escape quotes as part of your params to menuItemFormatter, +// You must double-escape those quotes +// eg. "Hello ""mate""" -> "Hello """"mate""""" +// eg. 'Hello "mate"' -> "Hello ""mate""' +//Offensive Submenu checks if(support_mortar_available) then { - _text = "[""Mortar"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _text = ["Mortar (2 CP)", '_null = [8, 50, 5, 3, 2, 2, ""grenade""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - // code is same as above, BUT 'isActive' is false. - _text = "[""Mortar"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _text = ["Mortar (N/A)", "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; if(support_arty_available) then { - _text = "[""Artillery"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _text = ["Artillery Strike (4 CP)", '_null = [6, 100, 8, 3, 1, 4, ""R_80mm_HE""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - _text = "[""Artillery"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _text = ["Artillery Strike (N/A)", "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; if(support_cluster_available) then { - _text = "[""Cluster Bomb"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _text = ["Cluster Bomb (6 CP)", '_null = [1, 250, 1, 90, 1, 6, ""grenade""] execVM ""support\cluster\mapclickcluster.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - _text = "[""Cluster Bomb"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _text = ["Cluster Bomb (N/A)", "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; if(support_jdam_available) then { - _text = "[""JDAM"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""1""]]"; + _text = ["JDAM Strike (1 CP)", '_null = [1, 2, 1, 1, 3, 1, ""Bo_Mk82""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - _text = "[""JDAM"", [0], """", -5, [[""expression"", ""player sidechat """"First"""" ""]], ""1"", ""0""]]"; + _text = ["JDAM (N/A)", "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; +// Compilaton and Call for Offensive SubMenu _finalString = "offensive_SubMenu = [[""Offensive Supports"",true],"; -_finalString += _offensiveItems joinString ","; +_offensiveItemsClassString = _offensiveItems joinString ","; +_finalString = _finalString + _offensiveItemsClassString; +_finalString = _finalString + "];"; + +_myCode = compile _finalString; +call _myCode; -diag_log format ["DUWS-R: Compiling this string (%1)",_finalString]; -_myCode = call compile _finalString; -// if(support_supplydrop_available) then { -// } -// support_paradrop_available = false; -// support_pFLIR_available = false; -// support_uav_recon_available = false; -// support_veh_refit_available = false; +//Logistics Submenu Checks +if(support_supplydrop_available) then { + _text = ["Supply Drop (2 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _logisticsItems pushBack _text; +} else { + _text = ["Supply Drop ((N/A)", '', 0] call menuItemFormatter; + _logisticsItems pushBack _text; +}; -// support_helotaxi_available = false; -// support_boattaxi_available = false; +if(support_paradrop_available) then { + _text = ["Airborne troops (25 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _logisticsItems pushBack _text; +} else { + _text = ["Airborne troops (N/A)", '', 0] call menuItemFormatter; + _logisticsItems pushBack _text; +}; + +if(support_pFLIR_available) then { + _text = ["Supply Drop (2 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _logisticsItems pushBack _text; +} else { + _text = ["Supply Drop (N/A)", '', 0] call menuItemFormatter; + _logisticsItems pushBack _text; +}; + +if(support_uav_recon_available) then { + _text = ["UAV Recon (3 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _logisticsItems pushBack _text; +} else { + _text = ["UAV Recon (N/A)", '', 0] call menuItemFormatter; + _logisticsItems pushBack _text; +}; -if(count _itemsCount > 0) then { - //_Ucode = - //call compile _Ucode; - //showCommandingMenu "#USER:MY_MENU_inCommunication"; +if(support_veh_refit_available) then { + _text = ["Vehicle Refit (2 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _logisticsItems pushBack _text; } else { - player commandChat "No support items available at this time!"; -} \ No newline at end of file + _text = ["Vehicle Refit (N/A)", '', 0] call menuItemFormatter; + _logisticsItems pushBack _text; +}; + + +// Compilaton and Call for Logistics SubMenu +_finalString = "logistic_SubMenu = [[""Logistical Supports"",true],"; +_logisticsItemsClassString = _logisticsItems joinString ","; +_finalString = _finalString + _logisticsItemsClassString; +_finalString = _finalString + "];"; + +_myCode = compile _finalString; +call _myCode; + +//Transport Submenu check +if(support_helotaxi_available) then { + _text = ["Helicopter taxi(1 CP)", '_nill = [getpos player,50] execVM ""support\taxi\helotaxi.sqf""', 1] call menuItemFormatter; + _transportItems pushBack _text; +} else { + _text = ["Helicopter taxi(N/A)", '', 0] call menuItemFormatter; + _transportItems pushBack _text; +}; + +if(support_boattaxi_available) then { + _text = ["Boat taxi (1 CP)", '_null = [getpos player,10] execVM ""support\taxi\boattaxi.sqf""', 1] call menuItemFormatter; + _transportItems pushBack _text; +} else { + _text = ["Boat taxi (N/A)", '', 0] call menuItemFormatter; + _transportItems pushBack _text; +}; + + +// Compilaton and Call for Transport SubMenu +_finalString = "transport_SubMenu = [[""Transport Supports"",true],"; +_transportItemsClassString = _transportItems joinString ","; +_finalString = _finalString + _transportItemsClassString; +_finalString = _finalString + "];"; + +_myCode = compile _finalString; +call _myCode; + + +//Construct and show Support Menu root +supportMenu = +[ + ["Support Menu",false], + ["Offensive", [2], "#USER:offensive_SubMenu", -5, [["expression", ""]], "1", "1"], + ["Logistics", [3], "#USER:logistic_SubMenu", -5, [["expression", ""]], "1", "1"], + ["Transport", [4], "#USER:transport_SubMenu", -5, [["expression", ""]], "1", "1"] +]; + +showCommandingMenu "#USER:supportMenu"; From 309271b584b098b2552100160ef16f2e09221b41 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 5 Jan 2018 13:43:38 +1100 Subject: [PATCH 03/27] Added code to add 'support menu' back on to player menu on respawn --- source/duws_revive/respawnClicked.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/duws_revive/respawnClicked.sqf b/source/duws_revive/respawnClicked.sqf index 8b9f40d..7ea13dc 100644 --- a/source/duws_revive/respawnClicked.sqf +++ b/source/duws_revive/respawnClicked.sqf @@ -10,4 +10,6 @@ if(!staminaEnabled) then { player enableStamina false; }; +player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; + closedialog 0; From 70fa5ce90ec48f4cbe0a1075c841d653754e2acd Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 12 Jan 2018 07:08:00 +1100 Subject: [PATCH 04/27] Added watchdog time variables for supports with delays Watchdog time variables will replace internal `sleep` commands to prevent spamming of 'timed' supports --- source/dialog/supports_init.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/dialog/supports_init.hpp b/source/dialog/supports_init.hpp index bd169ac..ca5919a 100644 --- a/source/dialog/supports_init.hpp +++ b/source/dialog/supports_init.hpp @@ -16,4 +16,19 @@ if (isNil "support_specialized_training_available") then { if (isNil "support_armory_available") then { support_armory_available = false; -}; \ No newline at end of file +}; + +/* + Support Timeout variables + Variables that hold the next VALID time to use that supports (in seconds) + Supports should set the next valid time as: + support_exampleSupport_timeout = *now* + xyz seconds; +*/ + +support_mortar_timeout = 0; +support_jdam_timeout = 0; +support_arty_timeout = 0; +support_cluster_timeout = 0; +support_uav_recon_timeout = 0; +//support_helotaxi_timeout = 0; format may not be suitable +//support_boattaxi_timeout = 0; From 3949002b48c5e361519aa569e4927d3ff837cb3a Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 12 Jan 2018 13:27:35 +1100 Subject: [PATCH 05/27] Removed code that added Comm Menu Items when purchasing supports --- source/dialog/request_support.sqf | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/source/dialog/request_support.sqf b/source/dialog/request_support.sqf index d6f7fa4..ffdf307 100644 --- a/source/dialog/request_support.sqf +++ b/source/dialog/request_support.sqf @@ -6,7 +6,6 @@ switch (_index2) do { if (!support_supplydrop_available) then { commandpointsblu1 = commandpointsblu1 - 5; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _supplydrop = [player,"ammo"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_supply, [0, 1, 0, 1]]; playSound "boots"; support_supplydrop_available = true; @@ -22,7 +21,6 @@ switch (_index2) do { if (!support_arty_available) then { commandpointsblu1 = commandpointsblu1 - 20; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _supplydrop = [player,"artillery"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_arty, [0, 1, 0, 1]]; playSound "boots"; support_arty_available = true; @@ -38,7 +36,6 @@ switch (_index2) do { if (!support_mortar_available) then { commandpointsblu1 = commandpointsblu1 - 10; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _supplydrop = [player,"mortar"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_mortar, [0, 1, 0, 1]]; playSound "boots"; support_mortar_available = true; @@ -54,7 +51,6 @@ switch (_index2) do { if (!support_paradrop_available) then { commandpointsblu1 = commandpointsblu1 - 20; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _supplydrop = [player,"paradrop"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_paradrop, [0, 1, 0, 1]]; playSound "boots"; support_paradrop_available = true; @@ -70,7 +66,6 @@ switch (_index2) do { if (!support_jdam_available) then { commandpointsblu1 = commandpointsblu1 - 15; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _supplydrop = [player,"jdam"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_jdam, [0, 1, 0, 1]]; playSound "boots"; support_jdam_available = true; @@ -125,7 +120,6 @@ switch (_index2) do { if (!support_uav_recon_available) then { commandpointsblu1 = commandpointsblu1 - 10; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _uav_recon = [player,"uav_recon"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_uavrecon, [0, 1, 0, 1]]; playSound "boots"; support_uav_recon_available = true; @@ -141,7 +135,6 @@ switch (_index2) do { if (!support_veh_refit_available) then { commandpointsblu1 = commandpointsblu1 - 3; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _veh_refit = [player,"vehicle_refit"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_refit, [0, 1, 0, 1]]; playSound "loadgun"; support_veh_refit_available = true; @@ -157,7 +150,6 @@ switch (_index2) do { if (!support_helotaxi_available) then { commandpointsblu1 = commandpointsblu1 - 3; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _veh_refit = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_helotaxi, [0, 1, 0, 1]]; playSound "boots"; support_helotaxi_available = true; @@ -173,7 +165,6 @@ switch (_index2) do { if (!support_cluster_available) then { commandpointsblu1 = commandpointsblu1 - 25; ctrlSetText [1000, format["%1",commandpointsblu1]]; - _cluster = [player1,"cluster"] call BIS_fnc_addCommMenuItem; lbSetColor [2103, index_support_cluster, [0, 1, 0, 1]]; playSound "boots"; support_cluster_available = true; @@ -210,7 +201,6 @@ switch (_index2) do { ctrlSetText [1000, format["%1",commandpointsblu1]]; lbSetColor [2103, index_support_boattaxi, [0, 1, 0, 1]]; support_boattaxi_available = true; - _supplydrop = [player,"boat_taxi"] call BIS_fnc_addCommMenuItem; playSound "boots"; } else { hint "This support is already available"; From c0e42f64e3f470419936c9724bae9a65200abea3 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Thu, 18 Jan 2018 16:34:26 +1100 Subject: [PATCH 06/27] Added documentation and cleaned up comments in /cluster/* --- source/support/cluster/cluster.sqf | 38 ++++++------ source/support/cluster/mapclickcluster.sqf | 67 +++++++++++++--------- 2 files changed, 58 insertions(+), 47 deletions(-) diff --git a/source/support/cluster/cluster.sqf b/source/support/cluster/cluster.sqf index 55fa35a..9289204 100644 --- a/source/support/cluster/cluster.sqf +++ b/source/support/cluster/cluster.sqf @@ -1,23 +1,28 @@ +/* + File: cluster.sqf -// R_60mm_HE / R_80mm_HE /Bo_Air_LGB(no sounds)/ Grenade / Bo_Mk82 -// -// _null = [1, 250, 1, 90, 1, 5, "grenade"] execVM "support\cluster\mapclickcluster.sqf" -// + Author: Kibot -_position = _this select 0; -_salvos = _this select 1; -_radius = _this select 2; -_interval = _this select 3; -_rps = _this select 4; -_supportype = _this select 5; // 1 = arty, 2 = mortar, 3 = jdam -_cost = _this select 6; -_ammotype = _this select 7; + Description: + Deploy a cluster of munitions at the specified location. + Parameter(s): + _this select 0 - POSITION - Center position of 'Strike Area' + _this select 1 - NUMBER - Number of ordinance salvos + _this select 2 - NUMBER - Radius of 'Strike Area' + _this select 3 - NUMBER - Interval between salvos (in seconds) + _this select 4 - NUMBER - Number of ordinance rounds per salvo + _this select 5 - NUMBER - Support type enumerator (1 - Artillery, 2 - Mortar Shell, 3 - JDAM) + _this select 6 - NUMBER - Cost of Support type + _this select 7 - STRING - Ammo type used for salvos + Returns: + - Nil - +*/ -_rpsinit = _rps; +params["_position", "_salvos", "_radius", "_interval", "_rps", "_supportype", "_cost", "_ammotype"]; -//hint format["Position: %1\nSalvos:%2\nRadius:%3\nInterval:%4\nRPS:%5\nSupport type:%6\nCost:%7\nAmmo type:%8", _position, _salvos, _radius, _interval, _rps,_supportype,_cost,_ammotype]; +_rpsinit = _rps; commandpointsblu1 = commandpointsblu1 - _cost; publicVariable "commandpointsblu1"; @@ -26,7 +31,6 @@ hint "Coordinates received !"; // create marker on target _markername = format["clus%1%2",_position]; // Define marker name -//hint _markername; _markerstr = createMarker [str(_markername), _position]; _markerstr setMarkerShape "ELLIPSE"; str(_markername) setMarkerColor "ColorGrey"; @@ -40,8 +44,6 @@ _trg5 setTriggerActivation["ANY","PRESENT",true]; _trg5 setTriggerStatements["this","", ""]; - - // create unit for comms _group = createGroup west; _unit = _group createUnit ["B_Soldier_SL_F", [0,0,0], [], 0, "FORM"]; @@ -61,8 +63,6 @@ _unit sidechat format["CBUs released, splash in 20 seconds."]; sleep 20; - - // NUMBER OF SALVOS while {_salvos>0} do { _rps = _rpsinit; // reset number of remaining rounds for next salvo diff --git a/source/support/cluster/mapclickcluster.sqf b/source/support/cluster/mapclickcluster.sqf index e4763f2..3b72b22 100644 --- a/source/support/cluster/mapclickcluster.sqf +++ b/source/support/cluster/mapclickcluster.sqf @@ -1,52 +1,63 @@ -// _null = [salvos, radius, interval between salvos(in seconds), shots per salvo, support type, CP cost, ammotype] execVM "support\arty.sqf" -// AMMO TYPES: R_60mm_HE / R_80mm_HE /Bo_Air_LGB(no sounds)/ Grenade / Bo_Mk82 -// SUPPORT TYPE: 1 = arty, 2 = mortar, 3 = jdam +/* + File: mapclickcluster.sqf -_salvos = _this select 0; -_radius = _this select 1; -_interval = _this select 2; -_rps = _this select 3; -_supportype = _this select 4; // 1 = arty, 2 = mortar, 3 = jdam -_cost = _this select 5; -_ammotype = _this select 6; + Author: Kibot + Description: + Wrapper script for cluster.sqf, provides guard against lack of CP points, waits for player to mark strike location + Parameter(s): + _this select 0 - NUMBER - Number of ordinance salvos + _this select 1 - NUMBER - Radius of 'Strike Area' + _this select 2 - NUMBER - Interval between salvos (in seconds) + _this select 3 - NUMBER - Number of ordinance rounds per salvo + _this select 4 - NUMBER - Support type enumerator (1 - Artillery, 2 - Mortar Shell, 3 - JDAM) + _this select 5 - NUMBER - Cost of Support type + _this select 6 - STRING - Ammo type used for salvos + + Usage: + _null = [1, 250, 1, 90, 1, 6, 'grenade'] execVM 'support\cluster\mapclickcluster.sqf'; + + Returns: + - Nil - +*/ + +params["_salvos", "_radius", "_interval", "_rps", "_supportype", "_cost", "_ammotype"]; _timer = 60; clicked = false; // IF NOT ENOUGH PTS if (commandpointsblu1<_cost) exitWith { - ["info",["Support","You don't have enough command points"]] call bis_fnc_showNotification; - sleep 30; -if (_supportype==1) exitWith { -_art = [player1,"artillery"] call BIS_fnc_addCommMenuItem; -}; - -if (_supportype==2) exitWith { -_art = [player1,"mortar"] call BIS_fnc_addCommMenuItem; -}; - -if (_supportype==3) exitWith { -_art = [player1,"JDAM"] call BIS_fnc_addCommMenuItem; -}; + ["info",["Support","You don't have enough command points"]] call bis_fnc_showNotification; + sleep 30; + if (_supportype==1) exitWith { + _art = [player1,"artillery"] call BIS_fnc_addCommMenuItem; + }; + + if (_supportype==2) exitWith { + _art = [player1,"mortar"] call BIS_fnc_addCommMenuItem; + }; + + if (_supportype==3) exitWith { + _art = [player1,"JDAM"] call BIS_fnc_addCommMenuItem; + }; }; _pos = []; hint "Click on your map to give the coordinates or wait 60 seconds to cancel the strike"; OnMapSingleClick format["_null = [_pos,%2,%3,%4,%5,%6,%7,'%8'] execVM 'support\cluster\cluster.sqf';clicked=true;onMapSingleClick ''",_pos,_salvos,_radius,_interval,_rps,_supportype,_cost,_ammotype]; -//hint format["Position: %1\nSalvos:%2\nRadius:%3\nInterval:%4\nRPS:%5\nSupport type:%6\nCost:%7\nAmmo type:'%8'", _position, _salvos, _radius, _interval, _rps, _supportype, _cost, _ammotype]; // TIMER while {_timer>0 AND !clicked} do { - -_timer = _timer-1; // remove 1 to timer -sleep 1; + _timer = _timer-1; // remove 1 to timer + sleep 1; }; + // TIMER ELLAPSED OR CLICKED sleep 60; OnMapSingleClick ""; if (_supportype==1) exitWith { -_art = [player1,"cluster"] call BIS_fnc_addCommMenuItem; + _art = [player1,"cluster"] call BIS_fnc_addCommMenuItem; }; From 5ab34288e1756b0157e09074bf99c6fa442134c1 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Thu, 18 Jan 2018 21:33:46 +1100 Subject: [PATCH 07/27] Added documentation and small refactors to ammobox.sqf --- source/support/ammobox.sqf | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/source/support/ammobox.sqf b/source/support/ammobox.sqf index 0018fea..c7c2614 100644 --- a/source/support/ammobox.sqf +++ b/source/support/ammobox.sqf @@ -1,9 +1,26 @@ +/* + File: ammobox.sqf + + Author: Kibot + + Description: + Air-deploys a NATO ammobox with a parachute at a assigned location. + + Parameter(s): + _this select 0 - OBJECT - A non-nil object with a physical location. + + Usage: + _scriptHandle = [player] execVM 'ammobox.sqf'; + + Returns: + - Nil - +*/ + _target = _this select 0; _location = getpos _target; -if (commandpointsblu1<2) exitWith -{ +if (commandpointsblu1<2) exitWith { ["info",["Not enough command points","Not enough Command Points (2CP required)"]] call bis_fnc_showNotification; }; commandpointsblu1 = commandpointsblu1 - 2; @@ -11,9 +28,10 @@ publicVariable "commandpointsblu1"; hint "A supply crate has been dropped near your location"; +// Create the parachute _parachute = "Steerable_Parachute_F" CreateVehicle _location; _parachute setPos [_location select 0, _location select 1, (_location select 2)+100]; - +// Create the supply crate _ammo = "B_supplyCrate_F" CreateVehicle [_location select 0,_location select 1,(_location select 2)+50]; _ammo attachTo [_parachute,[0,0,0]]; @@ -34,10 +52,6 @@ _ammo addBackpackCargo ["B_AssaultPack_khk",10]; if (support_armory_available) then {[[_ammo,["Armory","bisArsenal.sqf",[], 0, false, false, "", "_this distance _target < 4"]],"addAction",true,true] call BIS_fnc_MP;}; - -// magazines[] = {"1Rnd_HE_Grenade_shell","UGL_FlareWhite_F","UGL_FlareGreen_F","UGL_FlareRed_F","UGL_FlareYellow_F","UGL_FlareCIR_F","1Rnd_Smoke_Grenade_shell","1Rnd_SmokeRed_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","1Rnd_SmokeYellow_Grenade_shell","1Rnd_SmokePurple_Grenade_shell","1Rnd_SmokeBlue_Grenade_shell","1Rnd_SmokeOrange_Grenade_shell","3Rnd_HE_Grenade_shell","3Rnd_UGL_FlareWhite_F","3Rnd_UGL_FlareGreen_F","3Rnd_UGL_FlareRed_F","3Rnd_UGL_FlareYellow_F","3Rnd_UGL_FlareCIR_F","3Rnd_Smoke_Grenade_shell","3Rnd_SmokeRed_Grenade_shell","3Rnd_SmokeGreen_Grenade_shell","3Rnd_SmokeYellow_Grenade_shell","3Rnd_SmokePurple_Grenade_shell","3Rnd_SmokeBlue_Grenade_shell","3Rnd_SmokeOrange_Grenade_shell"}; - - waitUntil {sleep 1; getpos _ammo select 2<0.2}; _smoke = "SmokeShellGreen" CreateVehicle (getpos _ammo); ["info",["Supply delivered","The supply crate has been marked with green smokes"]] call bis_fnc_showNotification; From c5024535b6af467ba6506cb17ce324ecbc48cda8 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Thu, 18 Jan 2018 22:14:27 +1100 Subject: [PATCH 08/27] Added documentation, small refactors and fixed formatting to arty.sqf --- source/support/arty.sqf | 55 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/source/support/arty.sqf b/source/support/arty.sqf index 5e01699..bb59a48 100644 --- a/source/support/arty.sqf +++ b/source/support/arty.sqf @@ -1,25 +1,30 @@ -// _null = [position,salvos, radius, interval between salvos, shots per salvo] execVM "support\arty.sqf" -// R_60mm_HE / R_80mm_HE /Bo_Air_LGB(no sounds)/ Grenade / Bo_Mk82 -// +/* + File: arty.sqf -_position = _this select 0; -_salvos = _this select 1; -_radius = _this select 2; -_interval = _this select 3; -_rps = _this select 4; -_supportype = _this select 5; // 1 = arty, 2 = mortar, 3 = jdam -_cost = _this select 6; -_ammotype = _this select 7; + Author: Kibot + Description: + Deploy a number of salvos of a + Parameter(s): + _this select 0 - POSITION - Center position of 'Strike Area' + _this select 1 - NUMBER - Number of ordinance salvos + _this select 2 - NUMBER - Radius of 'Strike Area' + _this select 3 - NUMBER - Interval between salvos (in seconds) + _this select 4 - NUMBER - Number of ordinance rounds per salvo + _this select 5 - NUMBER - Support type enumerator (1 - Artillery, 2 - Mortar Shell, 3 - JDAM) + _this select 6 - NUMBER - Cost of Support type + _this select 7 - STRING - Ammo type used for salvos -_rpsinit = _rps; - -hint "Coordinates received, splash in 30 seconds"; -//hint format["Position: %1\nSalvos:%2\nRadius:%3\nInterval:%4\nRPS:%5\nSupport type:%6\nCost:%7\nAmmo type:%8", _position, _salvos, _radius, _interval, _rps,_supportype,_cost,_ammotype]; + Returns: + - Nil - +*/ +params["_position", "_salvos", "_radius", "_interval", "_rps", "_supportype", "_cost", "_ammotype"]; +_rpsinit = _rps; +hint "Coordinates received, splash in 30 seconds"; commandpointsblu1 = commandpointsblu1 - _cost; publicVariable "commandpointsblu1"; @@ -28,17 +33,15 @@ sleep 30; // NUMBER OF SALVOS while {_salvos>0} do { -_rps = _rpsinit; // reset number of remaining rounds for next salvo - - -while {_rps>0} do { // FIRE SALVO -_bomb= _ammotype createVehicle [(_position select 0)+(random _radius)-(random _radius), (_position select 1)+(random _radius)-(random _radius), (_position select 2)]; //spawn shells -sleep ((random 20)/10); -_rps = _rps-1 // REMOVE 1 ROUND TO SALVO -}; - -_salvos = _salvos-1; // remove 1 salvo to counter -sleep _interval; + _rps = _rpsinit; // Reset number of rounds for next salvo + while {_rps>0} do { + _bomb = _ammotype createVehicle [(_position select 0)+(random _radius)-(random _radius), (_position select 1)+(random _radius)-(random _radius), (_position select 2)]; + sleep ((random 20)/10); + _rps = _rps - 1; + }; + + _salvos = _salvos-1; // remove 1 salvo to counter + sleep _interval; }; hint "Ordinance complete"; \ No newline at end of file From 4eb576ec70f69fd9aa910114f5d92c844c801f08 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Thu, 18 Jan 2018 23:01:20 +1100 Subject: [PATCH 09/27] Added documentation and small refactors to fob_ammobox.sqf --- source/support/fob_ammobox.sqf | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/source/support/fob_ammobox.sqf b/source/support/fob_ammobox.sqf index 564a195..33d49a6 100644 --- a/source/support/fob_ammobox.sqf +++ b/source/support/fob_ammobox.sqf @@ -1,19 +1,37 @@ -_target = _this select 0; +/* + File: fob_ammobox.sqf + + Author: Kibot + + Description: + Variant of ammobox.sqf with less spread in deployment. + Air-deploys a NATO ammobox with a parachute at a assigned location. + + Parameter(s): + _this select 0 - OBJECT - A non-nil object with a physical location. + Usage: + _scriptHandle = [player] execVM 'fob_ammobox.sqf'; + + Returns: + - Nil - +*/ + +_target = _this select 0; _location = getpos _target; -if (commandpointsblu1<2) exitWith -{ - ["info",["Not enough command points","Not enough Command Points (2CP required)"]] call bis_fnc_showNotification; +if (commandpointsblu1<2) exitWith { + ["info",["Not enough command points","Not enough Command Points (2CP required)"]] call bis_fnc_showNotification; }; commandpointsblu1 = commandpointsblu1 - 2; publicVariable "commandpointsblu1"; hint "A supply crate has been dropped near the FOB"; +// Create the parachute _parachute = "Steerable_Parachute_F" CreateVehicle _location; _parachute setPos [_location select 0, _location select 1, (_location select 2)+50]; - +// Create the supply crate _ammo = "B_supplyCrate_F" CreateVehicle [_location select 0,_location select 1,(_location select 2)+20]; _ammo attachTo [_parachute,[0,0,0]]; @@ -33,10 +51,7 @@ _ammo addMagazineCargo ["Chemlight_green", 70]; _ammo addBackpackCargo ["B_AssaultPack_khk",10]; if (support_armory_available) then {[[_ammo,["Armory","bisArsenal.sqf",[], 0, false, false, "", "_this distance _target < 4"]],"addAction",true,true] call BIS_fnc_MP;}; - -// magazines[] = {"1Rnd_HE_Grenade_shell","UGL_FlareWhite_F","UGL_FlareGreen_F","UGL_FlareRed_F","UGL_FlareYellow_F","UGL_FlareCIR_F","1Rnd_Smoke_Grenade_shell","1Rnd_SmokeRed_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","1Rnd_SmokeYellow_Grenade_shell","1Rnd_SmokePurple_Grenade_shell","1Rnd_SmokeBlue_Grenade_shell","1Rnd_SmokeOrange_Grenade_shell","3Rnd_HE_Grenade_shell","3Rnd_UGL_FlareWhite_F","3Rnd_UGL_FlareGreen_F","3Rnd_UGL_FlareRed_F","3Rnd_UGL_FlareYellow_F","3Rnd_UGL_FlareCIR_F","3Rnd_Smoke_Grenade_shell","3Rnd_SmokeRed_Grenade_shell","3Rnd_SmokeGreen_Grenade_shell","3Rnd_SmokeYellow_Grenade_shell","3Rnd_SmokePurple_Grenade_shell","3Rnd_SmokeBlue_Grenade_shell","3Rnd_SmokeOrange_Grenade_shell"}; - waitUntil {sleep 1; getpos _ammo select 2<0.2}; _smoke = "SmokeShellGreen" CreateVehicle (getpos _ammo); ["info",["Supply delivered","The supply crate has been marked with green smokes"]] call bis_fnc_showNotification; From 79f460ecd21b3731d8ad9d7fb1ad0a993c4297e9 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Thu, 18 Jan 2018 23:51:38 +1100 Subject: [PATCH 10/27] Added documentation and cleaned up format and comments for fob.sqf --- source/support/fob.sqf | 62 ++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/source/support/fob.sqf b/source/support/fob.sqf index 5fd815b..7acf937 100644 --- a/source/support/fob.sqf +++ b/source/support/fob.sqf @@ -1,14 +1,30 @@ +/* + File: fob.sqf + + Author: Kibot + + Description: + Searches for a position and setups up Forward Operating Base + + Parameter(s): + _this select 0 - OBJECT - A non-nil object with a physical location. + + Usage: + _scriptHandle = [player] execVM 'fob.sqf'; + + Returns: + - Nil - +*/ + _position = _this select 0; _size = _this select 1; if (commandpointsblu1 < 10) exitWith { - ["info",["Not enough command points","Not enough Command Points (10CP required)"]] call bis_fnc_showNotification; - sleep 15; - _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; + ["info",["Not enough command points","Not enough Command Points (10CP required)"]] call bis_fnc_showNotification; + sleep 15; + _art = [player,"fob_support"] call BIS_fnc_addCommMenuItem; }; -// REGARDE SI LA ZONE EST OK -Hint "Requesting a FOB..."; player sidechat "Requesting a FOB on my position..."; _trg=createTrigger["EmptyDetector",_position]; @@ -21,17 +37,20 @@ _amountOPFOR = count list _trg; deleteVehicle _trg; if (_amountOPFOR > 0) exitWith { -Hint "This position is not clear from enemies"; -PAPABEAR sidechat "Request denied. Enemies are too close to this position."; -sleep 15; - _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; + Hint "This position is not clear from enemies"; + PAPABEAR sidechat "Request denied. Enemies are too close to this position."; + sleep 15; + _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; }; -// try to find a pos, if no pos is found exit the script +// Attempt to find a safe position _foundPickupPos = [_position, 0,50,10,0,0.2,0,[],[[0,0],[0,0]]] call BIS_fnc_findSafePos; // find a valid pos -if (0 == _foundPickupPos select 0 && 0 == _foundPickupPos select 1) exitWith {hint "No valid FOB pos nearby\nTry to go near a flat, object free zone."; sleep 5; _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem;}; +if (0 == _foundPickupPos select 0 && 0 == _foundPickupPos select 1) exitWith { + hint "No valid FOB pos nearby\nTry to go near a flat, object free zone."; + sleep 5; + _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; +}; -// LA ZONE EST OK commandpointsblu1 = commandpointsblu1 - 10; publicVariable "commandpointsblu1"; @@ -49,18 +68,17 @@ str(_markername) setMarkerText format["FOB %1",_fobname]; str(_markername) setMarkerSize [2.5, 2.5]; - sleep 5; _fob = "Land_Cargo_HQ_V1_F" createVehicle _foundPickupPos; DUWS_fnc_fob = { - _this addaction ["Player stats","dialog\info\info.sqf", "", 0, true, true, "", "_this == player"]; - _this addaction ["Request ammobox drop(2CP)","support\fob_ammobox.sqf", "", 0, true, true, "", "_this == player"]; - _this addaction ["Squad manager","dialog\squad\squadmng.sqf", "", 0, true, true, "", "_this == player"]; - _this addaction ["FOB manager","dialog\fob\FOBmanageropen.sqf", "", 0, true, true, "", "_this == player"]; - if (support_armory_available) then { + _this addaction ["Player stats","dialog\info\info.sqf", "", 0, true, true, "", "_this == player"]; + _this addaction ["Request ammobox drop(2CP)","support\fob_ammobox.sqf", "", 0, true, true, "", "_this == player"]; + _this addaction ["Squad manager","dialog\squad\squadmng.sqf", "", 0, true, true, "", "_this == player"]; + _this addaction ["FOB manager","dialog\fob\FOBmanageropen.sqf", "", 0, true, true, "", "_this == player"]; + if (support_armory_available) then { _this addaction ["Armory (VA)","bisArsenal.sqf", "", 0, true, true, "", "_this == player"]; }; if (isServer) then { @@ -105,15 +123,7 @@ publicVariable "Array_of_FOBS"; Array_of_FOBname = Array_of_FOBname + [_fobname]; publicVariable "Array_of_FOBname"; - - -sleep 1; - saveGame; -sleep 1; - sleep 600; _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; - -// Land_Cargo_HQ_V1_F From 31ac690b87131321af19d4c2223f9868e2906bda Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 00:09:21 +1100 Subject: [PATCH 11/27] Added Dynamic Menu class to support.hpp to allow it to be added directly to the comm menu --- source/support/support.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source/support/support.hpp b/source/support/support.hpp index 9850f6e..a5aa21e 100644 --- a/source/support/support.hpp +++ b/source/support/support.hpp @@ -1,5 +1,15 @@ class CfgCommunicationMenu { + class DynamicSupportMenu + { + text = "DUWS-R Support"; // Text displayed in the menu and in a notification + submenu = ""; // Submenu opened upon activation + expression = "_null = [] execVM 'dynamic_menu.sqf'"; // Code executed upon activation (ignored when the submenu is not empty) + icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa"; // Icon displayed permanently next to the command menu + cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"; // Custom cursor displayed when the item is selected + enable = "1"; // Simple expression condition for enabling the item + removeAfterExpressionCall = 0; // 1 to remove the item after calling + }; class artillery { text = "Artillery Strike (4 CP)"; // Text displayed in the menu and in a notification @@ -120,7 +130,4 @@ class CfgCommunicationMenu enable = "1"; // Simple expression condition for enabling the item removeAfterExpressionCall = 1; // 1 to remove the item after calling }; -}; - - - +}; From 1290a08d0946da952cb948092e85526eefb01da3 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 00:25:25 +1100 Subject: [PATCH 12/27] Added numbering to menu items in dynamic support submenus --- source/dynamic_menu.sqf | 49 +++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/source/dynamic_menu.sqf b/source/dynamic_menu.sqf index b522faa..8101719 100644 --- a/source/dynamic_menu.sqf +++ b/source/dynamic_menu.sqf @@ -15,10 +15,11 @@ */ menuItemFormatter = { format [ - "[""%1"", [0], """", -5, [[""expression"", ""%2""]], ""1"", ""%3""]", + "[""%1"", [%2], """", -5, [[""expression"", ""%3""]], ""1"", ""%4""]", _this select 0, _this select 1, - _this select 2 + _this select 2, + _this select 3 ]; }; @@ -35,34 +36,34 @@ _transportItems = []; //Offensive Submenu checks if(support_mortar_available) then { - _text = ["Mortar (2 CP)", '_null = [8, 50, 5, 3, 2, 2, ""grenade""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; + _text = ["Mortar (2 CP)", 2, '_null = [8, 50, 5, 3, 2, 2, ""grenade""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - _text = ["Mortar (N/A)", "", 0] call menuItemFormatter; + _text = ["Mortar (N/A)", 2, "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; if(support_arty_available) then { - _text = ["Artillery Strike (4 CP)", '_null = [6, 100, 8, 3, 1, 4, ""R_80mm_HE""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; + _text = ["Artillery Strike (4 CP)", 3, '_null = [6, 100, 8, 3, 1, 4, ""R_80mm_HE""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - _text = ["Artillery Strike (N/A)", "", 0] call menuItemFormatter; + _text = ["Artillery Strike (N/A)", 3, "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; if(support_cluster_available) then { - _text = ["Cluster Bomb (6 CP)", '_null = [1, 250, 1, 90, 1, 6, ""grenade""] execVM ""support\cluster\mapclickcluster.sqf""', 1] call menuItemFormatter; + _text = ["Cluster Bomb (6 CP)", 4, '_null = [1, 250, 1, 90, 1, 6, ""grenade""] execVM ""support\cluster\mapclickcluster.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - _text = ["Cluster Bomb (N/A)", "", 0] call menuItemFormatter; + _text = ["Cluster Bomb (N/A)", 4, "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; if(support_jdam_available) then { - _text = ["JDAM Strike (1 CP)", '_null = [1, 2, 1, 1, 3, 1, ""Bo_Mk82""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; + _text = ["JDAM Strike (1 CP)", 5, '_null = [1, 2, 1, 1, 3, 1, ""Bo_Mk82""] execVM ""support\mapclickarty.sqf""', 1] call menuItemFormatter; _offensiveItems pushBack _text; } else { - _text = ["JDAM (N/A)", "", 0] call menuItemFormatter; + _text = ["JDAM (N/A)", 5, "", 0] call menuItemFormatter; _offensiveItems pushBack _text; }; @@ -78,42 +79,42 @@ call _myCode; //Logistics Submenu Checks if(support_supplydrop_available) then { - _text = ["Supply Drop (2 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["Supply Drop (2 CP)", 2, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { - _text = ["Supply Drop ((N/A)", '', 0] call menuItemFormatter; + _text = ["Supply Drop ((N/A)", 2, '', 0] call menuItemFormatter; _logisticsItems pushBack _text; }; if(support_paradrop_available) then { - _text = ["Airborne troops (25 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["Airborne troops (25 CP)", 3, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { - _text = ["Airborne troops (N/A)", '', 0] call menuItemFormatter; + _text = ["Airborne troops (N/A)", 3, '', 0] call menuItemFormatter; _logisticsItems pushBack _text; }; if(support_pFLIR_available) then { - _text = ["Supply Drop (2 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["Supply Drop (2 CP)", 4, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { - _text = ["Supply Drop (N/A)", '', 0] call menuItemFormatter; + _text = ["Supply Drop (N/A)", 4, '', 0] call menuItemFormatter; _logisticsItems pushBack _text; }; if(support_uav_recon_available) then { - _text = ["UAV Recon (3 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["UAV Recon (3 CP)", 5, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { - _text = ["UAV Recon (N/A)", '', 0] call menuItemFormatter; + _text = ["UAV Recon (N/A)", 5, '', 0] call menuItemFormatter; _logisticsItems pushBack _text; }; if(support_veh_refit_available) then { - _text = ["Vehicle Refit (2 CP)", '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["Vehicle Refit (2 CP)", 6, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { - _text = ["Vehicle Refit (N/A)", '', 0] call menuItemFormatter; + _text = ["Vehicle Refit (N/A)", 6, '', 0] call menuItemFormatter; _logisticsItems pushBack _text; }; @@ -129,18 +130,18 @@ call _myCode; //Transport Submenu check if(support_helotaxi_available) then { - _text = ["Helicopter taxi(1 CP)", '_nill = [getpos player,50] execVM ""support\taxi\helotaxi.sqf""', 1] call menuItemFormatter; + _text = ["Helicopter taxi(1 CP)", 2, '_nill = [getpos player,50] execVM ""support\taxi\helotaxi.sqf""', 1] call menuItemFormatter; _transportItems pushBack _text; } else { - _text = ["Helicopter taxi(N/A)", '', 0] call menuItemFormatter; + _text = ["Helicopter taxi(N/A)", 2, '', 0] call menuItemFormatter; _transportItems pushBack _text; }; if(support_boattaxi_available) then { - _text = ["Boat taxi (1 CP)", '_null = [getpos player,10] execVM ""support\taxi\boattaxi.sqf""', 1] call menuItemFormatter; + _text = ["Boat taxi (1 CP)", 3, '_null = [getpos player,10] execVM ""support\taxi\boattaxi.sqf""', 1] call menuItemFormatter; _transportItems pushBack _text; } else { - _text = ["Boat taxi (N/A)", '', 0] call menuItemFormatter; + _text = ["Boat taxi (N/A)", 3, '', 0] call menuItemFormatter; _transportItems pushBack _text; }; From e236ce1308846f80ce35f618b035009d6c3f21cb Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 01:17:06 +1100 Subject: [PATCH 13/27] Added/Fixed mission dialogue not working in FOB deployment Fixed mission dialogue such that if FOB cannot be deployed due to nearby enemies, dialogue will now be shown. Added extra mission dialogue to intuitively show how many enemies are remaining inside the deployment zone. --- source/support/fob.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/support/fob.sqf b/source/support/fob.sqf index 7acf937..2097eb3 100644 --- a/source/support/fob.sqf +++ b/source/support/fob.sqf @@ -38,9 +38,9 @@ deleteVehicle _trg; if (_amountOPFOR > 0) exitWith { Hint "This position is not clear from enemies"; - PAPABEAR sidechat "Request denied. Enemies are too close to this position."; + [west, "PAPA_BEAR"] sidechat format["Request denied. Enemies are too close to this position. We approximate %1 enemy unit(s) nearby!", _amountOPFOR]; sleep 15; - _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; + _art = [player,"fob_support"] call BIS_fnc_addCommMenuItem; }; // Attempt to find a safe position @@ -48,7 +48,7 @@ _foundPickupPos = [_position, 0,50,10,0,0.2,0,[],[[0,0],[0,0]]] call BIS_fnc_fin if (0 == _foundPickupPos select 0 && 0 == _foundPickupPos select 1) exitWith { hint "No valid FOB pos nearby\nTry to go near a flat, object free zone."; sleep 5; - _art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; + _art = [player,"fob_support"] call BIS_fnc_addCommMenuItem; }; @@ -126,4 +126,4 @@ publicVariable "Array_of_FOBname"; saveGame; sleep 600; -_art = [player1,"fob_support"] call BIS_fnc_addCommMenuItem; +_art = [player,"fob_support"] call BIS_fnc_addCommMenuItem; From accd40063a7213f1a465080a2e66ea9eb19629bd Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 01:34:38 +1100 Subject: [PATCH 14/27] Fixed other instances of incorrect parameters in mission dialogue Changed other instances of 'PAPABEAR sideChat ...' into proper format --- source/WARCOM/WARCOM_gps_marker.sqf | 2 +- source/initHQ/BluHQinit.sqf | 2 +- source/missions/stratmap.sqf | 2 +- source/serverinit.sqf | 1 - source/support/fob.sqf | 6 +++--- source/support/sitrep.sqf | 2 +- source/support/uav_map.sqf | 6 +++--- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/source/WARCOM/WARCOM_gps_marker.sqf b/source/WARCOM/WARCOM_gps_marker.sqf index 135a8ec..f63865c 100644 --- a/source/WARCOM/WARCOM_gps_marker.sqf +++ b/source/WARCOM/WARCOM_gps_marker.sqf @@ -22,7 +22,7 @@ WARCOM_marker_num = WARCOM_marker_num + 1; if (_units_alive<=0) exitWith { // IF ALL DEAD, EXIT. str(_markername) setMarkerColor "ColorRed"; str(_markername) setMarkerType "waypoint"; - PAPABEAR sidechat format["To all units, this is HQ, Task force %1 just got wiped out. Stay alert",_TFname]; + [west, "PAPA_BEAR"] sidechat format["To all units, this is HQ, Task force %1 just got wiped out. Stay alert",_TFname]; sleep 600; deleteMarker str(_markername); }; diff --git a/source/initHQ/BluHQinit.sqf b/source/initHQ/BluHQinit.sqf index 7323500..bbce22a 100644 --- a/source/initHQ/BluHQinit.sqf +++ b/source/initHQ/BluHQinit.sqf @@ -28,7 +28,7 @@ _trg5 setTriggerStatements["this", format["[""%1"",thislist] execvm 'enterlocati _trgWarning=createTrigger["EmptyDetector",_hqblu]; _trgWarning setTriggerArea[300,300,0,false]; _trgWarning setTriggerActivation["EAST","PRESENT",true]; -_trgWarning setTriggerStatements["this","PAPABEAR sidechat 'This is HQ, there are enemies near our main base!'", ""]; +_trgWarning setTriggerStatements["this","[west, ""PAPA_BEAR""] sidechat 'This is HQ, there are enemies near our main base!'", ""]; // CREATE THE OFFICER _group = createGroup west; diff --git a/source/missions/stratmap.sqf b/source/missions/stratmap.sqf index e6af46c..329b404 100644 --- a/source/missions/stratmap.sqf +++ b/source/missions/stratmap.sqf @@ -4,7 +4,7 @@ _allFound = false; _counter = 0; if (isnil ("Mission_timeout_request")) then {Mission_timeout_request = true;}; -if (!Mission_timeout_request) exitWith {PAPABEAR=[West,"HQ"]; PAPABEAR SideChat "We don't have any other missions for you right now.";}; +if (!Mission_timeout_request) exitWith {[west, "PAPA_BEAR"] SideChat "We don't have any other missions for you right now.";}; if (!((vehiclevarname player) in game_master)) exitWith {hint "Only the host can request side missions for now"}; startLoadingScreen ["Loading zones..."]; diff --git a/source/serverinit.sqf b/source/serverinit.sqf index 9b5aab8..37677a2 100644 --- a/source/serverinit.sqf +++ b/source/serverinit.sqf @@ -86,7 +86,6 @@ can_get_mission = true;publicVariable "can_get_mission"; failsafe_zones_not_found = false;publicVariable "failsafe_zones_not_found"; createcenter sideLogic; LogicGroup = createGroup SideLogic;publicVariable "LogicGroup"; -PAPABEAR=[West,"HQ"];publicVariable "PAPABEAR"; locator_hq_actived = false;publicVariable "locator_hq_actived"; op_zones_index = 0;publicVariable "op_zones_index"; clientisSync = false;publicVariable "clientisSync"; diff --git a/source/support/fob.sqf b/source/support/fob.sqf index 2097eb3..4f0cfeb 100644 --- a/source/support/fob.sqf +++ b/source/support/fob.sqf @@ -54,7 +54,7 @@ if (0 == _foundPickupPos select 0 && 0 == _foundPickupPos select 1) exitWith { commandpointsblu1 = commandpointsblu1 - 10; publicVariable "commandpointsblu1"; -PAPABEAR sidechat "Roger that, the FOB is being deployed..."; +[west, "PAPA_BEAR"] sidechat "Roger that, the FOB is being deployed..."; _fobname = [1] call compile preprocessFile "random_name.sqf"; // create marker on FOB @@ -96,7 +96,7 @@ _fob addaction ["Fortify FOB(4CP)","inithq\fortifyFOB.sqf [_foundPickupPos, _size] execvm "createpatrol.sqf"; [_foundPickupPos, _size] execvm "createpatrol.sqf"; -PAPABEAR sidechat "The FOB has been deployed."; +[west, "PAPA_BEAR"] sidechat "The FOB has been deployed."; _handle = [_foundPickupPos, _fob] execVM "initHQ\guardsFOB.sqf"; @@ -113,7 +113,7 @@ _trg23 setTriggerStatements["this", format["[""FOB %1"",thislist] execvm 'enterl _trgWarning=createTrigger["EmptyDetector",_foundPickupPos]; _trgWarning setTriggerArea[300,300,0,false]; _trgWarning setTriggerActivation["EAST","PRESENT",true]; -_trgWarning setTriggerStatements["this",format["PAPABEAR sidechat 'This is HQ, enemies have been reported around FOB %1'",_fobname], ""]; +_trgWarning setTriggerStatements["this",format["[west, ""PAPA_BEAR""] sidechat 'This is HQ, enemies have been reported around FOB %1'",_fobname], ""]; //ADD THE FOB TO Array_of_FOBS fobSwitch = true; // tell that this is the player who created the FOB (to avoid variableEventHandler to trigger) diff --git a/source/support/sitrep.sqf b/source/support/sitrep.sqf index 570f2f4..80d52aa 100644 --- a/source/support/sitrep.sqf +++ b/source/support/sitrep.sqf @@ -10,7 +10,7 @@ saveGame; sleep 0.5; ["sitrepinfo",["SITREP","The game has been saved"]] call bis_fnc_showNotification; - PAPABEAR sidechat format["SITREP received, we have %1 command points and our army power is at %2",commandpointsblu1,WARCOM_blufor_ap]; + [west, "PAPA_BEAR"] sidechat format["SITREP received, we have %1 command points and our army power is at %2",commandpointsblu1,WARCOM_blufor_ap]; sleep 1; [] execVM "misc\bottom_right_message.sqf"; }; diff --git a/source/support/uav_map.sqf b/source/support/uav_map.sqf index df7e05e..31f2665 100644 --- a/source/support/uav_map.sqf +++ b/source/support/uav_map.sqf @@ -14,11 +14,11 @@ str(_markername) setMarkerSize [_checkedRadius, _checkedRadius]; str(_markername) setMarkerAlpha 0.5; -PAPABEAR SideChat "The UAV has been sent at the designated coordinates, please standby for further intel."; +[west, "PAPA_BEAR"] SideChat "The UAV has been sent at the designated coordinates, please standby for further intel."; sleep 20; -PAPABEAR SideChat "Collecting data from the UAV..."; +[west, "PAPA_BEAR"] SideChat "Collecting data from the UAV..."; sleep 7; -PAPABEAR SideChat "We've sent the last known location of the enemy to your map. The UAV is returning to the base"; +[west, "PAPA_BEAR"] SideChat "We've sent the last known location of the enemy to your map. The UAV is returning to the base"; /////////////////// THIS PART IS EAST ///// From a8159431ce4b62c1f34832cdcee7a4ab46da20d3 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 01:52:24 +1100 Subject: [PATCH 15/27] Removed BIS_fnc_addCommMenuItem from Support when lacking enough CP --- source/support/cluster/mapclickcluster.sqf | 12 ------------ source/support/mapclickarty.sqf | 14 +------------- source/support/mapclickuav.sqf | 4 +--- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/source/support/cluster/mapclickcluster.sqf b/source/support/cluster/mapclickcluster.sqf index 3b72b22..3c01a5b 100644 --- a/source/support/cluster/mapclickcluster.sqf +++ b/source/support/cluster/mapclickcluster.sqf @@ -30,18 +30,6 @@ clicked = false; // IF NOT ENOUGH PTS if (commandpointsblu1<_cost) exitWith { ["info",["Support","You don't have enough command points"]] call bis_fnc_showNotification; - sleep 30; - if (_supportype==1) exitWith { - _art = [player1,"artillery"] call BIS_fnc_addCommMenuItem; - }; - - if (_supportype==2) exitWith { - _art = [player1,"mortar"] call BIS_fnc_addCommMenuItem; - }; - - if (_supportype==3) exitWith { - _art = [player1,"JDAM"] call BIS_fnc_addCommMenuItem; - }; }; _pos = []; diff --git a/source/support/mapclickarty.sqf b/source/support/mapclickarty.sqf index 4ec4903..3bb093e 100644 --- a/source/support/mapclickarty.sqf +++ b/source/support/mapclickarty.sqf @@ -17,19 +17,7 @@ clicked = false; // IF NOT ENOUGH PTS if (commandpointsblu1<_cost) exitWith { - ["info",["Support","You don't have enough command points"]] call bis_fnc_showNotification; - sleep 30; -if (_supportype==1) exitWith { -_art = [player1,"artillery"] call BIS_fnc_addCommMenuItem; -}; - -if (_supportype==2) exitWith { -_art = [player1,"mortar"] call BIS_fnc_addCommMenuItem; -}; - -if (_supportype==3) exitWith { -_art = [player1,"JDAM"] call BIS_fnc_addCommMenuItem; -}; + ["info",["Support","You don't have enough command points"]] call bis_fnc_showNotification; }; _pos = []; diff --git a/source/support/mapclickuav.sqf b/source/support/mapclickuav.sqf index e6346b6..a457cb6 100644 --- a/source/support/mapclickuav.sqf +++ b/source/support/mapclickuav.sqf @@ -3,9 +3,7 @@ clicked = false; // IF NOT ENOUGH PTS if (commandpointsblu1<3) exitWith { - ["info",["Not enough command points","Not enough Command Points (3CP required)"]] call bis_fnc_showNotification; - sleep 30; -_art = [player1,"uav_recon"] call BIS_fnc_addCommMenuItem; + ["info",["Not enough command points","Not enough Command Points (3CP required)"]] call bis_fnc_showNotification; }; hint "Click on your map to scan a location using the UAV"; From 7a72ee7e297760d291ab1ea8a0ec38129b859691 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 02:23:33 +1100 Subject: [PATCH 16/27] Removed UAV Recon support from being readded upon completion Replaced with timeout logic using global variable --- source/support/mapclickuav.sqf | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/source/support/mapclickuav.sqf b/source/support/mapclickuav.sqf index a457cb6..3b0d6ff 100644 --- a/source/support/mapclickuav.sqf +++ b/source/support/mapclickuav.sqf @@ -1,6 +1,11 @@ _timer = 60; clicked = false; +// Guard against calling UAV Recon too often +if(support_uav_rec_timeout > 0) exitWith { + ["info",["Support is on Cooldown","UAV Recon is on "]] call bis_fnc_showNotification; +}; + // IF NOT ENOUGH PTS if (commandpointsblu1<3) exitWith { ["info",["Not enough command points","Not enough Command Points (3CP required)"]] call bis_fnc_showNotification; @@ -15,7 +20,14 @@ while {_timer>0 AND !clicked} do { _timer = _timer-1; // remove 1 to timer sleep 1; }; -// TIMER ELLAPSED OR CLICKED -sleep 80; -_art = [player1,"uav_recon"] call BIS_fnc_addCommMenuItem; -OnMapSingleClick ""; \ No newline at end of file + +// TIMER ELAPSED OR CLICKED +OnMapSingleClick ""; + +// Tick down timeout guard +support_uav_rec_timeout = 80; +while {support_uav_rec_timeout > 0} do { + sleep 1; + support_uav_rec_timeout = support_uav_rec_timeout - 1; + publicVariable support_uav_rec_timeout; +}; \ No newline at end of file From c717ed02d54e0c8dc171622c9c94651bc8382f11 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 10:36:23 +1100 Subject: [PATCH 17/27] Fixed logistics supports all dropping ammoboxes instead of intended action --- source/dynamic_menu.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/dynamic_menu.sqf b/source/dynamic_menu.sqf index 8101719..2b311aa 100644 --- a/source/dynamic_menu.sqf +++ b/source/dynamic_menu.sqf @@ -87,7 +87,7 @@ if(support_supplydrop_available) then { }; if(support_paradrop_available) then { - _text = ["Airborne troops (25 CP)", 3, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["Airborne troops (25 CP)", 3, '_null = [player] execVM ""support\paradrop.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { _text = ["Airborne troops (N/A)", 3, '', 0] call menuItemFormatter; @@ -103,7 +103,7 @@ if(support_pFLIR_available) then { }; if(support_uav_recon_available) then { - _text = ["UAV Recon (3 CP)", 5, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["UAV Recon (3 CP)", 5, '_null = [player] execVM ""support\mapclickuav.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { _text = ["UAV Recon (N/A)", 5, '', 0] call menuItemFormatter; @@ -111,7 +111,7 @@ if(support_uav_recon_available) then { }; if(support_veh_refit_available) then { - _text = ["Vehicle Refit (2 CP)", 6, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _text = ["Vehicle Refit (2 CP)", 6, '_null = [player] execVM ""support\veh_refit.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { _text = ["Vehicle Refit (N/A)", 6, '', 0] call menuItemFormatter; From cbae623e119ddb1a16c7557eb445f64cbea68a06 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 11:25:29 +1100 Subject: [PATCH 18/27] Removed FLIR from dynamic menu FLIR is a user action rather than CommMenuItem --- source/dynamic_menu.sqf | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/source/dynamic_menu.sqf b/source/dynamic_menu.sqf index 2b311aa..18c30d0 100644 --- a/source/dynamic_menu.sqf +++ b/source/dynamic_menu.sqf @@ -94,27 +94,19 @@ if(support_paradrop_available) then { _logisticsItems pushBack _text; }; -if(support_pFLIR_available) then { - _text = ["Supply Drop (2 CP)", 4, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; - _logisticsItems pushBack _text; -} else { - _text = ["Supply Drop (N/A)", 4, '', 0] call menuItemFormatter; - _logisticsItems pushBack _text; -}; - if(support_uav_recon_available) then { - _text = ["UAV Recon (3 CP)", 5, '_null = [player] execVM ""support\mapclickuav.sqf""', 1] call menuItemFormatter; + _text = ["UAV Recon (3 CP)", 4, '_null = [player] execVM ""support\mapclickuav.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { - _text = ["UAV Recon (N/A)", 5, '', 0] call menuItemFormatter; + _text = ["UAV Recon (N/A)", 4, '', 0] call menuItemFormatter; _logisticsItems pushBack _text; }; if(support_veh_refit_available) then { - _text = ["Vehicle Refit (2 CP)", 6, '_null = [player] execVM ""support\veh_refit.sqf""', 1] call menuItemFormatter; + _text = ["Vehicle Refit (2 CP)", 5, '_null = [player] execVM ""support\veh_refit.sqf""', 1] call menuItemFormatter; _logisticsItems pushBack _text; } else { - _text = ["Vehicle Refit (N/A)", 6, '', 0] call menuItemFormatter; + _text = ["Vehicle Refit (N/A)", 5, '', 0] call menuItemFormatter; _logisticsItems pushBack _text; }; From c3b2dd2944009d64a783a0dc07b7197da04d6fc5 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 11:37:19 +1100 Subject: [PATCH 19/27] Fixed UAV Recon timeout stopping script from continuing Changed mistyped variable name --- source/support/mapclickuav.sqf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/support/mapclickuav.sqf b/source/support/mapclickuav.sqf index 3b0d6ff..a855dac 100644 --- a/source/support/mapclickuav.sqf +++ b/source/support/mapclickuav.sqf @@ -2,8 +2,8 @@ _timer = 60; clicked = false; // Guard against calling UAV Recon too often -if(support_uav_rec_timeout > 0) exitWith { - ["info",["Support is on Cooldown","UAV Recon is on "]] call bis_fnc_showNotification; +if(support_uav_recon_timeout > 0) exitWith { + ["info",["Support is on Cooldown",format ["UAV Recon will be ready in %1 seconds", support_uav_recon_timeout]]] call bis_fnc_showNotification; }; // IF NOT ENOUGH PTS @@ -25,9 +25,9 @@ sleep 1; OnMapSingleClick ""; // Tick down timeout guard -support_uav_rec_timeout = 80; -while {support_uav_rec_timeout > 0} do { +support_uav_recon_timeout = 80; +while {support_uav_recon_timeout > 0} do { sleep 1; - support_uav_rec_timeout = support_uav_rec_timeout - 1; - publicVariable support_uav_rec_timeout; + support_uav_recon_timeout = support_uav_recon_timeout - 1; + publicVariable "support_uav_recon_timeout"; }; \ No newline at end of file From 152fc35ae4733672e7e3939af1f43bfc4c34b47f Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 13:24:38 +1100 Subject: [PATCH 20/27] Modified mapclickarty.sqf with new support timeout system Added documentation and cleaned up code-style Made small refactors and optimizations to code flow Included new guard and countdown for prevention of artillery spam --- source/support/mapclickarty.sqf | 87 +++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 27 deletions(-) diff --git a/source/support/mapclickarty.sqf b/source/support/mapclickarty.sqf index 3bb093e..b8a5435 100644 --- a/source/support/mapclickarty.sqf +++ b/source/support/mapclickarty.sqf @@ -1,48 +1,81 @@ -// _null = [salvos, radius, interval between salvos(in seconds), shots per salvo, support type, CP cost, ammotype] execVM "support\arty.sqf" -// AMMO TYPES: R_60mm_HE / R_80mm_HE /Bo_Air_LGB(no sounds)/ Grenade / Bo_Mk82 -// SUPPORT TYPE: 1 = arty, 2 = mortar, 3 = jdam +/* + File: mapclickarty.sqf -_salvos = _this select 0; -_radius = _this select 1; -_interval = _this select 2; -_rps = _this select 3; -_supportype = _this select 4; // 1 = arty, 2 = mortar, 3 = jdam -_cost = _this select 5; -_ammotype = _this select 6; + Author: Kibot + Description: + Guards and determines the position of a strike, based on location provided by the player, for arty.sqf + Parameter(s): + _this select 0 - NUMBER - Number of ordinance salvos + _this select 1 - NUMBER - Radius of 'Strike Area' + _this select 2 - NUMBER - Interval between salvos (in seconds) + _this select 3 - NUMBER - Number of ordinance rounds per salvo + _this select 4 - NUMBER - Support type enumerator (1 - Artillery, 2 - Mortar Shell, 3 - JDAM) + _this select 6 - NUMBER - Cost of Support type + _this select 7 - STRING - Ammo type used for salvos + Returns: + - Nil - +*/ + +params["_salvos", "_radius", "_interval", "_rps", "_supportype", "_cost", "_ammotype"]; _timer = 60; +_pos = []; clicked = false; +// Guard against calling UAV Recon too often +if (_supportype == 1 && {support_arty_timeout > 0}) exitWith { + ["info",["Support is on Cooldown",format ["Artillery will be ready to fire again in %1 seconds", support_arty_timeout]]] call bis_fnc_showNotification; +}; +if (_supportype == 2 && {support_mortar_timeout > 0}) exitWith { + ["info",["Support is on Cooldown",format ["Mortar team will be ready again in %1 seconds", support_mortar_timeout]]] call bis_fnc_showNotification; +}; +if (_supportype == 3 && {support_jdam_timeout > 0}) exitWith { + ["info",["Support is on Cooldown",format ["JDAM drop will be ready again in %1 seconds", support_jdam_timeout]]] call bis_fnc_showNotification; +}; + // IF NOT ENOUGH PTS if (commandpointsblu1<_cost) exitWith { ["info",["Support","You don't have enough command points"]] call bis_fnc_showNotification; }; -_pos = []; hint "Click on your map to give the coordinates or wait 60 seconds to cancel the strike"; OnMapSingleClick format["_null = [_pos,%2,%3,%4,%5,%6,%7,'%8'] execVM 'support\arty.sqf';clicked=true;onMapSingleClick ''",_pos,_salvos,_radius,_interval,_rps,_supportype,_cost,_ammotype]; -//hint format["Position: %1\nSalvos:%2\nRadius:%3\nInterval:%4\nRPS:%5\nSupport type:%6\nCost:%7\nAmmo type:'%8'", _position, _salvos, _radius, _interval, _rps, _supportype, _cost, _ammotype]; // TIMER -while {_timer>0 AND !clicked} do { - -_timer = _timer-1; // remove 1 to timer -sleep 1; +while {_timer > 0 AND !clicked} do { + _timer = _timer-1; // remove 1 to timer + sleep 1; }; + // TIMER ELLAPSED OR CLICKED -sleep 60; OnMapSingleClick ""; -if (_supportype==1) exitWith { -_art = [player1,"artillery"] call BIS_fnc_addCommMenuItem; -}; - -if (_supportype==2) exitWith { -_art = [player1,"mortar"] call BIS_fnc_addCommMenuItem; -}; - -if (_supportype==3) exitWith { -_art = [player1,"JDAM"] call BIS_fnc_addCommMenuItem; +// Tickdown timeout guards +switch(_supportype) do { + case 1: { + support_arty_timeout = 60; + while {support_arty_timeout > 0} do { + sleep 1; + support_arty_timeout = support_arty_timeout - 1; + publicVariable "support_arty_timeout"; + }; + }; + case 2: { + support_mortar_timeout = 60; + while {support_mortar_timeout > 0} do { + sleep 1; + support_mortar_timeout = support_mortar_timeout - 1; + publicVariable "support_mortar_timeout"; + }; + }; + case 3: { + support_jdam_timeout = 60; + while {support_jdam_timeout > 0} do { + sleep 1; + support_jdam_timeout = support_jdam_timeout - 1; + publicVariable "support_jdam_timeout"; + }; + }; }; \ No newline at end of file From cd7fad58b6a6baf908207b9f1b20fa19710f8a8e Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 13:34:49 +1100 Subject: [PATCH 21/27] Minor correction to documentation of mapclickarty.sqf --- source/support/mapclickarty.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/support/mapclickarty.sqf b/source/support/mapclickarty.sqf index b8a5435..f822c98 100644 --- a/source/support/mapclickarty.sqf +++ b/source/support/mapclickarty.sqf @@ -12,8 +12,8 @@ _this select 2 - NUMBER - Interval between salvos (in seconds) _this select 3 - NUMBER - Number of ordinance rounds per salvo _this select 4 - NUMBER - Support type enumerator (1 - Artillery, 2 - Mortar Shell, 3 - JDAM) - _this select 6 - NUMBER - Cost of Support type - _this select 7 - STRING - Ammo type used for salvos + _this select 5 - NUMBER - Cost of Support type + _this select 6 - STRING - Ammo type used for salvos Returns: - Nil - @@ -24,7 +24,7 @@ _timer = 60; _pos = []; clicked = false; -// Guard against calling UAV Recon too often +// Guard against calling Artillery support too often if (_supportype == 1 && {support_arty_timeout > 0}) exitWith { ["info",["Support is on Cooldown",format ["Artillery will be ready to fire again in %1 seconds", support_arty_timeout]]] call bis_fnc_showNotification; }; From 22819ac81f65e3a8368114d57351773ccdff6e22 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 14:08:13 +1100 Subject: [PATCH 22/27] Modified mapclickcluster.sqf with new support timeout --- source/support/cluster/mapclickcluster.sqf | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/support/cluster/mapclickcluster.sqf b/source/support/cluster/mapclickcluster.sqf index 3c01a5b..00998c3 100644 --- a/source/support/cluster/mapclickcluster.sqf +++ b/source/support/cluster/mapclickcluster.sqf @@ -26,13 +26,18 @@ params["_salvos", "_radius", "_interval", "_rps", "_supportype", "_cost", "_ammo _timer = 60; clicked = false; +_pos = []; + +// Guard against calling cluster bombs too often +if(support_cluster_timeout > 0) exitWith { + ["info",["Support is on Cooldown",format ["Cluster Bomb drop will be ready again in %1 seconds", support_cluster_timeout]]] call bis_fnc_showNotification; +}; // IF NOT ENOUGH PTS if (commandpointsblu1<_cost) exitWith { ["info",["Support","You don't have enough command points"]] call bis_fnc_showNotification; }; -_pos = []; hint "Click on your map to give the coordinates or wait 60 seconds to cancel the strike"; OnMapSingleClick format["_null = [_pos,%2,%3,%4,%5,%6,%7,'%8'] execVM 'support\cluster\cluster.sqf';clicked=true;onMapSingleClick ''",_pos,_salvos,_radius,_interval,_rps,_supportype,_cost,_ammotype]; @@ -43,9 +48,12 @@ while {_timer>0 AND !clicked} do { }; // TIMER ELLAPSED OR CLICKED -sleep 60; OnMapSingleClick ""; -if (_supportype==1) exitWith { - _art = [player1,"cluster"] call BIS_fnc_addCommMenuItem; +// Tick down timeout guard +support_cluster_timeout = 180; +while {support_cluster_timeout > 0} do { + sleep 1; + support_cluster_timeout = support_cluster_timeout - 1; + publicVariable "support_cluster_timeout"; }; From 355d7da24acce41e98d16c02fb31eb1c32c2a752 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 14:09:19 +1100 Subject: [PATCH 23/27] Modified INIT to include both supportmenu and playermenu --- source/INIT.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/INIT.sqf b/source/INIT.sqf index e9603fb..9de304f 100644 --- a/source/INIT.sqf +++ b/source/INIT.sqf @@ -281,7 +281,9 @@ for[{_x = 2},{_x <= 20},{_x = _x + 1}] do { }; //DEBUG - REMOVE BEFORE MERGING -player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; +//Note the space between Dynamic Support Menu is the char (ALT+255) +player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; +_dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem; //Loading player position and gear. //TODO: Add bought supports. From 9e176499c062f675c3e029f04327510535a026f0 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Fri, 19 Jan 2018 14:10:34 +1100 Subject: [PATCH 24/27] Updated respawn event to handle the re-adding of both methods of accessing support menu --- source/duws_revive/respawnClicked.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/duws_revive/respawnClicked.sqf b/source/duws_revive/respawnClicked.sqf index 7ea13dc..fdecf1a 100644 --- a/source/duws_revive/respawnClicked.sqf +++ b/source/duws_revive/respawnClicked.sqf @@ -10,6 +10,7 @@ if(!staminaEnabled) then { player enableStamina false; }; -player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; +player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; +_dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem; closedialog 0; From 82ce8f528a0f5d3e3ed53d159c0dd679458a7390 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Sun, 18 Feb 2018 17:51:11 +1100 Subject: [PATCH 25/27] Removed access to dyanmic menu from player menu --- source/INIT.sqf | 4 +--- source/duws_revive/respawnClicked.sqf | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/source/INIT.sqf b/source/INIT.sqf index 9de304f..69e3fe8 100644 --- a/source/INIT.sqf +++ b/source/INIT.sqf @@ -280,9 +280,7 @@ for[{_x = 2},{_x <= 20},{_x = _x + 1}] do { }; }; -//DEBUG - REMOVE BEFORE MERGING -//Note the space between Dynamic Support Menu is the char (ALT+255) -player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; + _dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem; //Loading player position and gear. diff --git a/source/duws_revive/respawnClicked.sqf b/source/duws_revive/respawnClicked.sqf index fdecf1a..c640c58 100644 --- a/source/duws_revive/respawnClicked.sqf +++ b/source/duws_revive/respawnClicked.sqf @@ -10,7 +10,6 @@ if(!staminaEnabled) then { player enableStamina false; }; -player addAction ["Dynamic Support Menu", "dynamic_menu.sqf", [], 10, false, true]; _dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem; closedialog 0; From d0986f801fde4c72c50c902c41fcc32587b7ddac Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Sun, 18 Feb 2018 17:53:19 +1100 Subject: [PATCH 26/27] Added vscode to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1981390..b4708dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/* +.vscode/* DUWS-R.iml localDevDeploy.properties From 2ef6de6a70f846a14dc88dbcac0d60959de67e85 Mon Sep 17 00:00:00 2001 From: Brenden Cai Date: Tue, 20 Feb 2018 17:09:36 +1100 Subject: [PATCH 27/27] Fixed tab-space --- source/support/arty.sqf | 48 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/source/support/arty.sqf b/source/support/arty.sqf index bb59a48..379c3e3 100644 --- a/source/support/arty.sqf +++ b/source/support/arty.sqf @@ -1,23 +1,23 @@ /* - File: arty.sqf + File: arty.sqf - Author: Kibot + Author: Kibot - Description: - Deploy a number of salvos of a + Description: + Deploy a number of salvos of the supplied ammo type - Parameter(s): - _this select 0 - POSITION - Center position of 'Strike Area' - _this select 1 - NUMBER - Number of ordinance salvos - _this select 2 - NUMBER - Radius of 'Strike Area' - _this select 3 - NUMBER - Interval between salvos (in seconds) - _this select 4 - NUMBER - Number of ordinance rounds per salvo - _this select 5 - NUMBER - Support type enumerator (1 - Artillery, 2 - Mortar Shell, 3 - JDAM) - _this select 6 - NUMBER - Cost of Support type - _this select 7 - STRING - Ammo type used for salvos + Parameter(s): + _this select 0 - POSITION - Center position of 'Strike Area' + _this select 1 - NUMBER - Number of ordinance salvos + _this select 2 - NUMBER - Radius of 'Strike Area' + _this select 3 - NUMBER - Interval between salvos (in seconds) + _this select 4 - NUMBER - Number of ordinance rounds per salvo + _this select 5 - NUMBER - Support type enumerator (1 - Artillery, 2 - Mortar Shell, 3 - JDAM) + _this select 6 - NUMBER - Cost of Support type + _this select 7 - STRING - Ammo type used for salvos - Returns: - - Nil - + Returns: + - Nil - */ params["_position", "_salvos", "_radius", "_interval", "_rps", "_supportype", "_cost", "_ammotype"]; @@ -33,15 +33,15 @@ sleep 30; // NUMBER OF SALVOS while {_salvos>0} do { - _rps = _rpsinit; // Reset number of rounds for next salvo - while {_rps>0} do { - _bomb = _ammotype createVehicle [(_position select 0)+(random _radius)-(random _radius), (_position select 1)+(random _radius)-(random _radius), (_position select 2)]; - sleep ((random 20)/10); - _rps = _rps - 1; - }; - - _salvos = _salvos-1; // remove 1 salvo to counter - sleep _interval; + _rps = _rpsinit; // Reset number of rounds for next salvo + while {_rps>0} do { + _bomb = _ammotype createVehicle [(_position select 0)+(random _radius)-(random _radius), (_position select 1)+(random _radius)-(random _radius), (_position select 2)]; + sleep ((random 20)/10); + _rps = _rps - 1; + }; + + _salvos = _salvos-1; // remove 1 salvo to counter + sleep _interval; }; hint "Ordinance complete"; \ No newline at end of file