Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

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

 
#1 Posted at 2010-10-23 14:15        
     
Greetings fellow Arma fans.

I recently purchased Arma 2 Operation Arrowhead on steam and having a blast (literally). I also started creating simple missions using the editor and I'd now like to create a simple mission where I can see all the available weapons/ammo within Arma 2. I've tried reading some of the guides here and I can't seem to get the script working. I even downloaded some pre-made script a ".sqf" file and tried to use that but everytime I try to do it it says script is not working etc etc.

What I would like is to find a way to create an ammo box/crate/vehicle whatever that will allow me to select any weapon and ammo in the game so that I can try it out and also to create future missions for me and my friends. If there is a program or mod that would do that for me please feel free to suggest that also. If I have to write a script in the init line I will do that also. Any help is highly appreciated.

Thanks!!!


Author Message

Pirin  



Posts: 1547
Rank:


Level: Member

Country: us
Location: Atlanta, GA
Occupation: IT
Age: 43
In-game name: kylania

 
#2 Posted at 2010-10-23 21:44        
     
Here's a script to add every possible (according to your addons) weapon to a box:

ammo.sqf:
/*
Script by Ghost (main design by Kronzky) Will add all weapons, items, magazines to an ammo box and refill it every 1200 seconds. no more manual typing of weapon/magazine/item names.
put null0 = this execVM "scripts\ammo.sqf"; in the initline of an ammo box.
*/

_wepcount = 10;
_magcount = 30;

clearweaponcargo _this;
clearmagazinecargo _this;

_weaponsList = [];
_namelist = [];
_cfgweapons = configFile >> "cfgWeapons";
for "_i" from 0 to (count _cfgweapons)-1 do {
	_weapon = _cfgweapons select _i;
	if (isClass _weapon) then {
		_wCName = configName(_weapon);
		_wDName = getText(configFile >> "cfgWeapons" >> _wCName >> "displayName");
		_wModel = getText(configFile >> "cfgWeapons" >> _wCName >> "model");
		_wType = getNumber(configFile >> "cfgWeapons" >> _wCName >> "type");
		_wscope = getNumber(configFile >> "cfgWeapons" >> _wCName >> "scope");
		_wPic =  getText(configFile >> "cfgWeapons" >> _wCName >> "picture");
		_wDesc = getText(configFile >> "cfgWeapons" >> _wCName >> "Library" >> "libTextDesc");	

		_isFake = false;
		_wHits=0;
		_mags=[];
		_muzzles = getArray(configfile >> "cfgWeapons" >> _wCName >> "muzzles");
		if ((_muzzles select 0)=="this") then {
			_muzzles=[_wCName];
			_mags = getArray(configfile >> "cfgWeapons" >> _wCName >> "magazines");
		} else {
			{
				_muzzle=_x;
				_mags = getArray(configfile >> "cfgWeapons" >> _wCName >> _muzzle >> "magazines");
			}forEach _muzzles;
		};
		{
			_ammo = getText(configfile >> "cfgMagazines" >> _x >> "ammo");
			_hit = getNumber(configfile >> "cfgAmmo" >> _ammo >> "hit");
			_wHits = _wHits + _hit;
		}forEach _mags;

		if ((_wCName!="") && (_wDName!="") && (_wModel!="") && (_wPic!="")) then {
			if !(_wDName in _namelist) then {
				_weaponsList = _weaponsList + [[_wCName,_wDName,_wPic,_wDesc]];
					_namelist = _namelist + [_wDName];
			};
		};
	};
	if (_i % 10==0) then {
		hintsilent format["Loading Weapons List... (%1)",count _weaponsList];
		sleep .0001;
};
};
hint "";
_namelist=nil;

_magazinesList = [];
_namelist = [];
_cfgmagazines = configFile >> "cfgmagazines";
for "_i" from 0 to (count _cfgmagazines)-1 do {
	_magazine = _cfgmagazines select _i;
	if (isClass _magazine) then {
		_mCName = configName(_magazine);
		_mDName = getText(configFile >> "cfgmagazines" >> _mCName >> "displayName");
		_mModel = getText(configFile >> "cfgmagazines" >> _mCName >> "model");
		_mType = getNumber(configFile >> "cfgmagazines" >> _mCName >> "type");
		_mscope = getNumber(configFile >> "cfgmagazines" >> _mCName >> "scope");
		_mPic =  getText(configFile >> "cfgmagazines" >> _mCName >> "picture");
		_mDesc = getText(configFile >> "cfgmagazines" >> _mCName >> "Library" >> "libTextDesc");	

		if ((_mCName!="") && (_mDName!="") && (_mModel!="")) then {
			if !(_mDName in _namelist) then {
				_magazinesList = _magazinesList + [[_mCName,_mDName,_mPic,_mDesc]];
					_namelist = _namelist + [_mDName];
			};
		};
	};
	if (_i % 10==0) then {
		hintsilent format["Loading magazines List... (%1)",count _magazinesList];
		sleep .0001;
};
};
hint "";
_namelist=nil;

