FANDOM


Let's add a recruitable character to the game: the scientific assistant! This type of character will be recruitable at the harbor and give the players some extra sanity when collecing butterflies (stackable with Darwin's perk ). This aspect should allow players to develop interesting strategies around planning their way with butterfly positions in mind. As with our other examples, let's create this character step by step:

ScientificAss title

Basic SetupEdit

First, you should set up your new mod as described on the Getting Started page (everything up to the Adding a language file section).

Next, write the basic definition of the Scientific Assistant into the mod.hjson. You can check out the existing character definitions to get an idea what is required or can be done in general. Feel free to use them as a basis for your characters when starting out. Your first step could look like this:

modEntries: [
  { 
    id: pl-scientificAssistant 
    title: txt-pl-scientificAssistant-title
    health: 4
    capacity: 2
    flags: +porter +humanoid +scientificAssistant
    debugCategory: Modding
  }
]

Flags are going to be used for general checks from many game systems, and adding the debugCategory is helpful to test spawn the character later on with the debugBar.

Adding localized textsEdit

The title entry still needs to have a proper text hooked up to it. Go to the lang_en.csv file in your modding langs folder and enter it. This is how your lang_en.csv file should look like for now:

"pl-scientificAssistant-title","Scientific Assistant"

If you want to know more about the language file go here.

Create face and sprite imagesEdit

It's time for graphics! Let's start with the face / portrait of the character. I recommend you start by taking a look at all the existing character faces as well as the provided template images.  In general, the image file should be sized somewhat around 33x32 pixels. You can also just copy the template_face_artwork.png and start with that. 

ScientificAss 12

Let's pick the lower left white male as a generic starting point (we'll add more diverse variations in a few steps). Next, let's pick one of the outfits provided in the template_face_outfits_artwork.png . 

ScientificAss 01
In this case I chose a simple adventurer shirt combined with a hat from the Mountain Trooper
ScientificAss 03

