WorldShaperDragon Posted April 3, 2012 Share Posted April 3, 2012 How do I run a script every time a savegame is loaded? Link to comment Share on other sites More sharing options...
Diserasta Posted April 3, 2012 Share Posted April 3, 2012 The easiest way would be to create a quest with no objectives that's always active, and attach the script so it loads with the quest.Or a hidden perk that has the script attached. Link to comment Share on other sites More sharing options...
WorldShaperDragon Posted April 3, 2012 Author Share Posted April 3, 2012 (edited) 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 April 3, 2012 by Wolf of the azar Link to comment Share on other sites More sharing options...
WorldShaperDragon Posted April 3, 2012 Author Share Posted April 3, 2012 http://forums.nexusmods.com/index.php?/topic/558795-script-tutorial-script-initialization-on-game-load/ In here it said that leaving the 'complete quest' option unchecked allowed it to run after every load, but I couldn't replicate said behavior. Am I missing or misinterpreting something? Link to comment Share on other sites More sharing options...
elseagoat Posted April 3, 2012 Share Posted April 3, 2012 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 More sharing options...
WorldShaperDragon Posted April 3, 2012 Author Share Posted April 3, 2012 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 More sharing options...
tunaisafish Posted April 4, 2012 Share Posted April 4, 2012 @Wolf, see this discussion on the Beth forum. The global constant method is mentioned there too, but also found not to work. It was assumed to work as it did in previous games. See kuertee's method that he links to, and the one posted near the end of the thread by JustinOther. Link to comment Share on other sites More sharing options...
WorldShaperDragon Posted April 4, 2012 Author Share Posted April 4, 2012 Cool! I'm going to give it a shot right now. Link to comment Share on other sites More sharing options...
WorldShaperDragon Posted April 4, 2012 Author Share Posted April 4, 2012 (edited) 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 April 4, 2012 by Wolf of the azar Link to comment Share on other sites More sharing options...
tunaisafish Posted April 4, 2012 Share Posted April 4, 2012 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(). Reveal hidden contents 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 More sharing options...
Recommended Posts