I'm working on a mission set in Chernarus where CDF battles ChDKZ, and I'd like to have every Chedaki guy wearing a balaclava. By having the initServer.sqf run
{if (side _x == East) then {_x addGoggles (selectRandom ["rhs_balaclava", "rhs_balaclava1_olive"]}} forEach (allUnits);
every editor-placed OPFOR unit has their nice balaclava without problems. However, since the mission will be played in multiplayer, a player managing Zeus will be adding more OPFOR units as needed. The code above, however, doesn't work for them, nor does it work for any OPFOR spawned via script, as expected. I've subsequently tried with something like
while {true} do {
{If ((side _x == East) and !((goggles _x) isEqualTo [""rhs_balaclava", "rhs_balaclava1_olive"])) Then {_x addGoggles (selectRandom [""rhs_balaclava", "rhs_balaclava1_olive"])}} forEach (allUnits);
};
This seems to work even with OPFORs spawned via script. Balaclavas, however, appear to be "flashing" on the soldiers' heads: I assume this is happening because they are constantly being added to them, and I also suspect this would kill the overall performance in a real multiplayer game. I understand there's no real purpose on this one but aesthetics, however I would really love to know how to do it best, because with minor changes a script of this kind could be used to remove or add NVGs to AIs and such.
Thanks in advice for your replies!