Creating a new Actor for your custom Foundry VTT system can get really complicated. Let's start from a simple building block and create our own custom Actor Data Template.
Creating An Actor Data Template For Foundry VTT
Open up your favorite JavaScript editor and create a blank template.json file.
We are going to make a very basic Actor template, then we are going to make sure that Foundry VTT creates the Actor as we expected.
This article builds upon information contained in the previous article: Creating A New System For Foundry VTT: The Data Template
Making It FutureSpace
Let's start out with something easy.
In our example, we are going to create a new Actor to hold information about a player.
The Actor subtype will be "PC" and it will only hold one attribute: health. Health will be a "resource" key so that we can link a token's status bar in the future.
For our FutureSpace example, let's do the following:
{userData}/Data/systems/futurespace/template.json
Test It!
Let's make sure everything we have done so far works properly.
Next, let's check that we can create a new player.
Go to the Actors Directory tab and Create Actor. You should have a blank new character sheet that only shows the default image and the character's name.
These two fields are built into the standard default Character Sheet.
If you can't make a new character, go back and check your templates.json file for typos.
Troubleshooting
Why don't we see the health?
The default character sheet doesn't have a handler for the custom field named "health". We will add that in a future article on making custom character sheets.
Why didn't we get a choice of what kind of actor to make?
When there is only one Actor Type listed, you don't get a drop-down menu. You only get a drop-down if there is more than one Actor Type defined.
How can I verify an Actor has been created?
You know you've created an Actor because you now have an Actor card in your Actor Directory.
How can I double-check an Actor data structure was created without a character sheet set up?
You can also create and directly view an Actor object by running a piece of code in the console.
Just press F12 to open the Developer Tools in Foundry VTT. This will give you access to various developer tools, including the CSS inspector - but for now, we want the Console tab.
Once on the Console screen, enter the following code:
Actor.create({name: "Test Actor", type: "PC"}).then(actor => {console.log(actor.data);})
You should get something like the following:
We can see our actor has been created, a name and portrait applied, plus we can see the data we added for the health attribute.
Success!
What Next?
Next, we will look at the Item Template.
Check out: Part 5- Creating A New System For Foundry VTT: The Item Data Template.
Your Turn: What Do You Do?
Try to duplicate my work, then expand upon it.
Create another Actor Type and make sure it gets listed on the Create Actor window.
Open the Console and create an Actor object by hand, inspect its properties to be sure it was made correctly.
Tell me about it in the Comments Section. I'm interested in what you have to say about creating your own Foundry VTT Data Template.
E-mail Notification Opt-in
Do you want to receive email notifications when we add new game design content?
Sign up on our private mailing list.
YES! Notify me of new game design posts!