Page MenuHomeFeedback Tracker

[Feature Request] New scripting command to return a single unit's combat mode ("BLUE", "RED", etc.)
New, NormalPublic

Description

This is essentially the same as https://feedback.bistudio.com/T146461.
However, according to @BIS_fnc_KK, this is not a bug (but I still believe it is). So I'm going to re-post it as a feature request.

As mentioned before, the combatMode command is broken, unless you use Group setCombatMode Mode.

However, if the unit's combat mode was changed without using setCombatMode on the original gorup, combatMode doesn't return the correct value.

There are two ways to reproduce the issue (see the Steps To Reproduce section)

The 1st method is the only way to change the combat mode of a selection of units (instead of the entire group) without using the vanilla commanding menus (I believe that the vanilla commanding menu uses the same trick too).

@BIS_fnc_KK
Regarding your comment:

A combat mode of a unit depends on a combat of the group the unit is in, so in order to get combat mode of the unit you can get the combat mode of the current group the unit is in. When you move unit to another group, the unit behaviour is set by the new group, this is why combat mode you set on temp group won’t affect the unit in the new group. In short, "combatMode unit" does what you want already, returns combat mode the unit is subject to currently. I hope I made it clearer.

This does affect the unit. The unit's combat mode successfully changes (as indicated in the "group bar", as well as unit's behavior), but it can't be returned using combatMode. You can test it yourself if you don't believe me!

TL;DR, what I'm requesting is a getter for whatever changes the unit's combat mode in the group bar, i.e this one:
(I've used the commanding menus in this screenshot; you can clearly see the bug)


Either the same command:

combatMode unit
return value: String. An individual unit's combat mode, not his group's (i.e. what is shown in the "group bar")

or a new command:

getCombatMode unit
return value: String. An individual unit's combat mode, not his group's (i.e. what is shown in the "group bar")

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
Scripting
Steps To Reproduce

Method 1 (script): (the only method to change the combat mode of individual units instead of whole group)

  1. Create a new group,
  2. Temporarily move the units to this new group,
  3. Set combat mode for the new group,
  4. Rejoin units back into their original group.
  5. Use the combatMode command on one of those units.
  6. It always returns "YELLOW"
_units = groupSelectedUnits player; // just some array of units
_sideUnits = side (_units#0);
_originalGrp = group (_units#0);
_tempGrp = createGroup _sideUnits;
_units joinSilent _tempGrp;
_tempGrp setCombatMode _desiredCombatMode; //e.g "RED"
_units joinSilent _originalGrp;

combatMode (_units#0)

Method 2 (engine commanding menus):

  1. While being the leader of a group, use the commanding menus to order a certain unit to hold fire.
  2. combatMode returns "YELLOW" (see the above screenshot)
Additional Information

Assuming this is what the current combatMode command does (sample SQF, for simplicity):

if !(_this isEqualType grpNull) then { //if param is a unit, change it into unit's group
   _this = group _this
};
_this getVariable "CombatMode"

, this is what it should become:

_this getVariable "CombatMode" //combat mode, regardless of whether the paramter is a group or a single unit

Event Timeline

Leopard20 updated the task description. (Show Details)Jul 27 2020, 7:28 PM
Leopard20 updated the task description. (Show Details)
Leopard20 changed Severity from None to Feature.Jul 27 2020, 7:32 PM
Leopard20 updated the task description. (Show Details)Jul 27 2020, 7:41 PM
h- added a subscriber: h-.Jul 27 2020, 8:23 PM
Leopard20 updated the task description. (Show Details)Jul 28 2020, 12:50 AM
Leopard20 edited Steps To Reproduce. (Show Details)
Leopard20 edited Additional Information. (Show Details)
Leopard20 edited Additional Information. (Show Details)
Leopard20 edited Additional Information. (Show Details)Jul 28 2020, 12:52 AM

I stand by what I said, both commands are operating on the AI group. However it is also true that when unit rejoins, it keeps its combat mode from previous group, so yes this will need some way of checking

Leopard20 added a comment.EditedJul 31 2020, 8:19 PM

when unit rejoins, it keeps its combat mode from previous group

Yeah, but please do not "fix" that. Otherwise there's no way to change the combat mode of individual units using scripts.
If it's not possible to change combatMode to return the combat mode of an individual unit, please add a new command.

rev 146576 Added unitCombatMode/setUnitCombatMode

@BIS_fnc_KK
Thanks! Can't wait to try them out!

@BIS_fnc_KK
Please add the command to the wiki as well. I though it isn't implemented yet (v2.01.146606), but it is.

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Nov 24 2020, 6:12 PM