Jump to content
Sign in to follow this  
dachs

Addaction removed by timer help?

Recommended Posts

this addAction ["<t color='#FFFF00'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal}];

I've added the above code to all the players init field, in the editor, so they can access the Virtual Arsenal. This seems to be working nicely, also on a dedicated server.

However, I only want this to be available for 5 minutes or so, and then be unavailable for the rest of the mission.

I've got a noobish feeling that this can be done with a timer somehow, maybe using a trigger, but I'm pretty much lost at the moment.. Will it work on a dedicated server, just by using the editor, or should it be scripted in .sqf files and whatnot? :confused:

Hope someone is able to point me in the right direction?

Share this post


Link to post
Share on other sites

//-- 'initPlayerLocal.sqf'

[] spawn {
dachs_action_arsenal = player addAction ["<t color='#FFFF00'>Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal}];
uiSleep 300;								// 5 min delay
player removeAction dachs_action_arsenal;			// remove the action (may already be gone if the player dies)
};	

If you don't have one already, create a file 'initPlayerLocal.sqf' in your main mission directory (where mission.sqm and description.ext are located), and paste that code in. Will allow the player to access VA via the add action until the 5 minutes are elapsed or they die.

Will work in dedi

Share this post


Link to post
Share on other sites

and for sure... remove all the players init field calls.

Share this post


Link to post
Share on other sites

If you don't have one already, create a file 'initPlayerLocal.sqf' in your main mission directory (where mission.sqm and description.ext are located), and paste that code in. Will allow the player to access VA via the add action until the 5 minutes are elapsed or they die.

Will work in dedi

:icon_dj:

Thanks a lot man, impressive you could shake that out of your sleeve like, just like that.

One day, I hope to be able to grasp a bit more of this coding stuff.. one day, most likely sometime in 2035, sigh..

@XoO Yup, I did delete the init fields, as I figured they would probably conflict. Thanks for making sure though!

On a related note, when the script is activated, is there a way to put up a message like "Arsenal available for 5 minutes" on the screen?

Share this post


Link to post
Share on other sites

Simply:

hintSilent "Arsenal available for 5 minutes";

Placed somewhere before the uiSleep and sometime after the addAction.

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  

×