Jump to content

Best way to add items to merchants


scrivener07

Recommended Posts

So has anyone found a way to add items to merchants without stomping all over someone elses mod? It seems skyrim has taken a step backwards on this. I have been bashing my head against a wall for a few days now trying to get something to work short of directly editing a merchants container. Heres what Ive tried so far.

 

-Using an alias to add a leveled item list directly to a merchants container. This will work but your items will never respawn.

-Using a script to add a leveled item list directly to a merchants container. This will work but your items will never respawn.

-Creating a new vendor faction and merchant container for the merchant Im trying to add to. Then adding the faction to the merchant with an alias. Nope the vendor will ignore this.

 

For testing purposes I also tried this stuff.

-Setting up a new merchant faction and container and removing my target merchants default ones. Still sells default stuff.

-Creating a new merchant container with my stuff in it and then link my container to the merchants default vendor faction. Merchant will sell my stuff and the stuff from their old container. wth?

:ninja: Also tried removing the faction and container to make the npc not a merchant. Nope, my plugin retains the changes but still uses data from skyrim.esm

-Just to double check if two mods editing the same container still stomp on each other I made two plugins that did just that. Yes, mods still stomp on each other.

 

Am I missing something? Is this how things are done now. Only one mod can ever alter what an npc can sell. There must be a way to link more than one merchant container to an npc or some other compatible method for doing this.

 

Dont let this thread vanish, this issue is a big deal. If Im just being retarded please correct me. I really hope Im just having a megaTard moment. :hurr:

Link to comment
Share on other sites

I did not get as far on this problem as you did. I think that your conclusions are correct. There is no simple solution to this problem. If someone finds a solution, it is bound to be complicated or tricky.

 

This is a severely disappointing aspect of Skyrim. The people at Bethesda really dropped the ball. If they had bothered to glance at TES Nexus, they would have noticed that people made and uploaded tons and tons of armor, clothing, and weapon mods and users wanted them all. They didn't want just a few, they wanted so many that they had to use bashed patches or had to merge mods to make more space. In Oblivion it was great being able to just drop an additional vendor chest with your item into a shop and have there be no mod conflicts at all.

 

I guess what we need to do is add new merchant NPCs when we want to add buyable items to the game.

Link to comment
Share on other sites

I need to add a single item to a merchant. I only want it to be available to purchase once. If I understand you correctly, your method of using the script to add a leveled list will work in this situation? If this is the case, I wonder if you'd be willing to share the script you used? I'm slowly getting better with papyrus, but it's still takes me a painfully long time to create a new script.

 

I really hope someone can figure out a solution to the larger problem you're discussing. Beyond all the armor, weapons and clothing mods, this was also used fairly often in Oblivion to trigger the start of new quests (by buying a book), to add new spells, and to purchase upgrades for new houses (or even the houses themselves). It's definitely a serious issue that limits the flexibility and ease of adding things to Skyrim.

Edited by kryptopyr
Link to comment
Share on other sites

Regarding the larger problem, you can use AddForm to add a form to leveled item lists. There's the problem that the changes don't persist through game loads, but there is a way for detecting a newly loaded game on the same page under examples (courtesy of JustinOther).

 

If they ever fix AddForm so that it persists through game loading, then this will no longer be a problem. If AddForm doesn't get fixed, then you can still exploit it to figure out when the game loads and to use AddForm on the lists you want again.

 

Example Script:

 

 

Scriptname Example extends Quest

LeveledItem Property EmptyList Auto
{An empty Leveled Item list that we use for the GetGameLoaded check.}

ObjectReference Property EmptyContainer Auto
{An empty container that we use for the GetGameLoaded check.}

LeveledItem Property VanillaList Auto
{The vanilla Leveled Item list that we want to add our custom item(s) to.}

Form Property CustomItem Auto
{The custom item that we want to add to VanillaList.}

Int Property ReqLevel Auto
{The level to add the custom item under in VanillaList.}

Int Property ItemCount Auto
{The number of the custom item to add in the VanillaList.}

Event OnInit()
RegisterForSingleUpdate(5)
EndEvent

