Jump to content
tonic-_-

Virtual Ammobox System (VAS)

Recommended Posts

Hi all Im new to editing but have made a complete mission, all that is holding it up is the VAS, ive added an ammo box and then I added the "this addAction["<t color=#ff1111'>Virtual Ammobox</t>", "VAS\open.sqf];" into its initialization field and then Ive added the

#include "VAS\menu.hpp"

class CfgFunctions

{

#include "VAS\cfgfunctions.hpp"

};

line in my description, and I have the red lettering saying that its the virtual ammobox but when I go to use it i get an error saying Cannot find Script VAS\open.sqf Ive tried both the "old and new" initialization lines, ive tried both #include lines that you see on the Armaholic VAS download page and get that error ever time, what am I missing? please help if you can.

Share this post


Link to post
Share on other sites

I found a bug. If you click [Load] button continuously in Load dialog, all of itmes are duplicated.

And I have a suggestion in fn_loadoutInfo.sqf file. Following code will display items quantity in Save or Load dialog.

Display items quantity in Save or Load dialog.

#include "macro.sqf"
/*
@version: 1.1
@file_name: fn_loadoutInfo.sqf
@file_author: TAW_Tonic
@file_edit: 5/27/2013
@file_description: Pulls up the selected saved slots loadout.
*/
private["_control","_slot","_type","_loadout"];
_type = _this select 0;
disableSerialization;

switch (_type) do
{
case 0: {_control = VAS_getControl(VAS_save_Display,VAS_save_fetch); _slot = lbCurSel VAS_save_list;};
case 1: {_control = VAS_getControl(VAS_load_Display,VAS_load_fetch); _slot = lbCurSel VAS_load_list};
};

lbClear _control;

if(_slot == -1) exitWith {hint "You didn't select a slot!";}; //No slot selected
if(vas_disableLoadSave) then
{
_loadout = missionNamespace getVariable format["vas_gear_new_%1",_slot];
}
else
{
_loadout = profileNamespace getVariable format["vas_gear_new_%1",_slot];
};

if(isNil {_loadout}) exitWith {(VAS_getControl(VAS_save_Display,VAS_save_text)) ctrlSetText "Custom Loadout Name";}; //No information in this slot.
if(_type == 0) then
{
(VAS_getControl(VAS_save_Display,VAS_save_text)) ctrlSetText (_loadout select 0);
};

// Original Code
/*
{
switch(typeName _x) do
{
	case "STRING":
	{
		_details = [_x] call VAS_fnc_fetchCfgDetails;
		if(count _details > 0) then
		{
			_control lbAdd format["%1", (_details select 1)];
			_control lbSetPicture [(lbSize _control)-1,(_details select 2)];
		};
	};

	case "ARRAY":
	{
		{
			_details = [_x] call VAS_fnc_fetchCfgDetails;
			if(count _details > 0) then
			{
				_control lbAdd format["%1", (_details select 1)];
				_control lbSetPicture [(lbSize _control)-1,(_details select 2)];
			};
		} foreach _x;
	};
};
} foreach _loadout;
*/

// Modified Code
private ["_listItems","_loadout_array","_className","_name"];
_loadout_array = [];
{
switch(typeName _x) do {
	case "STRING": {
		_loadout_array = _loadout_array + [_x];
	};
	case "ARRAY": {
		{
			_loadout_array = _loadout_array + [_x];
		} forEach _x;
	};
};
} forEach _loadout;

_listItems = [];
{
_className = _x;
_details = [_x] call VAS_fnc_fetchCfgDetails;
if(count _details > 0) then {
	_name = (_details select 1);
	if (_listItems find _name < 1) then {
		_control lbAdd format["[%1] %2",({_x == _className} count _loadout_array),_name];
		_control lbSetPicture [(lbSize _control)-1,(_details select 2)];
		_listItems = _listItems + [_name];
	};
};
} forEach _loadout_array;

Solution for the duplicating bug.

#include "macro.sqf"
/*
@version: 1.1
@file_name: fn_loadGear.sqf
@file_author: TAW_Tonic
@file_edit: 5/27/2013
@file_description: Load saved gear in old VAS format.
*/
private["_slot","_loadout","_primary","_launcher","_handgun","_magazines","_uniform","_vest","_backpack","_items","_primitems","_secitems","_handgunitems","_uitems","_vitems","_bitems","_handle"];
_slot = if(isNil {_this select 0}) then {lbCurSel VAS_load_list} else {_this select 0};
if(_slot == -1) exitWith {hint "You didn't select a slot to load!";};
// Added by naong
scopeName "main";
if (isNil "vas_nowLoading") then {
vas_nowLoading = true;
} else {
if (vas_nowLoading) then {
	breakOut "main";
} else {
	vas_nowLoading = true;
};
};
/////////////////

