Complete Example Scripts: Difference between revisions
→Enable/Disable Lock on object based on hours of day
imported>DarkWolfModding |
imported>Langerz82 |
||
| Line 772: | Line 772: | ||
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. | 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. | ||
<source lang="papyrus">ScriptName | '''To make this work''': Download and copy the [https://gist.github.com/Langerz82/bfe7ddf921b1ebc00ad4 TimedObjRef.psc] file to your Skyrim/Data folder. | ||
The following is an example of the script in action. | |||
<source lang="papyrus">ScriptName jlTimedLock2 extends TimedObjRef | |||
String Property sEnabledMessage Auto ; Optional Message when enabled. | String Property sEnabledMessage Auto ; Optional Message when enabled. | ||
String Property sDisabledMessage Auto ; Optional Message when disabled. | String Property sDisabledMessage Auto ; Optional Message when disabled. | ||
Function | ; Override the original function | ||
Function ObjectActive() | |||
if (sEnabledMessage != "") | if (sEnabledMessage != "") | ||
Debug.MessageBox(sEnabledMessage) | Debug.MessageBox(sEnabledMessage) | ||
| Line 845: | Line 792: | ||
; End Custom Code. | ; End Custom Code. | ||
EndFunction | EndFunction | ||
Function | ; Override the original function | ||
Function ObjectInactive() | |||
If (sDisabledMessage != "") | If (sDisabledMessage != "") | ||
Debug.MessageBox(sDisabledMessage) | Debug.MessageBox(sDisabledMessage) | ||
| Line 857: | Line 804: | ||
Self.Lock(FALSE, TRUE) | Self.Lock(FALSE, TRUE) | ||
; End Custom Code. | ; End Custom Code. | ||
EndFunction | |||
</source> | |||
= Adding a spell when you shout = | = Adding a spell when you shout = | ||