Jump to content
Sign in to follow this  
Learthane

Need help deleting ammo box after x amount of time

Recommended Posts

Hello,

 

I am making a mission where the players have x amount of time to access a virtual arsenal to grab their gear for the mission. After the players have begun the mission, I would like to have the ammo box to be deleted so that people cannot go back and re-equip their gear during the battle. If this is possible, then would it be possible to have other boxes spawn like ammo boxes from the base game that do not contain the virtual arsenal so that people still have a way to obtain ammo throughout the fight?

 

Thanks

Share this post


Link to post
Share on other sites
waitUntil {sleep 0.5; time > 60}; //Will delete the box ~60 seconds after mission start 
deleteVehicle _ammoBox;

Would I put this in the ammobox's init field? Sorry I am kinda new to mission editing.

Share this post


Link to post
Share on other sites
Sorry I am kinda new to mission editing.

 

No problem, that's why this part of the forum exists.

 

 

If you put it into the init of the ammobox, then replace _ammoBox with THIS (small letters)

Share this post


Link to post
Share on other sites

Make a .sqf file and add this too it.

private ["_box"];
_box = _this select 0;

waitUntil {sleep 0.5; time > 60}; //Will delete the box ~60 seconds after mission start
deleteVehicle _box;

Call for it by putting this in the init field of the box

[this] execVM "myscript.sqf";

Or an easier way is doing what Revo said.

Share this post


Link to post
Share on other sites

Using Revo's method, the box definitely is deleted but instead the box being deleted after ~60s, it is immediately deleted. I copy and pasted the code into the init field but removed the "//Will delete the box ~60 seconds after mission start" That leaves me with everything else looking correct. Any idea of what I could be doing wrong?

Share this post


Link to post
Share on other sites

Well, that's my fault. I believe script suspension is not possible in the init field. Use schadler17's suggestion.

Share this post


Link to post
Share on other sites

I believe script suspension is not possible in the init field.

 

You can use spawn there, though:

nul = this spawn { sleep 60; deleteVehicle _this; };

Edit: Forgot the handle.

Edited by Magirot

Share this post


Link to post
Share on other sites

When a person is new to editing a script is very difficult.

I find 98% of things do not need a script.

Place a soldier on the map.

Place a box on the map and name it box1

Place a trigger on the map. Activation is set to Anybody, Once and Present.

In the On Act field type Hint “ON ON ONâ€; deletevehicle box1;

Walk into the trigger area and watch the message come up ON ON ON and at the same time the box disappears.

You want a delay of 60 secs before the box disappears. In the trigger select Timeout and in the 3 cells input 60, 60 and 60

Walk into the trigger area. Wait 60 secs the message appears and the box disappears!

.

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  

×