-
Notifications
You must be signed in to change notification settings - Fork 17
Add Dynamic Support Menu (DSM) #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
86287dc
0d34aaf
309271b
70fa5ce
3949002
c0e42f6
5ab3428
c502453
4eb576e
79f460e
31ac690
1290a08
e236ce1
accd400
a815943
7a72ee7
c717ed0
cbae623
c3b2dd2
152fc35
cd7fad5
22819ac
355d7da
9e17649
82ce8f5
d0986f8
42f022e
2ef6de6
2ba636b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| .idea/* | ||
| .vscode/* | ||
|
|
||
| DUWS-R.iml | ||
| localDevDeploy.properties | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,6 @@ if(!staminaEnabled) then { | |
| player enableStamina false; | ||
| }; | ||
|
|
||
| _dynam = [player,"DynamicSupportMenu"] call BIS_fnc_addCommMenuItem; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. private |
||
|
|
||
| closedialog 0; | ||
| 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"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add |
||
| _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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| _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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. compiling scripts is very expensive. |
||
| 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"], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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!'", ""]; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also use |
||
|
|
||
| // CREATE THE OFFICER | ||
| _group = createGroup west; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
privatekeyword