Difference between revisions of "Adding items to vendors"


(tutorials are in-depth articles, this is more of a solution)
Line 37: Line 37:
  VendorChestBuriedGobREF.additem Jet 3
  VendorChestBuriedGobREF.additem Jet 3

Revision as of 18:36, 17 December 2008

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

To avoid incompatibilities with other mods, there are two ways of doing this: first, create a new container owned by the NPC; second, create a quest/script to add the items to the NPC's existing vendor container.

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

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 him 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 Qeust window after saving your script below.
Scn yourQuestAddItemsScr

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