I have a related problem. I wrote a script to set the equipment for a unit or a group of units. Here's the code:
/* USAGE: [[weapon array], [magazine array], unit, mode] execVM "equip.sqf"
The script equips a unit with the weapons specified in the weapon array, add
all the magazines in the magazine array. Each entry in the magazine array
is another array [classname, amount] (then "magazine array" is a matrix)
where "classname" is the classname of the magazine you want to add and "amount"
is the number of magazines.
So let's say you want to add an AK74 and a RPG7V to your unit with 6 magazines
for the AK74 and 3 rockets, the call will be the following (for the unit init
field):
call{[["AK74", "RPG7V"],[["30Rnd_545x39_AK", 6], ["PG7", 3]], this, false] execVM "equip.sqf"}
If "mode" is set to true then every
unit will be equiped with the given weapons and magazines. Note that the
script removes every weapon from the unit (or the whole group depending on
the selected mode). */
_weapons = _this select 0;
_magazines = _this select 1;
_unit = _this select 2;
_wholeGroup = _this select 3;
//equip the whole group
if (_wholeGroup) then
{
_unitGroup = units group _unit;
//pick every unit in the group and add the equipment
{
removeAllWeapons _x;
_temp = _x;
{_temp addWeapon _x} forEach _weapons;
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do
{
_temp addMagazine(_x select 0);
};
}
forEach _magazines;
_x selectWeapon(primaryWeapon _x);
reload _x;
}
forEach _unitGroup;
}
//equip a single unit only
else
{
removeAllWeapons _unit;
{_unit addWeapon _x} forEach _weapons;
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do
{
_unit addMagazine(_x select 0);
};
}
forEach _magazines;
_unit selectWeapon(primaryWeapon _unit);
reload _unit;
};
The problem is that I don't want the player to reload the weapon, but to start with the weapon already loaded and ready to fire (basically I don't want to see the reloading animation but to instantly have a magazine loaded). Is there a way to do that?