Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

Dylbill

Uploaded by

dylbill

Virus scan

Safe to use

Tags for this mod

About this mod

This adds script timer functionality similar to Fallout 4, achieved using skse's Mod Events.
Can have unique timers on the same script.

Requirements
Permissions and credits
Changelogs
Donations

     Check Out My Other Mods


Description
This adds script timer functionality similar to Fallout 4, achieved using skse's Mod Events.
Can have unique timers on the same script. 

Includes GetTimerObj, StartTimer, StartTimerGameTime, CancelTimer, CancelTimerGameTime and DeleteTimer functions. 
Here's an example of how to use the timers, which is also included in the download: 

Spoiler:  
Show
 
Scriptname TimerExample extends Form

TimerObj Property TimerA Auto Hidden 
TimerObj Property TimerB Auto Hidden 

Event OnInit() 
Utility.Wait(1)
;Timer events should be unique, use your mod name as a prefix
TimerA = Timer.GetTimerObj(TimerEvent = "MyMod_Timer", GameTimeTimerEvent = "MyMod_TimerGameTime")
TimerB = Timer.GetTimerObj(TimerEvent = "MyMod_Timer", GameTimeTimerEvent = "MyMod_TimerGameTime") 
 
;register for timer events
RegisterForModEvent("MyMod_Timer", "OnTimer")
RegisterForModEvent("MyMod_TimerGameTime", "OnTimerGameTime")
 
TimerA.StartTimer(1.0) ;update in 1 second
TimerA.StartTimerGameTime(0.5) ;update in half an hour game time
 
TimerB.StartTimer(3.0) ;update in 3 seconds 
TimerB.StartTimerGameTime(2.0);update in 2 hours game time
EndEvent

Event OnTimer(string a_eventName, string a_strArg, float a_numArg, form a_sender)
If a_sender == TimerA 
  Debug.MessageBox("TimerA")
Elseif a_sender == TimerB
  Debug.MessageBox("TimerB")
Endif
EndEvent

Event OnTimerGameTime(string a_eventName, string a_strArg, float a_numArg, form a_sender) 
If a_sender == TimerA 
  Debug.MessageBox("TimerA Gametime")
  TimerA.DeleteTimer() ;delete TimerA
  TimerA = None ;necessarry for TimerA to actually be deleted from game
Elseif a_sender == TimerB
  Debug.MessageBox("TimerB Gametime")
  TimerB.DeleteTimer() ;delete TimerB
  TimerB = None ;necessarry for TimerA to actually be deleted from game
Endif
EndEvent



Note that timers are actually persistent object references, so use: 
MyTimer.DeleteTimer() 
MyTimer = none 

If you don't need it anymore.

Update
I added an example of how to make timers without using SKSE. 
The timer objects call the OnTimer and OnTimerGameTime events directly on your main script.
It's explained how in the download's source scripts.

Installation
Extract to your Skyrim Data folder.

Requirements
SKSE64

ConsoleUtil SE

These are only required for the main skse version that uses mod events.
Note that this will work on LE as well. If installing on LE, install the LE versions of the above mods.