Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
wyattwic

Opening arsenal with a white background?

Recommended Posts

Hello everyone,

 

The Eden editor's unit arsenal option opens you to a white background, hiding the environment the unit is placed in while in editor mode.   Would anyone know how to achieve this via scripting command?  

 

Currently, the only luck I have been having is opening the standard arsenal.

 

 

Thank you,

Share this post


Link to post
Share on other sites

3den basically creates a copy of the unit you are editing and spawns it up in the air inside a sphere that has two objectTextures, one for the plane the unit is standing on and another for the spheres interior face.

Heres a little example that you can run from the debug console. This is by no means a thorough working example but just an example to show whats happening..

h = [] spawn {

	_centerPos = position player;
	_centerPos set [2,500];
	sphere = createVehicle ["Sphere_3DEN",_centerPos,[],0,"none"];
	sphere setPosATL _centerPos;
	sphere setDir 0;
	sphere setObjectTexture [0,"#(argb,8,8,3)color(1,0,0,1)"];
	sphere setObjectTexture [1,"#(argb,8,8,3)color(0,1,0,1)"];
	arsenal_unit = createVehicle [typeOf player,position player,[],0,"none"];
	arsenal_unit setPosATL [getPosATL sphere select 0,getPosATL sphere select 1,(getPosATL sphere select 2) - 4];
	arsenal_unit setDir 0;
	arsenal_unit switchMove animationState player;
	arsenal_unit switchAction "playerstand";
	[player,[arsenal_unit,"arsenal"]] call BIS_fnc_saveInventory;
	[arsenal_unit,[arsenal_unit,"arsenal"]] call BIS_fnc_loadInventory;
	_face = face player;
	arsenal_unit setFace _face;
	arsenal_unit enableSimulation false;
	
	["Open",[nil,objNull,arsenal_unit]] call bis_fnc_arsenal;
	
	[ missionNamespace, "arsenalClosed", {
		[arsenal_unit,[player,"arsenal"]] call BIS_fnc_saveInventory;
		[player,[player,"arsenal"]] call BIS_fnc_loadInventory;
		{
			deleteVehicle _x;
		}forEach [ sphere, arsenal_unit ];
	}] call BIS_fnc_addScriptedEventHandler;
	
};
Where the two lines 'sphere setObjectTexture' set the plane(red) and sphere(green).
  • Like 1

Share this post


Link to post
Share on other sites

Neat!  Thanks for that.  You just make made my life easier tenfold!

Share this post


Link to post
Share on other sites

i have noticed with arensal when players choosing gear server broadcasts the info to every one, on what they picking, can some one confirm this?

Share this post


Link to post
Share on other sites

In regards to broadcasting, it utilizes bis_fnc_loadinventory.   It has the same load impact on the server as if the player opened a crate and grabbed the gear.

 

The only thing noteworthy is the script modifies the gear of the dummy in real time, then on close copies it to the player.   The major note for those who have things secured is the use of createvehicle.

 

 

Myself and about 6 people were trying it out on a loaded down server.  We noticed no performance impact.

Share this post


Link to post
Share on other sites

Hello!

 

I unfortunately had my HDD fail on me and lost my notes.  I had this working the way I wanted at one point, but now I am lost.

 

How would I run functions like "BIS_fnc_addVirtualWeaponCargo" against this arsenal instance?

Share this post


Link to post
Share on other sites

As the arsenal has no box you would need to add the virtualCargo to missionNamespace. e.g

[ missionNamespace, <classes>, <isGlobal>, false ] call BIS_fnc_addVirtualWeaponCargo;

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Larrow,

 

Looking at that and examining the arsenal function, I was able to also find out how to separate things a bit more.  In my mission different ammo boxes provide different weapons (opfor vs blufor).

 

["Open",[nil,objNull,arsenal_unit]] call bis_fnc_arsenal;

In the above code, "objNull" can be replaced with an object that has virtual cargo.

 

