Jump to content

Help - Adding Items to Vendor Containers


Recommended Posts

Hello,

 

I've been trying to figure out how to add items to vendors via script for those who do not have leveled list that items can be added to. A perfect example of this is the Food vendor at the Institute. Can I just use FO4Edit to add the leveled items I'd like him to sell to his connected vendor chest? This is a problem I've ran into trying to do leveled list injections for my mod Simple Coffee. I've figured out how to add all the items to leveled lists, but not vendors who have no leveled lists that can be added to. Any help is greatly appreciated!

 

Thank You,

Plarux

Link to comment
Share on other sites

You can use quest aliases pointing to vendor chests where you want to add your leveled lists, attach a custom script to the aliases that adds the leveled list to the chests.

The script would look pretty similar to lockExtraLootSCRIPT:

Scriptname AddLeveledListScript extends ReferenceAlias

LeveledItem Property LLD_Vendor_Custom_List Auto

Auto State startState
	Event OnLoad()
	    GetReference().AddItem(LLD_Vendor_Custom_List)
	    goToState("doNothing")
	EndEvent
EndState

State doNothing
	Event OnLoad()
	EndEvent
EndState

I've tested it in the institute vendor with the alias using "forced reference" pointing to "VendorAspirationInstitute" at cell "InstituteConcourse" and it worked fine.

Edited by DieFeM
Link to comment
Share on other sites

You can use quest aliases pointing to vendor chests where you want to add your leveled lists, attach a custom script to the aliases that adds the leveled list to the chests.

The script would look pretty similar to lockExtraLootSCRIPT:

Scriptname AddLeveledListScript extends ReferenceAlias

LeveledItem Property LLD_Vendor_Custom_List Auto

Auto State startState
	Event OnLoad()
	    GetReference().AddItem(LLD_Vendor_Custom_List)
	    goToState("doNothing")
	EndEvent
EndState

State doNothing
	Event OnLoad()
	EndEvent
EndState

I've tested it in the institute vendor with the alias using "forced reference" pointing to "VendorAspirationInstitute" at cell "InstituteConcourse" and it worked fine.

 

DieFeM,

 

I tried following what you suggested, but couldn't get it to work. The vendor that I'm using is the vendor for food, which doesn't have an aspiration container. I created one, linked it via keyword to NPC, and through the quest alias. My script looked very similar to yours. There was nothing there when I loaded it up. Waited 2-3 days, saved and exited, loaded it back up, and still nothing. My leveled item has 5 cups of coffee. I've tried checking different options for "use all", leveled, count, etc. Can't think of anything else to try. I've tried adding the leveled list via FO4Edit to see if it works and no success. :confused:

Edited by Plarux
Link to comment
Share on other sites

Have you tested your LL on a plain chest ?

 

New start game enabled quest. New reference alias, unique actor player. New reference alias, create ref to object Workshop_Wood Crate at Player in the Alias Inventory box bottom left add your LL. Does stuff appear ?

 

If that works then remove the player alias, change the reference alias to Specific Reference, if you dont know the refid then select forced ref cell institute concourse filter vendor the ref box will drop down with some target options.

Link to comment
Share on other sites

Well, I've been trying it for a couple of hours, but I finally got it working without editing any vanilla form.

The problem was that you can't add misc objects to a food vendor.

So to resolve it what I did was:

1. Duplicate the vendor faction and the base object of the chest. (Container: VendorInstituteFood as VendorInstituteFoodExtraMisc and Faction: ServicesInstituteFood As ServicesInstituteFoodExtraMisc)

2. Edit the faction ServicesInstituteFoodExtraMisc in the Vendor tab, Vendor Buy/Sell list : VendorItemsMisc with "Buy/sell everything not in list?" checked. No "Merchant Container" (leave it unset).

3. Created a quest with 3 aliases:

Alias1 "Forced Reference" : "VendorInstituteFood" at Cell "InstituteConcourse"

Alias2 "Create Ref To Object" : "VendorInstituteFoodExtraMisc" At "VendorInstituteFood" (Alias1)

