Difference between revisions of "Merchant"

From wiki
Jump to: navigation, search
m (Fix redlink.)
(Added new variable.)
 
Line 89: Line 89:
  
 
This is the dialogue that the merchant will use.  
 
This is the dialogue that the merchant will use.  
 +
 +
 +
=== "genericDialogue" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string containing the code to a [[Dialogue]] file.</code>'''
 +
 +
'''Default Value:''' No default value is specified. Always need to provide your own.
 +
 +
 +
A secondary dialogue that plays when player undocks an item from their sellbox. Used mainly for the merchant selling tutorial.
  
  

Latest revision as of 05:47, 2 February 2018

In Staxel, *.merchant files are used to specify a merchant. It specifies the following;

  • What the merchant sells.
  • What the merchant looks like.
  • What the tile for selling should be.

These files are called specifically by the Tile#"merchantKind" property of Tiles.

Creating a *.merchant file

A merchantfile is mostly full of references to other files which provide the more basic information. The common layout of a merchant file looks like;

{
  "code" : "staxel.merchants.buildingMerchant",
  "stall" : 
  {
    "tile" : "staxel.merchants.carts.BuildingMerchant",
    "treasurePool" : "staxel.treasure.funStuff"
  },
  "sellBox" : 
  {
    "tile" : "staxel.merchants.SellBox",
    "offset" : { "x" : 1, "y" : 0, "z" : 3 }
  },
  "merchant" : {
    "name" : "Melissa",
    "dialogue" : "staxel.village.dialogue.FunStuffVendor",
    "offset" : { "x" : 2, "y" : 1.0, "z" : -5 },
    "outfit" : {
      "accessory" : "",
      "shirt" : "staxel.accessories.fullBodyOutfits.MagicMerchant",
      "trousers" : "",
      "shoes" : "",
      "hat" : "",
    }
  }
}

Feel free to edit these values however you want. The first property, #"code", is known as the identifier of this merchant. This is basically a unique name that the game can always rely on to find this merchant. The recommendation for this property is to make it the filepath to your file but replace "\" with ".", as the file path is always guaranteed to be unique.


The second property "stall" is a Blob which contains 2 properties. The first #"tile" is the code of the Tile you want to use as the stall. This stall should have a Dock Definition in order to allow selling items. The second is #"treasurePool" which is the Treasure Pool that is used to fill out all the docks. You can replace "treasurePool" with #"treasurePools" which is the same but is a List of Treasure Pools.


The next property "sellBox" is a Blob which contains 2 properties. The first #"tile"_2 is the code of the Tile you want to use as the sell box. This sell box should have a Dock Definition that is specifically set for the player to sell. The second is #"offset" which is the offset of the sellBox compared to the centre location.


The next property "merchant" is a Blob which contains 4 properties. The first #"name" is the name for the merchant. This can be translated for different languages. The next property is #"dialogue" which is the Dialogue you want the merchant to use. The third is #"offset"_2 which is the offset of the Merchant compared to the centre location. The final is #"outfit" is also a Blob. This contains up to 10 properties although the number needed can vary. There is a property for every Accessory slot, and a property for the Palette for this accessory. #"accessory" is the common accessory (Glasses etc) that should be used. Nothing special happens if this is omitted. #"accessoryPalette" is the palette for this accessory. #"shirt" is the shirt that should be used. A random shirt is chosen if not specified. #"shirtPalette" is the palette for this accessory. #"trousers" is the set of pants that should be used. A random set of pants is chosen if not specified. #"trousersPalette" is the palette for this accessory. #"shoes" is the shoes that should be used. A random pair of shoes is chosen if not specified. #"shoesPalette" is the palette for this accessory. #"hat" is the hat that should be used. Nothing special happens if this is omitted. #"hatPalette" is the palette for this accessory.


And with that you should now have a working merchant that can be specified on a tile.


Config Options

"code"

Valid options (String): A unique string which species what this Merchant is.

Default Value: No default value is specified. Always need to provide your own.


A string containing the code of the merchant the blob will be referring to.


"merchant"

This is an optional Blob that contains information on the merchant that will stand nearby the stall. It will commonly look like;

"merchant" : {
  "name" : "Melissa",
  "dialogue" : "staxel.village.dialogue.FunStuffVendor",
  "offset" : { "x" : 2, "y" : 1.0, "z" : -5 },
  "outfit" : { //exclude for random
    "accessory" : "",
    "shirt" : "staxel.accessories.fullBodyOutfits.MagicMerchant",
    "trousers" : "",
    "shoes" : "",
    "hat" : "",
  }
}

"dialogue"

Valid options (String): A string containing the code to a Dialogue file.

Default Value: No default value is specified. Always need to provide your own.


This is the dialogue that the merchant will use.


"genericDialogue"

Valid options (String): A string containing the code to a Dialogue file.

Default Value: No default value is specified. Always need to provide your own.


A secondary dialogue that plays when player undocks an item from their sellbox. Used mainly for the merchant selling tutorial.


"name"

Valid options (String): Any valid String.

Default Value: No default value is specified. Always need to provide your own.


This is the merchant's name.


"offset"

Valid options (Vector 3 - Double): { "x": 0, "y": 0, "z": 0 }

Default Value: No default value is specified. Always need to provide your own.


This is the Merchant NPC's offset compared to the location of the centre tile.


"outfit"

This is a Blob that contains information on the merchants outfit. It will commonly look like;

"outfit" : {
  "accessory" : "",
  "shirt" : "staxel.accessories.fullBodyOutfits.MagicMerchant",
  "trousers" : "",
  "shoes" : "",
  "hat" : "",
}

"accessory"

Valid options (String): A string containing the code to a Accessory file.

Default Value: If not specified, will not spawn any Accessory.


This is the accessory that will be spawned for the accessory slot of the merchant.


"accessoryPalette"

Valid options (String): A string containing the code to a Palette file.

Default Value: If not specified, will keep the default palette for the accessory.


This is the palette that will be used for the accessory.


"shirt"

Valid options (String): A string containing the code to a Accessory file.

Default Value: If not specified, will spawn a random shirt accessory. You can specify an empty string (e.g. "") to not have any accessory spawn.


This is the accessory that will be spawned for the shirt slot of the merchant.


"shirtPalette"

Valid options (String): A string containing the code to a Palette file.

Default Value: If not specified, will keep the default palette for the accessory.


This is the palette that will be used for the shirt.


"trousers"

Valid options (String): A string containing the code to a Accessory file.

Default Value: If not specified, will spawn a random trousers accessory. You can specify an empty string (e.g. "") to not have any accessory spawn.


This is the accessory that will be spawned for the trousers slot of the merchant.


"trousersPalette"

Valid options (String): A string containing the code to a Palette file.

Default Value: If not specified, will keep the default palette for the accessory.


This is the palette that will be used for the trousers.


"shoes"

Valid options (String): A string containing the code to a Accessory file.

Default Value: If not specified, will spawn a random shoes accessory. You can specify an empty string (e.g. "") to not have any accessory spawn.


This is the accessory that will be spawned for the shoes slot of the merchant.


"shoesPalette"

Valid options (String): A string containing the code to a Palette file.

Default Value: If not specified, will keep the default palette for the accessory.


This is the palette that will be used for the shoes.


"hat"

Valid options (String): A string containing the code to a Accessory file.

Default Value: If not specified, will not spawn any Accessory.


This is the accessory that will be spawned for the hat slot of the merchant.


"hatPalette"

Valid options (String): A string containing the code to a Palette file.

Default Value: If not specified, will keep the default palette for the accessory.


This is the palette that will be used for the hat.


"sellBox"

This is an optional Blob that contains information on the sell box. It will commonly look like;

"sellBox" : 
{
  "tile" : "staxel.merchants.SellBox",
  "offset" : { "x" : 1, "y" : 0, "z" : 3 }
},

"offset"

Valid options (Vector 3 - Integer): { "x": 0, "y": 0, "z": 0 }

Default Value: No default value is specified. Always need to provide your own.


This is the sell box's offset compared to the location of the centre tile.


"tile"

Valid options (String): A string containing the code to a Tile file.

Default Value: No default value is specified. Always need to provide your own.


This is the tile that will be used to act as the Sell Box. This tile should have a Dock Definition with a site that enables selling.


"stall"

This is a Blob that contains information on how the stall should look and what it should sell. It will commonly look like;

"stall" : 
{
    "tile" : "staxel.merchants.carts.BuildingMerchant",
    "treasurePool" : "staxel.treasure.funStuff"
},

"tile"

Valid options (String): A string containing the code to a Tile file.

Default Value: No default value is specified. Always need to provide your own.


This is the tile that will be used to act as the stall. This tile should have a Dock Definition with multiple sites.


"treasurePool"

Valid options (String): A string containing the code to a Treasure Pool file.

Default Value: If not specified, will not fill any docks. If #"treasurePools" is specified, this will act second.


This is the Treasure Pool that will be used in order to fill docks in the stall. Will keep going until either the Treasure Pool has no more entries, or all docks are filled.


"treasurePools"

This is a Blob that contains no specified variables. However, you do add more variables to this blob yourself.

Each variable in this file will have the name of the Docks#"siteName" as the property name. This property is then also a bool, which contains a single property. This single property is named "pool" which contains the treasure pool that should be used at this particular site.

This can commonly look like;

"treasurePools" : {
  "body" : {
    "pool" : "staxel.treasure.mannequin.dresses"
  },
  "site2" : {
    "pool" : "staxel.treasure.something"
  }
}

Which will fill the body site with dresses and the second site with something else.