That being said, the documentation around Arsenal is VERY lacking.  I don't believe I am qualified to add to its documentation properly, but I feel the community can't make use of this awesome tool the way its currently documented.

I would love it if Karel elaborated on its documentation!

Edited by wyattwic
confused nil for objnull

Share this post


Link to post
Share on other sites

Today I learned something, posting it here in hopes of it helping someone else.  I have tested the below.

 

Arsenal can be opened based on any item that has a virtual inventory.  This includes ammo box items made in eden, so long as you have a variable to address it with.

 

["Open",[nil,box,UNITTOEDIT]] call bis_fnc_arsenal;

 

Arsenal is opened wherever this command is executed locally.  Running it from a location without a UI has no effect.  

 

This being said, "unittoedit" can be any unit you want to edit while in the game (great idea for admin tools in a life server).

 

"box" is where you want arsenal to search for the virtual invintory.  By changing "box" to "objNull" arsenal will check missionNamespace (untested, based on Larrow's last post).

 

Nil can be also changed to false with no undesirable effect.  Nil can be changed to true to enable most items.  I am not sure why all items dont become available, but it seems to be unpredictable.  I'm not 100% sure what this is supposed to do, and I am fairly certain this effect is just how the script breaks.

 

 

Now, you do not have to use eden or BIS_fnc_addVirtualWeaponCargo (or its 3 brothers) in order to set up arsenal for use like above.  Arsenal looks for the variable "bis_addvirtualweaponcargo_cargo" within "box"s namespace in any situation.

You can set this yourself by using  the below.  This is a great way of avoiding having to use four separate functions.

box setvariable ["bis_addvirtualweaponcargo_cargo",[["array of items"],["array of weapons"],["array of magazines"],["array of backpacks"]],(BOOL FOR PUBLIC)];

 

Well that's everything I've learned today.  As a final help, below is a list of all items, weapons and backpacks related to blufor, along with all magazines.

box setvariable ["bis_addvirtualweaponcargo_cargo",[[["Binocular","Rangefinder","Laserdesignator","FirstAidKit","Medikit","ToolKit","ItemGPS","acc_flashlight","acc_pointer_IR","muzzle_snds_acp","muzzle_snds_L","muzzle_snds_H","muzzle_snds_B","muzzle_snds_338_black","muzzle_snds_338_green","muzzle_snds_338_sand","bipod_01_F_blk","bipod_01_F_mtp","bipod_01_F_snd","muzzle_snds_H_khk_F","bipod_01_F_khk","NVGoggles","NVGoggles_tna_F","optic_ACO_grn","optic_Aco","optic_ACO_grn_smg","optic_Aco_smg","optic_AMS","optic_AMS_khk","optic_AMS_snd","optic_Arco","optic_Arco_blk_F","optic_Arco_ghex_F","H_HelmetSpecO_blk","H_HelmetSpecO_ghex_F","H_HelmetSpecO_ocamo","G_Aviator","G_Balaclava_blk","G_Balaclava_combat","G_Balaclava_lowprofile","G_Balaclava_oli","bipod_03_F_blk","bipod_02_F_blk","bipod_02_F_hex","bipod_03_F_oli","bipod_02_F_tan","H_Cap_usblack","H_Cap_tan_specops_US","V_PlateCarrierGL_blk","V_PlateCarrierGL_rgr","V_PlateCarrierGL_mtp","V_PlateCarrierGL_tna_F","V_PlateCarrier1_blk","V_PlateCarrier1_rgr","V_PlateCarrier1_rgr_noflag_F","V_PlateCarrier1_tna_F","V_PlateCarrier2_blk","V_PlateCarrier2_rgr","V_PlateCarrier2_rgr_noflag_F","V_PlateCarrier2_tna_F","V_PlateCarrierSpec_blk","V_PlateCarrierSpec_rgr","V_PlateCarrierSpec_mtp","V_PlateCarrierSpec_tna_F","V_Chestrig_blk","V_Chestrig_rgr","V_Chestrig_khk","V_Chestrig_oli","U_B_CombatUniform_mcam","U_B_CombatUniform_mcam_tshirt","U_B_T_Soldier_F","U_B_T_Soldier_AR_F","G_Combat","G_Combat_Goggles_tna_F","H_HelmetB","H_HelmetB_black","H_HelmetB_camo","H_HelmetB_desert","H_HelmetB_grass","H_HelmetB_sand","H_HelmetB_snakeskin","H_HelmetB_tna_F","ItemCompass","H_HelmetCrew_B","V_PlateCarrierL_CTRG","V_PlateCarrierH_CTRG","H_HelmetLeaderO_ghex_F","H_HelmetLeaderO_ocamo","H_HelmetLeaderO_oucamo","G_Diving","G_B_Diving","optic_DMS","optic_DMS_ghex_F","H_HelmetSpecB","H_HelmetSpecB_blk","H_HelmetSpecB_paint2","H_HelmetSpecB_paint1","H_HelmetSpecB_sand","H_HelmetSpecB_snakeskin","H_HelmetB_Enh_tna_F","optic_ERCO_blk_F","optic_ERCO_khk_F","optic_ERCO_snd_F","U_B_FullGhillie_ard","U_B_T_FullGhillie_tna_F","U_B_FullGhillie_lsh","U_B_FullGhillie_sard","V_PlateCarrierIAGL_dgtl","V_PlateCarrierIAGL_oli","V_PlateCarrierIA1_dgtl","V_PlateCarrierIA2_dgtl","U_B_T_Sniper_F","U_B_GhillieSuit","H_CrewHelmetHeli_B","U_B_HeliPilotCoveralls","H_PilotHelmetHeli_B","optic_KHS_blk","optic_KHS_hex","optic_KHS_old","optic_KHS_tan","G_Lady_Blue","Laserdesignator_02_ghex_F","Laserdesignator_02","Laserdesignator_01_khk_F","Laserdesignator_03","V_HarnessOGL_brn","V_HarnessOGL_ghex_F","V_HarnessOGL_gry","V_HarnessO_brn","V_HarnessO_ghex_F","V_HarnessO_gry","H_HelmetB_light","H_HelmetB_light_black","H_HelmetB_light_desert","H_HelmetB_light_grass","H_HelmetB_light_sand","H_HelmetB_light_snakeskin","H_HelmetB_Light_tna_F","G_Lowprofile","optic_LRPS","optic_LRPS_ghex_F","optic_LRPS_tna_F","ItemMap","H_MilCap_blue","H_MilCap_ghex_F","H_MilCap_gry","H_MilCap_ocamo","H_MilCap_mcamo","H_MilCap_tna_F","H_MilCap_dgtl","optic_Holosight","optic_Holosight_blk_F","optic_Holosight_khk_F","optic_Holosight_smg","optic_Holosight_smg_blk_F","H_HelmetIA","optic_SOS","optic_SOS_khk_F","optic_MRCO","optic_MRD","optic_Nightstalker","None","NVGoggles_OPFOR","NVGoggles_INDEP","optic_NVS","U_B_PilotCoveralls","H_PilotHelmetFighter_B","H_HelmetO_ghex_F","H_HelmetO_ocamo","H_HelmetO_oucamo","ItemRadio","optic_Hamr","optic_Hamr_khk_F","V_RebreatherB","U_B_CombatUniform_mcam_vest","U_B_T_Soldier_SL_F","G_Shades_Black","G_Shades_Blue","G_Shades_Green","G_Shades_Red","V_BandollierB_blk","V_BandollierB_cbr","V_BandollierB_ghex_F","V_BandollierB_rgr","V_BandollierB_khk","V_BandollierB_oli","muzzle_snds_M","muzzle_snds_m_khk_F","muzzle_snds_m_snd_F","muzzle_snds_H_snd_F","muzzle_snds_B_khk_F","muzzle_snds_B_snd_F","muzzle_snds_93mmg","muzzle_snds_93mmg_tan","G_Spectacles","G_Sport_Red","G_Sport_Blackyellow","G_Sport_BlackWhite","G_Sport_Checkered","G_Sport_Blackred","G_Sport_Greenblack","G_Squares_Tinted","G_Squares","muzzle_snds_58_blk_F","muzzle_snds_58_ghex_F","muzzle_snds_58_hex_F","muzzle_snds_65_TI_blk_F","muzzle_snds_65_TI_ghex_F","muzzle_snds_65_TI_hex_F","U_B_survival_uniform","V_TacChestrig_cbr_F","V_TacChestrig_grn_F","V_TacChestrig_oli_F","V_TacVest_blk","V_TacVest_brn","V_TacVest_camo","V_TacVest_khk","V_TacVest_oli","V_TacVest_blk_POLICE","V_I_G_resistanceLeader_F","optic_tws","optic_tws_mg","B_UavTerminal","ItemWatch","U_B_Wetsuit","optic_Yorris","%All"],["MineDetector","hgun_Pistol_heavy_01_F","hgun_ACPC2_F","srifle_LRR_F","srifle_LRR_camo_F","srifle_LRR_tna_F","srifle_DMR_02_F","srifle_DMR_02_camo_F","srifle_DMR_02_sniper_F","srifle_DMR_03_F","srifle_DMR_03_multicam_F","srifle_DMR_03_khaki_F","srifle_DMR_03_tan_F","srifle_DMR_03_woodland_F","srifle_DMR_06_camo_F","srifle_DMR_06_olive_F","LMG_Mk200_F","arifle_MX_GL_F","arifle_MX_GL_Black_F","arifle_MX_GL_khk_F","arifle_MX_F","arifle_MX_Black_F","arifle_MX_khk_F","arifle_MX_SW_F","arifle_MX_SW_Black_F","arifle_MX_SW_khk_F","arifle_MXC_F","arifle_MXC_Black_F","arifle_MXC_khk_F","arifle_MXM_F","arifle_MXM_Black_F","arifle_MXM_khk_F","hgun_P07_F","launch_NLAW_F","SMG_05_F","arifle_SDAR_F","arifle_SPAR_01_blk_F","arifle_SPAR_01_khk_F","arifle_SPAR_01_snd_F","arifle_SPAR_01_GL_blk_F","arifle_SPAR_01_GL_khk_F","arifle_SPAR_01_GL_snd_F","arifle_SPAR_02_blk_F","arifle_SPAR_02_khk_F","arifle_SPAR_02_snd_F","arifle_SPAR_03_blk_F","arifle_SPAR_03_khk_F","arifle_SPAR_03_snd_F","MMG_02_black_F","MMG_02_camo_F","MMG_02_sand_F","launch_I_Titan_F","launch_O_Titan_ghex_F","launch_O_Titan_F","launch_B_Titan_F","launch_B_Titan_tna_F","launch_O_Titan_short_F","launch_O_Titan_short_ghex_F","launch_I_Titan_short_F","launch_B_Titan_short_F","launch_B_Titan_short_tna_F","SMG_01_F","arifle_Mk20_F","arifle_Mk20_GL_F","arifle_Mk20_GL_plain_F","arifle_Mk20_plain_F","arifle_Mk20C_F","arifle_Mk20C_plain_F","arifle_TRG20_F","arifle_TRG21_F","arifle_TRG21_GL_F","hgun_Pistol_Signal_F","srifle_DMR_03_spotter_F","srifle_EBR_F"],["Laserbatteries","10Rnd_338_Mag","130Rnd_338_Mag","7Rnd_408_Mag","11Rnd_45ACP_Mag","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01_Tracer_Green","30Rnd_45ACP_Mag_SMG_01_Tracer_Red","30Rnd_45ACP_Mag_SMG_01_Tracer_Yellow","6Rnd_45ACP_Cylinder","9Rnd_45ACP_Mag","10Rnd_50BW_Mag_F","5Rnd_127x108_Mag","10Rnd_127x54_Mag","5Rnd_127x108_APDS_Mag","3Rnd_UGL_FlareGreen_F","3Rnd_UGL_FlareCIR_F","3Rnd_UGL_FlareRed_F","3Rnd_UGL_FlareWhite_F","3Rnd_UGL_FlareYellow_F","3Rnd_SmokeBlue_Grenade_shell","3Rnd_SmokeGreen_Grenade_shell","3Rnd_SmokeOrange_Grenade_shell","3Rnd_SmokePurple_Grenade_shell","3Rnd_SmokeRed_Grenade_shell","3Rnd_Smoke_Grenade_shell","3Rnd_SmokeYellow_Grenade_shell","3Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","30Rnd_545x39_Mag_Green_F","30Rnd_545x39_Mag_F","30Rnd_545x39_Mag_Tracer_Green_F","30Rnd_545x39_Mag_Tracer_F","150Rnd_556x45_Drum_Mag_F","150Rnd_556x45_Drum_Mag_Tracer_F","200Rnd_556x45_Box_Red_F","200Rnd_556x45_Box_F","200Rnd_556x45_Box_Tracer_Red_F","200Rnd_556x45_Box_Tracer_F","20Rnd_556x45_UW_mag","30Rnd_556x45_Stanag_green","30Rnd_556x45_Stanag_red","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag_Tracer_Green","30Rnd_556x45_Stanag_Tracer_Red","30Rnd_556x45_Stanag_Tracer_Yellow","100Rnd_580x42_Mag_F","100Rnd_580x42_Mag_Tracer_F","30Rnd_580x42_Mag_F","30Rnd_580x42_Mag_Tracer_F","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag_Tracer","200Rnd_65x39_cased_Box","200Rnd_65x39_cased_Box_Tracer","20Rnd_650x39_Cased_Mag_F","30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_green_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_green","6Rnd_GreenSignal_F","6Rnd_RedSignal_F","150Rnd_762x54_Box","150Rnd_762x54_Box_Tracer","20Rnd_762x51_Mag","30Rnd_762x39_Mag_Green_F","30Rnd_762x39_Mag_F","30Rnd_762x39_Mag_Tracer_Green_F","30Rnd_762x39_Mag_Tracer_F","10Rnd_762x54_Mag","10Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_green_Mag","16Rnd_9x21_red_Mag","16Rnd_9x21_yellow_Mag","30Rnd_9x21_Mag","30Rnd_9x21_Mag_SMG_02","30Rnd_9x21_Green_Mag","30Rnd_9x21_Mag_SMG_02_Tracer_Green","30Rnd_9x21_Mag_SMG_02_Tracer_Red","30Rnd_9x21_Red_Mag","30Rnd_9x21_Mag_SMG_02_Tracer_Yellow","30Rnd_9x21_Yellow_Mag","10Rnd_93x64_DMR_05_Mag","150Rnd_93x64_Mag","Chemlight_blue","Chemlight_green","Chemlight_red","Chemlight_yellow","DemoCharge_Remote_Mag","UGL_FlareGreen_F","UGL_FlareCIR_F","UGL_FlareRed_F","UGL_FlareWhite_F","UGL_FlareYellow_F","B_IR_Grenade","SLAMDirectionalMine_Wire_Mag","NLAW_F","RPG7_F","HandGrenade","RPG32_HE_F","RPG32_F","SmokeShellGreen","SmokeShellRed","SmokeShell","1Rnd_SmokeBlue_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","1Rnd_SmokeOrange_Grenade_shell","1Rnd_SmokePurple_Grenade_shell","1Rnd_SmokeRed_Grenade_shell","1Rnd_Smoke_Grenade_shell","1Rnd_SmokeYellow_Grenade_shell","Titan_AA","Titan_AP","Titan_AT","%All"],["B_AssaultPack_blk","B_AssaultPack_cbr","B_AssaultPack_dgtl","B_AssaultPack_rgr","B_AssaultPack_ocamo","B_AssaultPack_khk","B_AssaultPack_mcamo","B_AssaultPack_sgg","B_AssaultPack_tna_F","B_Bergen_dgtl_F","B_Bergen_hex_F","B_Bergen_mcamo_F","B_Bergen_tna_F","B_Carryall_cbr","B_Carryall_ghex_F","B_Carryall_ocamo","B_Carryall_khk","B_Carryall_mcamo","B_Carryall_oli","B_Carryall_oucamo","B_GMG_01_A_weapon_F","B_HMG_01_A_weapon_F","B_HMG_01_high_weapon_F","B_HMG_01_weapon_F","B_GMG_01_high_weapon_F","B_GMG_01_weapon_F","B_FieldPack_blk","B_FieldPack_cbr","B_FieldPack_ghex_F","B_FieldPack_ocamo","B_FieldPack_khk","B_FieldPack_oli","B_FieldPack_oucamo","B_Mortar_01_support_F","B_Mortar_01_weapon_F","B_HMG_01_support_high_F","B_HMG_01_support_F","B_Kitbag_cbr","B_Kitbag_rgr","B_Kitbag_mcamo","B_Kitbag_sgg","B_Static_Designator_01_weapon_F","B_AA_01_weapon_F","B_AT_01_weapon_F","B_Parachute","B_TacticalPack_blk","B_TacticalPack_rgr","B_TacticalPack_ocamo","B_TacticalPack_mcamo","B_TacticalPack_oli","B_UAV_01_backpack_F","B_Bergen_blk","B_BergenC_blu","B_Bergen_rgr","B_BergenC_grn","B_Bergen_mcamo","B_BergenC_red","B_Bergen_sgg","B_HMG_01_A_high_weapon_F","B_GMG_01_A_high_weapon_F","B_B_Parachute_02_F"]],true];

 

 

 

Let me know if there is anything inaccurate or related I should look at!

Share this post


Link to post
Share on other sites

By changing "box" to "objNull" arsenal will check missionNamespace (untested, based on Larrow's last post).

MissionNamespace is always used no matter if you supply an object or not, it is an area for storing white listed equipment for all arsenals, where as object based lists are only for specific arsenals that uses the object in its parameters.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks!  Great to know!   Do you know of any other neat tricks for arsenal?  I may visit the wiki and post most of this in the talk pages later on.

 

 

UPDATE:

 

Here is the final update to the code.  It works perfectly!

 

Add this to any item you want to use as an inventory. This assumes there is an ammobox named "bbt0" with virtual cargo set.

 

Players will see it as an addaction "Invintory" and pressing the gear key at the box will open it as well.

 

//server\ammobox.sqf
// [this] execvm "server\ammobox.sqf";
_box = _this select 0;

_box addaction ["Inventory",{
	[_this select 1] spawn {
		_centerOrig = _this select 0;
		_centerPos = [random [0,15000,30000],0,random [500,750,1000]];
		_sphere = createvehicle ["Sphere_3DEN",_centerPos,[],0,"none"];
		_sphere setposatl _centerPos;
		_sphere setdir 0;
		_sphere setobjecttexture [0,"#(argb,8,8,3)color(0.93,1.0,0.98,0.028,co)"];
		_sphere setobjecttexture [1,"#(argb,8,8,3)color(0.93,1.0,0.98,0.01,co)"];
		_center = createagent [typeof _centerOrig,_centerPos,[],0,"none"];
		_center setposatl getposatl _sphere;
		_center setdir 0;
		_center switchmove animationstate _centerOrig;
		_center switchaction "playerstand";
		_inventory = [_centerOrig,[_center,"arsenal"]] call bis_fnc_saveInventory;
		[_center,[_center,"arsenal"]] call bis_fnc_loadInventory;
		_face = face _centerOrig;
		_center setface _face;
		_center enablesimulation false;

		//--- Create light for night editing (code based on BIS_fnc_3DENFlashlight)
		_light = "#lightpoint" createvehicle _centerPos;
		_light setlightbrightness 20;
		_light setlightambient [1,1,1];
		_light setlightcolor [0,0,0];
		_light lightattachobject [_sphere,[0,0,-20 * 7]];
		
		missionNamespace setvariable ["arsenal-center",_center];
		missionNamespace setvariable ["arsenal-centerOrig",_centerOrig];
		missionNamespace setvariable ["arsenal-light",_light];
		missionNamespace setvariable ["arsenal-sphere",_sphere];
		
		
		["Open",[nil,bbt0,_center]] call bis_fnc_arsenal;
		
		[ missionNamespace, "arsenalClosed", {
		
			_center = missionNamespace getVariable "arsenal-center";
			_centerOrig = missionNamespace getVariable "arsenal-centerOrig";
			_light = missionNamespace getVariable "arsenal-light";
			_sphere = missionNamespace getVariable "arsenal-sphere";
			
			missionNamespace setvariable ["arsenal-center",nil];
			missionNamespace setvariable ["arsenal-centerOrig",nil];
			missionNamespace setvariable ["arsenal-light",nil];
			missionNamespace setvariable ["arsenal-sphere",nil];
	
			[_center,[_centerOrig,"arsenal"]] call BIS_fnc_saveInventory;
			[_centerOrig,[_centerOrig,"arsenal"]] call BIS_fnc_loadInventory;
			{
				deleteVehicle _x;
			}forEach [ _light, _center, _sphere ];
		}] call BIS_fnc_addScriptedEventHandler;
	};
},"",10,true,true,"Gear"];

 

Edited by wyattwic

Share this post


Link to post
Share on other sites

Hello!

 

I have been testing the above code, and I have a situation I am having a hard time comprehending.

 

When a user activates the above code more than once before opening, he will be stuck.  Unable to move, and when looking around it fights him to return to the same horizontal viewing angle.  It does not effect vertical adjustment.

 

As an error, every few seconds the below will be printed into his rpt.

 2:48:57 Error in expression <elect 2) + 0.001);
_cam setpos (_target modeltoworldvisual [0,-_dis * _disCoef,0>
 2:48:57   Error position: <modeltoworldvisual [0,-_dis * _disCoef,0>
 2:48:57   Error Type Number,Not a Number, expected Number
 2:48:57 File A3\functions_f_bootcamp\Inventory\fn_arsenal.sqf, line 171
 2:48:57 Error in expression <call bis_fnc_setobjectrotation;
_target attachto [_center,BIS_fnc_arsenal_campos>
 2:48:57   Error position: <attachto [_center,BIS_fnc_arsenal_campos>
 2:48:57   Error 0 elements provided, 3 expected
 2:48:57 File A3\functions_f_bootcamp\Inventory\fn_arsenal.sqf, line 162

 

My assumption is another instance of arsenal is running.  I am installing other checks to help prevent it, but in case this happens, wow would it be fixed/closed?

Share this post


Link to post
Share on other sites
11 hours ago, wyattwic said:

When a user activates the above code more than once before opening,

How does the user get to activate the code more than once? The code should be run once on each client enabling only one action. As soon as the action is used the player enters the Arsenal so is unable to use the action again until he exits the Arsenal.

I can repro your error by adding the actions code above again in the same action, so you are right it is because the arsenal is initialising twice.

How ever I am confused on how, with just the normal code above, a player gets to run the code twice.

 

Is it because you spawn the code in the action and your scheduler is overloaded leading to the arsenal taking some time to actually open, hence the player gets time to use the action again before the scheduler gets around to actually running your code?

If so

  1. I would seriously look at how much stuff you have loaded up in the scheduler
  2. Maybe call the code instead
  3. Add condition to you action that disables it until the Arsenal is exited
  • Like 1

Share this post


Link to post
Share on other sites

Thanks Larrow,

 

I've moved it over to a call, added checks to make sure it cant be ran twice.   When it comes to things loaded, its this, the BIS respawn and VCOMAI.  Not much else is running.

 

Ill publish the updates and see how my guys break it.

Share this post


Link to post
Share on other sites

If thats all you have running then there is something else wrong and my initial point still stands ' How does the user get to activate the code more than once? '

Are they actually being able to use the action twice? before the Arsenal kicks in.

I noticed you have the Gear shortcut bound to the action, I have even tried going up to the box and spamming Gear button whilst doing the action and still cannot get it to error as you describe.

 

  • Like 1

Share this post


Link to post
Share on other sites

Hey Larrow, sorry about the late reply.  Its been a crazy week.

 

Before I fixed it, using the code posted above, using the action menu multiple times was the cause.  I completely forgot I had bound it to the gear key.

 

I currently have it set up so that the player has an unsatisfied condition in the addaction when arsenal starts, and satisfied again on close as his gear is copied to him, via global variable.

 

As is, everything seems to be working as expected.   Here is all my code.

 

Init.sqf

ammobox_active = true;


ammoboxcall = {
	ammobox_active = false;
	[_this select 0] spawn {
		_centerOrig = _this select 0;
		_centerPos = [random [0,15000,30000],0,random [500,750,1000]];
		_sphere = createvehicle ["Sphere_3DEN",_centerPos,[],0,"none"];
		_sphere setposatl _centerPos;
		_sphere setdir 0;
		_sphere setobjecttexture [0,"#(argb,8,8,3)color(0.93,1.0,0.98,0.028,co)"];
		_sphere setobjecttexture [1,"#(argb,8,8,3)color(0.93,1.0,0.98,0.01,co)"];
		_center = createagent [typeof _centerOrig,_centerPos,[],0,"none"];
		_center setposatl getposatl _sphere;
		_center setdir 0;
		_center switchmove animationstate _centerOrig;
		_center switchaction "playerstand";
		_inventory = [_centerOrig,[_center,"arsenal"]] call bis_fnc_saveInventory;
		[_center,[_center,"arsenal"]] call bis_fnc_loadInventory;
		_face = face _centerOrig;
		_center setface _face;
		_center enablesimulation false;

		//--- Create light for night editing (code based on BIS_fnc_3DENFlashlight)
		_light = "#lightpoint" createvehicle _centerPos;
		_light setlightbrightness 20;
		_light setlightambient [1,1,1];
		_light setlightcolor [0,0,0];
		_light lightattachobject [_sphere,[0,0,-20 * 7]];
		
		missionNamespace setvariable ["arsenal-center",_center];
		missionNamespace setvariable ["arsenal-centerOrig",_centerOrig];
		missionNamespace setvariable ["arsenal-light",_light];
		missionNamespace setvariable ["arsenal-sphere",_sphere];
		
		
		["Open",[nil,bbt0,_center]] call bis_fnc_arsenal;
		
		[ missionNamespace, "arsenalClosed", {
		
			_center = missionNamespace getVariable "arsenal-center";
			_centerOrig = missionNamespace getVariable "arsenal-centerOrig";
			_light = missionNamespace getVariable "arsenal-light";
			_sphere = missionNamespace getVariable "arsenal-sphere";
			
			missionNamespace setvariable ["arsenal-center",nil];
			missionNamespace setvariable ["arsenal-centerOrig",nil];
			missionNamespace setvariable ["arsenal-light",nil];
			missionNamespace setvariable ["arsenal-sphere",nil];
	
			[_center,[_centerOrig,"arsenal"]] call BIS_fnc_saveInventory;
			[_centerOrig,[_centerOrig,"arsenal"]] call BIS_fnc_loadInventory;
			{
				deleteVehicle _x;
			}forEach [ _light, _center, _sphere ];
			ammobox_active = true;
		}] call BIS_fnc_addScriptedEventHandler;
	};
};

The box's addaction

this addaction ["Inventory",{[_this select 1] call ammoboxcall;},"",10,true,true,"Gear","ammobox_active"];

 

Share this post


Link to post
Share on other sites

×