Jump to content
panther42

After many years... decided to mess around with the communication menu

Recommended Posts

As the title eludes to, I finally decided to mess around with the communication menu after all these years.

I was playing SOG PF in the editor with @pierremgi 's MGI Advanced Modules, found here or here, using Spawn Groups Attack modules and having one heck of a time defending an SF base in Khe Sanh.  I had a hard set editor placed defending contingent.

I was not using any AI revive and it got to the point the enemy was within the base compound.  Thought to my self, I could have used some reinforcements.

In the same mission, I use BIS support modules, and unfortunately, none are reinforce.

So, I decided to delve into the communication menu and make my own reinforcement communication menu.

The following is what came out of it (does not include the description.ext part):

Spoiler

submenu = "#USER:MENU_REINFORCE_1";

MENU_REINFORCE_1 =
[
	// First array: "User menu" This will be displayed under the menu, bool value: has Input Focus or not.
	// Note that as of version Arma 3 1.05, if the bool value is set to false, Custom Icons will not be displayed.
	["Request Reinforcements", false],
	// Syntax and semantics for following array elements:
	// ["Title_in_menu", [assigned_key], "Submenu_name", CMD, "expression",script-string, "isVisible", "isActive" (, optional icon path)]
	// Title_in_menu: string that will be displayed for the player
	// Assigned_key: 0 - no key, 1 - escape key, 2 - key-1, 3 - key-2, ... , 10 - key-9, 11 - key-0, 12 and up... the whole keyboard
	// Submenu_name: User menu name string (eg "#USER:MY_SUBMENU_NAME" ), "" for script to execute.
	// CMD: (for main menu:) CMD_SEPARATOR -1; CMD_NOTHING -2; CMD_HIDE_MENU -3; CMD_BACK -4; (for custom menu:) CMD_EXECUTE -5
	// script-string: command to be executed on activation. (_target=CursorTarget,_pos=CursorPos)
	// isVisible - Boolean 1 or 0 for yes or no, - or optional argument string, eg: "CursorOnGround"
	// isActive - Boolean 1 or 0 for yes or no - if item is not active, it appears gray.
	// optional icon path: The path to the texture of the cursor, that should be used on this menuitem.
	["Reinforce land", [2], "#USER:MENU_REINFORCE_2", -5, [], "1", "1"],
	["Reinforce paradrop", [3], "#USER:MENU_REINFORCE_3", -5, [], "1", "1"]
];

//heli insertion land
MENU_REINFORCE_2 =
[
	["Branch", false],
	["US Army", [2], "#USER:MENU_REINFORCE_2_1", -5, [], "1", "1"],
	["SF", [3], "#USER:MENU_REINFORCE_2_2", -5, [], "1", "1"],
	["LRRP", [4], "#USER:MENU_REINFORCE_2_3", -5, [], "1", "1"],
	["MACV", [5], "#USER:MENU_REINFORCE_2_4", -5, [], "1", "1"],
	["USN Advisory Det", [6], "#USER:MENU_REINFORCE_2_5", -5, [], "1", "1"],
	["USN SEAL Det Bravo", [7], "#USER:MENU_REINFORCE_2_6", -5, [], "1", "1"],
	["USN SEAL", [8], "#USER:MENU_REINFORCE_2_7", -5, [], "1", "1"],
	["USMC", [9], "#USER:MENU_REINFORCE_2_8", -5, [], "1", "1"],
	["USMC Force Recon", [10], "#USER:MENU_REINFORCE_2_9", -5, [], "1", "1"]
];

