Adding items to vendors

From GECK
Jump to: navigation, search

How do I add items to an existing vendor's inventory?

To avoid incompatibilities with other mods, there are four ways of doing this, the first being the best method and the fourth being the worst method:

  1. First method, create a new Container and a new faction and set the Container owned by the Faction and then add the vendor NPC to the Faction via a Quest & Script. This method also allows Creatures to be vendors as they cannot directly own things. Additionally this method can be safely uninstalled mid play without causing bugs or crashing using only vanilla script commands.
  2. Second method, create a new Container owned by the NPC
  3. Third method, create a Quest & Script to add the items to the NPC's existing vendor Container
  4. Fourth method, create a Quest & Script to add the items to a vendor's leveled item list.

You need to make sure that your NPC can buy/sell the type of items you're adding: this is done in the AI Data tab of the NPC's edit window.

Creating a new container owned by a faction the vendor belongs to (best method)

  1. in the Object Window, under World Objects > Container, in the right pane right click and select New.
  2. give it an Editor ID (first text field), and drag & drop the Leveled Items List that you should create before hand for your items into the container with a count amount of the objects you want to roll. You can also use the Vendor Caps Leveled Item Lists to give them a random amount of caps based on the tier you decide. Delete any lists from the container you do not wish the vendor to sell. Do not directly add items to containers, this is bad practice.
  3. check the Respawns option if you want it to respawn every 3 days, and click OK.
  4. in the Object Window, under Actor Data > Factions, in the right pane right click and select New.
  5. give it an Editor ID (first text field), and tick the Allow Sell box Click OK.
  6. in the Object Window, under Actors > NPC list or under Actors > Creatures list find your Actor, right click them, and select use info. Double click the Reference to that NPC that will be displayed in the list. This will take you to the cell in the Render Window.
  7. double click the Actor and copy the Editor ID for their Reference as you will need it later.
  8. drag and drop your new container into the Render Window, and place it near the NPC and under the floor/ground.
  9. double click on your container in the Render Window, give it a Reference ID (yourNPCVendorChestRef), check a Persistent Reference box, and select the Ownership tab, and select the Faction you created from the drop down list.
  10. in the Object Window, under Actor Data > Quest, in the right pane right click and select New, give it an Editor ID (second text field). tick Script Processing Delay default, and tick Start Game Enabled, click OK.
  11. double click the Quest you just created, select the ellipsis next to the script drop down box
  12. in the Script Edit window, select script menu and New. Set the Script Type to Quest, and enter the following script and alter it for your needs.
scn YourQuestScript

Begin GameMode

	ActorReferenceEditorID.AddToFaction YourCreatedVendorFaction 1
	StopQuest YourCreatedQuest
End

Creating a new container owned by the vendor

  1. in the Object Window, under World Objects > Container, double click on any of the VendorContainer* at the bottom of the list.
  2. give it a new Editor ID (first text field), and drag & drop the items you want your vendor to sell into the Item List on the right (deleting any items you don't want) and some caps if you want them to buy stuff from you (this is how you increase the amount of money a vendor has).
  3. check the Respawns option if you want it to respawn every 3 days, and click OK; when it asks you if you want to create a new Form, click Yes.
  4. in the Cell View window, double click on the VendorChestsCell, and drag & drop your new container from the Object Window into that cell in the Render Window.
  5. double click on your container in the Render Window, give it a Reference ID (yourNPCVendorChestRef), check a Persistent Reference box, and select the Ownership tab, and select your NPC from the drop down list.
  6. for new NPCs, you can also double click on the NPC in the Render Window and select the chest in the Merchant Container tab (this is probably already assigned for existing NPCs): select the VendorChestsCell in the first dropdown, then your chest reference (yourNPCVendorChestRef) in the second dropdown.

Creating a quest/script to add the items to the NPC's existing vendor container

  1. right-click on the container you want to add items to in the World Objects > Container window, and select Use Info.
  2. double click on the entry in the Used in these Cells list, which will select the container in the Render Window.
  3. double click on the container in the Render Window and copy the Reference ID to paste it in the script below.
  4. create a new quest naming it yourQuest.
  5. select Start Game Enabled option and give it a priority of 60 or above.
  6. click OK at the bottom right corner, then double click on yourQuest to open the window again.
  7. click on the ... button next to the Script dropdown menu.
  8. select Script > New in the Script Edit window and select Quest in the Script Type dropdown menu.
  9. type in the code below, editing the additem lines as needed, the click save and close the window.
  10. select the script from the dropdown menu in the Quest window after saving your script below.
Scn yourQuestAddItemsScr

Begin gameMode
  vendorChestReferenceID.additem itemEditorID count
  stopquest yourQuest
End
  • here's an example of the 'vendorChestReferenceID.additem itemEditorID count' line from the above script:
VendorChestBuriedGobREF.additem Jet 3

Creating a quest/script to add the items to a vendor's leveled item list

This is the method used by the official DLCs. It uses the AddItemToLeveledList function.

Do the same as the above, except:

  1. (Optional) Put your item in LeveledItem(s).
  2. Make your script look like this instead:
Scn yourQuestAddItemsScr

Begin gameMode
  AddItemToLeveledList VendorItemList YourItemOrItemList level count condition;
  stopquest yourQuest
End

VendorAmmoBullets100 is an example of a good list to add to.

Notes

  • If you want the new items to respawn along with the rest of the vendor's inventory, you'll want to place it in a new container. If you don't want it to respawn, then you can either place it in a non respawning container or add it to the original container by a script.

Possible Glitch

There is a cut off in bottle caps where the merchant will display buggy behavior and stop paying the PC for items. The Merchant will take the items but the PC will not receive the bottle caps. If the merchant has 32767 bottle caps they will behave correctly. However, if the merchant has 32768 bottle caps they will take the player's items but no bottle caps will be transferred to the player.