Forum Jump :

Author Message

Tonic  



Posts: 69
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name: Tonic

 
#1 Posted at 2013-03-06 04:53        
     
Hello Armaholic!

This will be my first post as I mainly stick to the BIS forums but it's a bit crazy there at the moment!
Anyways, here is a ammo crate filler script to automatically fill the ammo crate with everything available in the game i.e Rifles,Pistols,Grenades,Mines,Items,Gear,etc

Usage: Just simply place an ammobox on the map via editor and in the initialization field put: nul = [this] execVM "fillCrate.sqf";

Hope you enjoy :)
/*
	@file Version: v0.1
	@file name: fillCrate.sqf
	@file Author: TAW_Tonic
	@file edit: 3/5/2013
	@file Description: Automatically fill ammo box with everything in the game.
	@usage: put in a ammoboxes init field: nul = [this] execVM "fillCrate.sqf";
*/

if(!isServer) exitWith {};
private["_box","_CfgWeapons","_weapons","_items","_wep","_wep_type","_mags","_misc","_mag"];
_box = _this select 0;

clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;
clearItemCargoGlobal _box;
clearBackpackCargoGlobal _box;

_CfgWeapons = configFile >> "cfgWeapons";
_weapons = [];
_items = [];
_misc = [];

for "_i" from 0 to (count _Cfgweapons)-1 do
{
	_weapon = _CfgWeapons select _i;

	if(isClass _weapon) then
	{
		_wep = configName _weapon;
		_wep_type = getNumber(_weapon >> "type");
		_scope = getNumber(_weapon >> "scope");

		if(_scope == 2 && _wep_type != 65536) then
		{
		if(_wep_type in [1,2,4,5,4096] && _wep != "NVGoggles") then
		{
			_weapons set[count _weapons,_wep];
		}
			else
		{
			_items set[count _items,_wep];
		};
		};
	};
};

//Build Throw/Put magazine array
{_misc=_misc+getArray (configFile/"CfgWeapons"/"Throw"/_x/"magazines")} forEach getArray (configFile/"CfgWeapons"/"Throw"/"muzzles");  
{_misc=_misc+getArray (configFile/"CfgWeapons"/"Put"/_x/"magazines")} forEach getArray (configFile/"CfgWeapons"/"Put"/"muzzles");

{
	_box addMagazineCargoGlobal [_x,100];
} foreach _misc;

//Add weapons & Mags
{
	_box addWeaponCargoGlobal [_x,100];
	diag_log format["Weapon %1 added", _x];

	_mags = getArray(configFile >> "CfgWeapons" >> _x >> "magazines");

	if(count _mags > 0) then
	{
		{
			if(!(_x in ((getMagazineCargo _box) select 0))) then
			{
				_box addMagazineCargoGlobal [_x,100];
				diag_log format["Magazine %1 added", _x];
			};
		} foreach _mags;
	};
} foreach _weapons;

//Add Items
{
	_box addItemCargoGlobal [_x,100];
} foreach _items;

Thanks to a example by Celery a ways back for getting Throw/Put items, who would think you need to jump through loops for that o.O

This post was edited by Tonic (2013-03-06 05:19, ago)


Author Message

Blace  



Posts: 2
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2013-03-06 06:05        
     
Hi, thanks for this, i am a total noob and i'm just beginning to understand the scripting, however you script is a bit too advanced for my skillset, would it be possible to also add all backpacks available in the game? I've got my own script working with just a list of backpacks that are supposed to work, but i understand your script just takes every item available?

This sounds futureproof if they decide to add more weapons. Am i correct thinking this way?

Thanks for the help and the script.


Advertisement


Author Message


Posts: 1
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2013-03-06 06:09        
     
Hey man thanks for this but can you figure out how to make it not lag out the server so bad? I mean it is literally crashing server every time


Author Message

Tonic  



Posts: 69
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name: Tonic

 
#4 Posted at 2013-03-06 07:27        
     
# DirtySince90 : Hey man thanks for this but can you figure out how to make it not lag out the server so bad? I mean it is literally crashing server every time

Not quite under standing as to how this is making your server crash, you would have to supply a RPT of the server... I've ran it on about 6 different missions and it doesn't crash the server.

As for the other question, it is meant to be future proof but only time will tell when other weapon sets are in. I'll look into the backpack thing tomorrow.


Author Message


Posts: 8
Rank:


Level: Member

Country: se
Location: Gothenburg
Occupation:
Age: 31
In-game name:

 
#5 Posted at 2013-03-06 08:38        
     
Looking forward to trying this out after work! :D
Thanks!


Author Message


Posts: 156
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age: 45
In-game name:

 
#6 Posted at 2013-03-06 08:48        
     
# Tonic : Hello Armaholic!

This will be my first post as I mainly stick to the BIS forums but it's a bit crazy there at the moment!
Anyways, here is a ammo crate filler script to automatically fill the ammo crate with everything available in the game i.e Rifles,Pistols,Grenades,Mines,Items,Gear,etc

Usage: Just simply place an ammobox on the map via editor and in the initialization field put: nul = [this] execVM "fillCrate.sqf";

Hope you enjoy :)

/*
	@fil
e Version: v0.1
	@file name: fillCrate.sqf
	@file Author: TAW_Tonic
	@file edit: 3/5/2013
	@file Description: Automatically fill ammo box with everything in the game.
	@usage: put in a ammoboxes init field: nul = [this] execVM "fillCrate.sqf";
*/

if(!isServer) exitWith {};
private["_box","_CfgWeapons","_weapons","_items","_wep","_wep_type","_mags","_misc","_mag"];
_box = _this select 0;

clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;
clearItemCargoGlobal _box;
clearBackpackCargoGlobal _box;

