Jump to content

Run script every time savegame is loaded?


WorldShaperDragon

Recommended Posts

Well, always-active is one thing, I just want it to run a single time when the save is loaded. The Quest scripts only inits once. Do perk scripts re-init after every save?

 

edit- maybe some way of storing a variable that causes it to not get saved?

Edited by Wolf of the azar
Link to comment
Share on other sites

At the end of your script, set a global variable to 1 (make it default to 0 and not store it so it resets to zero when you load a game.). Then use the function to stop the script. Then make a condition for the quest to start be that the global var = 0. Otherwise just follow the info in that link you posted.
Link to comment
Share on other sites

Ok... I'm utterly new to papyrus and pretty know all I know via google searches & poking through the creation kit wiki.

 

So I managed to get it sort of implemented, but the problem is that I can either set it as a constant, which results in it not getting changed in the save (just as I want) but ALSO not getting changed in the instance (which I don't want!). This results in it always running on every update

 

Conversely:

 

If I don't set it as a constant, it gets set in the instance (which I want) but ALSO it gets set in the save (which I don't want either!). This results in it running only once.

 

So how do I 'not store it' like you said?

Link to comment
Share on other sites

Hmm, still doesn't work. :/

 

It seems that the item isn't getting added to the leveled list (regardless if I have a leveled list or not that the property points to)

 

Nevermind. The CK glitched up and was reporting a filled property when it really wasn't. Reloading the datafiles & refilling it corrected the issue, and the script now works.

Thanks!

Edited by Wolf of the azar
Link to comment
Share on other sites

Good to hear :)

 

I don't know if you saw, but that function is now on the wiki. Using a container rather than the player which is probably a little safer.

 

It's also a good idea to use several RegisterForSingleUpdate() over RegisterForUpdate().

 

 

Event OnInit()
       RegisterForSingleUpdate(30)
EndEvent

Event OnUpdate()
       If GetGameLoaded()
               Debug.Notification("bGetGameLoaded == True") ; Shows once per save load
       Else
               Debug.Notification("bGetGameLoaded == False") ; Shows repeatedly
       EndIf
       RegisterForSingleUpdate(30)
EndEvent

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...