Least Invasive Way To Add Items To Merchant?

Post » Fri Nov 18, 2011 10:53 pm

So I'm looking for any advice on the least mod-conflicty, minimalist way to add an item to (preferably all) merchants. It needs to have a random chance (not 100%) of being for sale, a maximum of 1 of the given item, and restock.

If I ref.AddItem the item onto the merchant NPC, will they have it for sale? What about if I ref.AddItem it to their vendor container? What happens to the item I if I add it via ref.AddItem when their stock naturally resets?

Queue
User avatar
Minako
 
Posts: 3379
Joined: Sun Mar 18, 2007 9:50 pm

Post » Fri Nov 18, 2011 11:56 am

Disclaimer: I have no idea if this will work.

The script VendorMerchantContainerScript seems to be used by all the merchant containers in the game (not including the DLCs). You could try creating a new leveled item, add your item to it and set the "Chance None." Then add an OnReset block to the VendorMerchantContainerScript and in that block do an AddItem . That way whenever the vendor's inventory resets your item has a random chance of being added in. This is just off the top of my head so again no idea if it will work. It's minimalist but potentially mod-conflicty.
User avatar
BethanyRhain
 
Posts: 3434
Joined: Wed Oct 11, 2006 9:50 am

Post » Fri Nov 18, 2011 10:37 am

Oh, that's a really clever approach to consider (modifying the script already attached to all the vendor containers). It does appear to be too mod-conflicty for what I'm shooting for, but I wouldn't have even found that script if you hadn't pointed it out. It's also kind've a fascinating script in its own right.

I have a few ideas on my plate to try, and I'll drop back by here with whatever I settle on as my final solution. I THINK I'm going to use a quest script with a really long interval (a real-time minute, probably), but I need a plan to deal with ''natural'' vendor resets that I expect to strip the items I'm adding from their inventory, and a plan so that, if the player doesn't buy the item, all merchants don't eventually wind up with one stocked (essentially also emulating a vendor's ''natural'' reset), so we'll see if it pans out.

Queue
User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm

Post » Fri Nov 18, 2011 11:37 am

I've read a couple times in the Nexus forums, that if you just place another container somewhere and give ownership to the vendor, then any items you place in it will be available for sale through that vendor. In addition to his vanilla container.
User avatar
Krystina Proietti
 
Posts: 3388
Joined: Sat Dec 23, 2006 9:02 pm

Post » Fri Nov 18, 2011 7:52 pm

You just need to create a levelled list with your item. You don't even need to add a new container to the vendor

MyvendorchestREF.additem TheLevelledlistIwant 1

I don't know ewactly what you want to do but this line can be used in any script, quest or dialogue
example :

If notdoneyet==0
If player.hasperk toughness
MyvendorchestREF.additem TheLevelledlistIwant 1
se notdoneyet to 1
endif
endif

I you don't want it anymore : myvendorchestref.removallitems or removitem will do

I can't imagine less intrusive.
User avatar
CArla HOlbert
 
Posts: 3342
Joined: Wed Feb 21, 2007 11:35 pm


Return to Fallout: New Vegas