Jump to content

Ability added with script not being removed on mod uninstall


Vinifera7

Recommended Posts

My question requires a bit of explanation first. Using a script, I want to give the player an ability that modifies several actor values. This itself is not a problem. I already know how to do it. The problem is this: When I uninstall my mod, the actor values that were affected by the ability don't revert back to their vanilla values. How can I get around this so that my mod can be uninstalled properly?
Link to comment
Share on other sites

You have to tell your players to make sure that the ability has worn off before uninstalling the mod - it is the only surefire way. This of course assumes you have built-in a way for that ability to be removed (like a timer, for example).

Alternative way is to make an uninstall script which removes your ability via game.getPlayer().removeSpell(myAbility) - this would restore the original actor values (assuming you have set the "recover" flag for all the effects) and then the mod can be safely uninstalled (the problem arises when your ability is not actually removed by proper means, but simply dissappears from game assets when the mod is removed). You could link that script to a potion's Magic Effect... sort of a "Blue Pill" perhaps? ;)

Edited by Mansh00ter
Link to comment
Share on other sites

One thing to keep in mind... a lot of player data/variables get cooked into your save game file, simply removing the mod that made the change won't do anything because the actual mod did its thing at the beginning and then was technically no longer needed once your game was saved.
Link to comment
Share on other sites

Yep, so you have to be careful with the way you run your scripts - I once had a situation where I tested uninstalling and erased the .esp and all the scripts, and lo and behold, the script was merily still ticking away even after uninstall.

 

So an uninstall script to remove all elements your mod added + scripting architecture that kills active scripts if the mod isn't running anymore is a must. If you have background "tick" scripts that use onUpdate() and similar, I find that using RegisterForSingleUpdate() and then re-registering the script each tick does the trick - if the mod is removed, the script will tick one more cycle, and then end; as opposed to using the RegisterForUpdate(), where your script will then continue to run even after you uninstall the mod.

Link to comment
Share on other sites

Damn. I was hoping that there would be an easier way. Oh well.. I guess I will just make an uninstall script and attach it to a book or something. Thanks for the help.

Generally anything who is in the game already will stay, anything new will be changed.

Even if you add an new weapon and enchant it removing the mod will not remove the weapon even if the mesh is unique, if you also changes the mesh you get an error object if I'm not mistaken.

Link to comment
Share on other sites

If you have background "tick" scripts that use onUpdate() and similar, I find that using RegisterForSingleUpdate() and then re-registering the script each tick does the trick - if the mod is removed, the script will tick one more cycle, and then end; as opposed to using the RegisterForUpdate(), where your script will then continue to run even after you uninstall the mod.

Brilliant! This worked like a charm. Thanks for the tip!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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