jaxonz Posted April 22, 2014 Share Posted April 22, 2014 OK, working on a little utility mod. I have an operation affecting the whole cell, so as a courtesy I am creating a savegame before this operation. Everything works beautifully. HOWEVER, when I load the saved game, the script that was running picks right up where it left off. Example:Confirm to do the operation Save the game in case something goes bad Do something big... Something goes wrong!On game load...Do something big... Something goes wrong!The only way I can think of avoiding this is to add another confirmation message after the save game. Is there some sort of volatile variable I could use that doesn't survive a saved game to detect when this is a new load and abort the script in progress? Hmmm... maybe a timestamp. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 22, 2014 Share Posted April 22, 2014 What is the "something big" and what is going wrong with it? Maybe that problem could be resolved instead of trying to figure out how to bypass the continuation of running scripts when a save is loaded. Link to comment Share on other sites More sharing options...
jaxonz Posted April 22, 2014 Author Share Posted April 22, 2014 In this case I am manipulating all of the objects in the cell to lock them in place (preventing havok settling). That IMHO is something one would want to do an autosave before hand. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 22, 2014 Share Posted April 22, 2014 That sounds like something that you have taking place as soon as the cell is loaded/attached and the 3D data of each object is loaded. How does one access this cell? Is it through a load door? If it is, you could rely on the standard auto-save that is made when going through load doors. In the event that the player has those turned off you can use GetINIBool (i.e. Utility.GetINIBool(bSaveOnTravel:Main) ) to check and see if the auto-save is on or off. When it is off request the save. I would use OnCrosshairRefChange with the target ref being the door that way it should process before the player activates the door itself. If you are manipulating the objects at another point, you can find some other means (perhaps a trigger box) to call the save request. The goal is that the save request needs to not be within the same event as the manipulating. In that way, if something goes wrong the player would know not to perform the event that caused the problem. At any rate, it is all guessing at this point since only you know exactly what is happening and when it is happening. Link to comment Share on other sites More sharing options...
jaxonz Posted April 23, 2014 Author Share Posted April 23, 2014 I really appreciate your response. What I did (and is working) is to leverage the OnPlayerLoadGame event from a player ref already in my mod for the SkyUI MCM menu. This doesn't fire on a new game load, but otherwise fires reliably. I'm using it to set a boolean flag tp false on the script that is doing the work to lock down objects (which is exposed as a property. I set the flag to true when I start the procedure, then check after the game.requestsave() call to see if it is still true. If not I abort the script in progress. Working pretty reliably. This is part of the Jaxonz Positioner mod. The operation allows one to lock down all the items in a cell (most likely a player home) so that they don't get bashed around by errant havok settling, NPCs or clumsy me. Thanks again for the help. Link to comment Share on other sites More sharing options...
Recommended Posts