Jump to content

[LE] Is there a way to add global variables to an already running instance of a quest?


Nund

Recommended Posts

So I am creating a mod that modifies an existing quest that starts at game start and never gets stopped or reset. The mod modifies a few dialogue topics and adds global variables for text replacement in those topics. I want to make it so that the mod can be installed into an existing savegame, which works fine for the most part, except that I can't get the text replacement to display because, of course, the running quest instance doesn't know those additional global variables. UpdateCurrentInstanceGlobal doesn't help because I can't update a variable that isn't there to begin with.

 

On a new game, everything works as intended and I can update the variables just fine, so there's most likely no error in the code with respect to this, at least.

 

So my question is, does anybody know a way to dynamically update the global variables list of an active quest instance without restarting the quest? Or, if that is not an option, an easy and failsafe way to store the state of the active quest instance (all variables, stage completion, alias references etc.) so I can copy that into a new quest instance without any events firing again that might re-trigger scenes etc.?

 

Or do I need to do this the hard way by making a script that picks up all the relevant data one by one and overrides all the unwanted events with empty ones while setting up the new quest instance?

 

I would like to avoid using SKSE functions to keep the mod as compatible with everything as possible.

 

Thanks in advance.

Link to comment
Share on other sites

Thanks, Rasikko. Contrary to my initial assumption, this would actually have worked, but the alias to which I attached the script was in one case not actually pointing to the reference I thought it was pointing to, because I misinterpreted the script code of the original quest. So nothing happened in my OnActivate event and I thought that was due to the UpdateCurrentInstanceGlobal() command not working in this context.

 

I'll let this thread and my original post stand as a reminder that UpdateCurrentInstanceGlobal() actually does add global variables and their values to quest instances that were started before a mod was installed that adds those global variables to the text global list of said quest, in case someone else experiences similar problems and starts to think that it might not, like I did.

Edited by Nund
Link to comment
Share on other sites

  • Recently Browsing   0 members

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