Jump to content

A non-destructive way to change actor attributes?


Anubis22

Recommended Posts

Let's say I have a mod that changes actor attributes on the fly from within a script. Is there any way to handle this task in a truly non-destructive manner? By which I mean, that the changes will automatically revert should the player decide to uninstall the mod - especially when doing so without warning or giving it time to properly uninstall.

 

I had hoped this could be achieved by adding spells to the player which do the alterations (instead of using modav) which, so I hoped, would then disappear when the mod is removed. But testing proves me wrong and spells do not dispel when the mod that caused them is removed. Even worse they seem to just stay active indefinately (even when the spell had a time limit) and it's only making it harder to reset the changes, compared to modifying the values directly.

 

Is there any approach to make an "automatic" uninstall on mod remove possible?

 

 

 

 

On a related note:

Is any cleanup advisable for scripts which are not registered for updates and only listen for events?

 

 

Edit:
I just realised I posted this in the wrong subforum, it should be in "Skyrim Creation Kit and Modders", apologies.

Edited by Anubis22
Link to comment
Share on other sites

I was able to find a way by experimenting around a lot, though I do not know how reliable it is.

 

This approach works by adjusting the values with ModAV() and storing the changes made as a seperate variable. Since scripts keep on running even though the mod which created them got removed this variable can then be used to undo the changes the mod made.

The problem was how to find out when the mod got removed to trigger a cleanup function. I managed to do this by creating a GlobalVariable and giving it some fixed value != 0. Then I periodically check if the variable indeed returns the value I gave it. If the mod gets removed unexpectedly the GlobalVariable will not be able to return the value so I know the mod was removed.

 

 

Still I would like to know if there is a more elegent alternative and the other question still stands

Link to comment
Share on other sites

  • Recently Browsing   0 members

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