PDA

View Full Version : Ammo box issue



MikeJHunter
Jun 8 2012, 18:27
What am I missing here?



//................................
// Ammo Box Germany
//................................

// Settings
_amountWeapon = 20;
_amountAmmo = 30;
_refreshTime = 360; // refill every 5 minutes

_this allowDamage false;

// Loop forever
while {true} do
{

// Clear box
clearWeaponCargo _this;
clearMagazineCargo _this;

// Fill box



// German Weapons
_this addWeaponCargo ["LIB_MP40", _amountWeapon];
_this addWeaponCargo ["LIB_M1908", _amountWeapon];
_this addWeaponCargo ["LIB_K98", _amountWeapon];
_this addWeaponCargo ["LIB_MG42", _amountWeapon];
_this addWeaponCargo ["LIB_MP44", _amountWeapon];
_this addWeaponCargo ["LIB_K98ZF39", _amountWeapon];
_this addWeaponCargo ["LIB_FLARE_PISTOL", _amountWeapon];
_this addWeaponCargo ["LIB_RPzB", _amountWeapon];

//Ammo
_this addMagazineCargo ["LIB_32Rnd_9x19", _amountAmmo];
_this addMagazineCargo ["lib_8rnd_9x19", _amountAmmo];
_this addMagazineCargo ["lib_5Rnd_792x57", _amountAmmo];
_this addMagazineCargo ["lib_50Rnd_792x57", _amountAmmo];
_this addMagazineCargo ["LIB_1Rnd_RPzB", _amountAmmo];
_this addMagazineCargo ["LIB_1Rnd_flare_yellow", _amountAmmo];
_this addMagazineCargo ["LIB_1Rnd_flare_green", _amountAmmo];
_this addMagazineCargo ["LIB_1Rnd_flare_red", _amountAmmo];
_this addMagazineCargo ["LIB_1Rnd_flare_white", _amountAmmo];
_this addMagazineCargo ["LIB_Ladung_Big_MINE_mag", _amountAmmo];


// Wait the duration of the timer
sleep _refreshTime;
};

Junker
Jun 8 2012, 22:34
need to know what the problem u r getting ?

MikeJHunter
Jun 8 2012, 23:59
The ammo boxes don't fill with the proper loads.

Junker
Jun 9 2012, 14:03
you might be over filling them (look up capacity in ammo boxes in the wiki) or you might need a slight pause before the loop.

MikeJHunter
Jun 9 2012, 14:47
Tried reducing the amounts still same effect.

Junker
Jun 9 2012, 16:09
the stuff in the box is just the vanilla stock right ?

I dont think the script knows where to put the stuff cus _this isnt directed to anything.
U need a line - _box = _this select 0 and change all the _this to _box
in the box init - [this] exec "ammobox".sqf

not good at sqf, still learning it but i think thats ur problem..

MikeJHunter
Jun 9 2012, 19:15
That did it! Now I just need to finish converting the CTF module over and add a no base attack and my TvT CTF mission will be done.

Tay-uk
Oct 9 2012, 17:12
Could you post the working script please?

Thanks

Günter Severloh
Oct 10 2012, 12:59
You could just define the number of weapons being added like this:

_this addweaponcargo ["M9SD", 20];
_this addmagazinecargo ["15Rnd_9x19_M9SD", 20];
Just an example of course, replace the weapon classname with one you want.

The 2nd number in the first line is the amont of that weapon being added
and the 2nd code the last number which is 20 is the amount of clips being added
so 20 clips of 15rds.

This is simpler script below:


if isnull _this exitwith {};
clearweaponcargo _this;
clearmagazinecargo _this;

_this addweaponcargo ["M9SD", 20];
_this addmagazinecargo ["15Rnd_9x19_M9SD", 20];

Just replace the modern day weapon you see there with the IF classnames,

So for every weapon you want to add just copy n paste this code:
_this addweaponcargo ["M9SD", 20];

and then replace the classname with a new one.
it will need ammo too, so for every weapon you add you need a corresponding ammo, so you need this too:
_this addmagazinecargo ["15Rnd_9x19_M9SD", 20];
============
Create a script with this tool:
http://www.armaholic.com/page.php?id=1455&highlight=ARMAEDIT

start new, choose Sqf

name the script Ammo

Copy n paste this:

if isnull _this exitwith {};
clearweaponcargo _this;
clearmagazinecargo _this;

_this addweaponcargo ["M9SD", 20];
_this addmagazinecargo ["15Rnd_9x19_M9SD", 20];

(change the classnames with IF ones)

Then in the editor in the init of the ammo box just put this code:

_dummy = this execvm "ammo.sqf";