Jump to content
Sign in to follow this  
RedRaider

Filling more than 1 ammo crate

Recommended Posts

Greetings all,

Alright I've spent a while searching on the forum for a solution but have not as yet found one, so I apologise in advance if this has indeed been answered already.

I am creating a mission in which I have 2 empty ammo crates. I wish to be able to have text files in my mission folder that contain preset inventories for different types of crate.

For example, the file "WestCrateGuns.txt" contains the following text:

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

clearMagazineCargo this;

this addMagazineCargo ["M16",100];

this addWeaponCargo ["M16",10];

this addMagazineCargo ["M4",100];

this addWeaponCargo ["M4",10];

this addWeaponCargo ["XMS",10];

this addMagazineCargo ["HK",100];

this addWeaponCargo ["HK",10];

this addMagazineCargo ["M21",100];

this addWeaponCargo ["M21",10];

this addMagazineCargo ["HKG3",100];

this addWeaponCargo ["HKG3",10];

this addMagazineCargo ["Steyrmag",100];

this addWeaponCargo ["Steyr",10];

this addMagazineCargo ["M60",100];

this addWeaponCargo ["M60",10];

The file "WestCrateExplosives.txt" contains the following text:

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

clearMagazineCargo this;

this addMagazineCargo ["CarlGustavLauncher",100];

this addWeaponCargo ["CarlGustavLauncher",10];

this addMagazineCargo ["LAWLauncher",100];

this addWeaponCargo ["LAWLauncher",10];

this addMagazineCargo ["AALauncher",100];

this addWeaponCargo ["AALauncher",10];

this addMagazineCargo ["Pipebomb",30];

In the Init section of the first crate I have put:

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

And for the second crate:

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

When I play the mission, the crate with "WestCrateGuns.txt" does not contain the correct weapons. It appears to have M16 magazines and hand grenades, which I presume is the original loadout for that type of crate.

The crate with "WestCrateExplosives.txt" does contain all the correct weapons.

If I delete the explosives crate, then suddenly the guns crate works correctly. But if I have both then only the explosives one works.

Any ideas? Is there some kind of OpFlash problem with having more than one custom-loaded crate?

Any help would be greatly appreciated.

Kind Regards,

RedRaider

Share this post


Link to post
Share on other sites

Hello RedRaider. You can have as many different ammo crates as you wish. I think your problem is when you save your files; make sure you save as all files rather than txt files. And then when triggering in game;

[] exec "WestCrateGuns.sqs" Hope this helps. smile_o.gif

Share this post


Link to post
Share on other sites

Okay just to further confuse you. tounge_o.gif If that still doesn't make your ammo crates work, l think you might try;

clearWeaponCargo first

clearMagazineCargo first

first addMagazineCargo ["M16",100]

first addWeaponCargo ["M16",10]

first addMagazineCargo ["M4",100]

first addWeaponCargo ["M4",10]

first addWeaponCargo ["XMS",10]

first addMagazineCargo ["HK",100]

first addWeaponCargo ["HK",10]

first addMagazineCargo ["M21",100]

first addWeaponCargo ["M21",10]

first addMagazineCargo ["HKG3",100]

first addWeaponCargo ["HKG3",10]

first addMagazineCargo ["Steyrmag",100]

first addWeaponCargo ["Steyr",10]

first addMagazineCargo ["M60",100]

first addWeaponCargo ["M60",10]

So....give your ammo crate name of first (or whatever) and then in init line ; [this] exec "first.sqs" and repeat the same for your second;

clearWeaponCargo second

clearMagazineCargo second

second addMagazineCargo ["CarlGustavLauncher",100]

second addWeaponCargo ["CarlGustavLauncher",10]

second addMagazineCargo ["LAWLauncher",100]

second addWeaponCargo ["LAWLauncher",10]

second addMagazineCargo ["AALauncher",100]

second addWeaponCargo ["AALauncher",10]

second addMagazineCargo ["Pipebomb",30]

and in the init line; [this] exec "second.sqs"

I did test this and it does work. smile_o.gif

Share this post


Link to post
Share on other sites
For example, the file "WestCrateGuns.txt" contains the following text:

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

clearMagazineCargo this;

this addMagazineCargo ["M16",100];

this addWeaponCargo ["M16",10];

this addMagazineCargo ["M4",100];

this addWeaponCargo ["M4",10];

this addWeaponCargo ["XMS",10];

this addMagazineCargo ["HK",100];

this addWeaponCargo ["HK",10];

this addMagazineCargo ["M21",100];

this addWeaponCargo ["M21",10];

this addMagazineCargo ["HKG3",100];

this addWeaponCargo ["HKG3",10];

this addMagazineCargo ["Steyrmag",100];

this addWeaponCargo ["Steyr",10];

this addMagazineCargo ["M60",100];

this addWeaponCargo ["M60",10];

The file "WestCrateExplosives.txt" contains the following text:

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

clearMagazineCargo this;

this addMagazineCargo ["CarlGustavLauncher",100];

this addWeaponCargo ["CarlGustavLauncher",10];

this addMagazineCargo ["LAWLauncher",100];

this addWeaponCargo ["LAWLauncher",10];

this addMagazineCargo ["AALauncher",100];

this addWeaponCargo ["AALauncher",10];

this addMagazineCargo ["Pipebomb",30];

In the Init section of the first crate I have put:

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

And for the second crate:

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

your first try was nearly correct, but you forgot to pass the ammobox-object to the script.

it would work like this:

[this] exec "WestCrateGuns.txt"

[this] exec "WestCrateExplosives.txt"

Share this post


Link to post
Share on other sites

Call the script with this exec "WestCrateGuns.txt" and change all global "this" in the scripts to local "_this".

I think it screws up the script if you use a global "this". Noone can't tell what it stands for in the moment of multiple script executions.

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  

×