TIMER ISSUES IN LOG2

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!
Post Reply
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

TIMER ISSUES IN LOG2

Post by WaspUK1966 »

I think I'm going MAD! In LOG1, a timer wont run until you tell it to (by plate activation etc). But for some reason, any timer I put on a map in LOG2 runs from the start of the mod by itself, without even being activated!. Which is causing me a whole lot of problems with my scripts! . (One of which is supposed to trigger a timer when an item is placed on a altar, but the timer is already running). Doesn't matter what option you select for the timer, onActivate etc, because the damn things just start anyway! AM I missing something here? I've even tried turning the timers off at the start of the level, but they just run anyway. HELP!!!
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: TIMER ISSUES IN LOG2

Post by minmay »

Yes, you're missing something: you can disable the TimerComponent to stop it from running. It won't run until it's enabled. (Starting it with the "start" method will also enable it.)
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

Re: TIMER ISSUES IN LOG2

Post by WaspUK1966 »

Why didn't I try that? Must be losing it! LOL! Works like a charm now. Must have disabled everything except the Timer Component, because I thought the Timer would be permanently disabled if I did..Still learning. Getting there..eventually! Thanks once again.

George
User avatar
Halluinoid
Posts: 165
Joined: Tue Apr 02, 2013 7:08 pm
Contact:

Re: TIMER ISSUES IN LOG2

Post by Halluinoid »

I am running a timer ticked (from start)

when I tested it with 10 I saw the door close after 10 seconds, works

however, when i change the 10 to 7200 (2 hours) come back after 2 hours, (the whole of the dungeon game I organised) the door is still open , 2:01 still open, 2:02 still open :evil:

I am looking at the time in "Statistics" from menu while the game is running. I thought when "statistics" shows 2 hours game play, the door would close, it doesn't

My dungeon is designed as a time test "you must return to the Oubliette within 2 hours" if the timer doesn't work as expected it kind of sours the whole thing a bit
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: TIMER ISSUES IN LOG2

Post by zimberzimber »

Timers located on a level you're not currently on run slower. (About twice as slow from what I could tell)
If you want the timer to stay consistent throughout the whole dungeon, you'll have to define it as a component for the party.
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
Halluinoid
Posts: 165
Joined: Tue Apr 02, 2013 7:08 pm
Contact:

Re: TIMER ISSUES IN LOG2

Post by Halluinoid »

crikey I should have known, sounds right Zimber thanks

reminds me of the Teleporters located on a level you're not currently on run slower. yeah you bet! at least twice as slow

it really helps if you know these things

so in my case I think I do want the timer to stay consistent throughout the whole dungeon, so I'll have to define it as a component for the party. like how do I do that? :lol:
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: TIMER ISSUES IN LOG2

Post by zimberzimber »

Assuming you know how to define components -
You'll have to redefine the party object (named party) and give it all the extra components you want it to carry.
Like so:

Code: Select all

defineObject{
	name = "party",
	baseObject = "party",
	components = {
		{
			class = "Party",
			-- party hooks go here (Like onDrawGui or onDie)
		},
		{
			class = "Timer",
			name = "myTimer",
			timerInterval = 30,
			disableSelf = true,
			enabled = false,
			onActivate = function(self)
				hudPrint("myTimer onActivated")
			end,
		},
	},
}
My asset pack [v1.10]
Features a bit of everything! :D
Post Reply