Jump to content

How to get the condition (health) of a Power Armor piece?


Recommended Posts

There doesn't seem to be any way (papyrus or conditionals) to get the condition of Power Armor pieces.

You can see it in pipboy (when you look at the part in your inventory) or when at the PA workbench.

Papyrus functions like GetItemHealthPercent() don't work as the parts are not objectreferences (they are base forms).

I am looking for a generic solution, rather than requiring script extensions, if possible.

Thanks!

Link to comment
Share on other sites

I can't think of any vanilla way to get this info about any inventory item.

But both object references and inventory items keep this data in the same structure and GetItemHealthPercent() is the actual function that returns it... so, you can make the armor part a persistent object reference and then you can keep track of the item's health value (due to the two existing objects, the object ref and inventory item, become "linked" to each other) by calling the function on the persistent reference which gets marked for deletion OnItemAdded but due it to persistent, cannot be deleted.

Haven't tested how it works ingame but in theory it should..

Of course the alternative is to Drop() the item and call GetItemHealthPercent() on the dropped ref.

 

Note: use extra care when you make an object reference persistent and AddItem() it to an inventory... the reference can get baked into the save upon calling RemoveItem() on the inventory owner (with the ref's base form as parameter akForm) if the item is still persistent. The inventory item gets removed but the linked (i.e. "original ref") doesn't. This is engine bug that can be fixed (may do it later now that I mention it..). By the way, BGS fixed a somewhat similar bug but only for dropped weapons (I mean the equipped weapon dropped OnDeath). So, call Drop() and then Delete() on the persistent ref instead of calling RemoveItem() on the inventory owner. Check the dropped ref's RefID as well. Make sure you delete the "original" one.

Link to comment
Share on other sites

As always Larannkiar - excellent information that brings up more questions than it answers. I had already read your very interesting examination of persistent objects in inventories previously but very interested to read the removeitem issue - that is new! I added some extra info to your report on that post...

I had wondered if drop would work to 'expose' the health attribute to that function call. Thanks for confirming. I may have to resort to this kludge...

Link to comment
Share on other sites

Well I only forgot to mention probably the most important thing.. 🙂 that as far as I remember it happens with non Temporary ([T] in Console) refs.

So the ones spawned with either Quest Alias >> Create Ref (Temp) or PlaceAtMe(abDeleteWhenAble = True) "should be" removed when the cause of persistence of the original ref ceases (e.g. its parent quest stops). (I didn't take notes though, don't know if all Temporary refs are undoubtedly unaffected).

Still, since Drop() internally doesn't set this flag and vanilla Papyrus doesn't provide any parameter or function for this it's best be cautious.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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