Jump to content

Mod to access NPC inventory?


Mookeylama

Recommended Posts

well, tbh you may be out of luck until/unless someone makes a mod to do it. l suggested the only two l know of off the top of my head - the vanilla method typically doesn't let you take their default items, only add stuff to it or take back what you've already added. I think there are other follower mods out there that let you manage inventory, but again they're based on the npc being a follower.
Link to comment
Share on other sites

I haven't been able to find a way to read in all items from an NPCs inventory, but I think there's a workaround. Right now, I'm just putting it down to get the order and main functions into some sort of sense from a scripting perspective.

 

One can create a spell that removes all items to another container. It's a targeted F&F spell with a projectile. RemoveAllItems() can move items to another container.

That container (hidden, similar to a merchant chest) has an Event OnItemAdded. OnItemAdded can return the source of the item.

If the item added does not have keywords VendorItemArmor OR VendorItemClothing it is returned to the source immediately.

If the item has either of the above keywords, a message box pops up with three options. Return, return and equip, delete (and optionally, give to player).

 

So an NPC could be given any clothing items, via pickpocket or console for example, then have the spell cast on them. The player can evaluate what to do for each article of clothing or armor until all items have been returned or deleted.

Link to comment
Share on other sites

  • 3 months later...

I think sharing and caring used dialogue to get at their inventories. If you make a new quest and add new dialogue for all the vanilla voice types but do not set a condition for the quest, all npc's should be able to say the new dialogue. So for each voice type, there would be a new line like:

 

Quest: NewNpcDialogue

- Player: Let's trade.

-- NPC Female Argonian: Alright.

-- NPC Male Argonian: Alright.

-- NPC Female Breton: Alright.

-- NPC Male Breton: Alright.

etc...

 

Each would have something like this in their script:

akSpeakerRef.OpenInventory(True)

 

I don't think that will do all that you want it to though. In Skyrim, NPC's have "Outfits" unlike Fallout. The items that make up their outfits don't show up in their inventory unless they are dead. To compound the issue, once you leave the area with the NPC you "clothed", they will fallback onto their assigned Outfit. The next time you visit the cell, they will revert to their "default" clothes.

 

The only way that I'm aware of to get around those issues is to remove their outfits and then give them the items that make up their outfit individually. So say their outfit had a torso piece and shoes, then you would have to give them those items individually or they will all be in their underwear. That will fix the issue with items not showing up in their inventories.

 

Then you will have to run a check every cell load to make them equip their items. I'm pretty sure that requires assigning 2 scripts 1 script to every npc or maybe assign it dynamically, but NPC's outside the radius will be in their underwear.

 

A script that extends ObjectReference for OnCellAttach and OnItemAdded events

Another script that extends Actor for OnObjectEquipped and OnObjectUnequipped events and to store their currently equipped items

A script that extends Actor for OnCellAttach, OnItemAdded, OnObjectEquipped and OnObjectUnequipped events and to store their currently equipped items

 

Then you would have to store the items the NPC equips. So when it gets an OnItemAdded, it Equips the item. When it equips or unequips an item, it will update the stored script items. Then when it gets a OnCellAttach, have it equip the items that are stored in the Actor script.

 

Hopefully, someone knows an easier way. But that's probably why there isn't a mod already.

 

Edit:

I keep forgetting Actor extends ObjectReference :P

Edited by Ez0n3
Link to comment
Share on other sites

couln't you just changed all nps to have no outfite and just clothes in their inventory, wont they auto equip it then? then if you open the gift menu you can change their equipment...

 

 

hummmmm i wonder if it might just be easier that when you talk to them it open YOUR inventory and adds a option Give, you never seen their inventory and you just use the give button to dynamicly add their actor id to add it to their inventory...the only problem i see happening is if you want to upgrade their equipment later they would quickly overload...but maybe...when you give a iteam the script would give back to you a item withthe same slot id position? give a body armor it gives back a body armor, gives boots you get back boots, give gloves and they have none you get back nothing

Link to comment
Share on other sites

If they have no Outfit assigned, it's as if they have a default Outfit assigned that is empty. When you revisit the cell, they will revert back to their default Outfit which would be "None". So they would all be in their underwear even though they have armor/clothing items in their inventories.

 

That's what I have been getting in my meddeling.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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