Editing
Complete Example Scripts
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Script for a quest with time limit = <syntaxhighlight lang="Papyrus"> Scriptname LH_TimeLimitedQuest 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 (TGRDays.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.0) TimedQuest.UpdateCurrentInstanceGlobal(GlobalTime) TimedQuest.SetStage(FailStage) UnregisterForUpdateGameTime() EndIf EndIf EndEvent </syntaxhighlight>
Summary:
Please note that all contributions to the CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
CreationKit:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Landing page
Tutorials
Game Systems
Editor Reference
Scripting Reference
Recent changes
Help
Tools
What links here
Related changes
Special pages
Page information
Page values