Belthan Posted June 18, 2014 Share Posted June 18, 2014 There seems to be a bug with removeallitems (and removealltypeditems) in FNV. If the actor has multiple armor items equipped that are using different slots (e.g. upper body, head and body part 1), not all of the items are removed. Furthermore, unless the script immediately does something that forces the actor to evaluate inventory, the inventory gets corrupted and the NPC can end up with multiple copies of the item(s) that were not removed. The workaround I implemented is to cast a spell on the actor that calls removeallitems once per frame, repeated for enough frames to clear all of the armor slots (typically 3 or 4 times). Two questions: 1) is this a known bug? 2) Is there a better workaround (like some undocumented "WorkCorrectly=true" flag)? Link to comment Share on other sites More sharing options...
rickerhk Posted June 21, 2014 Share Posted June 21, 2014 I use RemoveAllItems and RemoveAllTypedItems a LOT in my Wendy mod, and don't recall ever having that issue. However, I'm almost always transferring from one actor container to another, or from an actor to a remote containerREF, so no items are getting removed from the game. Maybe something to do with that? Actually, I've seen Removeallitems (no dest container) fail on an NPC that has never loaded into the save game yet. I think it was just one armor piece though. If manipulating the armor inventory of the NPC in a game mode script, I run a glitch-fix in a section of her quest script by removing the weapons, adding and equipping an invisible armor piece, removing the armor piece, and returning the weapons a couple seconds later: if (iFlagInvChk == 2) ;Un-glitch inventory set iFlagInvChk to 1 RHKWendyREF.RemoveAllTypedItems RHKWendyWeaponGlitchREF 0 1 40 ;Remove weapons only RHKWendyREF.AddItem RHKWendyExeter01XFechain 1 RHKWendyREF.EquipItem RHKWendyExeter01XFechain RHKWendyREF.RemoveItem RHKWendyExeter01XFechain 1 elseif (iFlagInvChk == 1) RHKWendyWeaponGlitchREF.RemoveAllItems RHKWendyREF ;Restore weapons 2 seconds later RHKWendyREF.AddItem AmmoMicroFusionCell 1 RHKWendyREF.RemoveItem AmmoMicroFusionCell 1 set iFlagInvChk to 0 endif Link to comment Share on other sites More sharing options...
Belthan Posted June 21, 2014 Author Share Posted June 21, 2014 Now that you mention it, the one place I know it's happening for sure is removing a set of disposable items without a dest container ref. I'll do some testing and let you know what I find. Thanks! Link to comment Share on other sites More sharing options...
Belthan Posted June 25, 2014 Author Share Posted June 25, 2014 I confirmed that the bug I reported in the first post only happens if there is no target container REF specified. I changed the script to simply remove everything to a trash container and then empty the trash container. Much easier and better for performance than the other workaround. Thanks again! Link to comment Share on other sites More sharing options...
rickerhk Posted June 26, 2014 Share Posted June 26, 2014 Thanks for confirming that! Link to comment Share on other sites More sharing options...
Athelbras Posted November 12, 2014 Share Posted November 12, 2014 (edited) Looks like the "bug" can happen even with a target REF specified ... I recently discovered this problem in our EVE mod. It occurs when transferring loot from a corpse to a remains object (ash pile, goo puddle, etc.). The bug does indeed manifest when multiple armor / clothing items are equipped, and it occurs consistently for a given test case. When the situation arises, a regular RemoveAllItems call transfers only non-equipped items. This is the current behavior of our scripts. While experimenting to create a fix, I subsequently found that a repeated invocation ensures a transfer of all remaining items. Or at least it is seemingly successful in the limited instances tested thus far. What I am using as a preliminary solution is a "Third Time is The Charm" (aka "Third Time's Charm") rule-of-thumb: three (3) successive invocations of RemoveAllItems forces a complete transfer. Note though that two might in fact suffice. A bit more testing is needed to confirm the proposed workaround / "fix". EDIT: A pair of calls (one following the other) ensures a transfer of all items, and has no adverse side effects. Edited November 13, 2014 by Athelbras Link to comment Share on other sites More sharing options...
weijiesen Posted March 31, 2015 Share Posted March 31, 2015 I've also noticed that having a "dummytestcell'' space exist, with some Persistent NPC refs in the cell works well too. Transferring the items to an NPC ref has worked better for me (for whatever reason) that simply moving the items to a non-humanoid container. Link to comment Share on other sites More sharing options...
Recommended Posts