MENU_REINFORCE_2_1 =
[
	["US Army", false],
	["Rifle Platoon (1st)", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_army','Rifle Platoon (1st)'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Rifle Squad (1st)", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_army','Rifle Squad (1st)'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Rifle Squad (2nd)", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_army','Rifle Squad (2nd)'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_2 =
[
	["Special Forces", false],
	["B-52 Team", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','B-52 Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["B-53 Team", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','B-53 Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Mike Force", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','Mike Force'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Roadrunner Team", [5], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','Roadrunner Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_3 =
[
	["Long Range Recon Patrol", false],
	["LRRP Recon Team", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_lrrp','LRRP Recon Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_4 =
[
	["MACV SOG", false],
	["Hatchet Force", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_sog','Hatchet Force'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Recon Team Columbia", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_sog','Recon Team Columbia'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Recon Team Raleigh", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_sog','Recon Team Raleigh'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_5 =
[
	["US Naval Advisory Detachment", false],
	["Strike Force", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_seal_nad','Strike Force'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Strike Team", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_seal_nad','Strike Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_6 =
[
	["US Navy SEAL Det Bravo", false],
	["Strike Force", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_seal_db','Strike Force'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_7 =
[
	["US Navy SEAL", false],
	["SEAL Platoon 1", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_seal','SEAL Platoon 1'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["SEAL Platoon 2", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_seal','SEAL Platoon 2'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["SEAL Platoon 3", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_seal','SEAL Platoon 3'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_8 =
[
	["USMC", false],
	["USMC 66 Rifle Squad", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_66','Rifle Squad'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["USMC 66 Weapons Squad", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_66','Weapons Squad'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["USMC 68 Rifle Squad", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_68','Rifle Squad'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["USMC 68 Weapons Squad", [5], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_68','Weapons Squad'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["USMC 70 Rifle Squad", [6], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_70','Rifle Squad'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["USMC 70 Weapons Squad", [7], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_70','Weapons Squad'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_2_9 =
[
	["USMC Force Recon", false],
	["Force Recon Team 66", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_recon_66','Recon Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Force Recon Team 68", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_recon_68','Recon Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Force Recon Team 70", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_recon_70','Recon Team'] execVM 'core\scripts\p42_reinf_land.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

//https://coffeeordie.com/multiple-combat-jumps-vietnam
//paradrop
MENU_REINFORCE_3 =
[
	["Branch", false],
	["SF", [2], "#USER:MENU_REINFORCE_3_1", -5, [], "1", "1"],
	["LRRP", [3], "#USER:MENU_REINFORCE_3_2", -5, [], "1", "1"],
	["MACV", [4], "#USER:MENU_REINFORCE_3_3", -5, [], "1", "1"],
	["USMC Force Recon", [5], "#USER:MENU_REINFORCE_3_4", -5, [], "1", "1"]
];

MENU_REINFORCE_3_1 =
[
	["Special Forces", false],
	["B-52 Team", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','B-52 Team'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["B-53 Team", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','B-53 Team'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Mike Force", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','Mike Force'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Roadrunner Team", [5], "", -5, [["expression", "[_pos,'vn_b_group_men_sf','Roadrunner Team'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_3_2 =
[
	["Long Range Recon Patrol", false],
	["LRRP Recon Team", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_lrrp','LRRP Recon Team'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_3_3 =
[
	["MACV SOG", false],
	["Hatchet Force", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_sog','Hatchet Force'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Recon Team Columbia", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_sog','Recon Team Columbia'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Recon Team Raleigh", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_sog','Recon Team Raleigh'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

MENU_REINFORCE_3_4 =
[
	["USMC Force Recon", false],
	["Force Recon Team 66", [2], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_recon_66','Recon Team'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Force Recon Team 68", [3], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_recon_68','Recon Team'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"],
	["Force Recon Team 70", [4], "", -5, [["expression", "[_pos,'vn_b_group_men_usmc_recon_70','Recon Team'] execVM 'core\scripts\p42_reinf_para.sqf';"]], "CursorOnGround", "1","\A3\ui_f\data\IGUI\Cfg\Cursors\iconcursorsupport_ca.paa"]
];

private _callReinf = [player,"Reinforce"] call BIS_fnc_addCommMenuItem;

 

 

Now this works fine with all the other scripts I have made for reinforcements via helicopter insertion landing and paradrop within the mission.

Problem is, it's pretty much hard coded for West and SOG PF.

My question to any familiar with the communication menu is if there is a better way to have multiple submenus like above, but without all the hard coding?

I've looked at almost all forum topics regarding the communication menu, and they just don't seem to address the same issue.  Even searched out @Larrow's knowledgeable posts, but they also seem to address one aspect or another, not the total package I'm looking for (unless I'm just blind).

 

My next goal was to make a Module with the same ingredients, but you'd be able to choose side, faction, etc.

 

Any input would be appreciated.

Share this post


Link to post
Share on other sites

They are only arrays and are stored on the player in the variable BIS_fnc_addCommMenuItem_menu. You can update these arrays and call refresh on the commenu to update it.

Maybe this thread helps?

  • Thanks 1

Share this post


Link to post
Share on other sites

Ok, thanks @Larrow.  From what I understand then, I can only update what is set in the description.ext and stored in BIS_fnc_addCommMenuItem_menu.

In my case, this shows up as:

[[1,"Call Reinforcements","#USER:MENU_REINFORCE_1","_this = [bis_o1,_pos,_target,_is3D,1];","1","","\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa",""]]

 

Using your post, which I did read previously and was trying to decipher how I could use it, I would need to do the following if I wanted different menu for another faction:

1. Create MENU_REINFORCE_4, 5, etc., which would be identical to MENU_REINFORCE_1 (edit as needed if "Reinforce Paradrop" will not be option)

2. Create all the MENU_REINFORCE_4_1..._4_5, etc. submenus to MENU_REINFORCE_4

3. Add your functions to mission and edit a bit, and based on faction of player, I should be able call [ "Reinforce", "#USER:MENU_REINFORCE_4" ] call p42_fnc_updateCommMenuItem; (my description.ext class is Reinforce)

4. In your function update to:

Spoiler

//Function to apply any arguments to a commMenu item
p42_fnc_updateCommMenuItem = {
    params[ "_item", "_args", [ "_menuID", -1 ] ];

    //Find the menu item index
    _menuIndex = if ( _menuID > -1 ) then {
        player getVariable "BIS_fnc_addCommMenuItem_menu" findIf{ _x select 0 isEqualTo _menuID };
    }else{
        missionNamespace getVariable[ "p42_commMenuItems", [] ] findIf{ _x select 0 == _item };
    };

    //If found
    if ( _menuIndex > -1 ) then {

        //Custom for what menu item?
        switch ( toLower _item ) do {

            case ( "reinforce" ) : {
                //Update reinforcement menu
                player getVariable "BIS_fnc_addCommMenuItem_menu" select _menuIndex set[ 2, _args ] ];

            };
        };

        //Update commMenu ( sets missionNamespace menu reference )
        [] call BIS_fnc_refreshCommMenu;
    };
};

I think I'm tracking.  Is this what your intent was?

 

FWIW, the use of TAG in peoples functions/scripting was supposed to identify individual creators and is/was kept at OFPEC.
I see a lot of users just keep the "TAG" not knowing what it means...

 

Ok, after looking over the code in that function, a direct call to it will not work with only the two passed parameters because it only queries BIS_fnc_addCommMenuItem_menu if the third parameter is passed for the index ("_menuID",-1) and > -1.

Direct call would need the ID from when I initially stored in: private _callReinf = [player,"Reinforce"] call BIS_fnc_addCommMenuItem;

Share this post


Link to post
Share on other sites
11 hours ago, panther42 said:

because it only queries BIS_fnc_addCommMenuItem_menu if the third parameter is passed for the index

You can always change it to reference anything you like out of the BIS_fnc_addCommMenuItem_menu arrays, doesn't have to be the index. For instance, you could reference them by their title "Call Reinforcements" etc.

Write it how you need it, the main point was to show that the menus are just an array of arrays stored on the player that can be edited and refreshed using BIS_fnc_refreshCommMenu

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×