Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
86287dc
Partially added new function to generate support menus
ultranoobian Dec 30, 2017
0d34aaf
Populated dynamic_menu script with all menus and functions
ultranoobian Jan 4, 2018
309271b
Added code to add 'support menu' back on to player menu on respawn
ultranoobian Jan 5, 2018
70fa5ce
Added watchdog time variables for supports with delays
ultranoobian Jan 11, 2018
3949002
Removed code that added Comm Menu Items when purchasing supports
ultranoobian Jan 12, 2018
c0e42f6
Added documentation and cleaned up comments in /cluster/*
ultranoobian Jan 18, 2018
5ab3428
Added documentation and small refactors to ammobox.sqf
ultranoobian Jan 18, 2018
c502453
Added documentation, small refactors and fixed formatting to arty.sqf
ultranoobian Jan 18, 2018
4eb576e
Added documentation and small refactors to fob_ammobox.sqf
ultranoobian Jan 18, 2018
79f460e
Added documentation and cleaned up format and comments for fob.sqf
ultranoobian Jan 18, 2018
31ac690
Added Dynamic Menu class to support.hpp to allow it to be added direc…
ultranoobian Jan 18, 2018
1290a08
Added numbering to menu items in dynamic support submenus
ultranoobian Jan 18, 2018
e236ce1
Added/Fixed mission dialogue not working in FOB deployment
ultranoobian Jan 18, 2018
accd400
Fixed other instances of incorrect parameters in mission dialogue
ultranoobian Jan 18, 2018
a815943
Removed BIS_fnc_addCommMenuItem from Support when lacking enough CP
ultranoobian Jan 18, 2018
7a72ee7
Removed UAV Recon support from being readded upon completion
ultranoobian Jan 18, 2018
c717ed0
Fixed logistics supports all dropping ammoboxes instead of intended a…
ultranoobian Jan 18, 2018
cbae623
Removed FLIR from dynamic menu
ultranoobian Jan 19, 2018
c3b2dd2
Fixed UAV Recon timeout stopping script from continuing
ultranoobian Jan 19, 2018
152fc35
Modified mapclickarty.sqf with new support timeout system
ultranoobian Jan 19, 2018
cd7fad5
Minor correction to documentation of mapclickarty.sqf
ultranoobian Jan 19, 2018
22819ac
Modified mapclickcluster.sqf with new support timeout
ultranoobian Jan 19, 2018
355d7da
Modified INIT to include both supportmenu and playermenu
ultranoobian Jan 19, 2018
9e17649
Updated respawn event to handle the re-adding of both methods of acc…
ultranoobian Jan 19, 2018
82ce8f5
Removed access to dyanmic menu from player menu
ultranoobian Feb 18, 2018
d0986f8
Added vscode to .gitignore
ultranoobian Feb 18, 2018
42f022e
Merge branch 'development-feature-dynamic_support' into development
ultranoobian Feb 20, 2018
2ef6de6
Fixed tab-space
ultranoobian Feb 20, 2018
2ba636b
Merge branch 'development'
ultranoobian Feb 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/*
.vscode/*

DUWS-R.iml
localDevDeploy.properties
Expand Down
3 changes: 3 additions & 0 deletions source/INIT.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ for[{_x = 2},{_x <= 20},{_x = _x + 1}] do {
};
};


_dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private keyword


//Loading player position and gear.
//TODO: Add bought supports.
/*
Expand Down
2 changes: 1 addition & 1 deletion source/WARCOM/WARCOM_gps_marker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
10 changes: 0 additions & 10 deletions source/dialog/request_support.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
17 changes: 16 additions & 1 deletion source/dialog/supports_init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,19 @@ if (isNil "support_specialized_training_available") then {

if (isNil "support_armory_available") then {
support_armory_available = false;
};
};

/*
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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optimally you would use a OFPEC tag for variables. But doesn't matter as much in mission scripts.

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;
2 changes: 2 additions & 0 deletions source/duws_revive/respawnClicked.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ if(!staminaEnabled) then {
player enableStamina false;
};

_dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private


closedialog 0;
160 changes: 160 additions & 0 deletions source/dynamic_menu.sqf
Original file line number Diff line number Diff line change
@@ -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";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax is wrong.


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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add private to private variables.

_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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of execVM'ing everytime (It recompiles and preprocesses the script everytime). You should compile it once and store it in a variable. And then spawn or call it.

_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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compiling scripts is very expensive.
To replace this you can use setVariable in combination with parseSimpleArray

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"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation?

["Transport", [4], "#USER:transport_SubMenu", -5, [["expression", ""]], "1", "1"]
];

showCommandingMenu "#USER:supportMenu";
2 changes: 1 addition & 1 deletion source/initHQ/BluHQinit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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!'", ""];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use ' ' to denote strings. Inside them you can use " " without having to escape them.


// CREATE THE OFFICER
_group = createGroup west;
Expand Down
2 changes: 1 addition & 1 deletion source/missions/stratmap.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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..."];
Expand Down
1 change: 0 additions & 1 deletion source/serverinit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
28 changes: 21 additions & 7 deletions source/support/ammobox.sqf
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
/*
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;
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]];

Expand All @@ -34,10 +52,6 @@ _ammo addBackpackCargo ["B_AssaultPack_khk",10];

if (support_armory_available) then {[[_ammo,["<t color='#ff1111'>Armory</t>","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;
Loading