Event OnUpdate()
if (GetGameLoaded(EmptyList, CustomItem, EmptyContainer))
	VanillaList.AddForm(CustomItem, ReqLevel, ItemCount)
endif
;perform update loop every 5 seconds, forever
RegisterForSingleUpdate(5)
EndEvent

Bool Function GetGameLoaded(LeveledItem akLeveledItem = None, Form apForm = None, ObjectReference akContainer = None)
akContainer.AddItem(akLeveledItem, 1, True)
If akContainer.GetItemCount(apForm)
	akContainer.RemoveItem(apForm, akContainer.GetItemCount(apForm), True)
	Return False
Else ; Will only return 'True' once per save load
	akLeveledItem.AddForm(apForm, 1, 1)
	Return True
EndIf
EndFunction

 

Link to comment
Share on other sites

  • 9 months later...

This looks really useful but I have a few questions that other people who find this topic may have.

 

If we use the script above we also would have to create a quest to attach the script to, since the script extends a quest? Also, how do we plug-in in our custom item in the Form Property?

 

Thanks!

Link to comment
Share on other sites

  • 3 weeks later...

I think that the above script is no longer necessary. Looking at the linked wiki page (and its previous revision which contains the code referenced by fg109) it seems that Bethesda fixed the problem with non-persistent changes.

 

Thus I assume that the much simpler code

CoolItems.AddForm(Axe, 5, 2)

 

[for adding 2 Axes to the list CoolItems for level 5] is sufficient. However, I don't know which object one must attach that script to... Can anyone clarify?

Link to comment
Share on other sites

  • 5 weeks later...

If you are trying to add them in-game, go to wherever the merchant is and type "tcl" in the Console Command (this turns off collisions) and go underneath the ground/floor and you should find a chest. Find the base ID for whatever item you want to add (help then the item name in quotes in the console should do it), click on the chest (make sure to click on it a couple of times so that you know that you've selected the right thing), type "additem" and whatever the ID is and the quantity after that. Then click on the chest again, so that the numbers at the top of the console go away, come up to the surface, type tcl again, and there ya go.

Another way is to simply add the items to your inventory with "player.additem" and then sell them to the merchant, but the above way is going directly to the merchant.

 

I dumbed this down in case someone else comes across this while looking it up, like I did. And if this doesn't help you, hopefully it will someone else. =P

Link to comment
Share on other sites

  • 3 weeks later...

If you are trying to add them in-game, go to wherever the merchant is and type "tcl" in the Console Command (this turns off collisions) and go underneath the ground/floor and you should find a chest. Find the base ID for whatever item you want to add (help then the item name in quotes in the console should do it), click on the chest (make sure to click on it a couple of times so that you know that you've selected the right thing), type "additem" and whatever the ID is and the quantity after that. Then click on the chest again, so that the numbers at the top of the console go away, come up to the surface, type tcl again, and there ya go.

Another way is to simply add the items to your inventory with "player.additem" and then sell them to the merchant, but the above way is going directly to the merchant.

 

I dumbed this down in case someone else comes across this while looking it up, like I did. And if this doesn't help you, hopefully it will someone else. =P

Yea, that will work and its really common that modders ask users to use the console to get items. But its also a little off topic because the thread is talking about ways to author items directly into the game through papyrus or a plugin. Still a good tip for most people. On topic now, fg109's post is the best solution because iirc AddForm(Form apForm) did get fixed and now persists.

 

^--- @anyone, Ive heard Addform got fixed through word of mouth so test it yourself before taking my word as law.

Link to comment
Share on other sites

I've been using AddForm to build formlists for the purposes of auto-transfering items from player inventory as they are added into a bag of holding. So far they've never reset on me (unless I purposefully did it) and I used those adjustments for about half of my last full playthrough. This has been since 1.8 patch. I however have not used it with leveled lists, so take it with a grain of salt...

 

As far as wanting to add an item to a merchant chest alias on a quest more than once (fake respawning), devise a way to start and stop the quest. It could be as simple as using a second quest with an update cycle.

Link to comment
Share on other sites

  • 6 months later...
  • Recently Browsing   0 members

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