Jump to content
Sign in to follow this  
Koni

Add magazine and weapons not loaded

Recommended Posts

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

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
...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

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
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

do you have any magazines in your gear?

Share this post


Link to post
Share on other sites
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

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 :thumbsup:

Share this post


Link to post
Share on other sites

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

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

Maybe, though that's another command I have never had to use before.

Share this post


Link to post
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×