Script to disableenable item based on time?

Post » Sun Jun 24, 2012 2:18 am

Don't really want to get too indepth with learning the Papyrus language, but I need a simple little script that will activate or deactive the object the script is placed on, depending if it's night or day.

Also, a little guide to actually making a new script would be useful, haven't even worked out yet how to view scripts :S
User avatar
Juliet
 
Posts: 3440
Joined: Fri Jun 23, 2006 12:49 pm

Post » Sun Jun 24, 2012 8:30 am

Not knowing what you are trying to make happen (whats the activation?), you could use a spell & conditions.
(Target) S
(Function Name) GetCurrentTime
(Comp) <=
(Value/Time/24hr format) 5.00 = 5am, 17 = 5pm for example.
(the last bit would be) And (or) Or.

This may not be exact but it may be worth looking into (depending what you are after).
User avatar
Zualett
 
Posts: 3567
Joined: Mon Aug 20, 2007 6:36 pm

Post » Sun Jun 24, 2012 5:52 am

The following script (attached to a start enabled quest) should be roughly what you want. Ideally you'd do something with the sunrise and sunset time of the current climate, but you'll need SKSE for that.

Disclaimer this is untested and typed without the CK at hand

ScriptName SleepyTime extends QuestObjectReference property objectToToggle auto ;; select the reference you wish to toggle for this oneGlobalVariable property GameHour auto ;; you can auto fill thisEvent OnInit()	RegisterForUpdate(10.0)EndEventEvent OnUpdate()	if objectToToggle.IsEnabled() && (GameHour > 20 || GameHour < 6)		objectToToggle.Disable()	elseif objectToToggle.IsDisabled() && (GameHour >= 6 && GameHour <= 20)		objectToToggle.Enable()	endifEndEvent

Note that you'll need to fill in the property values in the CK. Read up on those if you haven't yet: http://www.creationkit.com/Variables_and_Properties.
User avatar
Emmie Cate
 
Posts: 3372
Joined: Sun Mar 11, 2007 12:01 am

Post » Sat Jun 23, 2012 9:46 pm

Also, a little guide to actually making a new script would be useful, haven't even worked out yet how to view scripts :S

Check http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Hello_World

And (a bit more in-depth) http://www.creationkit.com/Bethesda_Tutorial_Basic_Quest_Scripting

(If you just want to view an existing script, open something like one of the main quests, go to the scripts tab, and right-click on the script, and then you can edit the source or open external)


Note that you'll need to fill in the property values in the CK. Read up on those if you haven't yet: http://www.creationkit.com/Variables_and_Properties.

Especially if you are writing the properties into the script yourself.
User avatar
Far'ed K.G.h.m
 
Posts: 3464
Joined: Sat Jul 14, 2007 11:03 pm

Post » Sun Jun 24, 2012 7:46 am

Thanks all.

I want to make a script that disables lights and FX objects at night, such as sunshafts and ambient lights in dungeons, so that the dungeon environment is more dynamic.
Worked fine in MW and OB, so should also work in SK.
User avatar
Genocidal Cry
 
Posts: 3357
Joined: Fri Jun 22, 2007 10:02 pm


Return to V - Skyrim