Jump to content

RemoveAllItems BUT Apparel?


XxLunaMothxX

Recommended Posts

I'm not aware of any way to do it in FO3. FNV GECK has a function RemoveAllTypedItems. Brute force is probably most reliable - call RemoveAllTypedItems once for every item type except armor & clothes. A shortcut for NPCs would be to RemoveAllItems to a temporary container and then RemoveAllTypedItems from the container back to the character, with the type code for armor & clothes. Since NPCs always equip the "best" item in their inventory, they should re-equip what they were wearing before it was removed. Won't work for the player, though (player would get back all armor, but nothing would be equipped).

Link to comment
Share on other sites

You have to use FOSE. And there are limitations when it comes to item health (can't get it). And if the player has multiple of the same item, and has one of them equipped - you can't distinguish which one is equipped.

 

Here's a script that I use in my Brisa Mod:

 

scn RHKBrisaRemoveTypedItemsQuestScript


ref rSourceREF ;set by calling script
ref rDestinationREF ;set by calling script
ref rExcludelistREF ;Set by calling script - dont remove items in this list
ref rBaseInvObjREF
short iListIndex
short iInvPos
short iItemType ;set by calling script
short iBaseItemType
short iBaseItemCount
short iRemoveComplete ;flag to calling script that move/remove is complete


;Some item types:
; 24: Armor
; 31: Misc
; 40: Weapon
; 41: Ammo
; 47: AlchemyItem


;This ignores item health, unfortunatly, but I'm not going to use it on the player for armor or weapons
;Call with ResetQuest, set the varables, then Startquest


BEGIN GameMode


if (iRemoveComplete)
    return
endif


if (rSourceREF && iItemType) ;mandatory parameters
   set iInvPos to rSourceREF.GetNumItems
else
   set iRemoveComplete to 1
   StopQuest RHKBrisaRemoveTypedItems
   printc "RHKBrisaRemoveTypedItems error - NULL parameter(s)"
   return
endif


Label 1
if (iInvPos)
   set iInvPos to (iInvPos - 1)
   set rBaseInvObjREF to Lockpick
   set rBaseInvObjREF to (rSourceREF.GetInventoryObject iInvPos)
   if (rSourceREF == Player)
      if (IsQuestItem rBaseInvObjREF)
         printc "skipped quest Item %n", rBaseInvObjREF
         Goto 1 ;skip
     endif
   endif
if (rExcludelistREF)
   set iListIndex to ListGetFormIndex rExcludelistREF rBaseInvObjREF
   if (iListIndex > -1)
      Goto 1 ;skip
   endif
endif
set iBaseItemType to GetType rBaseInvObjREF
if (iBaseItemType == iItemType)
   set iBaseItemCount to rSourceREF.GetItemCount rBaseInvObjREF
   if (rDestinationREF)
      rDestinationREF.AddItem rBaseInvObjREF iBaseItemCount 1
      rSourceREF.RemoveItem rBaseInvObjREF iBaseItemCount 1
   else
      rSourceREF.RemoveItem rBaseInvObjREF iBaseItemCount 1
   endif
endif
Goto 1
else
   set iRemoveComplete to 1
   StopQuest RHKBrisaRemoveTypedItems
endif




END

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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