HeirOfTheSeptims Posted June 5, 2021 Share Posted June 5, 2021 (edited) I'm trying to use this function to control time between uses of a scripted item. For some reason it just won't work at all. Here's a shortened version of the script: Event OnEquipped(Actor AkActor) If(Waiting == False) Game.DisablePlayerControls(false, false, False, false, false, True, false, False) ;Doing Stuff Waiting = true Game.EnablePlayerControls() If(RegisterForSingleUpdateGameTime(1.0)) Debug.Notification("Update Should Be Registered") Else Debug.Notification("Update Did Not Register!") EndIf Else Debug.Notification("You have already used this today") EndIf EndEvent Event OnUpdateGameTime() Waiting = False Debug.Notification("Update Completed") EndEventWhenever I test it it shows that it did not register, meaning that the issue is with the function not the event. Does anyone know why? I cant figure out what I could be doing wrong :wallbash: Edited June 5, 2021 by HeirOfTheSeptims Link to comment Share on other sites More sharing options...
ReDragon2013 Posted June 5, 2021 Share Posted June 5, 2021 (edited) You cannot use this code If RegisterForSingleUpdateGameTime(1.0) Else EndIfbecause the native function RegisterForSingleUpdate() does not return any variable like bool. So you'll get always the else branch. some links for interest:https://www.creationkit.com/index.php?title=OnEquipped_-_ObjectReferencehttps://www.creationkit.com/index.php?title=RegisterForSingleUpdateGameTime_-_Form ; https://forums.nexusmods.com/index.php?/topic/10108013-registerforsingleupdategametime-not-working/ Bool Waiting ; [default=False] EVENT OnEquipped(Actor akActor) IF ( Waiting ) ; == TRUE Debug.Notification("You have already used this today!!") ELSE ; == False Waiting = TRUE ; *T* Game.DisablePlayerControls(False, False, False, False, False, True, False, False) ; ---------------------- ; ... doing Stuff here ; ---------------------- Game.EnablePlayerControls() RegisterForSingleUpdateGameTime(1.0) ; (1.0) one hour to wait, (24.0) one day to wait(as in-game hour) Debug.Notification("Update has been registered.") ENDIF ENDEVENT EVENT OnUpdateGameTime() Waiting = False ; *** Debug.Notification("Update Completed!") ENDEVENT Sometimes its a good idea to look into original source files or Skyrim wiki. Edited June 5, 2021 by ReDragon2013 Link to comment Share on other sites More sharing options...
HeirOfTheSeptims Posted June 5, 2021 Author Share Posted June 5, 2021 That was just added for testing purposes, it still doesn't work in game with or without it Link to comment Share on other sites More sharing options...
Recommended Posts