uait 10 Posted March 26, 2013 Hi all! i just found this code #start @ (! alive player) _weapons = weapons player _magazines = magazines player @ (alive player) removeallweapons player {player addMagazine _x} foreach _magazines {player addWeapon _x} foreach _weapons goto "start" i'm trying to add 3 magazines for the weapon that player has. because if you die with only 1 magazine, you respawn with only 1 magazine. i try different roads but doesnt work... maybe someone know some tricks? thank you Share this post Link to post Share on other sites
Harzach 2516 Posted March 26, 2013 How are you trying to use this code? It looks like sqs (?), not sqf. Is this syntax even supported in A2? Share this post Link to post Share on other sites
tryteyker 28 Posted March 26, 2013 while {true} do { waitUntil {!alive player}; _weapons = weapons player; _mags = magazines player; waitUntil {alive player}; removeallweapons player; removeallmagazines player; {player addMagazine _x} foreach _mags; {player addWeapon _x} foreach _weapons; }; This is the exact code you posted but in .sqf, the more usable language. For more info look here: http://seit.unsw.adfa.edu.au/coursework/ZEIT2305/Resources/SQF_Tutorial/basic_sqf.HTML If you want to get 3 mags for the primary weapon of the player, try this (freehand, untested): _primwp = primaryWeapon player; _mags = (configFile >> CfgWeapons >> _primwp >> "magazines"); _mag = _mags select 0; _magcount = 3; player addMagazines [_mag,_magcount]; This checks the primary weapon of the player (Rifle) and gives the player three magazines usable by that Rifle. You can insert this into the init.sqf. @Harzach sqs is indeed supported by ArmA2 (not by ArmA3 however) but it's generally not used as it is slow and lacks certain features sqf has. (such as being able to create functions) Share this post Link to post Share on other sites
Harzach 2516 Posted March 26, 2013 sqs is indeed supported by ArmA2 (not by ArmA3 however) but it's generally not used as it is slow and lacks certain features sqf has. (such as being able to create functions) Ah, I knew it was something like that, thanks! Share this post Link to post Share on other sites
uait 10 Posted March 26, 2013 mmm no... some errors if i modify my script and the second doesnt work at all... maybe it's impossible... thank you anyway! you were very gentle! Share this post Link to post Share on other sites
tryteyker 28 Posted March 26, 2013 Nothing's impossible really. What kind of errors do you get? Share this post Link to post Share on other sites
uait 10 Posted March 26, 2013 #removeallmagazines player; error in variable not defined in the expression removeallmagazines Share this post Link to post Share on other sites
tryteyker 28 Posted March 26, 2013 Oh yeah just saw that removeallmagazines doesn't even exist. Just remove it from the code. Share this post Link to post Share on other sites