Frictional Games Forum (read-only)

Full Version: World Timer?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to have timer that runs through all of the maps? If you for instance were to place the timer in the global.hps, would it work?
(08-31-2014, 01:58 PM)i3670 Wrote: [ -> ]Is it possible to have timer that runs through all of the maps? If you for instance were to place the timer in the global.hps, would it work?

Placing it in the global.hps is just worth trying. I don't know if that'll work.

But it is possible, by using variables.

All you'd need is a second timer, that calls itself each second, lowering a variable.

Then when you change map, you set a global variable to the timer-variable.

When entering a map, it should then set the timer-amount to the new global variable.
Iirc..
This thing was impossible..
There were a couple of guys who tried this before.
Altho, i still think it could be possible with Flawless idea, or let the script capture the time with a variable?
Let it count and when leaving save that variable and into another map try to make it continue...
It's eminently possible! Smile

Like FlawlessHappiness was getting at, just use a looping timer. But you can just increment the global variable, like so:

PHP Code:
void OnStart()
{
      
AddTimer("GlobalClockTimer"1"IncrementGlobalClock");
}

void IncrementGlobalClock(string &in asTimer)
{
      
SetGlobalVarInt("GlobalClock"GetGlobalVarInt("GlobalClock") + 1);
      
AddTimer("GlobalClockTimer"1"IncrementGlobalClock");


You could also make it count down, or use floats and a shorter delay to make it more accurate.
Alrighty then. I'll try. Thank you all.

Double Post! While I have your attention, I got an error.

main (1, 27190): ERR : 'f' is not a member of const double'

weirdly large number
(08-31-2014, 05:19 PM)i3670 Wrote: [ -> ]Alrighty then. I'll try. Thank you all.

Double Post! While I have your attention, I got an error.

main (1, 27190): ERR : 'f' is not a member of const double'

weirdly large number

To solve that problem, I think we need to see your script.

Since the number is that large I'm gonna guess it's a for-loop problem.
Found it, it was a stupid . between a number and an f
@MrBehemoth

Might as well use the AddLocalVarInt instead of SetLocalVarInt with +1 to its current value. Not that it would make a difference, but ya know, that's why it's there.
(08-31-2014, 07:48 PM)Mudbill Wrote: [ -> ]@MrBehemoth

Might as well use the AddLocalVarInt instead of SetLocalVarInt with +1 to its current value. Not that it would make a difference, but ya know, that's why it's there.

Absolutely, forgot about that one! Big Grin