Global timer

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Global timer

Post by cromcrom »

Is there a way to set up a global timer, that will carry on at the same "speed" over different areas ?
A trip of a thousand leagues starts with a step.
Ixnatifual

Re: Global timer

Post by Ixnatifual »

Perhaps you could teleport the timer to the new area when the party changes location. Or attach it to the party.
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Global timer

Post by NutJob »

I found the timer slows down, too, if the party leaves the level it's on.
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Global timer

Post by cromcrom »

Exactly.
A trip of a thousand leagues starts with a step.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Global timer

Post by Batty »

I'm doing a timer test, I'll have a thread on it. If you want a global timer, you probably need it to "follow" the party wherever they go.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Global timer

Post by Komag »

You create a separate timer for every level, and just have the timer on the party level be the next that updates your ticker
Finished Dungeons - complete mods to play
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Global timer

Post by cromcrom »

Thanks for the ideas, I will give it a try once I have some more script definitions
A trip of a thousand leagues starts with a step.
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Global timer

Post by cromcrom »

Something I could try is to have a "party_detect" timer that runs all the time on each level. If it detects the party on his level, then it starts the "global_timer" that is also on this level. If it doesn't detect the party, it turns the "global_timer" off.

I really don't like that. At all.
A trip of a thousand leagues starts with a step.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: Global timer

Post by Diarmuid »

The onGui / onUpdate timer solution will be the easiest to implement once we get the reference.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Global timer

Post by JKos »

I suddenly got this crazy idea that I have to try to attach a TimerComponent to the Party-object. And you know what? It works :o

Code: Select all

defineObject{
   name = "party",
   baseObject = "party",
   components = {
		{
			class = "Timer"
		}
   }
}
then in script:

Code: Select all

party.timer:addConnector("onActivate", "t", "onPartyTimer")
Now you have a timer which follows the party. But I haven't tested this much, so it's possible that it causes some problems.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
Post Reply