Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

noob question on using game time in scripting


Tonycubed2
 Share

Recommended Posts

Greetings,

I have serached the wikis and other material I found on the web but found no examples or solutions to creating a skyrim script that uses the time of day. I need to wirte a if-then script that activates on the player approaching a grave stone betwee the hours of 11pm and 4 am. Setting a trigger for it was easy, but I can't find a solution ofr getting the time of day/night, as in 3am, 2pm, etc. Anyhelp apprecaited.

I hope this is the right forum. First time here.

Respectfully,

Tony

Link to comment
Share on other sites

Well, I am somewhat closer than this morning. I saw the string one, but not usable to compare integers. There is a Global variable called GameHour that does keep a 24 hour clock. back in previous games the variable could be compared to an integer directly. No more. Global variables cannot be used now like that. I am testing for valid time being between 10pm and 4 am. The followintg script compiles but I am still doing something wrong:

Scriptname TombstoneDanger extends ObjectReference  


GlobalVariable property GameHour auto

Float Property NoEarlierThan = 20.0 Auto  

Float Property NoLaterThan = 4.0 Auto  


bool function IsTimeValid()

	Float Timeofday = GameHour.GetValue()       

		if Timeofday > 13

             		if Timeofday >= NoEarlierThan

			return TRUE

		       endif

             elseif Timeofday <=  NoLaterThan    

			return TRUE

		endif

	Return FALSE

endFunction



Event OnTriggerEnter(ObjectReference akActionRef)

Debug.Notification("Triggered")

if (akActionRef == Game.GetPlayer()) 

if  IsTimeValid()

Debug.Notification("Time is Valid")

endif

endif

EndEvent

Edited by WillieSea
Added Code box
Link to comment
Share on other sites

Couldn't you convert to an integer like this?

int Timeofday = GameHour.GetValue() as int
or perhaps like this?
int Timeofday = GameHour.GetValueInt()

I would probably use GetcurrentTime instead.

http://www.creationkit.com/GetCurrentTime

Another thing you can do is display the hour that was returned from the function to make sure its working.

Link to comment
Share on other sites

I wish I had seen the GetCurrentTime before. I searched for something like that , too. Well, I got it working finally. Took 2 days. I feel like I discovered e=mc2 . :coffee: At this rate the mod should be done by the year 3022 . :crybaby: here is the code I used, and I did add a line to display the time in the function for testing, that was very helpful. Next I need to spawn some skeletons at random moments during the witching hours and add some equally random spooky noises. Then on to infect every gravestone in the game. Almost.

p.s.: thanks for the suggestions, it helps to bounce stuff off someone.

p.s.s: Is there a text editor that I can use for skyrim that uses the color coding I see here? It is very cool. Using Sublime Text now.

Let me look for the code box thingy.


Scriptname TombsHaunted extends ObjectReference  


GlobalVariable property GameHour auto

Float Property NoEarlierThan = 20.0 Auto  

Float Property NoLaterThan = 4.0 Auto  


bool function IsTimeValid()

	Float TT = GameHour.GetValue()   

		if TT > 13

             		if TT >= NoEarlierThan

			return TRUE

		       endif

            elseif TT <=  NoLaterThan    

			return TRUE

		endif

	Return FALSE

endFunction



Event OnTriggerEnter(ObjectReference akActionRef)

Debug.Notification("Triggered")

	if (akActionRef == Game.GetPlayer()) 

		if  IsTimeValid()

		Debug.Notification("Time is Valid")

             	endif

	endif

	Debug.Notification(GameHour.GetValue())

EndEvent

Edited by Tonycubed2
Link to comment
Share on other sites

p.s.s: Is there a text editor that I can use for skyrim that uses the color coding I see here? It is very cool. Using Sublime Text now.

Let me look for the code box thingy.

Maybe something like this?

notepadpapyrus01.th.jpg

notepadpapyrus02.th.jpg

notepadpapyrus03.th.jpg

See if you can follow the instructions HERE ... You will need the free and great program NotePad++ there is a link to it on the page that I linked.

I did both the following sections:

  • Setting up a quick compile
  • Setting up Papyrus Language Definitions

If you have issues just PM me and I'll do my best to help you. I've used NotePad++ for several years now and I love it, and using it with Skyrim's Papyrus coding makes scripting a lot easier especially with the AutoComplete setup.

Link to comment
Share on other sites

  • 5 months later...

You can set the 'timescale' used in the game.

A setting of '1' is normal passage of time, where one minute in game is one minute in the real world.

The game usually goes at '30'. Perhaps '16'? I am not sure what Skyrim uses.

Is it possible to incorporate the set timescale into a script that affects the player when a player is in a worldspace and/or cell(s)

Link to comment
Share on other sites

That would be correct. And I have made worldspaces forever twilight. :)

well i still have 15 minutes of daylight... in theory my weather setting should get rid of it, as i did a preview while making it, but the weird thing is that my weather setting won't apply to my climate setting. I don't know why...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...