Jump to content

How to add a leveled item to a container (or even create one) via script?


PJMail

Recommended Posts

Basically I want to create multiple items of given health to transfer to an existing container. The item must be based on an existing base Form. Basically adding 'worn' versions to a container.

 

I know you can create such an object in the world (with a certain health) - but it is then a reference so you can't add more than one of it to a container (via additem).

 

Or you can create a leveled list with one (using the "Extra Data" field to set Item Health), but Additem (or placeatme) does not accept LeveledItem Lists.

 

There is also no way to modify an item's health% (you can only read it via getitemhealthpercent()).

 

Am I missing something obvious?

Link to comment
Share on other sites

I was under the impression that damageobject worked with the 'destruction stages' (not that I know anything about that either) so avoided it.

Do you know how the damage value actually alters the healthpercent?

 

 

And PlaceAtMe will take a leveleditem, but creates an item at full health (even if the leveleditem is defined with reduced health).

Link to comment
Share on other sites

Thanks niston, I will give it a try. I wonder why game scripts do things like DamageObject(9999)?

 

Update: The following code has no effect.

ObjectReference oEmptyCore = Self.PlaceAtMe(AmmoFusionCore)
oEmptyCore.DamageObject(50)
Debug.Trace("FusionCore "+oEmptyCore+" created. Health "+oEmptyCore.GetItemHealthPercent()+"%")

 

Returned:

[10/30/2021 - 08:36:10AM] - FusionCore [ObjectReference < (FF0036FB)>] created. Health -1.000000%

 

Tried it on in-game fusion cores (with <100% health) - no change to health.



Edited by PJMail
Link to comment
Share on other sites

Hmm.. The issue might be with GetItemHealthPercent(). From the Fallout CK Wiki:

 

 

Returns the item health percent of this object. Items begin at 100% (1.0) and can be increased via crafting.

 

I suspect this Function does not work as the name might imply.

Compare with Info from the Skyrim CK Wiki:

Return Value
The item health percent of this reference.

1.1 = Fine
1.2 = Superior
1.3 = Exquisite
1.4 = Flawless
1.5 = Epic
1.6 = Legendary

Try obtaining damage with GetResourceDamage() instead.

Link to comment
Share on other sites

You are no doubt correct - my reading of DamageObject had suggested it modified a mechanic different to what I was looking for (which was item health).

 

Surprisingly I have resolved my issue - a case of don't believe everything you read:-

Additem DOES accept a leveledItem and does exactly what I want (gives me an item with reduced health of the correct base object).

 

Post answered!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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