if(vas_disableLoadSave) then
{
_loadout = missionNamespace getVariable format["vas_gear_new_%1",_slot];
}
else
{
_loadout = profileNamespace getVariable format["vas_gear_new_%1",_slot];
};

if(isNil {_loadout}) exitWith {}; //Slot data doesn't exist
_primary = _loadout select 1;
_launcher = _loadout select 2;
_handgun = _loadout select 3;
_magazines = _loadout select 4;
_uniform = _loadout select 5;
_vest = _loadout select 6;
_backpack = _loadout select 7;
_items = _loadout select 8;
_primitems = _loadout select 9;
_secitems = _loadout select 10;
_handgunitems = _loadout select 11;
_uitems = _loadout select 12;
_vitems = _loadout select 13;
_bitems = _loadout select 14;

//Strip the unit down
RemoveAllWeapons player;
{player removeMagazine _x;} foreach (magazines player);
removeUniform player;
removeVest player;
removeBackpack player;
removeGoggles player;
removeHeadGear player;
{
player unassignItem _x;
player removeItem _x;
} foreach (assignedItems player);

//Add the gear
if(_uniform != "") then {[_uniform,true,nil,nil,nil] spawn VAS_fnc_handleItem;};
if(_vest != "") then {[_vest,true,nil,nil,nil] spawn VAS_fnc_handleItem;};
if(_backpack != "") then {[_backpack,true,nil,nil,nil] spawn VAS_fnc_handleItem;};
{
_handle = [_x,true,nil,nil,nil] spawn VAS_fnc_handleItem;
waitUntil {scriptDone _handle};
} foreach _magazines;

if(_primary != "") then {[_primary,true,nil,nil,nil] spawn VAS_fnc_handleItem;};
if(_launcher != "") then {[_launcher,true,nil,nil,nil] spawn VAS_fnc_handleItem;};
if(_handgun != "") then {[_handgun,true,nil,nil,nil] spawn VAS_fnc_handleItem;};

{_handle = [_x,true,nil,nil,nil] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach _items;
{_handle = [_x,true,nil,nil,true] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_uitems);
{_handle = [_x,true,nil,nil,true] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_vitems);
{_handle = [_x,true,true,nil,nil] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_bitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_primitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_secitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_handgunitems);

if(primaryWeapon player != "") then
{
player selectWeapon (primaryWeapon player);
};

// Added by naong
vas_nowLoading = false;
/////////////////

Edited by naong
Added solution for duplicating bug

Share this post


Link to post
Share on other sites
any chance the Update will released soon?

You are new here, so I'll say it slowly. An author is doing this for free - they owe you nothing - and therefore asking them will NOT speed up the coding. Better just wait it out, like the rest of us, as it will be ready SoonTM.

Share this post


Link to post
Share on other sites

UPDATE: 1.2

Credits / Thanks:

naong - For his code tweaks to the Load / Save display.

Change log:

Changed: Tweaks to VAS_fnc_handleItem for better handling in future.

Changed: Tweaks to VAS_fnc_fetchCfgDetails (Should display Ghillie suits till BIS fixes the config entries).

Changed: Tweaks to VAS_fnc_buildConfig for future use, Range finder and other binocs should show as a weapon.

Changed: Tweaks to UI Experience, should no longer flash when adding/removing items.

Added: Ability to remove all magazines of a type or items of a type.

Added: Double clicking on a weapon/item/whatever adds it.

Added: Double clicking on a weapon/item/whatever removes it.

Changed: Tweaks to the save/load display, items are now grouped and show in quantity thanks to naong.

Changed: Tweaks to load option to prevent excessive magazines being added when spamming Load.

Download:

Virtual Ammobox System (1.2)

Hi all Im new to editing but have made a complete mission, all that is holding it up is the VAS, ive added an ammo box and then I added the "this addAction["<t color=#ff1111'>Virtual Ammobox</t>", "VAS\open.sqf];" into its initialization field and then Ive added the

#include "VAS\menu.hpp"

class CfgFunctions

{

#include "VAS\cfgfunctions.hpp"

};

line in my description, and I have the red lettering saying that its the virtual ammobox but when I go to use it i get an error saying Cannot find Script VAS\open.sqf Ive tried both the "old and new" initialization lines, ive tried both #include lines that you see on the Armaholic VAS download page and get that error ever time, what am I missing? please help if you can.

You didn't move the folder VAS into your missions directory,

If you are making your mission through the Editor at the main menu it will be located at:

Documents\Arma 3 Alpha\missions\yourmissiontitle.stratis or Documents\Arma 3 Alpha - Other Profiles\Profilename\missions

If you are using the MP Editor then instead of missions its mpmissions.

Edited by Tonic-_-

Share this post


Link to post
Share on other sites

great ammo box tonic, im using it in my mission im building now, it automatically adds the new snipers which is cool!

love the save loadout thing aswell

Share this post


Link to post
Share on other sites

UPDATE: 1.2

Credits / Thanks:

naong - For his code tweaks to the Load / Save display.

....

Thanks for Update, u rock! :)

