Page MenuHomeFeedback Tracker

[Feature Request] Add eventhandler for issuing squad commands
New, NormalPublic

Description

Reasoning:
Group eventhandlers dont fire when the player order 'combat' 'safe' 'stealth' etc:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#CombatModeChanged
only seems to trigger from auto combat and waypoints I believe, but command menu doesnt

The most benefit would be to became aware of commands.
Next would be the ability to stop a command (and replace with something scripted).

Suggested command:

_group addEventhandler ["command",{}];

_this containing _issuer [objNull], _commandType [int/string], _selectedUnits [array], _type (of command menu - simple/complex) [int/string]

Return:
_blockCommand [bool] (default: false)

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

kju-PvPscene updated the task description. (Show Details)
h- added a subscriber: h-.Tue, Apr 2, 4:48 PM
mrzorn added a subscriber: mrzorn.Thu, Apr 4, 2:06 AM
dedmen added a subscriber: dedmen.EditedThu, Apr 25, 1:10 PM

There is a CommandChanged group EH, but that only works for commands, which is unfortunate when lots of things just aren't commands, see below.

The AI command system is VERY old and messy and I don't understand it. So any more features to it is unlikely.
I found where the UI commands are handled. Its a giant switch case, for ALL hardcoded menu commands (Set combat mode to stealth, take backpack, open inventory, keep depth relative up, slingload cargo, change voice chat channel to global, change voice chat channel to side, set voice chat channel to command, high command, assemble weapon, heal self, open parachute)
There is AI commands, and non-AI actions, all mixed together. Some AI commands are implemented directly in this several thousand lines block of mess (not dispatching any commands, but directly setting flags on the AI group).
It is not feasible to clean it all up in a way where we could decide between AI command or not to give a group eventhandler (or even decide which group is meant in some weird case of File formation, where that is apparently special somehow).
(Why the heck is most of AI commanding, implemented in our Menu UI code, and not in the AI code.. ahhh)

I could make a global eventhandler, that gets all commands selected in UI (Both AI Commanding, and normal action menu).
It seems VBS once had such a eventhandler for the whole menu. It had the command (as integer) and the list of selected units.
The command integer is not guaranteed to be stable though, if a new command is added somewhere it would change (though we likely won't do that anymore), and converting to string is not feasible.

_issuer would always be focusOn and I think for _type I could give you the "name" (config classname?) of the parent menu that contained the used menu item.

Intercepting and returning a different command code, would be possible.
I am also not able to provide any list or documentation of which command code corresponds to what command/menuitem.