manipulating day/night cycle

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
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

manipulating day/night cycle

Post by FeMaiden »

can I do this?
like, can i trigger it to become night when the party steps on a floor trigger?
or can I make a map level so that it will always be night time?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: manipulating day/night cycle

Post by Drakkan »

viewtopic.php?f=22&t=7055
part 9 - day and night cycle
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: manipulating day/night cycle

Post by FeMaiden »

Drakkan wrote:viewtopic.php?f=22&t=7055
part 9 - day and night cycle
lol i'm only up to part 8 - buried treasure.
perhaps I should just sit through all of them before trying to move forward
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: manipulating day/night cycle

Post by FeMaiden »

well, watching skuggaveins tutorial did help me do what I wanted to do, but I still had to be a little creative.

this is what I wanted to do. I wanted the party to trigger a floor trigger that makes it become "eternal night". the game will stay in night time mode until a certain villain is defeated, at which time, dawn will finally come.

skuggs did not mention anything about keeping the time at a certain spot. maybe I'm making it more complicates as usual.
is there a way to just stop the game clock?

the way I worked it out was to put a script

Code: Select all

function eternalnight()
	GameMode.setTimeOfDay(1.5)
end
and then I hooked a timer up to it with a timerInterval of 1 so that every time it ticks, the game clock gets reset to midnight.

sooo..i have a perpetually ticking clock running throughout my mod.

the villain has an onDie connector to deactivate the clock and set the time of day to a little after dawn, so it becomes dawn when they defeat him.


now one that that confuses me is how the objects work when the party is on a different map level.
so like, I put the script and the timer on the level they first encounter the villain

and i used skugg's "what time is it " script for debugging purposes to give me repeated hurPrints of the time to make sure it's working properly.

and I noticed that when i'm on the same map, the timer ticks every second but when i'm on another map, the timer only ticks once like every 80 seconds.

do game objects update more slowly when they are on a different map?
I noticed in the main campaign when you drop the rock down the hole in the ruins of desarunes, that it takes a few seconds before you hear that *click* and the door opens. there's a delay.

TL:DR

so i'm not asking how to make this work,
I have it working.
I'm asking how the objects work when they are off map.
Also wondering if there was a "better" way to make this work.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: manipulating day/night cycle

Post by Drakkan »

yes there is I believe - check the global timer.
viewtopic.php?f=22&t=7829#p80454

just note regarding "ticking" time on the same value again again - I hope you realize this could (and will) screw some game mechanics which are dependable on time flow (like gardening ingredients...)
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: manipulating day/night cycle

Post by FeMaiden »

Drakkan wrote:yes there is I believe - check the global timer.
viewtopic.php?f=22&t=7829#p80454

just note regarding "ticking" time on the same value again again - I hope you realize this could (and will) screw some game mechanics which are dependable on time flow (like gardening ingredients...)
well, one, I think the alchemy is going to be irrelevant.
and two, as far as I know, the alchemy herb spawning is not tied to time flow, it is tied to the number of steps taken in the game stats.
every 750 steps, a red herb spawns
every 3000, a bloodmoss spawns
every 4500, a crystal flower spawns

but the herbs is all moot
like I said earlier, this is going to be a small mod more just so I can have something to my name in the steam workshop(no this is not a lazy slapped together mod), so i made a design decision not to put herbs in it, to have better control on just how many potions the player will get.

so as long as I don't make any time based puzzles, like a magic bridge that only appears at a certain time of day, I should be okay right?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: manipulating day/night cycle

Post by minmay »

Drakkan wrote:just note regarding "ticking" time on the same value again again - I hope you realize this could (and will) screw some game mechanics which are dependable on time flow (like gardening ingredients...)
...i'm pretty you're making this up
can you name a single game mechanic that depends on time of day?
the only one i know of is the nightstalker trait, which you absolutely cannot screw up by changing time of day
alchemist herbs absolutely do not depend on time of day, they don't even depend on game time or real time (and again, TIME OF DAY IS NOT IN ANY WAY RELATED TO GAME TIME OR REAL TIME, time of day only changes when the party is resting or takes actions)
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
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: manipulating day/night cycle

Post by FeMaiden »

minmay wrote:
Drakkan wrote:just note regarding "ticking" time on the same value again again - I hope you realize this could (and will) screw some game mechanics which are dependable on time flow (like gardening ingredients...)
...i'm pretty you're making this up
can you name a single game mechanic that depends on time of day?
the only one i know of is the nightstalker trait, which you absolutely cannot screw up by changing time of day
alchemist herbs absolutely do not depend on time of day, they don't even depend on game time or real time (and again, TIME OF DAY IS NOT IN ANY WAY RELATED TO GAME TIME OR REAL TIME, time of day only changes when the party is resting or takes actions)
lol, i basically said the same thing. the alchemy herbs is tied to the steps taken taken stat. where drakkan might be getting that from is skuggaveinns tutorial part 9. it seems like he was still somewhat new it himself when he made the video and near the end he says "i don't know if this will screw up some mechanics like the alchemist herbs which spawn as time passes" or something like that.
I left a comment on the video about the herbs.

however, there is a game mechanic that does depend on time, but only if you script a puzzle that depends on the time of day, such as the magic bridge that only appears at night, if I made the ticker do "eternal day" then the night bridge would never appear.
so maybe he was just trying to warn me that it might conflict with other scripts i put someplace else?
Post Reply