time riddles

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
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

time riddles

Post by Drakkan »

Hello script masters around. Somebody was already able to crack how to script / make time riddles ? I want make magical bridge visible only in particular time of the day.
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: time riddles

Post by Skuggasveinn »

I've been flirting with a timemachine :)

So far I've not uncovered much. But I have this http://www.zorglubb.net/grimrock/dropzo ... achine.mp4

This is what I've found out so far.
The commande GameMode.setTimeOfDay() changes the skybox.
so 0 seems to be dawn, and about 0.5 is high day, then just before 1 we go into dusk and just after 1 we have night that stays until we go back to 0

The lever in the video simply starts a timer that calls this function

Code: Select all

function timemachine()
	clock = 0 else

    GameMode.setTimeOfDay(clock)
	clock = clock + 0.01
	hudPrint(""..clock.."")
	
	end
	
end
I haven't figured out how I can query for time, and if time is this or that then do .... (like I wan't to query for the time after 1 until 0 again, to spawn fireflies only in the night etc)
If anyone has any insight, I'm all ears :D

Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: time riddles

Post by JKos »

That's cool, how did you find that GameMode-object?
Edit: Just tested and you can query time with command: GameMode.getTimeOfDay()
so you can just use a timer which executes a script where you check if it's time to show the bridge or do something else, should be easy.
- 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
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: time riddles

Post by Drakkan »

JKos wrote:That's cool, how did you find that GameMode-object?
Edit: Just tested and you can query time with command: GameMode.getTimeOfDay()
so you can just use a timer which executes a script where you check if it's time to show the bridge or do something else, should be easy.
sounds quite esay, still too complicate to me :) In case you will be boring can you please write the scrpt ?
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: time riddles

Post by JKos »

Something like this (not tested)
bridge_check script entity

Code: Select all

-- show bridge between timeofday 0.5 and 0.7
function brigeShowCheck(timer)
	if GameMode.getTimeOfDay() > 0.5 and GameMode.getTimeOfDay() < 0.7 then
		--show bridge
	end
end
place a timer to the level where your bridge is located and set desired interval for eg. 10 secs. And then add a connector and attach its onActivate-event to bridge_check.script:bridgeShowCheck
- 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