A quest to keep track of time and add items

Post » Mon Jun 18, 2012 8:51 pm

Hello,

I need a quest that alsways runs in the background, to keep track of days passed and add items to a container everyday, untill a certain amount of days have passed. I have already had some help on the scripting side of this, but I have no experience with quests for Skyrim and I don't know how I would go about making a simple quest that's only used for a script, how to start this quest and what it should look like. Is there anybody that could point me in the right direction? Maybe give an example of such a quest already in the creation kit or somewhere else?

Thanks in advance.

Silverbird
User avatar
Danel
 
Posts: 3417
Joined: Tue Feb 27, 2007 8:35 pm

Post » Tue Jun 19, 2012 2:46 am

Bump, I just need to be pointed in the right direction..
User avatar
Isabella X
 
Posts: 3373
Joined: Sat Dec 02, 2006 3:44 am

Post » Mon Jun 18, 2012 12:33 pm

Okay, without help, I made a quest, set priority to 60, checked Start Game Enabled, added one quest stage 0 and added a script in the script tab, which looks like this:

Scriptname MyAddGoldQuestScript extends QuestInt lastTimeAddedObjectReference Property MyContainerREF AutoMiscObject Property Gold001 AutoEvent OnInit()RegisterForUpdate(10.0)EndEventFunction AddItemAfter1Day()Float time = Utility.GetCurrentGameTime ()If time - lastTimeAdded > 1;24 hours has passedlastTimeAdded == timeMyContainerREF.Additem(Gold001, 1000);...add your code hereEndIfEndFunctionEvent OnUpdate()AddItemAfter1Day()EndEvent

Would this quest and script work or have I done something totally wrong? At least it compiled okay.
User avatar
Red Sauce
 
Posts: 3431
Joined: Fri Aug 04, 2006 1:35 pm

Post » Tue Jun 19, 2012 1:49 am

If I were going to try to handle adding something to a container every day, I would probably try this:

edit: for completeness

Scriptname MyAddGoldQuestScript extends QuestObjectReference Property MyContainerRef AutoMiscObject Property Gold001 Autoint iDayCountEvent OnInit()	 RegisterForUpdateGameTime(24)EndEVentEvent OnUpdateGameTime()	 MyContainerRef.AddItem(Gold001, 1000)	 iDayCount += 1	 if (iDayCount == 5)		  UnregisterForUpdateGameTime()		  ; maybe stop your quest too?	 EndIfEndEvent

edit: corrections and revision
User avatar
Rob Smith
 
Posts: 3424
Joined: Wed Oct 03, 2007 5:30 pm

Post » Mon Jun 18, 2012 7:05 pm

That is a very easy solution, however, I need to stop adding the item after a certain amount of days. This isn't in the script yet, but it is going to be in there. And with that in mind, I'm afraid your solution does not work. But apart from the way I did it, do you think I set it up alright, with the quest and the script?
User avatar
Ross
 
Posts: 3384
Joined: Thu Aug 10, 2006 7:22 pm

Post » Mon Jun 18, 2012 3:00 pm

Why, you would only need to add

UnRegisterForUpdateGameTime() after the script has checked for how many things have been added to the barrel.

I.E
Event OnUpdate();additemUnRegisterForUpdateGameTime()Endevent
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Mon Jun 18, 2012 12:49 pm

See my correction and my initial thoughts on how to stop the quest after 5 days.
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Mon Jun 18, 2012 6:56 pm

GraniteDevil, thanks a million! That script looks way cleaner then mine, I'll be sure to credit you when the mod is released! Again, thanks alot!
User avatar
Dezzeh
 
Posts: 3414
Joined: Sat Jun 16, 2007 2:49 am

Post » Mon Jun 18, 2012 6:37 pm

Did you get to try it out? If it works, then I'm totally cool just knowing that it did :)
User avatar
Claire Lynham
 
Posts: 3432
Joined: Mon Feb 12, 2007 9:42 am

Post » Mon Jun 18, 2012 1:31 pm

Did you get to try it out? If it works, then I'm totally cool just knowing that it did :)

It works! Thanks alot GraniteDevil! Only problem is now I have all kinds of other bugs with my mod. It would be awesome if you could help me with that aswell. I managed to get it working as I want, but it only works one time and after that it's bugged. If you would like to help me with more scripting problems, please reply! Or send a private message.
User avatar
Neil
 
Posts: 3357
Joined: Sat Jul 14, 2007 5:08 am


Return to V - Skyrim