Jump to content

NVSE mod woes


brewdles

Recommended Posts

Hi, having a bit of trouble with a script. I'm trying to create a mod that scans player inventory every few seconds so when you pick up a weapon you already have one of, it repairs them automatically.

 

As each weapon you pick up will have a different reference, using

if (item1 == item2)

obviously won't work, so I'm trying to use the NVSE function called GetBaseObject.

GBO is supposed to return the base form id of a supplied reference, so the code for this is

set base to item.getBaseObject

 

Which should be fine, except that the script never actually gets past that point, and does not get called again. I have tried assigning a value to the base reference before calling GBO, it had no effect. I've tried putting a message after that line and it's never displayed. Removing that line makes the script execute from start to finish.

 

So has anyone else had luck using GetBaseObject? Is it just my fallout install? Or are inventory objects handled differently to world references?

Assuming it's just broken, is there another way to compare the objects properly?

 

Thank you.

Link to comment
Share on other sites

Inventory objects don't have references. You can scan through a container using GetInventoryObject, which returns base forms. You can't get the health of an item, though. If you are already using GetInventoryObject to get the item, then you don't need to use GetBaseObject - you already have the base form. Multiple of the same base form in a container are considered as just one item by the GetInventoryObject function .You use GetItemCount to get how many. Then you have a problem figuring out how you will repair these items with an unknown condition. With the current state of NVSE, you can't get the health of an item in a container unless it's equipped.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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