Share this post


Link to post
Share on other sites

Hi I'm getting a message that says "VAS never initialized something went wrong?". Am I missing some trivial detail?

I'm quite sure I've got the folders in the correct place.

Share this post


Link to post
Share on other sites
Hi I'm getting a message that says "VAS never initialized something went wrong?". Am I missing some trivial detail?

I'm quite sure I've got the folders in the correct place.

If you're getting that then the only thing I can tell you is you didn't put the class CfgFunctions in your description.ext because that is how VAS compiles its self.

Thunder666;2409396']in the newest version i verrey often get "VAS hasnt loading yet" .:( Trying 2 reconnect' date=' no chance . What can i do ?[/quote']

Need more details then that to help with a solution. If you are running addons like AiA and ACRE it may take an extremely long time to build the configs.

Share this post


Link to post
Share on other sites
Need more details then that to help with a solution. If you are running addons like AiA and ACRE it may take an extremely long time to build the configs.

running a clean vamnila Arma 3 !

Share this post


Link to post
Share on other sites

Thanks for a great script :)

I know all ACRE items are filtered out by default but is it possible for me as a total script-noob to add some of the radios into the list again? We use ACRE quite heavily and it would be great to have it in VAS on our missions.

No biggie if it's not, we'll just continue the oldfashioned way :)

Share this post


Link to post
Share on other sites

hi Tonic-_-,

I have a suggestion for improve script performance.

Currently you are using 'spawn' command rather than 'call' command. If you not use time critical loop script, I recommend use 'call' command. It's faster than 'spawn' command.

For example in 'fn_loadGear.sqf' file

//Original Code
/*
{_handle = [_x,true,nil,nil,nil] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach _items;
{_handle = [_x,true,nil,nil,true] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_uitems);
{_handle = [_x,true,nil,nil,true] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_vitems);
{_handle = [_x,true,true,nil,nil] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_bitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_primitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_secitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_handgunitems);
*/

// Modified Code
{[_x,true,nil,nil,nil] call VAS_fnc_handleItem;} foreach _items;
{[_x,true,nil,nil,true] call VAS_fnc_handleItem;} foreach (_uitems);
{[_x,true,nil,nil,true] call VAS_fnc_handleItem;} foreach (_vitems);
{[_x,true,true,nil,nil] call VAS_fnc_handleItem;} foreach (_bitems);
{[_x,true,nil,true,nil] call VAS_fnc_handleItem;} foreach (_primitems);
{[_x,true,nil,true,nil] call VAS_fnc_handleItem;} foreach (_secitems);
{[_x,true,nil,true,nil] call VAS_fnc_handleItem;} foreach (_handgunitems);

You can also use this command in 'fn_handleItem.sqf', 'fn_mainDisplay.sqf', 'load_onrespawn.sqf', 'fn_removeGear.sqf', 'fn_saveGear.sqf', 'fn_SaveLoad.sqf', 'misc_functions.sqf', 'add_gear.sqf' and 'fn_deleteGear.sqf' file.

It will improve VAS performance.

Share this post


Link to post
Share on other sites
Thunder666;2409412']running a clean vamnila Arma 3 !
hi Tonic-_-' date='

I have a suggestion for improve script performance.

Currently you are using 'spawn' command rather than 'call' command. If you not use time critical loop script, I recommend use 'call' command. It's faster than 'spawn' command.

