Mornedil Posted July 10, 2016 Share Posted July 10, 2016 (edited) How do you properly add items to a merchant's container using papyrus scripts? What I've tried so far:I've made a script to add items to the vendor's container (and they show up when searching the chest), but as soon as I ask the vendor what's for sale, his inventory updates and the vendor's chest respawns without the added items.I've seen posts where people say you can add items to vendors like that, but it doesn't seem to work as expected. I've also read about the method to add items to LeveledItem lists with the AddForm function.However, it's hard to fully control the odds of the item appearing in the vendors stock like that, and not to mention this will add items to ALL vendors using that LeveledItem list. Edited July 10, 2016 by Mornedil Link to comment Share on other sites More sharing options...
redrakiton125 Posted July 10, 2016 Share Posted July 10, 2016 This might help a lot http://www.gamesas.com/adding-items-vendor-lists-safe-t259655.html Link to comment Share on other sites More sharing options...
Mornedil Posted July 10, 2016 Author Share Posted July 10, 2016 (edited) This might help a lot http://www.gamesas.com/adding-items-vendor-lists-safe-t259655.html That thread seems to discuss the method I mentioned about using AddForm to add items to LeveledItem lists. Seems to be useful for adding items randomly to a bunch of different merchants using the same lists, but not for adding items to specific merchants. Edited July 10, 2016 by Mornedil Link to comment Share on other sites More sharing options...
lofgren Posted July 10, 2016 Share Posted July 10, 2016 Because the merchant container respawns frequently, there is a high risk that an item added to the container will be obliterated before the player actually sees it. In order to avoid losing the item you can: 1. Add the item after the player has already looked at the merchant's inventory. This results in a very counterintuitive experience for the player, since they have to look at the vendor items, close the vendor screen, and then look again. 2. Put the item in an alias. This means you have to have a quest running, you can only put as many items on the merchant as you have aliases, they won't stack in inventory, and they are persistent. 3. Put the item on the merchant directly instead of in his merchant chest. This means that the merchant may equip or use the item (which would block it from being sold), other merchants who use the same merchant chest will not have the item for sale (e.g. at Warmaiden's), and, while the vendor's inventory resets less often than his vendor chest, the item will still disappear eventually. 4. Modify the merchant container directly in the CK. This is the best way to go unless the player is using another mod that changes the same container. Then they would have to create a merge patch or you will have the usual load order conflicts. If anybody has some better ideas, I'd love to hear them too. These are the best I could come up with, so personally I just use AddForm to modify the leveled lists. Link to comment Share on other sites More sharing options...
Mornedil Posted July 10, 2016 Author Share Posted July 10, 2016 (edited) Thank you, it's helpful to know all these methods. Although it's kinda frustrating that the method with the desired result is to overwrite vanilla files.. You never know what other mods a player has installed, so I think it's best to avoid overwriting stuff at all costs (unless the purpose of the mod is to replace and improve default files of course). I'm sticking with adding items to the vendors default LeveledItem lists for now, and I think I'll use method #2 to add the mod's instruction book to the arcaneum library in winterhold in case the player drops it and wants a new one Edited July 10, 2016 by Mornedil Link to comment Share on other sites More sharing options...
Mornedil Posted July 10, 2016 Author Share Posted July 10, 2016 (edited) Idea! Would it be possible to add a custom LeveledItems list to a vendor via a quest alias?If that's possible, items could be added to a vendor with a specified spawn chance. Edited July 10, 2016 by Mornedil Link to comment Share on other sites More sharing options...
lofgren Posted July 10, 2016 Share Posted July 10, 2016 Yes, you can add leveled lists through aliases. You can also add the GetRandomPercent condition to the alias if you don't want to bother making a leveled list (that is if you want only one specific item with a random chance of not appearing, rather than a list of items with one chosen randomly). Link to comment Share on other sites More sharing options...
Recommended Posts