Jump to content
Sign in to follow this  
David Schofield

How do I make soldiers with Custom weapon loadouts start with already loaded mags?

Recommended Posts

Ok, so I was tinkering around in Editor, and I've realized that I have a problem. Whenever I give an AI or my own player a custom loadout (For example: A Corpsman with a G36a and 6 G36 magazines) the gun starts empty, but 6 mags are in reserve. I have to reload to shoot... However, an unedited corpsman starts with a gun that is already loaded.

So how to I make it so that the guns are already loaded on mission start? If there is a code, what is it?

Any help would be greatly appreciated; I play ARMA 2 (not OA) on up-to-date patch 1.10 with no mods.

Share this post


Link to post
Share on other sites

Add a/the magazine/s first, then the weapon will start loaded.

Share this post


Link to post
Share on other sites
Add a/the magazine/s first, then the weapon will start loaded.

Thank you for the code, but where at specifically should I put it? At the very beginning?

Here is my code so far:

removeAllWeapons this; this addWeapon "AK_107_pso"; this addMagazine "30Rnd_545x39_AK"; this addMagazine "30Rnd_545x39_AK";

So all I do is place it at the start?

a/the magazine/s; removeAllWeapons this; this addWeapon "AK_107_pso"; this addMagazine "30Rnd_545x39_AK"; this addMagazine "30Rnd_545x39_AK";

Share this post


Link to post
Share on other sites

Like this:

removeallweapons this; {this addmagazine "30Rnd_545x39_AK"} foreach [1,2,3]; this addweapon "AK_107_pso";

Share this post


Link to post
Share on other sites

Oh, hehe, no.

Just do this:

removeAllWeapons this; this addMagazine "30Rnd_545x39_AK"; this addWeapon "AK_107_pso"; this addMagazine "30Rnd_545x39_AK";

Share this post


Link to post
Share on other sites

Heh, that isn't code. DM is simply saying that you need to add the magazines before adding the weapon. So put the "this addMagazine..." part before the "this addWeapon..." part.

edit: Ninja'd

Share this post


Link to post
Share on other sites
Like this:

removeallweapons this; {this addmagazine "30Rnd_545x39_AK"} foreach [1,2,3]; this addweapon "AK_107_pso";

I'm not too familiar with that version of the addition code... I'm sorry, but thanks for helping out.

Oh, hehe, no.

Just do this:

removeAllWeapons this; this addMagazine "30Rnd_545x39_AK"; this addWeapon "AK_107_pso"; this addMagazine "30Rnd_545x39_AK";

Oh haha! Thank you very much, I understand now! :o

Heh, that isn't code. DM is simply saying that you need to add the magazines before adding the weapon. So put the "this addMagazine..." part before the "this addWeapon..." part.

edit: Ninja'd

Ninja'd indeed, but still very helpful indeed! Thank you!

Thanks to all that answered my call for assistance, the problem is solved :bounce3:

Just gotta lotta work to do now on notepad... Haha..

Share this post


Link to post
Share on other sites

It's just an easier way to add multiple magazines. In that example it would give 3.

Share this post


Link to post
Share on other sites

The above won't always work if weapon have multiple muzzles.

//add magazines
//add weapon
//do the following:
_primw = primaryWeapon _p;
if (_primw != "") then {
_p selectWeapon _primw;
_muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");
_p selectWeapon (_muzzles select 0);
};

Share this post


Link to post
Share on other sites

Also if you don't have a primary weapon but instead have a secondary or pistol, then the above will again not work. Luckily, afaik, pistols and launchers don't have muzzles (or are there any that do have them?) and you can just use _p selectWeapon "M9" or whatever weapon you use.

Share this post


Link to post
Share on other sites

this is an example of the method I use, similar to some that have been mentioned before. this way, you don't have to add individual magazines, and it starts with a mag loaded and the proper weapon selected. here is an example of a grenadier.

removeAllWeapons this; {this addmagazine "30Rnd_556x45_STANAG";} forEach [1,2,3,4,5,6,7,8]; {this addmagazine "1Rnd_HE_M203";} forEach [1,2,3,4,5,6,7,8]; this addWeapon "M4A1_RCO_GL"; this selectWeapon "M4A1_RCO_GL"; this addWeapon "Throw"; {this addmagazine "HandGrenade_West";} forEach [1,2,3,4];

{this addmagazine "15Rnd_9x19_M9";} forEach [1,2,3,4]; this addWeapon "M9";

Share this post


Link to post
Share on other sites

That will even overfill pistol mag slots. Oh well, do you ever find out that it doesn't work quite as intended, you need to press f etc, then go back and add the muzzle related code.

@galzohar: Why would you give anyone just a launcher or pistol?

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  

×