siOnzee 10 Posted December 26, 2014 (edited) 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 Edited December 26, 2014 by siOnzee Game info Share this post Link to post Share on other sites
columdrum 11 Posted December 26, 2014 (edited) The script seems ok but you are using exec to execute it when it should be used just for sqs and thats a sqf script. So i guess try to run in with execVM instead? or call + compile( or, in a3, define it on cfgfunctions and then call it)... Edited December 26, 2014 by columdrum Share this post Link to post Share on other sites
siOnzee 10 Posted December 26, 2014 Thaaanks maaan! execVM fixed my problem. Why this isn't in the Documentation? :confused: Share this post Link to post Share on other sites
KiloSwiss 16 Posted December 30, 2014 Why this isn't in the Documentation? It is: https://community.bistudio.com/wiki/exec It is not recommended to use this command in any game other than OFP. Instead, the execVM command should be used.Learn more about scripts under Scripts. https://community.bistudio.com/wiki/Script_(File)#Execution The commands to execute scripts are:exec exec starts a thread for a script in SQS syntax. execVM (Armed Assault only) execVM compiles a script in SQF syntax and starts a thread for it. Share this post Link to post Share on other sites