Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Antigoon

Limited time available

Recommended Posts

Hi, is there a way you can subtract time from a starting amount?

I was thinking of using addAction to make a piece of equipment available to the player, but only for a certain amount of time.

So when he selects 'Activate', the equipment is available and the timer starts running...and when he then selects 'Deactivate', the timer stops and the equipment is unavailable again.

Ofcourse when all available time is used up, the equipment is no longer available.

Share this post


Link to post
Share on other sites

in the addaction script you use variableSetInActionScript = true/false, for on off.

script below responds to that variable.

_maxtime = 120;  // time in seconds.
while {_maxtime != 0} do {
  if (variableSetInActionScript) then {waitUntil {!variableSetInActionScript}};  // here it pauses if action is used to set the variable.
  _maxtime = _maxtime - 1;  // remove one more second.
  sleep 1;  // sleep the 1 second removed.
};
//exits loop after 120 seconds active. not counting paused time ofc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×