Jump to content
Sign in to follow this  
davidoss

Adding VAS and Arsenal functionality to ingame spawned/delivered boxes

Recommended Posts

HI.

I am trying to set VAS and Arsenal functionallity to the boxes which comes from airdrop

Its works but only once i dont knew how to repeat once exited while loops.

Please help me.

The greatest problem for me is define non existing boxes.

ammoresupply=true;
weaponresupply=true;

[] spawn {while{ammoresupply} do 

		{
			{
				if (typeof _x == "rhsusf_ammo_crate") then 

					{
						[_x,"resupply_fnc_ARSENAL",nil,true] spawn BIS_fnc_MP;
						[_x,"resupply_fnc_VASAMMO",nil,true] spawn BIS_fnc_MP;
						ammoresupply=false
					}
			} foreach (NearestObjects [player, [], 100]);
			sleep 0.5;
		};
	};


[] spawn {while{weaponresupply} do 

		{
			{
				if (typeof _x == "rhsusf_weapons_crate") then

					{
						[_x,"resupply_fnc_ARSENAL",nil,true] spawn BIS_fnc_MP;
						[_x,"resupply_fnc_VASAMMO",nil,true] spawn BIS_fnc_MP;
						weaponresupply=false
					}
			} foreach (NearestObjects [player, [], 100]);
			sleep 0.5;
		};
	};

Edited by DaVIdoSS

Share this post


Link to post
Share on other sites

Any ideas? I have trying to use addEventHandler but still no luck.

player addEventHandler ["Init", { _this spawn resupply_fnc_ARSENAL }];

description.ext

class CfgFunctions
{
class resupply
{
	class functions
	{
		class ARSENAL {file = "resupply\ARSENAL.sqf";};
	};
};
};

resupply\ARSENAL.sqf

if ((typeof _this == "rhsusf_ammo_crate") || (typeof _this == "rhsusf_weapons_crate")) then
{
_this addAction ["<t color='#ff1111'>BIS Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal}];
};

Anyone knew how to add Arsenal to ingame spawned boxes in MP?. Is that even possible?

Edited by DaVIdoSS

Share this post


Link to post
Share on other sites


function_add_VAS_Arsenal = 
{
  _passedObject = this;
  _passedObject addAction["<t size='1' color='#32D138'>Virtual Ammobox</t>", "VAS\open.sqf", 0, 5];
  _passedObject addAction["<t size='1' color='#32D138'>BIS Arsenal</t>", {["Open",true] call BIS_fnc_arsenal;}, 0, 5]; 
};

[variable_of_Crate, "function_add_VAS_Arsenal" , true, true] call BIS_fnc_MP;

where variable_of_Crate is the object thats getting the vas/arsenal, usually the output of functions used to spawn objects.

ie// (would create a truck at player, and above code would make the truck have vas/arsenal)

variable_of_Crate = "C_Offroad_01_F" createVehicle position player;

color='#32D138' makes the text green, remove it for white or use a hex color picker to set the color you want

VAS folder should be in the root of the mission file

Share this post


Link to post
Share on other sites

Hi thanks for reply. Is that the only way to get Arsenal functionality for in game spawned boxes?

The problem is that the boxes seams to have no variables at all. How to go around that problem?

If you put some object in editor you can give them a name=variable. How to do this from a script?

For eg. name the box xx1 if alive and another one xx2.

Share this post


Link to post
Share on other sites

usually when you spawn something dynamically( ie a crate) from an sqf the command/function will automatically return the object.

If you have the items already placed with the editor then whatever name you give them will become the variable and name to reference that object

ie in the name field if you call it: myAmmoBox1 then just replace the variable_of_Crate with myAmmoBox1

if you are placing the object in the editor, you can just use the following as an init command to make the box an ammobox from the start

  
  this addAction["<t size='1' color='#32D138'>Virtual Ammobox</t>", "VAS\open.sqf", 0, 5]; 
  this addAction["<t size='1' color='#32D138'>BIS Arsenal</t>", {["Open",true] call BIS_fnc_arsenal;}, 0, 5];  

Edited by zakiechan

Share this post


Link to post
Share on other sites

We cant understand each other because my English is poor. You saying me what i already knew.

Anyway thanks a lot.

I am looking for opportunity to add VAS and Arsenal in MP game for that boxes which are deliver from player resupply in ALiVE addon.

We cant edit the addon script i think but maybe there could be some way to interact with from custom script/init.

It would be enough adding it for only two boxes

"rhsusf_ammo_crate"

and

"rhsusf_weapons_crate"

Both are Virtual boxes (empty) with Arsenal action but only in SP game.

For now these crates hasn't variable names at all.

Please help.

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
Sign in to follow this  

×