OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: ArMaTeC on 09 Jun 2007, 21:40:04

Title: (Accepted) Ammo box filler
Post by: ArMaTeC on 09 Jun 2007, 21:40:04
ok i was lookign for a way to fill the ammo boxs so that they stay full of goodies
Code: [Select]
// AmmoBox filler
// By ArMaTeC
//
// Usage: res=[boxname]execVM"ammobox.sqf";
// Edited: 29.06.07 05:41
_boxname = _this select 0;
while {true} do
{
_waitrnd = random 600;
_count = 10+random 20;
_West_weap = ["M16A2","M16A2GL","M16A4","M16A4_GL","M16A4_ACG","M16A4_ACG_GL","M4","M4GL","M4AIM","M4A1SD","M4SPR","M4A1","M4A1GL","G36K","G36C","G36A","MP5A5","MP5SD","M249","M240","M24","M107","M9","M9SD","M136","JAVELIN","STINGER"];
_East_weap = ["AK74","AK74GL","AKS74U","AKS74UN","AKS74PSO","PK","SVD","KSVK","MAKAROV","MAKAROVSD","RPG7V","STRELA"];
_West_ammo = ["30Rnd_556x45_Stanag","20Rnd_556x45_Stanag","30Rnd_556x45_StanagSD","30Rnd_556x45_G36","30Rnd_9x19_MP5","30Rnd_9x19_MP5SD","200Rnd_556x45_M249","100Rnd_762x51_M240","5Rnd_762x51_M24","10Rnd_127x99_M107","15Rnd_9x19_M9","15Rnd_9x19_M9SD","M136","JAVELIN","STINGER","FlareWhite_M203","FlareGreen_M203","FlareRed_M203","FlareYellow_M203","1Rnd_HE_M203"];
_East_ammo = ["30Rnd_545x39_AK","30Rnd_545x39_AKSD","100Rnd_762x54_PK","10Rnd_762x54_SVD","5Rnd_127x108_KSVK","8Rnd_9x18_Makarov","8Rnd_9x18_MakarovSD","PG7V","PG7VR","FlareWhite_GP25","FlareGreen_GP25","FlareRed_GP25","FlareYellow_GP25","1Rnd_HE_GP25"];
_Misc_ammo = ["HandGrenade","HandGrenadeTimed","SmokeShell","SmokeShellRed","SmokeShellGreen","PipeBomb","TimeBomb","Mine","MineE","Laserbatteries"];
{_boxname removeWeapon _x;} forEach Weapons _boxname;
{_boxname removeMagazine _x;} forEach magazines _boxname;
{_boxname addWeaponCargo [_x,_count];} forEach _West_weap;
{_boxname addWeaponCargo [_x,_count];} forEach _East_weap;
{_boxname addMagazineCargo [_x,_count];} forEach _West_ammo;
{_boxname addMagazineCargo [_x,_count];} forEach _East_ammo;
{_boxname addMagazineCargo [_x,_count];} forEach _Misc_ammo;
_wait = 60 + _waitrnd;
sleep _wait;
_reWait = _time + 60;
waitUntil {(!Alive _boxname) && (_time < _reWait);};
_boxname setdammage 0;
};

added demo
Title: Re: Ammo box filler
Post by: Mr.Peanut on 09 Jun 2007, 22:59:30
Where is
Code: [Select]
six_fRndIntpdefined?
Title: Re: Ammo box filler
Post by: ArMaTeC on 11 Jun 2007, 05:46:59
fixed
Title: Re: Ammo box filler
Post by: hoz on 27 Jun 2007, 16:50:10
Does this work in MP? How about a demo mission?
Title: Re: Ammo box filler
Post by: Mandoble on 27 Jun 2007, 17:47:09
_Unitname ??? :blink: :whistle:

Code: [Select]
{_boxname removeWeapon _x;} forEach Weapons _Unitname;
{_boxname removeMagazine _x;} forEach magazines _Unitname;

Code: [Select]
res=[_boxname]execVM"ammobox.sqf";
if (true) exitWith {};


You dont need any if (true) exitWith {}; and you are excuting the script over&over for the same ammo box. You may that with a simple while

Code: [Select]
...
...
...

while {true} do
{
   ...
   ...
   ...
   ...
   ...

waitUntil {(!Alive _boxname) && (_time < _reWait);};
_boxname setdammage 0;
sleep 1.0;
};

Title: Re: Ammo box filler
Post by: ArMaTeC on 29 Jun 2007, 07:50:38
edited top post sorry i posted this when i was really new at it learning every day
Title: Re: Ammo box filler
Post by: hoz on 30 Jun 2007, 19:26:23
It would be really nice if you included a demo mission with it.
Title: Re: Ammo box filler
Post by: ArMaTeC on 01 Jul 2007, 01:56:20
demo added hoz
Title: Re: (Accepted) Ammo box filler
Post by: hoz on 05 Sep 2007, 17:24:43
I added this resource to the Editors Depot. However I had a thought that you could get the ammo and weapons names via the config. This would make this script work with future addons which you won't know about until they come out.