Jump to content
Sign in to follow this  
james mckenzie-smith

Selecting HC unit and giving orders using Communications menu?

Recommended Posts

Hello All,

I have a small problem. I have successfully made some pretty detailed HC menus, but I am in the process of trying to simplify things, by allowing the player to use the F1-F12 keys to select an HC group (or more than one group), and then use a custom communications menu to execute commands.

Now, I know that, to do this within a player's squad, you can use something like this...

{_x stop true} foreach groupselectedunits player

...and it stops 'em dead. Problem is, it does not work at all in HC. Selecting an HC unit using the F1-F12 keys (or by any other method) and doing this results in nothing much at all happening. I have tried:

_array = hcSelected player; _array stop true

and

onHCGroupSelectionChanged, _x stop true

and other hc commands, but cannot figure it out.

Any assistance would be considered a great favour, and worthy of much praise!

Share this post


Link to post
Share on other sites

See if this works and you need to call it by placing this in your menu call script

hcSelected player

_array = _this select 0;
_selectedgrps = (count _array);

for "_i" from 0 to _selectedgrps do 
{
   {_x stop true } foreach units (_array select _i);
};

Share this post


Link to post
Share on other sites

Thanks for the assistance. Unfortunately, I use triggers and nothing else for my missions, and I imagine that that PHP code goes into a .qf file. In a trigger, it generates an error saying something like 'local variable in global space'.

I will have to keep looking for a solution. It's one of the last little pieces to the high command puzzle...

Share this post


Link to post
Share on other sites

yeap, cant assign local variables in trigger space since its global. I managed to get this working for my weapon team script. however, it had to be scripted in order to continuosly loop and update the high command selection as well as enable/disable comm menu actions when the appropriate team is selected.

have a look here: http://forums.bistudio.com/showthread.php?t=128524&highlight=weapon+team+script

the script is in the example mission, the main one has some insight how to do it, but beware, the comm menu can get very complicated when trying to pass local variables or parameters for it.

Share this post


Link to post
Share on other sites

I didn't realise you were doing it that way, no problem.

Just place it in a trigger, you can call it on a radio when you want it.

null=[] spawn {  _array =  hcSelected player;  _selectedgrps = (count _array);    for "_i" from 0 to _selectedgrps do    {      {_x stop true } foreach units (_array select _i);  };    };

Edited by F2k Sel

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  

×