Villager Personalities

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

  • Several types of dialogue. Normal and when someone is theiving.
  • Set regards [Need to look into this sorry.]
  • Set idle script

As such this file, in essence, creates the entirety of the villagers personality. This file does not affect the villager's Job which is handled by .viallagerjob files.


Creating a New Villager Personality

Villager personalities (or *.villager files) are fairly light files. These are mostly to do with how the Villager will act, which is mostly done through Dialogue. You can have a personality file without any dialogue, but then it will be down to generic dialogue. So feel free to continue, even without dialogue.


Before you start this tutorial, be sure to head through Modding#Getting Started with Staxel Modding.


Adding the Villager Personality via Asset Manager

Follow Modding#Using the AssetManager to Create Mods to open up the Asset Manager. With the Asset Manager open, head to View → Characters and Animals → Villager Assets. When the new window is open, head to Asset → Add → New Asset and the following window will show up.

Asset Manager - New Asset.png

First click on the button Asset Path and navigate upwards to the /content/ folder. Once there, open the /mods/ folder and create a new folder. Name this new folder to what you want the mod to be called and then open this new folder. When you open this folder give the asset a name, then click on the drop down and select Villager Personality Asset. Then click save, give the item a code then click OK.


After the asset is created, it will have been automatically selected. With that it is now time to tell the game what you want to do with this Villager Design. The following set of steps highlight the important properties, however you can mess with any property.

  1. Click on CanGiveQuests. Set to True or False.
  2. Click on CanLeaveTown. Set to True or False. (Normally true for villagers, but false for Store Managers/ Mayor.)
  3. Click on DialoguePools. Click on the dropdown. Select the pool you want and click add. Keep doing this for every Dialogue Pools you want. These should all have the type of "Personality".
  4. If you have a Dialogue Pool that must go first. (Maybe because it has a first time greeting in it.) Click on PrimaryDialogue and select that Dialogue. This should all have the type of "Personality".
  5. If you have dialogue that is about the season. Then click on the dropdown to the left of Seasonal Dialogue. And add each dialogue to the season you want it in.
  6. Click on SuppressGeneralDialogue. Set to True or False. (This largely depends on whether or not you want the character to say generic dialogue (true), or only your dialogue (false).)
  7. If you have dialogue that is about theft. Click on TheftDialoguePools. Click on the dropdown. Select the pool you want and click add. Keep doing this for every Dialogue Pools you want. These should all have the type of "Theft".


With that, hit Crtl+S to save the file. And then go to File → All Assets → Build and Validate Assets. If this succeeds, then HURRAY! you have a new tile in the game. If it fails, try and read the error to see what you have done wrong. If you are confused then go to the #Modding channel on Discord and ask there.


Adding the Villager Personality via Text Files

Follow Modding#Using a Text Editor to Create Mods in order to be properly set up for this step.

Create a text file and rename its extension to *.characterdesign. After creating this file, open it up in the text editor of your choice by right clicking the file and choosing open. You may want to force set the default program as well. Once this file is open copy the following template into the file.

{
  "code": "staxel.village.personality.Caithgirl",
  "dialoguePools": [ "staxel.dialoguePool.Caithgirl"],
  "primaryDialogue" : "staxel.dialoguePool.Caithgirl",
  "theftDialoguePools": [],
  "seasonalDialogue": {
    "Winter": "staxel.dialoguePool.CaithGirlWinter"
  },
  "suppressGeneralDialogue": false,
  "canGiveQuests": true,
  "canLeaveTown": true
}

