Hello, I maded script SQF.
Named "GiveWeapon.sqf"
_unit = _this select 0;
_weaponName = _this select 1;
_weaponAmmo = _this select 2;
_weaponQuantity = _this select 3;
//hint format ["\nUnit = %1\nWeapon Name = %2\nWeapon Ammo = %3\nWeapon Quantity = %4\n Arm weapon = %5\n ", _unit, _weaponName, _weaponAmmo, _weaponQuantity, _loaded];
for "_i" from 0 to _weaponQuantity do {
_unit addMagazine _weaponAmmo;
};
_unit addWeapon _weaponName;
In editor I assign to unit on INIT
removeAllWeapons this; [this, "M9", "15Rnd_9x19_M9", 6] exec "GiveWeapon.sqf"
In-game I'll got weapon M9 with one Magazine. Why?
I goes deep for debug.
for "_i" from 0 to _weaponQuantity do {
hint format ["%1", _i];
};
This print 'any' :butbut:
_n = 0;
while {_n < _weaponQuantity} do {
_n = _n + 1;
_unit addMagazine _weaponAmmo;
};
Too doesn't work. What I do wrong?
Game: Armed Assault 2 Operation Arrowhead (CO)
Platform: PC on Steam
Version: 1.62.103718