Alias3 "Unique Actor" : "InstituteSynthFoodVendor" with "Linked Aliases": "VendorInstituteFoodExtraMisc" (Alias2) with Keyword "VendorContainerKeyword01" and added "Alias Factions": "ServicesInstituteFoodExtraMisc" and Attached a custom script to remove the previous vendor faction:

Scriptname AliasRemoveFromFactionSCRIPT extends ReferenceAlias Const

Faction Property ServicesInstituteFood Auto Const Mandatory

Event OnAliasInit()
	GetActorReference().RemoveFromFaction(ServicesInstituteFood)
EndEvent

Now you can safelly add your custom leveled list in to VendorInstituteFoodExtraMisc.

 

What this quest does is create a new chest reference next to the original chest, then links this new chest to the vendor, adds the new misc vendor faction to the vendor, and finally removes the food vendor faction with the script, so the new misc vendor faction is used by the vendor.

Edited by DieFeM
Link to comment
Share on other sites

I'm going to try what SKK50 suggested first, because some of the items I'd like to add to the Institute Food Vendor are actually aid items - Cup of Coffee.

 

Hopefully that works for making the coffee drink available, but I also need the vendor to carry misc objects too (Coffee Tins). Would I just make the option for "VendorItemsMisc" to be empty, so that he can sell anything? If I can't have the luxury of both, then being able to have just the drink is good enough. The option for coffee tins at the Institute vendor was requested, so I want to try and make it possible.

 

I appreciate the help from both of you. Will try what you guys suggested later today.

 

Thank You,

Plarux

Link to comment
Share on other sites

Note that "Buy/Sell list" is a filter that let the vendor sell only the type of items that it has listed, the listed options are actually formlists that you can open and see the content.

 

Looking at VendorItemsFood you'll notice that it filters by food, drink, alcohol and water, while VendorItemsMisc filters by keys and "nosale", so the misc filter is meant to be used with "Buy/sell everything not in list?" checked, which produces the opposite effect: sell everything but keys and "nosale" items.

 

So if you don't mind editing vanilla records, you can just edit the faction ServicesInstituteFood so it uses VendorItemsMisc and add your leveled lists to the container VendorInstituteFood.

 

I prefer not to edit vanilla records because they can be overwritten by another mod. By using my own faction, container and quest I make sure that no mod will be incompatible.

Link to comment
Share on other sites

Note that "Buy/Sell list" is a filter that let the vendor sell only the type of items that it has listed, the listed options are actually formlists that you can open and see the content.

 

Looking at VendorItemsFood you'll notice that it filters by food, drink, alcohol and water, while VendorItemsMisc filters by keys and "nosale", so the misc filter is meant to be used with "Buy/sell everything not in list?" checked, which produces the opposite effect: sell everything but keys and "nosale" items.

 

So if you don't mind editing vanilla records, you can just edit the faction ServicesInstituteFood so it uses VendorItemsMisc and add your leveled lists to the container VendorInstituteFood.

 

I prefer not to edit vanilla records because they can be overwritten by another mod. By using my own faction, container and quest I make sure that no mod will be incompatible.

 

Makes a lot more sense now. I thought about it a bit at work today, and knew I didn't quite understand it. After reading SKK50's reply again, I see what you mean about editing vanilla records and agree with you about avoiding editing these. I thought I was missing an alias from the suggestion in your very first reply, but can see now that's not right. :mellow:

 

Anyways, I will attempt to try your new suggestion tomorrow. I'll post another reply with an update some time soon.

 

Thanks again,

Plarux

Link to comment
Share on other sites

DieFeM,

 

Alright, so i was able to get everything working! The vendor sells some misc items too, but that's not a problem *insert meme here*.

I really appreciate the time and effort you put into figuring this out. One step closer to releasing version 3 for Simple Coffee.

Fallout4%205_9_2019%202_43_50%20PM_zpsng

Edited by Plarux
Link to comment
Share on other sites

You can create your own vendor filter by creating a new FormList that contains the objects that you don't want to be sold, or vice versa, and then set your own list as Buy/Sell list for the faction, in order to show all FormLists in the vendor settings of the faction you only need to remove VendorItems from the filter that is just on top of the drop-down menu where you choose the Buy/Sell list.

Edited by DieFeM
Link to comment
Share on other sites

  • Recently Browsing   0 members

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