For example in 'fn_loadGear.sqf' file

//Original Code
/*
{_handle = [_x,true,nil,nil,nil] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach _items;
{_handle = [_x,true,nil,nil,true] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_uitems);
{_handle = [_x,true,nil,nil,true] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_vitems);
{_handle = [_x,true,true,nil,nil] spawn VAS_fnc_handleItem; waitUntil {scriptDone _handle};} foreach (_bitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_primitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_secitems);
{[_x,true,nil,true,nil] spawn VAS_fnc_handleItem;} foreach (_handgunitems);
*/

// Modified Code
{[_x,true,nil,nil,nil] call VAS_fnc_handleItem;} foreach _items;
{[_x,true,nil,nil,true] call VAS_fnc_handleItem;} foreach (_uitems);
{[_x,true,nil,nil,true] call VAS_fnc_handleItem;} foreach (_vitems);
{[_x,true,true,nil,nil] call VAS_fnc_handleItem;} foreach (_bitems);
{[_x,true,nil,true,nil] call VAS_fnc_handleItem;} foreach (_primitems);
{[_x,true,nil,true,nil] call VAS_fnc_handleItem;} foreach (_secitems);
{[_x,true,nil,true,nil] call VAS_fnc_handleItem;} foreach (_handgunitems);

You can also use this command in 'fn_handleItem.sqf', 'fn_mainDisplay.sqf', 'load_onrespawn.sqf', 'fn_removeGear.sqf', 'fn_saveGear.sqf', 'fn_SaveLoad.sqf', 'misc_functions.sqf', 'add_gear.sqf' and 'fn_deleteGear.sqf' file.

It will improve VAS performance.[/quote']

Few things wrong:

add_gear.sqf cannot use it.

I use waituntil's in the load part for gear loadout, usually call doesn't work properly when using call & waitUntil. I use waitUntil because people complain it doesn't load their stuff in the correct order and I try to keep it as mismatched as possible.

The reason why I say you can't use call in add_gear is because there is waitUntil's in handleItem.sqf and as you know you can't use call on functions that try to 'halt'. The reason there is waitUntil's in handleItem is because of the Attachment prompt window.

Others you are right and can be changed to call but in a comparison there really isn't that big of a performance different between spawn & call. Both have cons and pros.

Share this post


Link to post
Share on other sites
Few things wrong:

add_gear.sqf cannot use it.

I use waituntil's in the load part for gear loadout, usually call doesn't work properly when using call & waitUntil. I use waitUntil because people complain it doesn't load their stuff in the correct order and I try to keep it as mismatched as possible.

The reason why I say you can't use call in add_gear is because there is waitUntil's in handleItem.sqf and as you know you can't use call on functions that try to 'halt'. The reason there is waitUntil's in handleItem is because of the Attachment prompt window.

Others you are right and can be changed to call but in a comparison there really isn't that big of a performance different between spawn & call. Both have cons and pros.

Yes. You're right. But please test it once. 'call' command wait until a result is returned. It not need waitUntil. And it will show better performance in load process.

Thanks.

Share this post


Link to post
Share on other sites

Assuming BIS doesn't fix up the ghillie-suit issue, could you add the OpFor one to the exceptions as well? Currently only the BluFor one will appear.

Seems like a change to using the following would be a good way of going about it:

if(_entity == "U_B_GhillieSuit") then
{
_ret set[1,"Ghillie Suit [MTP]"];
};
if(_entity == "U_O_GhillieSuit") then
{
_ret set[1,"Ghillie Suit [Hex]"];
};

Share this post


Link to post
Share on other sites

Hello,

I would like to use the VAS with the MCC Sandbox 3 mission. Do I need to manually put the script into the ammobox each time I want to place an ammobox? Or is it possible to make the VAS an object? So that it can easily be placed each time. Thank you for the nice addon.

Share this post


Link to post
Share on other sites
Assuming BIS doesn't fix up the ghillie-suit issue, could you add the OpFor one to the exceptions as well? Currently only the BluFor one will appear.

Seems like a change to using the following would be a good way of going about it:

if(_entity == "U_B_GhillieSuit") then
{
_ret set[1,"Ghillie Suit [MTP]"];
};
if(_entity == "U_O_GhillieSuit") then
{
_ret set[1,"Ghillie Suit [Hex]"];
};

Or this as a code change:

switch (_entity) do
{
case "U_B_GhillieSuit": {_ret set[1,"Ghillie Suit (MTP)"];};
case "U_O_GhillieSuit": {_ret set[1,"Ghillie Suit (HEX)"];};
};

I forgot about the opfor ghillie suit, but I probably won't be doing an update to VAS till the beta just to see what is added and what breaks. Thankfully the beta is just around the corner.

Hello,

I would like to use the VAS with the MCC Sandbox 3 mission. Do I need to manually put the script into the ammobox each time I want to place an ammobox? Or is it possible to make the VAS an object? So that it can easily be placed each time. Thank you for the nice addon.

The only thing I can answer is VAS is a script not an addon so no it can't be turned into an object.

The rest of the question I really don't know what you mean but I guess the answer is yes? -_-

Share this post


Link to post
Share on other sites

Can i suggest magazines filtering ? Seems to work for A2 content as well.

magazines:

count =>5

underbarrel:

type == 16

count <5

throwables:

type == 256

count <5

explosives:

!(type in [16,256])

count <5

_config = configFile >> "CfgMagazines";
for "_i" from 0 to (count _config)-1 do {
_current = _config select _i;
if (isClass(_current) && (getNumber(_current>>"scope")==2) && getText(_current>>"picture")!="") then {
	if(getNumber(_current>>"count")>4) then {
		cfgList_magazines set [count cfgList_magazines, configName(_current)]; 
	} else {
		switch (getNumber(_current>>"Type")) do { 
			case 16: {
				cfgList_underbarrel set [count cfgList_underbarrel, configName(_current)];
			};
			case 256: {
				cfgList_throwables set [count cfgList_throwables, configName(_current)];
			};
			default {
				cfgList_explosives set [count cfgList_explosives, configName(_current)];
			};
		};
	};	
};
};

example mission

Edited by aeroson

Share this post


Link to post
Share on other sites
last dev EXE rev 06546 broke VAS system :/

Any examples or details on how? :) "It dun be broked" isn't that helpful. heh

