Home   Help Search Login Register  

Author Topic: (Accepted) Ammo box filler  (Read 3416 times)

0 Members and 1 Guest are viewing this topic.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
(Accepted) Ammo box filler
« 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
« Last Edit: 05 Sep 2007, 17:23:29 by hoz »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Ammo box filler
« Reply #1 on: 09 Jun 2007, 22:59:30 »
Where is
Code: [Select]
six_fRndIntpdefined?
urp!

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: Ammo box filler
« Reply #2 on: 11 Jun 2007, 05:46:59 »
fixed

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: Ammo box filler
« Reply #3 on: 27 Jun 2007, 16:50:10 »
Does this work in MP? How about a demo mission?
Xbox Rocks

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Ammo box filler
« Reply #4 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;
};

« Last Edit: 27 Jun 2007, 17:59:05 by Mandoble »

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: Ammo box filler
« Reply #5 on: 29 Jun 2007, 07:50:38 »
edited top post sorry i posted this when i was really new at it learning every day

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: Ammo box filler
« Reply #6 on: 30 Jun 2007, 19:26:23 »
It would be really nice if you included a demo mission with it.
Xbox Rocks

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: Ammo box filler
« Reply #7 on: 01 Jul 2007, 01:56:20 »
demo added hoz

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: (Accepted) Ammo box filler
« Reply #8 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.
Xbox Rocks