rainrtw Posted February 17, 2012 Share Posted February 17, 2012 In previous games we could use GetContainer to figure out whose inventory a given object was in, and use the ref it returns to affect that container.http://geck.bethsoft.com/index.php/GetContainer This was useful for dropping a token item into an npc inventory that could do all sorts of things for all sorts of purposes, but only if that token item could tell who was holding it. This was used for all sorts of things from animation triggers to swapping out old version of gear for newer ones. In my case I would like a given armor to check who is holding it in the OnInit event and give them some extra items associated with it. Granted I could manually add those things to each npc wearing that armor in the CK but that is cumbersome and not very dynamic in the sense that all of those npc's have to be and decided in advance and it can't really adjust to situations via logical arguments. If I could find out who is carrying the item in the OnInit block then it could employ some logic in who got the extra items based on a number of conditions. Later in future events like OnEquipped we get the special variable akActor to work with and finally identify who it is that is handling this object. With OnContainerChanged events we can make it so that when a new game starts we could perhaps do something TO that item specifically, but we still can't do anything that involves the actor holding it, like remove the item or add others based on logic in the script. So my question is simple. Is there any sort of Papyrus equivalent to the GetContainer we have lost? If not then I personally hope this is one of the first things added via SKSE, because currently I don't see any way to emulate this function. GetActorOwner only returns an ActorBase which we obviously can't add or remove items from, and that is the closest thing I've found so far. Link to comment Share on other sites More sharing options...
Cipscis Posted February 18, 2012 Share Posted February 18, 2012 There's not, but you can get this value as one of the parameters of OnContainerChanged. I've successfully used this with tokens added by a perk when the player kills an actor, so I can guarantee that it works. Cipscis Link to comment Share on other sites More sharing options...
rainrtw Posted February 18, 2012 Author Share Posted February 18, 2012 (edited) Hmmm well you have a good point there as that would be a nice workaround for tokens and such added as part of that mod.And it would even work for scripts added to pre-existing objects as long as a new game is started since OnContainerChanged seems to fire when npcs first load up in game. Still if a pre-existing game was loaded with a mod that adds a script to a normal object, any instances of that object would still fail to fire a useful identifying event, since they have already changed container, or have been equipped in that saved game. In my specific case I am now wondering if a pre-existing item in a pre-existing save game could be made to acquire info about its container. The OnInit block would still fire on items already loaded in game, since even if the item already exist and has been equipped and loaded once, the newly added script has not. As always I am still looking for a way to get race specific armor to work in game with the minimum number of conflicts. Altering armor forms to include armor addons for the new race conflicts with any armor tweak mod, as well then new races will have no visible effect from any mod added content. Marking the race to use armor models of a default race means it now Only counts as the default race for the purpose of armor addons, thus they will equip items exactly as the base race would. So in effect no race specific armor is acquired. I had been experimenting with changing torso armors to have no armor addons specified by default, and instead acquire the visible counterparts via a script that adds a stat-less version of the armor with proper race specific models specified. Granted in this method many torso armor forms must be tagged in the esp and thus can conflict with armor tweak mods, and compatibility patches would still be needed for the most popular tweak mods.This method seems to work the best as now everyone now loads the base non visible armor for stats, and also a non-playable stat-less version for looks. The trouble here is that if an existing game is loaded with this active, all npcs that have already been loaded in game become naked or bodiless, due to this method relying on OnEquipped events. These fire once for each item an npc equips the first time they are loaded. I am not sure if there is a way around this problem at the moment. I can't figure out how to get them to aquire data about their container in a case where they are pre-existing objects in the world and the OnInit event seemed to be the closest thing. Either way, I appreciate the input and as always have fun modding. Edited February 18, 2012 by rainrtw Link to comment Share on other sites More sharing options...
Recommended Posts