Difference between revisions of "Totems"

From wiki
Jump to: navigation, search
(Initial commit.)
 
(Updated to new category.)
Line 1: Line 1:
[[Category:Modding]][[Category:VillagerModding]]
+
[[Category:Modding]][[Category:Villager Modding]]
[[:Category:VillagerModding|Villagers]] in Staxel are fairly moddable, with many parts being able to be switched out, and new creations can add to the pool.
+
[[:Category:Villager Modding|Villagers]] in Staxel are fairly moddable, with many parts being able to be switched out, and new creations can add to the pool.
  
 
This page is about Totems, these are found in .totem files and contains information for;
 
This page is about Totems, these are found in .totem files and contains information for;

Revision as of 01:56, 8 July 2017

Villagers in Staxel are fairly moddable, with many parts being able to be switched out, and new creations can add to the pool.

This page is about Totems, these are found in .totem files and contains information for;

  • What objects are needed to make a building
  • Size of the search area
  • What is needed to make higher tiers of building

This file actually doesn't have much to do with villagers. But this system is entirely made to allow villagers to take advantage of it. Villagers will know of totems and can speak about them in their dialogue. It also has a tier system which can also be taken advantage of.


Creating a *.totem file

Villager totems can actually be a somewhat complicated file to work with. But it can be simply broken down into separate parts. But first here is a typical .totem file.

{
  "code" : "staxel.totem.workplace.Patisserie",
  "region" : {
    "x" : 5,
    "y" : 5,
    "z" : 5
  },
  "centreOffset" : {
    "x" : -5,
    "y" : 5,
    "z" : 0
  },
  "tiers": 2,
  "requiresRoof" : true,
  "requiredCategories" : {
    "tier0": [
      {
        "category" : "stool",
        "count" : 3
      },
      {
        "category" : "table",
        "count" : 5
      }
    ],
    "tier1": [
      {
        "category" : "stool",
        "count" : 1
      }
    ]
  },
  "requiredObjects" : {
    "tier1": [
      {
        "code" : "staxel.tileObject.office.OfficeChair",
        "count" : 1
      }
    ]
  },
  "requiredBuildings" : {
    "tier1": [
      {
        "code" : "staxel.totem.workplace.Patisserie",
        "tier" : 1
      },
      {
        "code" : "staxel.totem.workplace.FishingSpot",
        "tier" : 0
      }
    ]
  },
}

The first five properties are fairly simple to understand. Code is just the unique identifier for this totem. Region is how many tiles in each direction, for example if you have an x of 3, it will stretch from -3 to 3 (7 tiles) with the totem as the centre. Centre offset moves the area that it searches away from the totem. And requires roof allows it to check if a roof has been built over the totem/area.

With that comes the more complicated looking bits. All of these parts rely on the property "tiers". Tiers that is greater than 0, numbering how many different tiers that this totem can have. This does not include the base "Broken" tier that you get just for placing down the totem. The first of the properties to use this is "requiredCategories". Required categories follows the following order;

"requiredCategories" : {
  "tier0": [
    {
      "category" : "stool",
      "count" : 3
    },
    {
      "category" : "table",
      "count" : 5
    }
  ],
  "tier1": [
    {
      "category" : "stool",
      "count" : 1
    }
  ]
},

Required categories is actually not a list but a blob. It contains properties for each tier of the totem is to be influenced. The first tier is "tier0", the second tier is "tier1" etc. In each of these tiers is a list of category names. It will look for a certain number of items that have the "category" specified in their name. If at least the number in "count" exist then this part succeeds. If all succeed then this tier is complete. Feel free to play around with this to get a feel for it.

The second one is required objects. This one acts pretty much the same as the required categories one, except that it looks for specific tiles and tileObjects, with a specific code. This is great for making sure a very specific object is included. It will normally look like;

"requiredObjects" : {
  "tier1": [
    {
      "code" : "staxel.tileObject.office.OfficeChair",
      "count" : 1
    }
  ]
}

This also shows off that you can completely skip tiers. Feel free to play around with this as well.

The last one for this tutorial is required Buildings. Required buildings is also fairly similar to required categories and required objects. This time the code points to another totem altogether. Alongside the code is a new property named "tier". This is a check that the building is this tier or higher.

