Jump to content
Sign in to follow this  
Parto

Add Magazine in Ammo Crates

Recommended Posts

Hi Guys,

I making mission and script. I have a problem for remove magazines in Ammo Crates. The script is init.sqs

; Ammo Crate West #1

RemoveMagazines ["handgrenade"];

AC_W1 AddWeaponCargo ["HK", 10];

AC_W1 AddWeaponCargo ["M16", 10];

AC_W1 AddWeaponCargo ["G36a", 10];

AC_W1 AddMagazineCargo ["HK", 30];

AC_W1 AddMagazineCargo ["M16", 30];

AC_W1 AddMagazineCargo ["G36aMag", 30];

; Ammo Crate West #2

RemoveMagazines ["handgrenade"];

AC_W2 AddWeaponCargo ["HK", 10];

AC_W2 AddWeaponCargo ["M16", 10];

AC_W2 AddWeaponCargo ["G36a", 10];

AC_W2 AddMagazineCargo ["HK", 30];

AC_W2 AddMagazineCargo ["M16", 30];

AC_W2 AddMagazineCargo ["G36aMag", 30];

; Ammo Crate West #3

RemoveMagazines ["handgrenade"];

AC_W3 AddWeaponCargo ["HK", 10];

AC_W3 AddWeaponCargo ["M16", 10];

AC_W3 AddWeaponCargo ["G36a", 10];

AC_W3 AddMagazineCargo ["HK", 30];

AC_W3 AddMagazineCargo ["M16", 30];

AC_W3 AddMagazineCargo ["G36aMag", 30];

If you think the remove magazine make mistake. Tell me. I has already fix add ammo but one problem I couldnt remove handgrenade

Anyone can help me please and will be great appreciate.

Regards

Parto

Share this post


Link to post
Share on other sites

RemoveMagazines can be used on units, not on objects/vehicles.

You must clear all the weapons and magazines from the cargo space of the ammo crate(s), or you'll just add a new set of magazines and weapons to the original/already egsisting one (therefore the handgrenades are still there). As I can also see the crate's cargo is the same in all three cases, so it's easier to make one separate script for all of them. Give script a name (let's say 'ammo_crate'), and run it from the crates' Initialisation field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this] exec "ammo_crate.sqs"

Here is the script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_crate = _this select 0

clearMagazineCargo _crate

clearWeaponCargo _crate

_crate addWeaponCargo ["HK", 10]

_crate addWeaponCargo ["M16", 10]

_crate addWeaponCargo ["G36a", 10]

_crate addMagazineCargo ["HK", 30];

_crate addMagazineCargo ["M16", 30];

_crate addMagazineCargo ["G36aMag", 30];

exit

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  

×