Share this post


Link to post
Share on other sites
last dev EXE rev 06546 broke VAS system :/

It seems you are right, apparently BIS has either removed the command removeItemFromPrimaryWeapon or changed it, going through the command references it seems that my best guess is removeItemFromPrimaryWeapon was removed entirely and was possible changed to something else and if BIS did change it then thanks BIS for giving heads up, paving the way forward for proper development builds!

Sarcasm and slight displeased feelings aside i'll dig around and see if it was changed to something else.

*Edit*

removeItemFromPrimaryWeapon was renamed to: removePrimaryWeaponItem

So to fix it for the latest development build just open fn_handleItem.sqf and replace removeItemFromPrimaryWeapon with removePrimaryWeaponItem (simply by hitting ctrl+h and replacing it that way).

On a side note, Kylania do you have access to the wiki or know someone that can update it?

This should be expressed since BIS gave no notification of it like they usually do.

Edited by Tonic-_-

Share this post


Link to post
Share on other sites
It seems you are right, apparently BIS has either removed the command removeItemFromPrimaryWeapon or changed it, going through the command references it seems that my best guess is removeItemFromPrimaryWeapon was removed entirely and was possible changed to something else and if BIS did change it then thanks BIS for giving heads up, paving the way forward for proper development builds!

Sarcasm and slight displeased feelings aside i'll dig around and see if it was changed to something else.

*Edit*

removeItemFromPrimaryWeapon was renamed to: removePrimaryWeaponItem

So to fix it for the latest development build just open fn_handleItem.sqf and replace removeItemFromPrimaryWeapon with removePrimaryWeaponItem (simply by hitting ctrl+h and replacing it that way).

On a side note, Kylania do you have access to the wiki or know someone that can update it?

This should be expressed since BIS gave no notification of it like they usually do.

thx Tonic , I'm going to try that later tonight.

Share this post


Link to post
Share on other sites
... removeItemFromPrimaryWeapon was renamed to: removePrimaryWeaponItem

So to fix it for the latest development build just open fn_handleItem.sqf and replace removeItemFromPrimaryWeapon with removePrimaryWeaponItem

Confirmed working fix. Virtual AmmoBox now working again in latest release.

And by the way, I just ran a search and replace "removeItemFromPrimaryWeapon" with "removePrimaryWeaponItem" on all files in my Arma3 Profiles directory and it replaced it 338 times!!

How many scripts were using this?

I've only got 90 odd missions or so.

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

×