Do something 24 hours after Event

Post » Sat Nov 17, 2012 6:19 am

Hey guys. Here is a test script I threw together before. It works great as is, but what I'd like to do is have the object in question enabled 24 hours after the first object is activated; as opposed to instantly. Here is the script:

Spoiler

Scriptname aaatestactscript1 extends ObjectReference  ObjectReference Property aaacookstone1  Auto  Ingredient Property HISTroll1Heart  Auto  Quest Property HISQuest1WRTroll  Auto  Event OnActivate(ObjectReference akActionRef)	if (akActionRef == Game.GetPlayer()) && (HISQuest1WRTroll.GetStageDone(40))   Game.GetPlayer().RemoveItem(HISTroll1Heart, 1)   aaacookstone1.Enable()elseDebug.Messagebox("You cannot activate this object")  endifEndEvent

I've had a look at the different "Update" functions, but not really sure which one to use, or where to use it.

As always any help is much appreciated :smile:

EDIT: Please pay no attention to the actual items. I'm not planning on making cooking stones appear when you have troll hearts :wink: This is just a test script I'm working on for a much more elaborate idea :rock:
User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Sat Nov 17, 2012 4:25 pm

Make aaacookstone1 an activator (perhaps with no display name if you don't want the player to see activation mouseover text). Attach a script to it that has a function that your aaatestactscript1 calls when activated. Have that function RegisterForSingleUpdateGameTime(24) inside aaacookstone1's script. In aaacookstone1's OnUpdateGameTime() event, call self.enable().
User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm

Post » Sat Nov 17, 2012 12:46 am

These are the two things you need to know:
http://www.creationkit.com/OnUpdateGameTime_-_Form
http://www.creationkit.com/RegisterForSingleUpdateGameTime_-_Form

Note, this line:
Member of: http://www.creationkit.com/ActiveMagicEffect_Script, http://www.creationkit.com/Alias_Script, and http://www.creationkit.com/Form_Script

So make sure you use this code an appropriate item type.

Here's your code updated (sorry, I didn't compile, but hopefully it gives you what you need to make it work):

Scriptname aaatestactscript1 extends ObjectReferenceObjectReference Property aaacookstone1  AutoIngredient Property HISTroll1Heart  AutoQuest Property HISQuest1WRTroll  AutoEvent OnActivate(ObjectReference akActionRef)	if (akActionRef == Game.GetPlayer()) && (HISQuest1WRTroll.GetStageDone(40))   Game.GetPlayer().RemoveItem(HISTroll1Heart, 1)   RegisterForSingleUpdateGameTime(24) ;in game hourselseDebug.Messagebox("You cannot activate this object")  endifEndEventEvent OnUpdateGameTime()   aaacookstone1.Enable()EndEvent
User avatar
T. tacks Rims
 
Posts: 3447
Joined: Wed Oct 10, 2007 10:35 am

Post » Sat Nov 17, 2012 8:01 am

These are the two things you need to know:
http://www.creationkit.com/OnUpdateGameTime_-_Form
http://www.creationkit.com/RegisterForSingleUpdateGameTime_-_Form

Note, this line:
Member of: http://www.creationkit.com/ActiveMagicEffect_Script, http://www.creationkit.com/Alias_Script, and http://www.creationkit.com/Form_Script

So make sure you use this code an appropriate item type.

Here's your code updated (sorry, I didn't compile, but hopefully it gives you what you need to make it work):

Scriptname aaatestactscript1 extends ObjectReferenceObjectReference Property aaacookstone1  AutoIngredient Property HISTroll1Heart  AutoQuest Property HISQuest1WRTroll  AutoEvent OnActivate(ObjectReference akActionRef)	if (akActionRef == Game.GetPlayer()) && (HISQuest1WRTroll.GetStageDone(40))   Game.GetPlayer().RemoveItem(HISTroll1Heart, 1)   RegisterForSingleUpdateGameTime(24) ;in game hourselseDebug.Messagebox("You cannot activate this object")  endifEndEventEvent OnUpdateGameTime()   aaacookstone1.Enable()EndEvent
Make aaacookstone1 an activator (perhaps with no display name if you don't want the player to see activation mouseover text). Attach a script to it that has a function that your aaatestactscript1 calls when activated. Have that function RegisterForSingleUpdateGameTime(24) inside aaacookstone1's script. In aaacookstone1's OnUpdateGameTime() event, call self.enable().

Thanks guys I'll try it out :D

EDIT:

That script worked a treat Sollar cheers man! Oh the possibilities lol ;)
User avatar
katsomaya Sanchez
 
Posts: 3368
Joined: Tue Jun 13, 2006 5:03 am


Return to V - Skyrim