Skip to main content Link Search Menu Expand Document (external link)

Merchant

extensions to normal NPCs. They can also barter items.

Table of contents

  1. How does a merchant work?
  2. Adding a new merchant
  3. Changing a merchant’ setting
  4. Changing a merchant’ speech
  5. Removing a merchant completely
  6. Steps (without Worldsmith)
  7. Speech extensions
  8. Next up

How does a merchant work?

The merchant has three main values that gets used for the bargain:

  • the selling item (the item is selling to you),
  • the currency (the item used as currency),
  • the price (the item quantity needed for the trade).

For example, the shroom guy in the Philosopher’s Forest wants you to get 9 Shrooms, this speech (sale lines) is usually presented right after the introduction.

Merchant before

While you haven’t collected the wanted amount of shrooms, the merchant will trigger the not-enough-currency lines.

Once you got all the shrooms, the trading speech (selling line) will show up.

Merchant inv before Merchant after

Once finished with the selling line, that’s finished you will get the sold lines and your item will be automatically worn on you (if the selling item is wearable).

Merchant inv after Merchant after

Adding a new merchant

  1. Navigate to the Content Manager page.

    Content Manager

  2. Scroll until you find an header “NPCs”.
  3. Click on the Create a NPC button found on the right side. A prompt will show up asking the necessary details for your merchant. The following image is how it should look like.

    Create a NPC

  4. Select the appropriate type for your merchant (click on merchant) and write a recognizable name for your merchant, you won’t be able to change it later!
  5. Click on Select sprite.
  6. A new prompt will show up asking you to select a sprite for your merchant.

    Add NPC

  7. After selecting your file, click Open.
  8. Make sure the row and column count align with your sprite sheet.

    NPC adjust spritesheet

  9. Click Add NPC and you should see your NPC below “Merchants”.

Merchant success

Changing a merchant’ setting

  1. Navigate to the Content Manager page.
  2. Scroll until you find an header “NPCs”.
  3. Click on the merchant you’d like to edit its settings.

    Merchant success

Merchant settings

A prompt will show up with the merchant’ settings, from here you can modify as you will.

Changing a merchant’ speech

  1. Navigate to the Content Manager page.
  2. Scroll until you find an header “NPCs”.
  3. On the NPC you are looking to modify, click on the blue button that contains a text bubble.

    Merchant success

Merchant speeches

A prompt will show up with the merchant’ quotes, from here you can modify as you will.

Removing a merchant completely

  1. Navigate to the Content Manager page.
  2. Scroll until you find an header “NPCs”.
  3. On the merchant you are looking to modify, click on the red button that contains a trash bin.

    Merchant success

  4. A prompt will show up asking for confirmation of your deletion. Click Yes, delete if you are completely sure.

    Merchant delete

After clicking it, your merchant will be removed completely. And you shouldn’t see it both in the Content Manager and Screens pages.

Steps (without Worldsmith)

Retexturing a merchant NPC

To replace a spritesheet of a NPC:

  1. Convert a new image into a packed XNB file.
  2. Name it as the NPC you want to retexture.
  3. Place the file in props/textures/merchant and replace the file.
  4. If you modified the sprite sheet, you will need to modify the sprite sheets and the animation settings inside your NPC’s configuration file (that you can find in props/textures/old_man/merchant).

Merchant additions

In addition the massive list of settings that the normal NPC brings, the merchant adds even more:

Selling item settings

Setting the merchant’s selling item

  1. Search for the sale_item tag.
  2. Modify the sale_item to the item you want to use give to the user.

Setting the merchant’s selling currency

  1. Search for the currency_type tag.
  2. Modify the currency_type to the item of currency you want to use. It is recommended that you use an item that is stackable.

Setting the merchant’s selling price

  1. Search for the price_increase tag.
  2. Modify the price_increase to the payment value. If it’s higher than 1, make sure your currency item is stackable, otherwise it can not be redeemable.

Sale lines (before payment)

Setting sale lines

  1. Search for the sale_lines tag.
  2. Get rid of all the string tags that could be present.
  3. Copy the following snippet:
     <string>YOUR_STRING_HERE</string>
    
  4. Replace YOUR_STRING_HERE with your “selling this item” string.

    You can add as many strings as you want, just copy the snippet in a line after your closing string tag and replace YOUR_STRING_HERE with your second, third… string.

    You can even add as many quotes as you want by copying the OldManQuote tag and pasting it below the closing tag of the previous OldManQuote.

Selling line (during payment)

Setting the selling line

  1. Search for the sell_quote tag.
  2. Get rid of all the string tags that could be present.
  3. Copy the following snippet:
     <string>YOUR_STRING_HERE</string>
    
  4. Replace YOUR_STRING_HERE with your “im selling you this item as we speak” string.

    You can add as many strings as you want, just copy the snippet in a line after your closing string tag and replace YOUR_STRING_HERE with your second, third… string.

Sold lines (after payment)

Setting sold lines

  1. Search for the sold_lines tag.
  2. Get rid of all the string tags that could be present.
  3. Copy the following snippet:
     <string>YOUR_STRING_HERE</string>
    
  4. Replace YOUR_STRING_HERE with your “sold this item to you” string.

    You can add as many strings as you want, just copy the snippet in a line after your closing string tag and replace YOUR_STRING_HERE with your second, third… string.

    You can even add as many quotes as you want by copying the OldManQuote tag and pasting it below the closing tag of the previous OldManQuote.

Not-enough-currency lines

Setting not-enough-currency lines

  1. Search for the no_gold_lines tag.
  2. Get rid of all the string tags that could be present.
  3. Copy the following snippet:
     <string>YOUR_STRING_HERE</string>
    
  4. Replace YOUR_STRING_HERE with your “you don’t have enough of this item” string.

    You can add as many strings as you want, just copy the snippet in a line after your closing string tag and replace YOUR_STRING_HERE with your second, third… string.

    You can even add as many quotes as you want by copying the OldManQuote tag and pasting it below the closing tag of the previous OldManQuote.

Speech extensions

If you want to display the price in-game through a speech, use [gold_count] as the value.

Next up

Ravens.