while {alive _this} do
{
clearweaponcargo _this;
clearmagazinecargo _this;

for "_i" from 0 to (count _weaponsList)-1 do {
	_weapon = _weaponsList select _i;
	_this addweaponcargo [_weapon select 0,_wepcount];
};

for "_i" from 0 to (count _magazinesList)-1 do {
	_magazine = _magazinesList select _i;
	_this addmagazinecargo [_magazine select 0,_magcount];
};



sleep 1200;
};


Advertisement


Author Message


Posts: 3
Rank:


Level: Member

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

 
#3 Posted at 2010-10-24 00:17        
     
Thanks for the script Pirin.

I have one question - how do I install this script? Do I copy and paste this into notepad and save it as a certain file type? If so, where do I place this file type? What sort of ammo crate do I spawn for this script? I'm sorry if I sound noobish but that's what I am - a total noob at this whole scripting business. If I could get some guidance from you I'd appreciate it. Thanks in advance.


Author Message

Pirin  



Posts: 1547
Rank:


Level: Member

Country: us
Location: Atlanta, GA
Occupation: IT
Age: 43
In-game name: kylania

 
#4 Posted at 2010-10-24 05:09        
     
No problem. This one is actually a bit more complicated than others. It'll fill the crate with EVERY possible weapon you have, which usually isn't what you want. For fun and testing it's OK though.

To use it, copy everything in the code box above and save it as a file called ammo.sqf making sure it's ammo.sqf and not ammo.sqf.txt (see this video to fix that.) Save ammo.sqf to your mission folder (MyDocs\Arma2 Other Profiles\Nickname\Missions\missionname.takistan or whatever).

Then in the Singleplayer -> Editor place any type of ammo box (First place your player, then Empty -> Ammo from the Units option) you want, the contents will be deleted and replaced so it doesn't matter which one and in the ammo box object's init field type:

_nil = this execVM "ammo.sqf";

Then preview the mission and check the crate.


Author Message

VIPER[CWW]  

I'm a stable whore


Posts: 2126
Rank:


Level: Member

Country: en
Location:
Occupation:
Age: 28
In-game name: VIPER [RR]

 
#5 Posted at 2010-10-24 14:03        
     
There are also two other scripts hosted here on armaholic Universal Crate Filler and Fill Ammo Box, both work well you just have to add them to the init of the ammobox (in the editor) read the ReadMe in the packs on how to do this.

Also use the Search Function that Armaholic provides :-)


Author Message


Posts: 3
Rank:


Level: Member

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

 
#6 Posted at 2010-10-27 18:54        
     
Thanks so much. *THUMBS UP*

I'm happily creating crates now *YAHOO*


Author Message


Posts: 1
Rank:


Level: Member

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

 
#7 Posted at 2013-07-12 18:37        
     
hey i got this script and i have a problem with it. So i am making a pvp map and there should be 1 box with all weapons for one team and one box with all weapons for the other team. When i preview it in the editor it works fine but then when i put my server up only one box will have all weapons in it. The other team's box only has 4 m4 carbines and a lot of ammo. i cant figure out why only the one team gets the box to work


Author Message


Posts: 1
Rank:


Level: Member

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

 
#8 Posted at 2014-04-26 05:19        
     
Hey can you help me out? Is there a way so you can use the script obove and have it apear in a crate infront of you after you exicute it.


Author Message


Posts: 67
Rank:


Level: Member

Country: nl
Location: The Netherlands
Occupation: Joint Tast Force 141
Age: 19
In-game name: 2LT D.Reynaert

 
#9 Posted at 2014-04-26 18:24        
     
DaegenJ it is possible with addAction.

Ammobox.sqf:
_player = player;
_player removeaction (_this select 2);
_Ammobox = createVehicle ["USBasicWeaponsBox", player modeltoworld [0,1,0], [], 0, "can_collide"];
nul = _Ammobox execVM "Ammo.sqf";

Unit's init:
this addAction ["Place ammobox", "Ammobox.sqf"]


Author Message


Posts: 1
Rank:


Level: Member

Country: us
Location: Mesquite, Texas
Occupation:
Age: 20
In-game name:

 
#10 Posted at 2017-01-18 14:30        
     
Is it possible to add all the backpacks to the list of things in the crate?

Also, hello to anyone viewing this in 2017!

There's nothing like the feel of stainless steel.