Villager Jobs

From wiki
Jump to: navigation, search

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 Villager Jobs, these are found in .villagerjob files and contains information for;

  • The dialogues specific for the job
  • Starting and ending times
  • Tools and tiles that should be used for the job
  • The totem that signifies the workplace

The file specifies the entire set of information needed for a villager to do their job. Villager jobs help with locking progression of items and help bring more life to the world. Most workplaces have to be built by the player so the world can quickly start to become more built over time.

That being said, a villager is not forced to have a job, so this file contains no mandatory information for a villager.


Creating a *.villagerjob file

Creating a villager job file is mostly specifying other files that might be necessary for the job. This file is then used in a .villagernpc villager files. The file commonly looks like:

{
  "code" : "staxel.village.job.Barkeep",
  "startingTime" : 0,
  "endingTime" : 1440,
  "workPlace" : "staxel.totem.workplace.Tavern",
  "primaryDialogue" : "staxel.village.dialogue.Barkeep",
  "dialoguePools" : [
    "staxel.dialoguePool.Barkeep"
  ],
  "jobItems" : [
    {
      "code" : "staxel.item.tool.Net"
    }
  ],
  "workPlaceTools" : [
    "staxel.tileObject.shop.CashRegister"
  ],
  "weightedScripts" : [
    {
      "script" : "staxel.script.StandAroundIdle",
      "weight" : 25.0
    }
  ]
}

As with many other villager files, most properties just contain a code that points towards another file of the correct type. The first two properties that stand out are the start time and the end time. This is the amount of time in seconds from the start of the day change transition. The second would be the job items property. This contains a list of items which are to be spawned. There is more information on how to create these at [[[Items#How to Spawn an Item]] (Currently not made). The third and final is "workPlaceTools", which specifies the tiles/tile objects in a workplace that the villager can "interact" with. (Stand around.) With all of these properties out of the way, you now have a working villager job.


Config Options

"code"

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

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


A string containing the code of the job this file will be referring to.


"dialoguePools"

Valid options (List of Strings): A list of strings that each point to a Dialogue Pool.

Default Value: If not specified, will rely on the villagers normal dialogue.


This is the list of dialogue pools that will be used while the villager is working. All dialogue pools in this section should have the "Job" type.


"primaryDialogue"

Valid options (String): A string that points to a Dialogue.

Default Value: If not specified, will not force a certain dialogue to appear first. (While working.)


This specifies a dialogue which must be played first before all other dialogues. Useful for when something should be done first before all else.


"jobItems"

Valid options (List of Blobs): A list of blobs containing Items. See Items#How to Spawn an Item for more details.

Default Value: If not specified, will not hold any items during the job.


This contains a list of items that the villager will hold in their hand. Any valid item can be used.


"startingTime"/"endingTime"

Valid options (Integer): An integer which is between 0-1440. (Start and End of the day)

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


The points to the time in which the villager will start/end their job. These times are specified in seconds after the day has been started. In terms of what it actually does, it changes dialogues to the job ones specified above and it also changes the scripts (how the villager behaves) to the ones specified.


"weightedScripts"

This is a List of Blobs that contain properties for weighting scripts. These scripts involve how the villager should act, and the weight specifies how likely the particular script will be gotten compared to the others. These blobs look like;

{
  "script": "staxel.script.StandAroundIdle",
  "weight": 25.0
}

"script"

Valid options (String): A string that points to a Script.

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


This specifies which script to use.


"weight"

Valid options (Double): A positive decimal number.

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


The weight this script will have compared to other scripts.


"workplace"

Valid options (String): A string which points to a totem's code.

Default Value: If not specified, the villager will not have a workplace, and will just wander.


This is the totem which is specified as the workplace for the villager. If one exists in the village, then the villager can use this workplace. If one doesn't exist, then the villager will end up using the dialogue specified by #"workPlaceMissingPools" instead of their normal job dialogue.


"workOvernight"

Valid options (Bool): True or False.

Default Value: If not specified, will default to False.


This allows the worker to stay at the workplace during the night transition. That is, the worker will not teleport back home on a night transition.


"workPlaceMissingPools"

Valid options (List of Strings): A list of strings that each point to a Dialogue Pool.

Default Value: If not specified, will not play any dialogue concerning missing their workplace.


This is the list of dialogue pools that will be used if the villager is missing their workplace. All dialogue pools in this section should have the "WorkPlaceMissing" type.


"workPlaceTools"

Valid options (List of Strings)): A list of strings that each point to a Tile

Default Value: If not specified, will not stand around certain tiles in the workplace.


This is the list of tiles in which the villager will "interact" with if they are in the workplace. Interacting with mostly involves standing nearby at this point in time.