Jump to content
twitchmafia1

Help with Items Respawning

Recommended Posts

Hey guys,Currently trying to make a PVP mission and running into a problem. 

Im trying to have Ammo, and Attachments placed around the Play area on Tables and such that can be picked up and when picked up after say 15 secs, it respawns on that position again. Such like Halo does in its multiplayer. 

Can anyone help me out a little?

Share this post


Link to post
Share on other sites

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Option 1, will keep executing since the condition is true. unless you change the condition.//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

while {true} do {
if (
("classname" in (vestItems player + uniformItems player + backpackItems player + assignedItems player))) then {
	sleep 15;
		_item = "classname" createVehicle position player;
		_item setPos [0,0,0]//Table position, make sure to change the Z axis to place on top of table
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Option 2, You could try to just make a simple object on a table and adding an action to it.//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//For example I will be using a map
//////////////////////////////////////////////////////////////////
//Will have to do this for each different item//
/////////////////////////////////////////////////////////////////
//On the item, Name It

 

map addaction ["Pickup Map", {null = []execVM"Pickup_Map.sqf"}];

//Inside Pickup_Map.sqf
deleteVehicle map;
		player addITem "ItemMap";
sleep 15;
		_item = "ItemMap" createVehicle position player;
		_item setPos [0,0,0]; //To place on top of table
		_item addAction ["Pickup Map", {null = []execVM"Pickup_Map.sqf"}];

Now there is probably a more effective way to do this, but as of now these are the only two ways I could think of doing this.

  • Confused 2

Share this post


Link to post
Share on other sites
3 hours ago, HazJ said:

I personally would add a Take EH to the items. Something like this:


object addEventHandler ["Take",
{
	[] spawn
	{
		sleep 15;
		// create item again...
		// attach item to the table...
		// etc...
	};
}];

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take

Hm, I should of looked at all the eventhandlers before making something much more complicated lmao.

Share this post


Link to post
Share on other sites

You can use HazJ approach, just remember to add the event handler to the replenishment item you create (mentioned under etc... :) ).

  • Like 1

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

×