Jump to content
Sign in to follow this  
DEV614

Adding action to Support command menu?

Recommended Posts

Hi all, I'm trying to find out how to add an action to the Support menu (0-8) that will allow me to turn autocombat on for certain units. Could anybody help?

Share this post


Link to post
Share on other sites

Thank you! Sadly, I'm not the brightest bulb in the pack, so I still can't figure this out myself. I'd like to add three separate actions to the command menu, under the support section I'm assuming. I'd like each action to run a different code to allow autocombat to be turned on for the unit. This is the code I have that I want to be ran on the "Alpha" action:

K41A1 enableAI "AUTOCOMBAT";
K41A2 enableAI "AUTOCOMBAT";
K41A3 enableAI "AUTOCOMBAT";
K41B1 enableAI "AUTOCOMBAT";
K41B2 enableAI "AUTOCOMBAT";
K41B3 enableAI "AUTOCOMBAT";
K41B4 enableAI "AUTOCOMBAT";
K41C1 enableAI "AUTOCOMBAT";
K41C2 enableAI "AUTOCOMBAT";
K41C3 enableAI "AUTOCOMBAT";
K41A enableAI "AUTOCOMBAT";
K41B enableAI "AUTOCOMBAT";
K41C enableAI "AUTOCOMBAT";

Basically, that's it. I just want something in the command menu to be able to shoot off the code above, and I can't seem to figure it out from the wiki. :(

Share this post


Link to post
Share on other sites

This is what I've came up with so far, and it doesn't work a single bit. :upside:

 

class CfgCommunicationMenu
{
    class MyAutocombat
    {
        text = "AutoCombat"; // Text displayed in the menu and in a notification
        submenu = ""; // Submenu opened upon activation (expression is ignored when submenu is not empty.)
        expression = "{_x disableAI “AUTOCOMBAT”;} foreach (units group K41A);"; // Code executed upon activation
        icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\defend_ca.paa"; // Icon displayed permanently next to the command menu
        cursor = ""; // 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
    };
};
_autocombat = [player,MyAutocombat] call BIS_fnc_addCommMenuItem;

The "expressions" part is where I think I'm confused at, I literally have no idea what to put there in order to get it to execute the script in the above post.

 

If the code above is no where near what it's supposed to be, please don't laugh. I have no idea what I'm looking at, I just tried to wing it from the wiki page. :thanx:

Share this post


Link to post
Share on other sites

 

 

You have a Quotes error in expression try 

 

expression = "{_x disableAI 'AUTOCOMBAT';} foreach (units group K41A);"; // Code executed upon activation

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
Sign in to follow this  

×