"requiredBuildings" : {
  "tier1": [
    {
      "code" : "staxel.totem.workplace.Patisserie",
      "tier" : 1
    },
    {
      "code" : "staxel.totem.workplace.FishingSpot",
      "tier" : 0
    }
  ]
},

As with all others feel free to experiment.

With this, you have created a totem. Now all you need to do is let a tile have a totem component with this totem and your good to go.


Creating a Shop

[To be done when Treasures is complete]


Config Options

"code"

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

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


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


"centreOffset"

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

Default Value: Can be omitted. Will just leave the totem centred in the area.


This is how many tiles it will offset the totem from the centre of the search area. So offsetting the totem by 1,1,1 will move it one tile upwards, one tile forwards and one tile to the side.


"region"

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

Default Value: No default value. Must be specified.


This is how large the area it will search. It extends the number in every direction, that is if you have an x of 3, it will go between -3 and 3 (Crossing 7 tiles).


"requiredBuildings"

Required buildings act fairly similar to required categories and required objects. It is a blob that contains blobs that are named "tier0", "tier1" etc. It can have any of the numbers up to but not including the number specified by "tiers". (i.e. If tiers is 2, then you can put "tier0" and "tier1" but not any other numbers). It has code points to another totem altogether. It uses that code to check if a totem of that type exists in the village. Then if it does exist it will also check it's current tier, and if that is correct it will allow the tier specified to be built. It can commonly look like;

"requiredBuildings" : {
  "tier1": [
    {
      "code" : "staxel.totem.workplace.Patisserie",
      "tier" : 1
    },
    {
      "code" : "staxel.totem.workplace.FishingSpot",
      "tier" : 0
    }
  ]
},

As a note, this is note needed. You do not need to tie any tiers to any other buildings, but doing so can be a good way to force progress. (A smelter would need a mine for example.)


"requiredCategories"

Required Categories act fairly similar to required buildings and required objects. It is a blob that contains blobs that are named "tier0", "tier1" etc. It can have any of the numbers up to but not including the number specified by "tiers". (i.e. If tiers is 2, then you can put "tier0" and "tier1" but not any other numbers). It has categories that it will look for in every tile that the totem covers. It also has a quantity, and if that amount of tiles, or more, can be found then it will allow this tier to be gotten. It can commonly look like;

"requiredCategories" : {
  "tier0": [
    {
      "category" : "stool",
      "count" : 3
    },
    {
      "category" : "table",
      "count" : 5
    }
  ],
  "tier1": [
    {
      "category" : "stool",
      "count" : 1
    }
  ]
},

As a note, this is note needed. You do not need to tie any tiers to any categories, but this will be the most used property in tiles. (You don't care what table is place, just that a table is placed for example.)


"requiredObjects"

Required objects act fairly similar to required buildings and required categories. It is a blob that contains blobs that are named "tier0", "tier1" etc. It can have any of the numbers up to but not including the number specified by "tiers". (i.e. If tiers is 2, then you can put "tier0" and "tier1" but not any other numbers). It has a tile code that it will look for in every tile that the totem covers. It also has a quantity, and if that amount of tiles, or more, can be found then it will allow this tier to be gotten. It can commonly look like;

"requiredCategories" : {
  "tier0": [
    {
      "category" : "stool",
      "count" : 3
    },
    {
      "category" : "table",
      "count" : 5
    }
  ],
  "tier1": [
    {
      "category" : "stool",
      "count" : 1
    }
  ]
},

As a note, this is note needed. You do not need to tie any tiers to any objects, but this is useful for making sure a very specific object is placed. (You want to make sure a baking station is placed for example.)


"requiresRoof"

Valid options (bool): True or False

Default Value: False.


Whether the totem requires a roof before any tier can be reached.


"shopGoods"

[Will be editted when Treasures is complete.


"tiers"

Valid options (Int): A number that is 0 or greater

Default Value: No default value. Must be specified.


This is how many tiers the totem will have. It will not check for tiers higher than this number. (i.e. If you have tiers = 2, it will check for "tier0","tier1" but will not check "tier2" etc.)


"villagerSpawner"

Valid options (Int): A code that points to a [Tiles|Tile] that is a villager spawner.

Default Value: Can be omitted. Will not spawn any villagers.


This will place the tile in question and spawn villagers on a night transition or at some other times.