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!
= Enable/Disable Lock on object based on hours of day = Say you have a door or treasure chest you want to have a timed lock on it, here you can. You can also send a Message to the users when it Enables/Disables. Similar to above. You could use it for a template for a variety of things not just a lock Mechanism, however this is a straight-forward basic example. This script section now uses a new Timed Object Reference which no longer performs polling in order to check the times. Instead it make use of the WaitGameTime function which means less overhead and more accurate timing. '''To make this work''': Download and copy the [https://gist.github.com/Langerz82/976c172ce04f074bea91 TimedObjRef2.psc] file to your Skyrim/Data folder. The following is an example of the script in action. <syntaxhighlight lang="papyrus">ScriptName jlTimedLock2 extends TimedObjRef2 String Property sEnabledMessage Auto ; Optional Message when enabled. String Property sDisabledMessage Auto ; Optional Message when disabled. ; Override the original function Function ObjectActive() if (sEnabledMessage != "") Debug.MessageBox(sEnabledMessage) EndIf ; Insert Custom Code. ; Example - Timed Locking. Self.Lock(TRUE, TRUE) ; End Custom Code. EndFunction ; Override the original function Function ObjectInactive() If (sDisabledMessage != "") Debug.MessageBox(sDisabledMessage) EndIf ; Insert Custom Code. ; Example - Timed Unlocking. Self.Lock(FALSE, TRUE) ; End Custom Code. EndFunction </syntaxhighlight> Don't forget to set the properties once you have attached the script to an Object Reference. For more examples like this see [[Using Activated Object Reference]] for advanced functionality.
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