[Take a template face and put it in a layer behind the outfit. Your image should now look somewhat like this.

ScientificAss 04
Let's colorize the hat to fit to the rest of the outfit and remove the glasses. Put some on the face instead.
ScientificAss 05
I decided to give it some more character by adding a moustache and slight manipulation of some of the facial features. Also I changed the outfit a bit to give it a more distinctive look.
ScientificAss 06
A final touch to the sleeves and finished is our first variation of the scientific assistant. 
ScientificAss 20
An optional step you can do (but recommended) is to add a small face variation for your portrait. This small image will be used when hovering over the dice of your character during combat or during feedback messages. Just remove everything but the face of your character and save the file seperately (file should be sized to match the outer bounds of the face only) with the same name used for the portrait with an added _small at the end. In this example, the file will be called face_scientificAssistant_1_small.png.


Great, now that we have the face done let's move on to the character sprite that will be used in the location scenes. Again, I recommend to start by taking a look at the exisiting character sprites as well as the provided template images for sprites

Compared to the faces you are much more flexible in terms of how large your character sprite can be (unlike the faces they don't need to fit into the frame on the right hand side of the screen during gameplay), but I recommend for this example to stick with one of the templates provided by template_porter_artwork.png .

ScientificAss 13
ScientificAss 09

I chose one of the slender and simple templates. Notice that it already has a shadow added with 25% transparent black pixels around the feet. While the image can be as wide and high as you want, it is strongly recommended that the spirte is placed in the image file you are using in a way that the lowest shadow pixel as directly at the bottom of the image. This way the sprite will be placed optimally on the image slots provided by the event background image.

ScientificAss 10
Let's replace the template skintones with the skintones you have been using for your face image. From here on, use your creativivty to add the clothing on top of the spirte thats is indicated in the face image.

In the end you should have two images, one for the sprite and one for the face, which could look somehwat like these:

ScientificAss 11

Hook up graphicsEdit

Now let's add these images into your mod. First, make sure to save them as .png into your mod folder. For this example, I suggest the filenames face_scientificAssistant_1.png and sprite_scientificAssistant_1.png. Now let's add them to your mod.hjson inside the imageData section:

imageData:[
  {
    id: sprite_1
    file: scientificAssistant/sprite_scientificAssistant_1.png
  }
  {
    id: face_1
    file: scientificAssistant/face_scientificAssistant_1.png
  }
],

The optional _small face:

{
  id: face_scientificAssistant_1_small.png
  file: scientificAssistant/face_scientificAssistant_1_small.png
}


This only references the images, we still need to hook them up to your character in it's definition by adding a variations section. Let's do it like this:

{ 
  id: pl-scientificAssistant 
  title: txt-pl-scientificAssistant-title
  health: 4
  capacity: 2
  flags: +porter +humanoid +scientificAssistant
  debugCategory: Modding
  variations: [
    {
      gender: male
      sprite: sprite_1
      portrait: face_1
      name: westernCharacterMale
    }
  ]
}

As you can see we added the id's for sprite and portrait as defined in the imageData section. For simplicity I suggest to use one of the existing name pools, in thise case the westernCharacterMale. Feel free to create your own name pools and add them with the mod if you feel like adding a more custom feeling to your character. 

Testing and adding a minispriteEdit

It's time to test your character in the game. Start the game and make sure to activate your mod in the Mod Menu. Jump into a test game and use the debugBar to spawn your Scientific Assistant. It should be located under the Characters section (2nd column from left) inside the Modding category. Congratulations, you have added your first character to the game! However, it's not yet finished. In fact, there is a very obvious thing missing if you remove all characters but the Scientific Assisant and your main explorer: there is no minisprite yet that shows the character as part of your tiny trek on the map:

ScientificAss 14

Worry not, adding a minisprite is the last graphical task you have to do to finish this first aspect of your character. Again, take a look at the existing character minisprites as well as the provided template images for minisprites. Since your minisprite will be animated the image has to follow a clear size guideline. Use the template_minisprite.png to understand the orientations and animation stages of the file.  In the end, your finished image should look like this: 

ScientificAss 15

With the minisprite image created, we can now enter it into the imageData section:

{
  id: miniSprite_1
  file: scientificAssistant/minisprite_scientificAssistant_1.png
}

Finally, add it into the variation definition of your character:

{ 
  id: pl-scientificAssistant 
  title: txt-pl-scientificAssistant-title
  health: 4
  capacity: 2
  flags: +porter +humanoid +scientificAssistant
  debugCategory: Modding
  variations: [
    {
      gender: male
      sprite: sprite_1
      portrait: face_1
      miniSprite: miniSprite_1
      name: westernCharacterMale
    }
  ]
}

Now you can again test your character in game and it should have all the necessary basic elements for a character. Yay!

SpawnEventsEdit

Let's add some spawnEvents to the character. While these are purely optional, they will increase the character's personality by adding a random starting status and personality:

spawnEvents: {
  partyEvents: [
    {
      select: [ 
        {
          slots:2
          setStatus: +alcoholic
        }
        {
          slots:1
          setStatus: +kleptomania
        }
        {
          slots:10
        }
      ],
    }, 
    {
      select: [ 
        {
          slots:1
          setCharFlags: +witty
        }
        {
           slots:1
           setCharFlags: +brave
        }
        {
           slots:1
           setCharFlags: +coward
        }
      ]
    }
  ]     
}

The first select section has a chance to add two negative satus effects, alcoholic  and kleptomania. However, based on the slots count for the 3rd, empty entry, it is very likely that the character is spawned without any ailments. 

The second select section will randomly pick one of three personality traits. These personalities are used to influence which chat lines are picked when the character says something with a speech bubble during an location event. 

Create a custom perkEdit

Now that we have all the basics of a character, let's add some unique gameplay element for it by creating our very own perk. As described at the very start of this page, we'll add a perk that will give some extra sanity when collecing butterflies. Let's use Darwin's perk as a basis for this. You can find the script used in the perks.hjson at the id st-butterflyEnthusiast. With some small modifications it will look like this:

{ 
  id: st-scientificAssistant-1
  title: "txt-st-researchAssistance-1-title"
  description: "txt-st-researchAssistance-description"
  sprite: res_status_butterfly.png
  debugCategory:Unit Perk
  bonus: {
    taxonomySanity: 10
  }
},

Basically it's very similar to the st-butterflyEnthusiast. We give it an unique id, use the same sprite for the icon (we're lazy), hook up our own title and description and tune the taxonomySanity bonus a little bit. Remeber that you will have to extend the lang_en.csv file in your modding langs folder to include the new texts:

"pl-scientificAssistant-title","Scientific Assistant"
"st-researchAssistance-1-title","Research Assistance 1"
"st-researchAssistance-description","Increased sanity gain when discovering a new butterfly specimen."

Unlike perks for explorers character perks usually have 4 versions, one for each rank of the character. Let's copy the existing perk defintion 3 more times and adjust the title and taxonomySanity bonus of each. The rest can be identical to the original st-scientificAssistant-1, so we can use the extends function to keep our workload low and script a bit easier to read.

{ 
  id: st-scientificAssistant-1
  title: "txt-st-researchAssistance-1-title"
  description: "txt-st-researchAssistance-description"
  sprite: res_status_butterfly.png
  debugCategory:Unit Perk
  bonus: {
    taxonomySanity: 10
  }
}
{ 
  id: st-scientificAssistant-2
  extends: st-scientificAssistant-1
  title: "txt-st-researchAssistance-2-title"
  bonus: {
    taxonomySanity: 20
  }
}
{ 
  id: st-scientificAssistant-3
  extends: st-scientificAssistant-1
  title: "txt-st-researchAssistance-3-title"
  bonus: {
    taxonomySanity: 30
  }
}
{ 
  id: st-scientificAssistant-4
  extends: st-scientificAssistant-1
  title: "txt-st-researchAssistance-4-title"
  bonus: {
    taxonomySanity: 40
  }
},

Add the new perk titles to your lang_en.csv file:

"pl-scientificAssistant-title","Scientific Assistant"
"st-researchAssistance-1-title","Research Assistance 1"
"st-researchAssistance-2-title","Research Assistance 2"
"st-researchAssistance-3-title","Research Assistance 3"
"st-researchAssistance-4-title","Research Assistance 4"
"st-researchAssistance-description","Increased sanity gain when discovering a new butterfly specimen."

Now that we have all 4 versions of the perk, let's add it to the defintion of the character by adding a levels section:

{ 
  id: pl-scientificAssistant 
  title: txt-pl-scientificAssistant-title
  health: 4
  capacity: 2
  flags: +porter +humanoid +scientificAssistant
  debugCategory: Modding
  variations: [
    {
      gender: male
      sprite: sprite_1
      portrait: face_1
      miniSprite: miniSprite_1
      name: westernCharacterMale
    }
  ]

  spawnEvents: { ... Cutting this short in sake of readability ... }

  levels: [ 
    { 
      statuses: st-scientificAssistant-1
      dice: dc-support-1
    }
    { 
      statuses: st-scientificAssistant-2
      dice: dc-support-1 dc-support-1

    }
    { 
      statuses: st-scientificAssistant-3
      dice: dc-support-2 dc-support-1

    }
    {
      statuses: st-scientificAssistant-4
      dice: dc-support-2 dc-support-2

    }
  ]
}

As you can see we have added 4 sections to the levels, one for each rank, starting with the basic on top and ending with the maxium rank for the character (3 stars). I have also added a dice defintion to each rank which will add support dice that are defined in the challenge.conf.js . Of course you could add your own dice as well to make this character even more special.

ScientificAss 16
You can again now test your character in game and rank it up easily by giving you XP through the debugBar to test your new perk. Make sure to test the functionality of the perk by seeking out a butterfly zone on the map.

Add character to harbor recruitEdit

Almost finished! You'll want your character to appear in a normal game without using the debugBar spawning. The easiest way to do this is to hook it up to the hubEvent harborRecruit.hjson , so it is offered as a recruitable character at the Harbor before the beginning of an expedition. If you want to know more about how to make your mods appear seamlessly in the game, go see the hubEvents documentation. First, add this section at the bottom of your modEntries section:

{
  targetId: +evt-harbor-recruit-select::select
  slots:1
  ref: evt-harbor-recruit-scientificAssistant
}

This will add your own entry into the list of possible recruitable characters that are offered at the Habor in the harborRecruit.hjson evt-harbor-recruit-select event. If you want to make your character more likely to appear at the harbor just increase the amount of slots.

Next, you'll need to create the actual event in which your character is added to the player trek if they chose to select it from the offered recruits:

{
  id: evt-harbor-recruit-scientificAssistant
  npc: pl-scientificAssistant
  npcEvents: {
    actions: {
      alwaysShown: true
      actionText: txt-evt-harbor-recruit-scientificAssistant-action
      setPartyFlags: +recruitedSomebody
      addNPC: true
      chat: cl-join
      text: txt-evt-harbor-recruit-scientificAssistant
      select: evt-harbor-recruit
    }
  }
  charEvents: { 
    count: all
    reqCharFlags: -scientificAssistant
  }
}

This event will place a generated scientific assistant on one of the available NPC slots at the harbor and add an action for recruiting it into the trek. We'll need to add two final entries to our lang_en.csv to make it complete:

"pl-scientificAssistant-title","Scientific Assistant"
"st-researchAssistance-1-title","Research Assistance 1"
"st-researchAssistance-2-title","Research Assistance 2"
"st-researchAssistance-3-title","Research Assistance 3"
"st-researchAssistance-4-title","Research Assistance 4"
"st-researchAssistance-description","Increased sanity gain when discovering a new butterfly specimen."
"evt-harbor-recruit-scientificAssistant-action","$name the assistant"
"evt-harbor-recruit-scientificAssistant","[There was never such a thing as too much science|I was sure an assistant would help a lot|I always wanted my own assistant], so I welcomed $name to our team."

You can now, for testing, increase the slots of the earlier added section to 1000 and run a test game. Run a TestGame with Skip Start Events disabled on the debugBar. Once you reach the harbor, you should be offered to recruit the scientific assistant:

ScientificAss 17

Variations and final touchesEdit

Congratulations, you have now created a unique and gameplay modifying character that can be recruited in the game. I strongly recommend to make the extra effort and now add variations to this character to include different appearances, names and genders. This way, your character will be much more interesting to players. For the Scientific Assistant, I have created all in all 4 variants, which look like this:

ScientificAss 18

Last but not least: you can add a custom preview image for your mod, which will be shown in the modding menu. Optimal size is 268x268 pixels. You will have to add it in the imageData section like any other image reference:

{
  id: mod_preview
  file: scientificAssistant/mod_preview.png
}

and then add it into your modInfo section as well:

modInfo:
{
  id: scientificAssistant
  name: Scientific Assistant
  authors: yourName
  version: "1.0"
  defaultLang: en
  preview: mod_preview
}

As a final touch to your mod, make sure to provide additional information in your modInfo like a direct link to the Steam Workshop page of your mod (this will allow for your rating to show up directly on the mod page, and make updating your mod easier for you), your twitter or contact link (in case players want to get in contact with you) and a brief description of your mod. 

modInfo:
{
  id: scientificAssistant
  name: Scientific Assistant
  authors: yourName
  version: "1.0"
  defaultLang: en
  preview: mod_preview
  twitter: yourTwitterPage
  mail: mailto:yourEmail
  steam: linkToTheSteamWorkshopPage
  description: Adds a character that can be recruited at the harbor. It will give you some extra sanity when collecing butterflies (stackable with Darwin's perk). This should allow you to develop interesting strategies around planning your route with butterfly positions in mind. 
}


ScientificAss 19
Community content is available under CC-BY-SA unless otherwise noted.