Jump to content

Cell reference issue and how to write an uninstall


Recommended Posts

Hey there,

 

I got 2 questions regarding some recent things I'm dealing with.

 

The first:

 

I have a struct array which holds a Cell field. It works fine for my needs but now I am getting an error like:

 

cannot be bound because <SomeFormID> is not the right type.

 

It only happens when I use the DiamondCityEntrance as a reference, but not with DiamondCityOrigin for example, or any other cell I tried. I know DiamondCity is in a different world space, but both Origin and Entrance are there. Anyone knows why is that so and if is there something I can do about it? Or should I just ignore the warning message and check if it behaves as expected in my mod? (I got no other error or warning)

 

 

The second:

 

I've written the Uninstall code to remove my mod if the user so decides. On it I've unregistered to any events, stopped any timers, removed inventory event filters.

Should I do anything else? I checked with ReSaver and what it does find after removing my mod is some Unattached Instances.

 

Anything else I am missing? Should I clear aliases that I forced a reference to or something?

 

Thanks,

SameOldBard.

Link to comment
Share on other sites

Disable() and Delete() any spawned ObjectReferences.

 

Clear all script event registrations UnregisterForAllEvents()

 

Ensure all script functions are stopped.

 

Clear all script level variables.

 

Stop quests which will clear all aliases.

 

The only pointers that will then be held are script properties, which you can't do anything about as there is no actual "unload script" function. Tip: quest attached scripts still run even after the parent quest is stopped.

Link to comment
Share on other sites

The only pointers that will then be held are script properties, which you can't do anything about as there is no actual "unload script" function.

Maybe I'm mistaken, but couldn't you simply set all script properties to none and thus clear them? It would seem that the script itself won't be unloaded though.

Link to comment
Share on other sites

 

Maybe I'm mistaken, but couldn't you simply set all script properties to none and thus clear them? It would seem that the script itself won't be unloaded though.

 

 

Let me modify that:

 

The only pointers that will then be held are CONST script properties, which you can't do anything about as there is no actual "unload script" function.

Link to comment
Share on other sites

Ok.

 

So a learning from that is to avoid using CONST on the Auto Properties to avoid such issue. Great, thanks about that. I implemented those things. A question though, do I need to call both Disable and Delete or Delete only should be enough?

 

Regarding the first question, do you guys know of a way around it?

 

Thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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