Repository navigation
Custom Content: Homebrew Characters
Caution
This page describes making edits to the datapack. Future updates to the project may overwrite changes you make!
As of right now, this project does not natively support homebrew characters (though it is a planned feature). However, it's not too difficult to manually add them; it just takes a bit of finessing. This page will walk you through that process as we add the Centurion from Fall of Rome to the pack.
Tip
MAAT's Buddy has made an excellent tool to automate this whole process. Most users will find it easier to use that instead!
While it is expected that modpack updates will make changes that may break any custom content you create, creating a separate datapack and overlaying it on top of the existing one can reduce the likelihood of that occurring. As such, we are going to create a datapack and operate within the ct namespace, which allows us to replace existing functions with our own without making any edits to the base pack.
Within our datapack, we're going to create an mcfunction file in ct/function/data. Because we will only be running this function ourselves, we do not want to give this file the same name as an existing function, so we'll go with fall_of_rome_data.mcfunction. We'll use this function to insert our character's basic information. Paste the following into your file:
data modify storage ct:character_data characters append value {"physician_fall_of_rome": { "ability": "Each night, choose two players (not yourself): they are sober, healthy & get true info tonight. The 1st time the Demon kills one, you learn the Demon type.", "first": "The Physician points to two players not themselves. Mark both players with the PATIENT token.", "flavor": "Some patients recover, because they believe in doctors.", "name": "Physician", "other": "Remove all PATIENT tokens. The Physician points to two players not themselves. Mark both players with the PATIENT token. If a player with a PATIENT token was killed by the Demon, place the 1ST DEMON token next to the Physician and wake the Physician and show them Demon token.", "reminders": [{"text":"patient_safe","icon":"patient"},{"text":"patient_once","icon":"patient"}]}}
This is a little hard to parse. Let's look at it blown up, with some //comments to indicate what each line does:
{
"physician_fall_of_rome": { // Your character's ID. This needs to be unique.
"ability": "Each night, choose two players (not yourself): they are sober, healthy & get true info tonight. The 1st time the Demon kills one, you learn the Demon type.", // The ability of your character as displayed on the script.
"first": "The Physician points to two players not themselves. Mark both players with the PATIENT token.", // First night reminder for the Storyteller. If your character doesn't act on night 1, exclude this.
"flavor": "Some patients recover, because they believe in doctors.", // Flavor text; currently not shown anywhere.
"name": "Physician", // Your character's name as displayed on the script.
"other": "Remove all PATIENT tokens. The Physician points to two players not themselves. Mark both players with the PATIENT token. If a player with a PATIENT token was killed by the Demon, place the 1ST DEMON token next to the Physician and wake the Physician and show them Demon token.", // Other nights reminder for the Storyteller. If your character doesn't act on night 2 forward, exclude this.
"reminders": [ // A list of reminder tokens associated with your character. We'll assign readable text to them later.
{
"text": "patient_safe", // A unique ID for this reminder token.
"icon": "physician_fall_of_rome" // Your character's ID, which must be the same as above.
},
{
"text": "patient_once", // A unique ID for this reminder token.
"icon": "physician_fall_of_rome" // Your character's ID, which must be the same as above.
}
]
}
}Now pop into your world, do a /reload in chat, and use /function ct:data/fall_of_rome_data to actually insert your character. The map now knows that our character exists!
There are several places in the datapack that refer to our character and make it actually appear and function in the game. You will need to copy the below functions from the default datapack into our own, making sure to preserve their names and paths, and making the listed changes.
-
admin/setup/set_from_menu.mcfunction: Start a new line after line 70. Paste the following:
execute if score physician_fall_of_rome role_list matches 1 run data modify storage ct:roles roles insert 0 value {id:68,name:physician_fall_of_rome} -
script/set_imported.mcfunction: Start a new line after line 84. Paste the following:
execute if data storage ct:script script_imported{script:[physician_fall_of_rome]} run function ct:script/set_char_data {char:physician_fall_of_rome,type:townsfolk} -
start_game/roles/announce.mcfunction: Start a new line after line 96. Paste the following:
execute as @s[scores={role=68}] run title @s title [{"translate":"clocktower.prefix.the","color":"#1464e7"},{"translate":"clocktower.role.physician_fall_of_rome.name",color:"#1464e7"}] -
start_game/roles/set_grim_roles.mcfunction: Start a new line after line 68. Paste the following:
$execute if entity @s[scores={role=68}] as @a[tag=storyteller] run fmvariable set p$(id)_role false physician_fall_of_rome -
util/reset_in_roles.mcfunction: Add a new line anywhere and paste the following:
scoreboard players set physician_fall_of_rome role_list 0
Any new character must be specified in all five of these files. Each character much have a unique ID (ours is 68) within the range of its character type. Townsfolk IDs are 1-199, Outsider IDs are 200-299, Minion IDs are 300-399, and Demon IDs are 400-499. Travellers are 500-599, but aren't supported right now anyway.
Do /reload in-game. If you've done all of this correctly, loading a script with the Physician on it will now cause the Physician to display on the script, and import our reminder tokens! You can test this by importing the following script, which should have the Physician as its only Townsfolk: [{"id":"_meta","name":"Panem Et Circenses","author":"You!"},"physician_fall_of_rome","politician","fearmonger","lordoftyphon"]
You can download a datapack correctly set up with our changes here:
You'll notice that your character's name, description, and icon aren't displaying correctly. That's because those things are handled by the resource pack, which we'll be creating now. The deal here is the same as with the datapack; we'll be creating our own to overlay instead of modifying the base one. You can download the sample pack here: