Jump to content
Sign in to follow this  
DesolateChris

Refill Ammobox Script

Recommended Posts

Hey so I've encountered a slight problem whilst placing ammoboxes...

Basically, I want a default ruck box to refill after x seconds but I can't seem to get the script for this. I've searched the forums but all the posts about refilling ammoboxes give scripts for custom ammoboxes which is not what I want, I want to use the default ACE ruckbox but have it refill. I've tried sleep and refill delays but doesn't work.

I'm guessing this is an easy fix but I'm not the best at scripting so please help :3

Thanks in advance :)

Share this post


Link to post
Share on other sites

// Default Ammobox Content Refiller by Harzach
// nul = this execVM "ammocrate.sqf";

private ["_mags","_weaps"];

// Get default contents at mission init
_mags = getMagazineCargo _this;
_weaps = getWeaponCargo _this;

// Refill loop
while {alive _this} do
{
sleep 600;

clearMagazineCargo _this;
clearWeaponCargo _this;

   for "_i" from 0 to (count (_mags select 0)) do
{_this addMagazineCargoGlobal [(_mags select 0) select _i, (_mags select 1) select _i]};

   for "_i" from 0 to (count (_weaps select 0)) do
{_this addWeaponCargoGlobal [(_weaps select 0) select _i, (_weaps select 1) select _i]};
};

This should work with any crate, ACE, ACRE or otherwise. Change the sleep value to whatever value works for you.

Edited by Harzach

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  

×