Koni 3 Posted October 27, 2011 For some reason, all of a sudden I am having problems adding ammo then a weapon to units and there ends up being no ammo allocated to the unit. player addmagazine "8Rnd_9x18_Makarov"; player addweapon "Makarov"; player addmagazine "8Rnd_9x18_Makarov"; player addmagazine "8Rnd_9x18_Makarov"; Obviously this is what I am using, always add the magazine first then the weapon, then how ever many mags is needed in reserve and it has always worked perfectly for whatever weapon is selected, but it's all of a sudden become hit n miss wether the unit actually gets any magazines for some reason. Any other way of doing this, and any ideas why it has worked for years and now seems to be having problems ? Tar Share this post Link to post Share on other sites
Gunter Severloh 4070 Posted October 27, 2011 Hi, Do it like this player addweapon "Makarov"; player addmagazine "8Rnd_9x18_Makarov"; player addmagazine "8Rnd_9x18_Makarov"; player addmagazine "8Rnd_9x18_Makarov"; keep the addmagazine and the addweapon listings seperate, and together like above. then for the gear theres 8 slots so add 8 lines: player addmagazine "8Rnd_9x18_Makarov"; Not sure how to add an extension to the code for the addmagazine like my example below where you have a 2nd number that defines the number of magazines to add limit 8 as theres only 8 slots for the pistol slot magazine. In an ammo cache you can do this: Ammo.sqf if isnull _this exitwith {}; clearweaponcargo _this; clearmagazinecargo _this; _this addweaponcargo ["Makarov", [b]1[/b]]; _this addmagazinecargo ["8Rnd_9x18_Makarov", [b]20[/b]]; then ingame place an ammo cache and put this code in the init line: _dummy = this execvm "ammo.sqf"; the number in the code (bolded) is the amount of that item you want. Share this post Link to post Share on other sites
buliwyf 4 Posted October 27, 2011 ...then for the gear theres 8 slots so add 8 lines: player addmagazine "8Rnd_9x18_Makarov"; Or put this instead of 8 lines: {player addMagazine "8Rnd_9x18_Makarov";} forEach [1,2,3,4,5,6,7,8]; ;) Share this post Link to post Share on other sites
bospor 0 Posted October 27, 2011 Is it possible when you addweapon and addmagazine to a player to have it already be loaded when you start the game? Share this post Link to post Share on other sites
cuel 25 Posted October 27, 2011 Add the magazines before the weapon Share this post Link to post Share on other sites
Koni 3 Posted October 27, 2011 Add the magazines before the weapon That's why I always added a magazine before the weapon so it was already loaded, but now it seems to be ignoring the addmagazine commands. Share this post Link to post Share on other sites
cuel 25 Posted October 27, 2011 do you have any magazines in your gear? Share this post Link to post Share on other sites
riouken 15 Posted October 27, 2011 That's why I always added a magazine before the weapon so it was already loaded, but now it seems to be ignoring the addmagazine commands. Does the player have room in their inventory? have you cleared out the other items? Share this post Link to post Share on other sites
celery 8 Posted October 27, 2011 Or put this instead of 8 lines: {player addMagazine "8Rnd_9x18_Makarov";} forEach [1,2,3,4,5,6,7,8]; ;) Or just [player,["Makarov",8]] execVM "cly_addweapon.sqf"; http://forums.bistudio.com/showthread.php?t=100496 ;) Share this post Link to post Share on other sites
Koni 3 Posted October 28, 2011 Yes, there are no weapons\items in the units gear other than standard compass\map etc Thanks Celery, very handy script you have there and one that I will end up using rather a lot as I do change weapons around alot from standard units and this will come in very handy Share this post Link to post Share on other sites
DAP 619 Posted October 28, 2011 Maybe just use this command after adding magazines to player? Like player addmagazine "8Rnd_9x18_Makarov"; player addweapon "Makarov"; player addmagazine "8Rnd_9x18_Makarov"; player addmagazine "8Rnd_9x18_Makarov"; [b]reload player;[/b] Share this post Link to post Share on other sites
Koni 3 Posted October 28, 2011 Didn't actually know about the reload player command, though the problem I was having was that the unit got the weapon, but no ammo was showing on screen to say you could just hit reload, as there wasn't any there to use, BUT if you went into the gear section of the unit, then the magazines would be there in the allocated slots, just not able to use them... Share this post Link to post Share on other sites
celery 8 Posted October 28, 2011 I think you have to use player selectWeapon "Makarov"; Share this post Link to post Share on other sites
Koni 3 Posted October 28, 2011 Maybe, though that's another command I have never had to use before. Share this post Link to post Share on other sites
shadowguy 0 Posted October 29, 2011 Are you trying to arm a civilian unit? I have had problems trying to do that. Share this post Link to post Share on other sites
Koni 3 Posted October 29, 2011 Seems like I have found the answer to the problem. In the init file for the mission I had a load of different addmagazine and weapon command lines, but they all had // before them, so I could change what weapons I wanted quickly between previews, like this... //player addmagazine "20Rnd_B_765x17_Ball"; //player addweapon "Sa61_EP1"; //player addmagazine "20Rnd_B_765x17_Ball"; //player addmagazine "20Rnd_B_765x17_Ball"; //player addmagazine "20Rnd_B_765x17_Ball"; player addmagazine "100Rnd_762x54_PK"; player addweapon "PK"; //player addmagazine "100Rnd_762x54_PK"; //player addmagazine "100Rnd_762x54_PK"; //player addmagazine "pipeBomb"; player addmagazine "HandGrenade"; //player addmagazine "HandGrenade"; maybe the game was missing some of the // and was getting mixed up, I don't know, but now I removed all the surplus add weapon\mag lines it's working fine now. Share this post Link to post Share on other sites