Surjamte Posted May 17, 2013 Share Posted May 17, 2013 So I saw this example script that could be used to make a timed quest and decided to try and make one. The story is pretty simple. An npc has been poisoned and you need to find a cure within a certain amount of time. Otherwise (s)he'll die. The script compiled nice and well, but whenever I fast travel and/or in-game the game crashes. So something is obviously wrong, but I have no idea what, because I suck at scripting. Scriptname ASURG02TimedQuest extends Quest GlobalVariable Property GlobalDays auto ;initial days to complete GlobalVariable Property GlobalTime auto ;counter for hours left Quest Property TimedQuest auto ;the quest (I used two scripts on same quest while cause I modified a vanilla one) int Property FailObjective auto ;objective that will fail when hours left reaches 0, it is the one to display the time left and will be refreshed int Property FailStage auto ;stage to set the quest to, fail whole quest from it's fragment or whatever Float endTime Event OnInit() if (GlobalTime.GetValue()>0) ;Debug.Notification("Starting countdown") GlobalTime.SetValue(GlobalDays.GetValue()*24) endTime = Utility.GetCurrentGameTime()+GlobalDays.GetValue() TimedQuest.UpdateCurrentInstanceGlobal(GlobalTime) RegisterForUpdateGameTime(0.10) EndIf EndEvent Event OnUpdateGameTime() if (!TimedQuest.IsRunning()) UnregisterForUpdateGameTime() EndIf float step = Math.Ceiling((endTime - Utility.GetCurrentGameTime())*24) - GlobalTime.GetValue() if (step != 0) if (0-step > GlobalTime.GetValue()) ;avoid displaying less then 0 step = 0 - GlobalTime.GetValue() EndIf if TimedQuest.ModObjectiveGlobal(step, GlobalTime, FailObjective, 0, false, false) GlobalTime.SetValue(0) TimedQuest.UpdateCurrentInstanceGlobal(GlobalTime) TimedQuest.SetStage(FailStage) UnregisterForUpdateGameTime() EndIf EndIf EndEvent I have no idea what I'm doing, but I really want this to work. So plz help me find out what's wrong. If you want to share any better way/script to create a timed quest that would work too. :smile: Link to comment Share on other sites More sharing options...
mellophonist Posted May 17, 2013 Share Posted May 17, 2013 Based off the plot of the story your doing, I'm assuming you already watched the YouTube tutorial on how to do this in the CK? Link to comment Share on other sites More sharing options...
Surjamte Posted May 17, 2013 Author Share Posted May 17, 2013 Nope. I didn't know there was one :P I don't really like video tutorials. Prefer reading. But I could give it a try, do you have a link? Link to comment Share on other sites More sharing options...
mellophonist Posted May 18, 2013 Share Posted May 18, 2013 Sure do, the guy that does this series of CK tutorials is really thorough, I learned alot from the CK following his channel. Link to comment Share on other sites More sharing options...
Surjamte Posted May 18, 2013 Author Share Posted May 18, 2013 Okay, that was pretty awesome. I've changed my mind about youtubube tutorials :) Thanks for the link. It helped alot. Link to comment Share on other sites More sharing options...
mellophonist Posted May 18, 2013 Share Posted May 18, 2013 Not a problem, glad I could help! Good luck with your mod, if you need a tester for it when its done feel free to PM me! And also let me know when its done, I might review it on my upcoming YouTube series. Link to comment Share on other sites More sharing options...
Recommended Posts