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 diff --git a/source/INIT.sqf b/source/INIT.sqf index 09546c1..69e3fe8 100644 --- a/source/INIT.sqf +++ b/source/INIT.sqf @@ -280,6 +280,9 @@ for[{_x = 2},{_x <= 20},{_x = _x + 1}] do { }; }; + +_dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem; + //Loading player position and gear. //TODO: Add bought supports. /* 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/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"; 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; diff --git a/source/duws_revive/respawnClicked.sqf b/source/duws_revive/respawnClicked.sqf index 8b9f40d..c640c58 100644 --- a/source/duws_revive/respawnClicked.sqf +++ b/source/duws_revive/respawnClicked.sqf @@ -10,4 +10,6 @@ if(!staminaEnabled) then { player enableStamina false; }; +_dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem; + closedialog 0; diff --git a/source/dynamic_menu.sqf b/source/dynamic_menu.sqf new file mode 100644 index 0000000..18c30d0 --- /dev/null +++ b/source/dynamic_menu.sqf @@ -0,0 +1,160 @@ +/* + Author: UltraNoobian (Brenden Cai) + + Description: + Dynamically generate and update the Support menus, then display the root menu. + + Parameter(s): + None. + + Usage: + [] call "dynamic_menu.sqf"; + + Returns: + - Nil - +*/ +menuItemFormatter = { + format [ + "[""%1"", [%2], """", -5, [[""expression"", ""%3""]], ""1"", ""%4""]", + _this select 0, + _this select 1, + _this select 2, + _this select 3 + ]; +}; + +_itemsCount = 0; +_offensiveItems = []; +_logisticsItems = []; +_transportItems = []; + +// 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 (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)", 2, "", 0] call menuItemFormatter; + _offensiveItems pushBack _text; +}; + +if(support_arty_available) then { + _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)", 3, "", 0] call menuItemFormatter; + _offensiveItems pushBack _text; +}; + +if(support_cluster_available) then { + _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)", 4, "", 0] call menuItemFormatter; + _offensiveItems pushBack _text; +}; + +if(support_jdam_available) then { + _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)", 5, "", 0] call menuItemFormatter; + _offensiveItems pushBack _text; +}; + +// Compilaton and Call for Offensive SubMenu +_finalString = "offensive_SubMenu = [[""Offensive Supports"",true],"; +_offensiveItemsClassString = _offensiveItems joinString ","; +_finalString = _finalString + _offensiveItemsClassString; +_finalString = _finalString + "];"; + +_myCode = compile _finalString; +call _myCode; + + +//Logistics Submenu Checks +if(support_supplydrop_available) then { + _text = ["Supply Drop (2 CP)", 2, '_null = [player] execVM ""support\ammobox.sqf""', 1] call menuItemFormatter; + _logisticsItems pushBack _text; +} else { + _text = ["Supply Drop ((N/A)", 2, '', 0] call menuItemFormatter; + _logisticsItems pushBack _text; +}; + +if(support_paradrop_available) then { + _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; + _logisticsItems pushBack _text; +}; + +if(support_uav_recon_available) then { + _text = ["UAV Recon (3 CP)", 4, '_null = [player] execVM ""support\mapclickuav.sqf""', 1] call menuItemFormatter; + _logisticsItems pushBack _text; +} else { + _text = ["UAV Recon (N/A)", 4, '', 0] call menuItemFormatter; + _logisticsItems pushBack _text; +}; + +if(support_veh_refit_available) then { + _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)", 5, '', 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)", 2, '_nill = [getpos player,50] execVM ""support\taxi\helotaxi.sqf""', 1] call menuItemFormatter; + _transportItems pushBack _text; +} else { + _text = ["Helicopter taxi(N/A)", 2, '', 0] call menuItemFormatter; + _transportItems pushBack _text; +}; + +if(support_boattaxi_available) then { + _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)", 3, '', 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"; 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/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; diff --git a/source/support/arty.sqf b/source/support/arty.sqf index 5e01699..379c3e3 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 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 -_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 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..00998c3 100644 --- a/source/support/cluster/mapclickcluster.sqf +++ b/source/support/cluster/mapclickcluster.sqf @@ -1,52 +1,59 @@ -// _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; +_pos = []; -// 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; +// 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 (_supportype==3) exitWith { -_art = [player1,"JDAM"] call BIS_fnc_addCommMenuItem; -}; +// 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]; -//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; +// 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"; }; diff --git a/source/support/fob.sqf b/source/support/fob.sqf index 5fd815b..4f0cfeb 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,21 +37,24 @@ _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"; + [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 = [player,"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 = [player,"fob_support"] call BIS_fnc_addCommMenuItem; +}; -// LA ZONE EST OK 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 @@ -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 { @@ -78,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"; @@ -95,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) @@ -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 +_art = [player,"fob_support"] call BIS_fnc_addCommMenuItem; 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; diff --git a/source/support/mapclickarty.sqf b/source/support/mapclickarty.sqf index 4ec4903..f822c98 100644 --- a/source/support/mapclickarty.sqf +++ b/source/support/mapclickarty.sqf @@ -1,60 +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 5 - NUMBER - Cost of Support type + _this select 6 - STRING - Ammo type used for salvos + Returns: + - Nil - +*/ + +params["_salvos", "_radius", "_interval", "_rps", "_supportype", "_cost", "_ammotype"]; _timer = 60; +_pos = []; 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; +// 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; }; - -if (_supportype==2) exitWith { -_art = [player1,"mortar"] call BIS_fnc_addCommMenuItem; +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) exitWith { -_art = [player1,"JDAM"] call BIS_fnc_addCommMenuItem; +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 diff --git a/source/support/mapclickuav.sqf b/source/support/mapclickuav.sqf index e6346b6..a855dac 100644 --- a/source/support/mapclickuav.sqf +++ b/source/support/mapclickuav.sqf @@ -1,11 +1,14 @@ _timer = 60; clicked = false; +// Guard against calling UAV Recon too often +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 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"; @@ -17,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_recon_timeout = 80; +while {support_uav_recon_timeout > 0} do { + sleep 1; + support_uav_recon_timeout = support_uav_recon_timeout - 1; + publicVariable "support_uav_recon_timeout"; +}; \ No newline at end of file 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/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 }; -}; - - - +}; 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 /////