Absolutely new to all of this, need help with a silly query.
Hello! I'm extremely new to all of this, and i'm having issues trying to understand how to code a way for the system to calculate the health of my character sheets.
I've created in template.json an Actor and modified the "base" template to include the attribute "Health" which is composed of:
"health": {
"value": 10,
"min": 0,
"max": "@attributes.maxHealth"
},
and that leads down to
"character": {
"templates": ["base"],
"attributes": {
"level": {
"value": 1
},
"maxHealth":{
"formula":"72 + (@abilities.for.value * 8)",
"min": 0
}
},
The thing is, i have an ability called "for", short for Fortitude. And when i create an Actor in my test environment, it spits out the literal "72 + (abilities.for.value * 8" as a Text. How would i go on to actually make it do the math?
Thank you beforehand for taking the time to read this!
6 Replies
I might be wrong, but I think template is now deprecated in favor of Data Models, which is preferred.
Not saying using templates is wrong, but its old way of doing it.
Anyway, I do not see your entire template here, so not 100% sure on cause, but assuming fortitude is defined leave one question: have you added fortutide to Roll Data? 🤔
Ah, Hello! Disregarding the part of my table that includes Items, my Template file looks like this:
As to whether it's in the "Roll Data" or not, i'm not too sure? I mean, i've been able to use it to have the system give me the ability modifier and roll a check based off of it.
And as to the part where you say that Data Modles is preferred while template is deprecated, i'd love to update to Data Models! I just don't know where to- start? I followed the Foundry Wiki and it lead me down to Boilerplate, and when i downloaded Boilerplate and checked the wikis and such the very first thing i came across was this file formatting itself.
you need to modify the
Actor#getRollData()
to properly handle Roll Data. Other things you have probably work because they were in the boilerplate already
Also I do not know what system you are making, but abilities
is something that is more like dnd keyword, you should probably use term specific for your system (attribute, characteristic, stat etc.) to not confuse GMs and playersLets see if i'm, getting this right. I changed the max in the templates base value back to "100" since it doesn't really matter, or well, it shouldn't given the fact that getRollData will replace it.
So in template.json file, health looks like this:
Ahh, i see. That's in the actor.mjs file. It's still very much in it's template values form.
Changing it up a bit, i think i'm on the right track? Though the change i made to the code in there doesn't seem to be affecting anything.
The part that i added is all that there is on the character roll data starting on
const forAbility = data.abilities.for.value;
all the way to the max: healthFormula parameter
Though i wouldn't worry too much about responding to my query here, as i'm looking into the whole DataModels thing that you mentioned.
Is there any resource or wiki that i could utilize to learn it?I do not know too much about WIki. There is some information about it on Foundry's Knowledge Base. Otherwise you could take a look at DND 5e 3.0.0+, or at
effect refactor
branch of WFRP4e, as both systems switched/are switching to Data Models (other systems probably as well, but I'm not as familiar)
I do not know about the method you showed, all I know is that Actor#getRollData()
method should return an object of key-value
pairs that will be used by rolls, where @something.is.here
would be a something.is.here
key/path in that object.got you, many thanks for the help!