Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help World Timer?
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#1
World Timer?

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?

"What you think is irrelevant" - A character of our time

A Christmas Hunt
08-31-2014, 01:58 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: World Timer?

(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.

Trying is the first step to success.
08-31-2014, 02:14 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#3
RE: World Timer?

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...
08-31-2014, 04:21 PM
Find
MrBehemoth Offline
Senior Member

Posts: 408
Threads: 19
Joined: Feb 2014
Reputation: 40
#4
RE: World Timer?

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: (Select All)
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.

(This post was last modified: 08-31-2014, 04:57 PM by MrBehemoth.)
08-31-2014, 04:55 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#5
RE: World Timer?

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

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 08-31-2014, 05:35 PM by i3670.)
08-31-2014, 05:19 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: World Timer?

(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.

Trying is the first step to success.
08-31-2014, 05:46 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#7
RE: World Timer?

Found it, it was a stupid . between a number and an f

"What you think is irrelevant" - A character of our time

A Christmas Hunt
08-31-2014, 05:46 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: World Timer?

@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
Find
MrBehemoth Offline
Senior Member

Posts: 408
Threads: 19
Joined: Feb 2014
Reputation: 40
#9
RE: World Timer?

(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

08-31-2014, 09:17 PM
Find




Users browsing this thread: 1 Guest(s)