Jump to content

Determining the "source" of an item


ObieDwyer

Recommended Posts

I'm trying to make a mod that tries to simulate armor fitting in an attempt to nerf looted armor and to instead increase the usefulness of merchants and player crafting.

 

What I need to know is how to find out whether an item is an object on an NPC or in the world, or whether the player bought it or crafted it themselves. I can't find any functions related to this so I'd like some help formulating a script.

Link to comment
Share on other sites

In the OnItemAdded event there is akSourceContainer which can be used to tell you where the specific item instance came from. If akSourceContainer has no value, it was picked up from the environment rather than from a container or an NPC. If akSourceContainer has value, it is from a container or an actor. You can run conditions from there to determine it is an actor and what gender that actor is.

 

If you use SKSE, you can use IsMenuOpen. Any items added while the barter menu is open were bought, any items added while the crafting menu is open were crafted, shoot you can even check if the console is open to catch items added via console commands.

 

But I have no idea how you can use that information to do what you are wanting.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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