Page 1 of 1

time riddles

Posted: Sun Oct 26, 2014 10:17 pm
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.

Re: time riddles

Posted: Sun Oct 26, 2014 10:44 pm
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.

Re: time riddles

Posted: Sun Oct 26, 2014 11:36 pm
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.

Re: time riddles

Posted: Mon Oct 27, 2014 12:29 am
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 ?

Re: time riddles

Posted: Mon Oct 27, 2014 8:25 am
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