Jump to content
Sign in to follow this  
CrazyAce

Ammobox refil or infinity ammo in ammobox

Recommended Posts

I have no idea what to do here and am asking how can an ammobox have unlimited ammo, or if its easier to have the ammobox respawn the ammo taken from the box?

Share this post


Link to post
Share on other sites

No idea about infinite ammo, but it is easy to make a script which checks the box say...every 2 mins if the ammo count has dropped below the treshold and then refill it. It could be bigger than 2 mins too...I doubt anyone can empty it in 2 mins. Just don't make it check the box constantly w/o any delay (can seriously slow down the game)

Share this post


Link to post
Share on other sites
No idea about infinite ammo, but it is easy to make a script which checks the box say...every 2 mins if the ammo count has dropped below the treshold and then refill it. It could be bigger than 2 mins too...I doubt anyone can empty it in 2 mins. Just don't make it check the box constantly w/o any delay (can seriously slow down the game)

Thank you for replying, I did a search here:

http://www.armaholic.com/forums.php?m=posts&p=20698#20698

And came across to the closest match, but I don't know what I need from the script or what format to save the script as and how to call the script. I asked Myke in the above link in PM, but didn't get the response that would be helpful, as I didn't ask the right question.

If someone can help me figure this problem out I as well as others would be grateful.

Share this post


Link to post
Share on other sites

You are making a mission?

Put a text file into your mission folder. Name it like ammoboxCheck.sqf

Then into the init line of the ammo box in the editor

nul=[this] execVM "ammoboxCheck.sqf"

In the ammoBox.sqf you have the code bit like in the link you posted

Share this post


Link to post
Share on other sites

Thank you once again, yes I am creating a SP mission.

For ACE weapon/ammo boxes I will need to input each box contents for each corresponding boxes, otherwise the items not in the list will not respawn?

_West_weap = ["",""]
_West_ammo = ["",""]

I'm going to assume that I only need to use the script provided as is (+ the ACE contents) by Myke on the second post in the above link into the *.sqf file.

_boxname = _this select 0;
while {true} do
{
_West_weap = ["ACE_WEAPON,ACE_WEAPON"];
_West_ammo = ["ACE_AMMO,ACE_AMMO"];
{_boxname removeWeapon _x;} forEach Weapons _boxname;
{_boxname removeMagazine _x;} forEach magazines _boxname;
{_boxname addWeaponCargo [_x,_count];} forEach _West_weap;
{_boxname addMagazineCargo [_x,_count];} forEach _West_ammo;
{_boxname addMagazineCargo [_x,_count];} forEach _Misc_ammo;
waitUntil {(!Alive _boxname)};
_boxname setdammage 0;
};

:edit:

I can't seem to get it to work... I wonder if _boxname has to be the name of the ACE weapon box?

Edited by CrazyAce

Share this post


Link to post
Share on other sites

The code in your post is not quite fully working. Besides it is supposted to respawn the box only when it is destroyed.

The 1st line in the code (_boxname = _this select 0;) sets the _boxname as the first given parameter to the script. IF you set the "nul=[this] execVM "ammoCheck.sqf") into the init line of the ammobox (in the editor), _boxname is initalized with the boxname of the box ('this' is a reserved word meaning in that situation the object who's init line it is).

The setdammage 0 in hte original script probably doesn't fix a destroyed box (at least it didn't fix a destroyed car when I tryed it once). In that case you have to delete the old one and make a new one.

I fixed the code quickly (not tested so it might give errors) and in principle it should work like this...

// YOU HAVE TO FILL THE PROPER WEAPON NAMES HERE!!!
_West_weap = [ ["M16A4",12],["M4",8],["M4AIM",4] ]; // ...

// YOU HAVE TO FILL THE PROPER MAGAZINE NAMES HERE!!!
_West_ammo = [ ["30Rnd_556x45_Stanag",100],["1Rnd_HE_M203",50] ];  // ...


_boxname = _this select 0;

while {true} do
{

clearWeaponCargo _boxname;
clearMagazineCargo _boxname;
{_boxname addWeaponCargo [_x select 0,_x select 1];} forEach _West_weap;
{_boxname addMagazineCargo [_x select 0,_x select 1];} forEach _West_ammo;

// check the situation every 2-2.5 mins
sleep (120+random 30);

_boxname setdammage 0;
if( !alive _boxname) then {
  _newbox = (typeOf _boxname) createvehicle (getpos _boxname);
  _newbox setpos (getpos _boxname);
  deletevehicle _boxname;
 _boxname = _newbox;
};

};

Note that I changed the waepons and ammo lists/arrays so that they have ["weapon",count] and ["magazine",count] pairs, so that you can have different count for each type. I don't know ACE weapon names, but BIS names are here...

http://community.bistudio.com/wiki/ArmA:_Weapons

Share this post


Link to post
Share on other sites

Ah yes, that is starting to make sense thank you for pointing that out. I did find and convert ACE1.07 weapon config.cpp file and it lists all the weapons + magazines in the file and wow there are a lot. The weapons are easy to find, except for the mags for each weapon usage takes more time to hunt down in that file.

I'll give this script a try and fill in the weap, ammo blanks with ACE contents and see if it works. And from looking at the script it should respawn a new ammobox around every 2 minutes.

Share this post


Link to post
Share on other sites

yes, it refills the box in every 2 mins. It recreates the box only if it is destroyed. Note the "!" in the test. It inverts the logic. It can be written also as "not alive _boxname"

Share this post


Link to post
Share on other sites

:EDIT:

Nevermind, its working. Thank you for the help.

Edited by CrazyAce

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  

×