Feature #10316

New scripting command: addActionForKind

Added by Dr_Eyeball about 7 years ago. Updated almost 7 years ago.

Status:Expired Start date:04/26/2010
Priority:Normal Due date:
Assignee:- % Done:


Category:Scripting: Problem
Target version:-
Affected ArmA II version:Please select... First affected ArmA II version:
Reproduced by another DH user:No Single / Multi Player?:
I am using some Mods:No BIForumURL:
I am using: NGUrl:
Reproducible for you:No WIKIurl:
Related to content of DLC:


The action would then be associated with any object of the given type/kind, including derived classes.
Rather than requiring a unique 1 addAction call to add the identical action for each and every object of the same kind each time that object type is created.

All classes already do this by design via the 1 class UserActions, so it's odd that this functionality doesn't naturally extend into scripting.


Updated by kju about 7 years ago

  • Due date set to 05/07/2010
  • Status changed from New to Feedback

so basically this?

 if (_x isKindOf "T90") then {_x addAction ...};
} forEach allUnits;


 if ((typeOf _x) == "T90") then {_x addAction ...};
} forEach allUnits;

I don't get quite the idea as you have very different situations when to apply actions.

  1. Map placed units
  2. Units created by script
  3. Respawning units (essentially 2)

Updated by Sickboy about 7 years ago

Additionally what could be useful is:
"They should also do this for eventhandlers
and on top of that add 'persistent' eventhandlers, that cannot be removed with removeAllEventhandlers"

Updated by Dr_Eyeball about 7 years ago

These particular features are not a necessity, just common sense requests. I doubt we'll ever see them, but worth mentioning, since you never know.

@Kju, so let's say your mission adds a "Drag" action on all PBX objects initialised at the start. Now, if addonX creates a new PBX mid-game, it will now not have the required action.

Another example, let's say your mission adds a conditional "Apply bandage" action on all caManBase objects initialised at the start. Now, if addonX creates a new infantry unit mid-game, it will now not have the required action. But with this feature, it will also now work automatically for respawned units too, without requiring re-initialisation.

It is only intended for actions which you want to operate on all identicle types/kinds. The flexiMenu system uses this exact same concept. (In fact, every single menu/option is associated to types/kinds, not added to individual objects, even though it supports individual.) Remember, addAction can have a condition parameter, so you can control it further.

In a way, a global onCreateObject EH would be even more useful. It would then allow you to do this and much more automatically.

@Sickboy: Good point. A command like addEventHandlerForKind would be fantastic too. Exact same reasoning. It also greatly simplifies the complexity of the initialisation scripting otherwise required, which would help all scripters.
"caManBase" addEventHandlerForKind ["killed", "_this call fnc_handleDeath"];

Persistent EH's: That's a problem if it deletes events added by class based EH's. If that's true, we'll need to at least add a note to:
since that clearly says it only removes actions added by addEventHandler, which is otherwise misleading.

Updated by Xeno about 7 years ago

Basically all you ask for is what Extended Eventhandlers allready do.

Updated by kju about 7 years ago

  • Subject changed from Command: addActionForKind to New scripting command: addActionForKind

I get the idea, but there are two points:

a) The request is not as simple and precise as it could and needs to be (isClass "X" vs isKindOf "X").
b) We need one request per ticket (mainly at Sickboy).

While I am not so optimistic that BI ever will realize suggested scripting commands,
it is not wrong trying. So overall your action is welcome, yet it needs to be improved a little.

Edit: The best would to make the suggestion BIKI like.

Syntax (+ code example) and short description.

Updated by kju almost 7 years ago

  • Due date deleted (05/07/2010)
  • Status changed from Feedback to Expired
  • Audio card set to Please specify!
  • Size of OS swap file set to Please specify!
  • I am using some Mods set to No
  • Reproducible for you set to No


Feel free to reopen with better and more precise description.

Updated by Dr_Eyeball almost 7 years ago

Why is this expired? This would be an extremely useful feature right now.

Updated by kju almost 7 years ago

You only need to read the two posts above yours.

The description is not clear and incomplete.

Also available in: Atom PDF