Asterra Posted April 27, 2020 Share Posted April 27, 2020 (edited) Now's your chance. I'm asking a question that's comparatively non-esoteric. I just don't know if there's a function for accomplishing this. Say some mod has a sequence where it moves your gear to a holding container for safekeeping. And you want to know where it's been moved. RemoveAllItems does not trigger OnDrop, contrary to what OnDrop's article suggests. It does trigger OnActorUnequip, however. Unfortunately, the latter does not return item refs—only the base objects. Which kinda makes it rather less useful than it should be. I honestly don't know how I might go about this. RemoveAllItems also destroys the original item ref, so I can't even do any preemptive work to solve this. Edit: So while I'm at it, how about when a mod adds stuff back to the player? RemoveAllItems -> player doesn't trigger anything at all. Certainly not OnAdd. Edited April 27, 2020 by Asterra Link to comment Share on other sites More sharing options...
dubiousintent Posted April 27, 2020 Share Posted April 27, 2020 No special knowledge here, but according to the GECKWiki "Inventory Reference" article: In Fallout, objects stored inside of the inventories of actors or containers are not references. However, it can be useful to treat them as references in order to modify them. NVSE provides this functionality through the use of "inventory references", which are specialized, temporary references representing a stack of one or more items inside of a container. Scripts can obtain an inventory reference in three ways: by iterating over the contents of a container, by requesting references to items in a container matching a particular base item using GetInvRefsForItem, or by creating one directly using CreateTempRef. However, the cautions listed make it appear that your entire premise as to "refs" is not practical (at this time) and a quick search of JIP functions did not turn up anything helpful to get around the problem. I imagine you want the ref to be able to retain info such as "weapon mods" that are not part of the base object. Looks like you will have to capture/save that information prior to moving them. I did notice that some functions had the ability to move an item to a container with the "ownership" retained. That presents the possibility of walking through the container contents checking "ownership" and identifying/retrieving "base copies" to the player. You might be able to write your own EventHandler to use in place of the usual RemoveAllItems function. Or see if you can persuade one of the DLL teams (JIP, JohnnyGuitar, lStewie) to create what you need. (They do sometimes show up here.) -Dubious- Link to comment Share on other sites More sharing options...
UnvalidUserName Posted April 27, 2020 Share Posted April 27, 2020 If the inventory reference is destroyed on the process I don't see how it would be possible to track it Link to comment Share on other sites More sharing options...
Asterra Posted April 29, 2020 Author Share Posted April 29, 2020 (edited) I did notice that some functions had the ability to move an item to a container with the "ownership" retained. That presents the possibility of walking through the container contents checking "ownership" and identifying/retrieving "base copies" to the player. The difficulty is in knowing where to check. If a mod moves your stuff, it moves it to... probably some container it's arranged for itself. You have no way of knowing which mod, let alone which container. Or see if you can persuade one of the DLL teams (JIP, JohnnyGuitar, lStewie) to create what you need. (They do sometimes show up here.) I have a big list of function requests on the JohnnyGuitar forum. They've been inactive for months, so it's not going to happen. The JIP guys have been ignoring requests since long before that. What would be needed here is a sort of "GetEverySingleItemRef" for a given base object. Should be possible. Parse the game/save data for all item ref records of where some custom mod weapon is being stored in-game, and present it as an array. Can pull containers from that data if need be. Honestly I'm kind of amazed this hadn't already been done. I mean, obviously, mods are going to mess with the player's inventory in ways that other mods need to be able to monitor, yet right now we have nothing. Edited April 29, 2020 by Asterra Link to comment Share on other sites More sharing options...
Recommended Posts