Jump to content

"MustPersist" keyword used to force persistence of Armor Forms?


Hoamaii

Recommended Posts

Hey guys,

 

Has any of you used the Vanilla keyword "MustPersist" on some custom armor Form to force Inventory Safe Persistence? Is it reliable in the long run?

 

I have a scripted piece of armor which needs to run some functions onEquipped and onUnequipped - this works fine for newly crafted objects, but once the object has been stored in an Actor's inventory for a while, it stops working of course.

 

I'm looking for a safer way to force its persistence than dropping it then picking it up - this armor form is a ring and of course the terrain will swallow it as soon as you drop it.

 

This Vanilla Keyword "MustPersist" is used only on WorkshopWorkbenches in the game - so obviously it's not intended for Inventory Items.

 

Anybody used this keyword on MiscObjects, Weapons or Armors?

 

Many thanks in advance! :)

 

 

Link to comment
Share on other sites

Dunno about the keyword, but if your script adds the crafted Objectreference to a formlist or quest refcollectionalias that will force it to persist. Don't forget to remove it to release on destruction.

Link to comment
Share on other sites

Hey SKK50, I had a hinch that if you were around, the quickest answer would come from you, thanks for dropping by!.. :wink:

 

 

 

Almost nothing is persistent in my mod (Sleep Together Anywhere) except a container in a holding cell.

 

At some point I even had to add my custom formlists as properties to that container - even though the container doesn't use them - because that was the only way I could force my formlists to persist!..

 

What you're saying is I need each and every crafted ObjectReference to a formlist - don't formlists have a max size btw? - and probably add that formlist as a property to that one persistent form in my mod?

 

Now I'm thinking: what event could I run on the object to make sure it's added to the list as soon as the Player crafts it?.. I'm thinking "OnItemAdded" or "OnContainerChanged" - would akOldContainer be none for a newly crafted object, like when you pick it up?

 

Thanks a lot for you help :smile:

Link to comment
Share on other sites

OK so I don't do much work with objects, but:

 

If the base armor is your own created item then attach a script to the base form and use Event OnInit() which *should* fire when the ObjectReference is created.

 

I have used AddForm() to add several hundred ObjectReferences to a formlist and then RemoveAddedForm, no they don't have the same 127 limit as an array. Alternative is a quest RefCollectionAlias that I have used past 10,000 active entries, benefit is that can have a script attached to mange its entries.

Edited by SKK50
Link to comment
Share on other sites

Yes, onInit() would probably fire for every new instance of the script, easy enough to verify in game.

 

Just thinking out loud here, but a lot of users already have this scripted objects in their games by now - so rather than modify the original script, I'll just add a new scrpt to the object, loaded objects would run it and unloaded objects would probably ignore it until the objects is dropped. I'll test that, thanks!..

 

And while I'm at it, I'll also test this "MustPersist" keyword on some other piece of equipment and store it in my inventory for a while, see what that keyword does.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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