Sadly there are no pictures for this, as there is nothing to show. However here are the explanations for this file above which contain things known as properties. These explanations are listed below.

  • "code": A unique String that would be used to identify this object from others. For example this is like "staxel.item.crafting.BakingPowder" or "staxel.tile.grass". You will most commonly want to use you use the path to the Accessory Model but replace / with ., as this will ensure your design will have a different code to all other designs.
  • "dialoguePools": A List of Strings that each contain the code to a Dialogue Pool. These dialogue pools should all have the type "Personality". These dialogues get randomly selected whenever talking commences.
  • "primaryDialogue": A Strings that contains the code to a Dialogue Pool. This dialogue pool should have the type "Personality". This makes this Dialogue the first dialgoue to show up. Before any random dialogue will show. Helpful if the NPC has important dialogue or a custom greeting.
  • "theftDialoguePools": A List of Strings that each contain the code to a Dialogue Pool. These dialogue pools should all have the type "Theft". These dialogues will show up randomly when a player has stolen from tills.
  • "suppressGeneralDialogue": A Bool. Keep False to let the NPC say other generic lines. Set to True in order to only have #P"primaryDialogue", #"dialoguePools", #"theftDialoguePools" and #"seasonalDialogue" from this personality to play.
  • "canGiveQuests": A Bool. Set to True in order to allow this NPC to get random Quests. Set to False to disallow that.
  • "canLeaveTown": A Bool. Set to True in order to allow this NPC to leave town when their home is destroyed. Set to False to disallow that. (Generally kept to true unless the NPC is truly important to the world. (Shop Keepers and the Mayor are False.)

The only thing left is Seasonal Dialogue. Which itself is a Blob. It's commonly created like;

"seasonalDialogue": {
  "Winter": "staxel.dialoguePool.CaithGirlWinter",
  "Summer": "staxel.dialoguePool.CaithGirlSummer",
  "Autumn": "staxel.dialoguePool.CaithGirlAutumn",
  "Spring": "staxel.dialoguePool.CaithGirlSpring"
},

Each property is a Dialogue Pool and each one does not need to be included.


After you have done editing the file, head to gamedata/bin/ folder, and start up Staxel.ContentBuilder.exe. When this has started up, click Validate Resources and wait until the progress bar has done. And with that you should have a working item. If you are confused then go to the #Modding channel on Discord and ask there.


Config Options

"code"

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

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


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


"canGiveQuests"

Valid options (Bool): True or False.

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


This determines whether or not this villager can give quests to the player.


"canLeaveTown"

Valid options (Bool): True or False.

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


This determines whether or not this villager can leave the town when their totem is incomplete or broken.


"canOverrideBehaviour"

Valid options (Bool): True or False.

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


This determines whether or not Festivals can override this personality. This is mainly used to combat the Festivals#"generalVillagerOverride".


"dialoguePools"

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

Default Value: If not specified, will not have any dialogue.


This is a list of strings that point towards the dialogue pools which will be used for general talking. These do not include dialogues for jobs or theft.


"idleScript"

Valid options (Strings): A string represented pointing to a Script that handles idling.

Default Value: "staxel.script.IdleNpcScript"


This determines what code should dictate how the npc's will do while idle. These scripts are snippets of c# code, but the one that is most often used is "staxel.script.IdleNpcScript".

To create your own script, you will have to follow Code Based Mod and implement a class which inherits IScript.


"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.


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


"seasonalDialogue"

This is a Blob which contains properties for specifying certain dialogues to appear in certain seasons. It will commonly look like;

"seasonalDialogue": {
  "Summer": "staxel.dialoguePool.CaithGirlSummer",
  "Autumn": "staxel.dialoguePool.CaithGirlAutumn",
  "Spring": "staxel.dialoguePool.CaithGirlSpring",
  "Winter": "staxel.dialoguePool.CaithGirlWinter"
},

"Summer" / "Autumn" / "Spring" / "Winter"

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

Default Value: If not specified, will not have a seasonal dialogue.


This specifies a dialogue that will appear in separate seasons.


"suppressGeneralDialogue"

Valid options (Bool): True or False.

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


This defines whether or not the "General" dialogue, or the dialogue that all villagers have, will not be played. (i.e When this property is true, it will not play normal dialogue.)


"theftDialoguePools"

Valid options (List of String): A list of strings which point to a Dialogue Pool code each

Default Value: If not specified, will not react to thefts in the village.


This is a list of strings that point towards the dialogue pools which will be used for general talking. These do not include dialogues for jobs or theft.

"typicalRegards"

Typical Regards is not yet implemented completely.