brewdles Posted January 26, 2011 Share Posted January 26, 2011 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, usingif (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 More sharing options...
blove Posted January 26, 2011 Share Posted January 26, 2011 How are you defining "item"? If "item" is already the base object it will error. Link to comment Share on other sites More sharing options...
rickerhk Posted January 26, 2011 Share Posted January 26, 2011 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 More sharing options...
brewdles Posted January 27, 2011 Author Share Posted January 27, 2011 So to get this done I might have to make an addon for NVSE then. Fair enough, I guess. Thanks for your help. Link to comment Share on other sites More sharing options...
Recommended Posts