sagittarius22 Posted February 9, 2012 Share Posted February 9, 2012 (edited) Hi, I've a script here; I'd like it to be run during gamemode, never stopping; but for some reasons it does not seem to work, even if the script compiles without errors... Here it is: Scriptname SAGPlayerInChargenMyScript extends Quest Quest Property MyProperty Auto Spell Property Rested Auto SPell Property WellRested Auto Spell Property MarriageRested Auto Function SomeFunction() registerForUpdate(0.5) ; Before we can use onUpdate() we must register. EndFunction Event OnUpdate() if Game.GetPlayer().HasSpell(Rested) || Game.GetPlayer().HasSpell(WellRested) || Game.GetPlayer().HasSpell(MarriageRested) Debug.MessageBox("Its okay") registerForUpdate(0.5) else registerForUpdate(0.5) Debug.MessageBox("Not Okay") Endif EndEvent No message appear, so that means something is done wrong... Edited February 10, 2012 by sagittarius22 Link to comment Share on other sites More sharing options...
philip141091 Posted February 9, 2012 Share Posted February 9, 2012 The function SomeFunction() needs to be called or it wont run (it wont run automatically) try EVENT OnInit() instead Link to comment Share on other sites More sharing options...
Korodic Posted February 9, 2012 Share Posted February 9, 2012 what are you attempting to do exactly? see if the player has slept? Link to comment Share on other sites More sharing options...
sagittarius22 Posted February 9, 2012 Author Share Posted February 9, 2012 I'm trying to see if the player is under the WellRested effect... Link to comment Share on other sites More sharing options...
Korodic Posted February 10, 2012 Share Posted February 10, 2012 Meh, I was only asking because this seems to be the exact thing I was trying to accomplish with my mod. I need to know when the payer has slept, but I wasn't sure if it was more effective to have a continuously running script or script the beds themselves. I still am not sure which is more efficient. :psyduck: EDIT: But I agree w/ philip. Something needs to be using a function. Better to have an event which starts it. :thumbsup: Link to comment Share on other sites More sharing options...
sagittarius22 Posted February 10, 2012 Author Share Posted February 10, 2012 Thanks I'll try this :-) Link to comment Share on other sites More sharing options...
philip141091 Posted February 10, 2012 Share Posted February 10, 2012 additonally, you only need to RegisterForUpdate(0.5) once, and itll send an update event every 0.5 seconds. To ask for single update use RegisterForSingleUpdate(0.5), or keep it as it is and use UnregisterForUpdate() when you dont need updates anymore Link to comment Share on other sites More sharing options...
sagittarius22 Posted February 10, 2012 Author Share Posted February 10, 2012 (edited) I made this:Scriptname SAGPlayerInChargenMyScript extends Quest Quest Property MyProperty Auto Spell Property Rested Auto SPell Property WellRested Auto Spell Property MarriageRested Auto Function SomeFunction() registerForUpdate(0.5) EndFunction Event OnInit() SomeFunction() if Game.GetPlayer().HasSpell(Rested) || Game.GetPlayer().HasSpell(WellRested) || Game.GetPlayer().HasSpell(MarriageRested) Debug.MessageBox("Its okay") else Debug.MessageBox("Not Okay") Endif EndEvent But it does not have any effect :psyduck: Edited February 10, 2012 by sagittarius22 Link to comment Share on other sites More sharing options...
Korodic Posted February 10, 2012 Share Posted February 10, 2012 SomeFunction should not be in the OnInit event. Because if that is looping then it is constantly asking to register for updates. http://www.creationkit.com/OnInit Link to comment Share on other sites More sharing options...
philip141091 Posted February 10, 2012 Share Posted February 10, 2012 is that script attached to a quest or something? if it isnt attached to anything it wont run Link to comment Share on other sites More sharing options...
Recommended Posts