I would be great to have a c++ based command to select units based on side.
The following examples are used very often, and always require to go through an array of all units first, and then selecting the units of the correct side with a if condition.
Example_1:
```
{
if (side _x isEqualTo WEST) then
{
_x addEventHandler
[
"HandleDamage",
{
_returnDamage = (_this select 2);
if ((side (_this select 0)) isEqualTo (side (_this select 3))) then
{
_returnDamage = 0;
};
_returnDamage;
}
];
};
} forEach allUnits;
```
Example_2:
```
{
if (side _x == EAST) then
{
_x setBehaviour "COMBAT"
};
}forEach allUnits;
```
The main advantages of those new commands would be the improved legibility and lower performance impact.
Example_1 with allUnitsWest:
```
{
_x addEventHandler
[
"HandleDamage",
{
_returnDamage = (_this select 2);
if ((side (_this select 0)) isEqualTo (side (_this select 3))) then
{
_returnDamage = 0;
};
_returnDamage;
}
];
} forEach allUnitsWest;
```
Example_2 with allUnitsEast:
```
{
_x setBehaviour "COMBAT"
I would be great to have an engine command to select units based on side.
The following examples are used very often, and always require to go through an array of all units first, and then selecting the units of the correct side with a if condition.
Example_1:
```
{
if (side _x isEqualTo WEST) then
{
_x addEventHandler
[
"HandleDamage",
{
_returnDamage = (_this select 2);
if ((side (_this select 0)) isEqualTo (side (_this select 3))) then
{
_returnDamage = 0;
};
_returnDamage;
}
];
};
} forEach allUnits;
```
Example_2:
```
{
if (side _x == EAST) then
{
_x setBehaviour "COMBAT"
};
}forEach allUnits;
```
The main advantages of those new commands would be the improved legibility and lower performance impact.
Example_1 with allUnitsWest:
```
{
_x addEventHandler
[
"HandleDamage",
{
_returnDamage = (_this select 2);
if ((side (_this select 0)) isEqualTo (side (_this select 3))) then
{
_returnDamage = 0;
};
_returnDamage;
}
];
} forEach allUnitsWest;
```
Example_2 with allUnitsEast:
```
{
_x setBehaviour "COMBAT"
}forEach allUnitsEast;
```