_CfgWeapons = configFile >> "cfgWeapons";
_weapons = [];
_items = [];
_misc = [];

for "_i" from 0 to (count _Cfgweapons)-1 do
{
	_weapon = _CfgWeapons select _i;

	if(isClass _weapon) then
	{
		_wep = configName _weapon;
		_wep_type = getNumber(_weapon >> "type");
		_scope = getNumber(_weapon >> "scope");

		if(_scope == 2 && _wep_type != 65536) then
		{
		if(_wep_type in [1,2,4,5,4096] && _wep != "NVGoggles") then
		{
			_weapons set[count _weapons,_wep];
		}
			else
		{
			_items set[count _items,_wep];
		};
		};
	};
};

//Build Throw/Put magazine array
{_misc=_misc+getArray (configFile/"CfgWeapons"/"Throw"/_x/"magazines")} forEach getArray (configFile/"CfgWeapons"/"Throw"/"muzzles");  
{_misc=_misc+getArray (configFile/"CfgWeapons"/"Put"/_x/"magazines")} forEach getArray (configFile/"CfgWeapons"/"Put"/"muzzles");

{
	_box addMagazineCargoGlobal [_x,100];
} foreach _misc;

//Add weapons & Mags
{
	_box addWeaponCargoGlobal [_x,100];
	diag_log format["Weapon %1 added", _x];

	_mags = getArray(configFile >> "CfgWeapons" >> _x >> "magazines");

	if(count _mags > 0) then
	{
		{
			if(!(_x in ((getMagazineCargo _box) select 0))) then
			{
				_box addMagazineCargoGlobal [_x,100];
				diag_log format["Magazine %1 added", _x];
			};
		} foreach _mags;
	};
} foreach _weapons;

//Add Items
{
	_box addItemCargoGlobal [_x,100];
} foreach _items;

Thanks to a example by Celery a ways back for getting Throw/Put items, who would think you need to jump through loops for that o.O
I try this but my ammo crate is empty do I need to name the ammo crate

"-Advanced Combined Operations-";

dyslexic people process language/gammer poorly, but that doesn’t mean they aren't intelligent

Author Message


Posts: 20251
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 41
In-game name: Foxhound

 
#7 Posted at 2013-03-06 09:39        
     
Thanks for posting the script on our forums :-)
I have written a news item about it since so many seem to be in need of such. You can find our mirror here:



Visit my family webshop desteigerhoutshop.nl.

Author Message

Tonic  



Posts: 69
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name: Tonic

 
#8 Posted at 2013-03-06 09:43        
     
# Lightninguk : I try this but my ammo crate is empty do I need to name the ammo crate

All you do is take the content and save in the code as fillCrate.sqf and put it in your missions main directory and then place the ammo box on the map and in the ammo boxes initialization field put: nul = [this] execVM "fillCrate.sqf";

If it doesn't work then you did something wrong.


Author Message


Posts: 155
Rank:


Level: Member

Country: uk
Location: Birmingham, United Kingdom
Occupation:
Age:
In-game name: Haz

 
#9 Posted at 2013-03-06 10:08        
     
Really useful script mate, thanks!

Haz

Author Message


Posts: 156
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age: 45
In-game name:

 
#10 Posted at 2013-03-06 10:18        
     
ok sorted it now thanks great job

"-Advanced Combined Operations-";

dyslexic people process language/gammer poorly, but that doesn’t mean they aren't intelligent

Author Message

mrew  



Posts: 14
Rank:


Level: Member

Country: si
Location:
Occupation:
Age:
In-game name: mrew

 
#11 Posted at 2013-03-06 12:04        
     
Thanks for the script...i will need it and use it.Greetings


Author Message


Posts: 15
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name:

 
#12 Posted at 2013-03-07 03:33        
     
I am using this as well, and running into the problem that clients can't put on say... a wetsuit, unless they drag it to the ground first.

Another client couldn't put on his wetsuit no matter what manner of dragging and dropping he tried.

The host could drag/drop from the crate just dandy however.

Any thoughts on this?


Author Message


Posts: 7
Rank:


Level: Member

Country: us
Location: Florida
Occupation:
Age:
In-game name: Anubis77

 
#13 Posted at 2013-03-07 03:42        
     
Really quick question, I have downloaded the ammo filler script but where is the ammo box object?? In ARMA 2 I just went to F1 Units, then "Empty" and it was right there. In this game, I only have five options (Opfor, Blufor, Independent, Civilian, Ambient Life). There's no ammo boxes that I can see...


Author Message

Blace  



Posts: 2
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#14 Posted at 2013-03-07 04:11        
     
# lonewolf_sx : Really quick question, I have downloaded the ammo filler script but where is the ammo box object?? In ARMA 2 I just went to F1 Units, then "Empty" and it was right there. In this game, I only have five options (Opfor, Blufor, Independent, Civilian, Ambient Life). There's no ammo boxes that I can see...

Hi there, make sure you first place a normal blufor unit, then the 'empty' options becomes available.


Author Message

Tajin  



Posts: 433
Rank:


Level: Member

Country: de
Location: Bavaria
Occupation: Communications Designer
Age: 33
In-game name: Tajin

 
#15 Posted at 2013-03-07 15:59        
     
# Sappo569 : I am using this as well, and running into the problem that clients can't put on say... a wetsuit, unless they drag it to the ground first.

Another client couldn't put on his wetsuit no matter what manner of dragging and dropping he tried.

The host could drag/drop from the crate just dandy however.

Any thoughts on this?
This is more of an A3-alpha problem and not really related to this script. (which works just fine)

There are a lot of very capable people on this forum, willing to spend some of their time to help you out. So if you have a problem, it surely isn't too much to ask that you atleast take the time to describe it properly. Thanks.