davidnowlin Posted March 12, 2015 Share Posted March 12, 2015 I don't know if this is the right place to ask this, but I'm just about to give up and I'm looking for help wherever I can find it. I'm trying to script an item sorter and I would like to sort items that are stolen into ContainerA (for sale to fences), items that have enchantments the player does not know into ContainerB (for disenchanting) and items the player has favorited into Container C (so stuff he/she uses all the time doesn't get sorted into random containers). I can't for the life of me figure out how to do any of these three things, despite *significant* searching for answers. It seems like each of them should be easy, but it also seems like they're impossible. I can't find a way to determine if a specific item is stolen in papyrus. It seems like you should be able to do something like "If ItemProperty.GetIsStolen() = 1..." but there doesn't appear to be a "getIsStolen()" or even a "getOwner()". It seems like there should be a way to say "If Player.HasEnchantment(FortifyDestruction)..." but I can't find anything along those lines. It also seems like it MUST be possible. The Enchanter knows what enchantments you know. How does the code work on that thing? Vendors know which items you have are stolen. How? Also, if you have SkyUI (as almost everyone on earth does) you know that the gui puts a little red hand by stolen items, a yellow star by favorites and a blue lightning bolt by enchanted items. That information has to come from somewhere... right? If anyone has any idea what I'm missing, I'd sure appreciate some advice. Thanks Link to comment Share on other sites More sharing options...
sLoPpYdOtBiGhOlE Posted March 12, 2015 Share Posted March 12, 2015 You could probably use GetFactionOwner() on the items you pass and if they are owned by another faction other then player or none, then consider them stolen.http://www.creationkit.com/GetFactionOwner_-_ObjectReferenceI haven't tried it, but I'd imagine with a bit of testing for what the function returns and comparing it against items that are flagged as stolen in your inventory, you'd soon enough get a grasp of which items are stolen or not based on the owning factions. Link to comment Share on other sites More sharing options...
lofgren Posted March 12, 2015 Share Posted March 12, 2015 Stores are managed by the engine, not by Papyrus. As far as I know there is no way to detect whether an item in an inventory is stolen. I don't think it's even stored on the item. I think it is stored on the container. Something like "The nth item of this type in this container is stolen." For enchantments I think you can use the SKSE functions GetEnchantment() and PlayerKnows() http://www.creationkit.com/PlayerKnows_-_Form to determine if an enchantment is known Link to comment Share on other sites More sharing options...
lofgren Posted March 12, 2015 Share Posted March 12, 2015 (edited) You could probably use GetFactionOwner() on the items you pass and if they are owned by another faction other then player or none, then consider them stolen.http://www.creationkit.com/GetFactionOwner_-_ObjectReferenceI haven't tried it, but I'd imagine with a bit of testing for what the function returns and comparing it against items that are flagged as stolen in your inventory, you'd soon enough get a grasp of which items are stolen or not based on the owning factions. You would have to drop each item from the inventory in order to create an object reference of it. Even then I'm not sure that who actually owns the item is actually transferred with it. I think it's probably just whether or not it is stolen. If the original owner is stored then you would also have to determine whether or not the player was a member of that faction, their rank, and the owner's disposition towards them when they took the item in order to reliably determine if it was stolen. Edited March 12, 2015 by lofgren Link to comment Share on other sites More sharing options...
cavbirdie Posted March 12, 2015 Share Posted March 12, 2015 what about looking at the script that is on the jail stolen goods container? that should be a good start to modify for your stolen goods container not sure about enchantments or favorites... what about keywords Link to comment Share on other sites More sharing options...
lofgren Posted March 13, 2015 Share Posted March 13, 2015 Enchantmented weapons do not have a special keyword, unfortunately. Link to comment Share on other sites More sharing options...
davidnowlin Posted March 14, 2015 Author Share Posted March 14, 2015 For enchantments I think you can use the SKSE functions GetEnchantment() and PlayerKnows() http://www.creationkit.com/PlayerKnows_-_Form to determine if an enchantment is known You rock my face off. That's got it. Enchantment Property FortifyDestruction Auto if FortifyDestruction.PlayerKnows() Debug.Notification("The player has FortifyDestruction") else Debug.Notification("The player does not has FortifyDestruction") endIf Link to comment Share on other sites More sharing options...
davidnowlin Posted March 14, 2015 Author Share Posted March 14, 2015 what about looking at the script that is on the jail stolen goods container? that should be a good start to modify for your stolen goods container Took me a while to figure out what you were talking about, but I finally found "EvidenceChestStolenGoods" in Riften Jail. There's no specific script on the chest though, so whatever gets put in there must be transferred by the script that governs the arrest encounter (which I wouldn't begin to know how to find). The truth is, with favorites and stolen items, it's a relatively simple matter to empty those out of the inventory (if you have SkyUI) before you hit the pullbar that starts the inventory sorter. Sort of. I've noticed that sometimes you don't get the red hand icon on an item if you have multiple copies because somehow the first in the stack is not stolen, but you may still have stolen copies lower in the stack. *sigh* It appears that no one yet has found a workable way to sort stolen items, though I don't think I'm the first to try it. With favorites, at least, you can easily sort those by hand before using a coded sorter. It would be more convenient if I could add it to the code, but it's not something I'm going to lose sleep over. Thanks for the help guys. Especially the PlayerKnows() bit. That solves the biggest of the three problems by far. Link to comment Share on other sites More sharing options...
Xander9009 Posted March 11, 2016 Share Posted March 11, 2016 This is the first useful Google result for this kind of search, so I'm necroing it to add some information that was missed. When you're arrested, it uses the function PlayerPayCrimeGold, which is called on a faction. One of its parameters is to remove stolen goods, but it doesn't allow you to specify where they'll go. That's specified in the faction itself in the crime tab. So, to do this (unless another way has become available), is to create a custom faction with a stolen goods chest set. Then, when you want to remove stolen goods, call PlayerPayCrimeGold(true, false). The first true makes it remove the stolen goods to the crime's specified container. The false tells it not to send the player to jail. In theory, this should work. Link to comment Share on other sites More sharing options...
Recommended Posts