Ashby Blackburn
Ashby Blackburn
LOELeague of Extraordinary FoundryVTT Developers
Created by Ashby Blackburn on 3/14/2024 in #system-development
Absolutely new to all of this, need help with a silly query.
got you, many thanks for the help!
10 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by Ashby Blackburn on 3/14/2024 in #system-development
Absolutely new to all of this, need help with a silly query.
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?
10 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by Ashby Blackburn on 3/14/2024 in #system-development
Absolutely new to all of this, need help with a silly query.
Lets 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:

"health": {
"value": 10,
"min": 0,
"max": 100
},

"health": {
"value": 10,
"min": 0,
"max": 100
},
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.
_getCharacterRollData(data) {
if (this.type !== 'character') return;

// Copy the ability scores to the top level, so that rolls can use
// formulas like `@str.mod + 4`.
if (data.abilities) {
for (let [k, v] of Object.entries(data.abilities)) {
data[k] = foundry.utils.deepClone(v);
}
}
const forAbility = data.abilities.for.value;
const healthFormula = 72 + (forAbility * 8);
data.health = {
value: 0,
min: 0,
max: healthFormula
};
// Add level for easier access, or fall back to 0.
if (data.attributes.level) {
data.lvl = data.attributes.level.value ?? 0;
}
}
_getCharacterRollData(data) {
if (this.type !== 'character') return;

// Copy the ability scores to the top level, so that rolls can use
// formulas like `@str.mod + 4`.
if (data.abilities) {
for (let [k, v] of Object.entries(data.abilities)) {
data[k] = foundry.utils.deepClone(v);
}
}
const forAbility = data.abilities.for.value;
const healthFormula = 72 + (forAbility * 8);
data.health = {
value: 0,
min: 0,
max: healthFormula
};
// Add level for easier access, or fall back to 0.
if (data.attributes.level) {
data.lvl = data.attributes.level.value ?? 0;
}
}
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
10 replies
LOELeague of Extraordinary FoundryVTT Developers
Created by Ashby Blackburn on 3/14/2024 in #system-development
Absolutely new to all of this, need help with a silly query.
Ah, Hello! Disregarding the part of my table that includes Items, my Template file looks like this:
"Actor": {
"types": ["character", "npc"],
"templates": {
"base": {
"health": {
"value": 10,
"min": 0,
"max": "72+(@abilities.for.value * 8)"
},
"light": {
"value": 5,
"min": 0,
"max": 5
},
"stagger": {
"value": 5,
"min": 0,
"max": 5
},
"sanity": {
"value": 5,
"min": 0,
"max": 5
},
"biography": ""
}
},
"character": {
"templates": ["base"],
"attributes": {
"level": {
"value": 1
}
},
"abilities": {
"for": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/FortitudeIcon.webp"
},
"pru": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/PrudenceIcon.webp"
},
"jus": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/JusticeIcon.webp"
},
"cha": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/CharmIcon.webp"
},
"ins": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/InsightIcon.webp"
},
"tem": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/TemperanceIcon.webp"
}
}
},
"npc": {
"templates": ["base"]
}
},
"Actor": {
"types": ["character", "npc"],
"templates": {
"base": {
"health": {
"value": 10,
"min": 0,
"max": "72+(@abilities.for.value * 8)"
},
"light": {
"value": 5,
"min": 0,
"max": 5
},
"stagger": {
"value": 5,
"min": 0,
"max": 5
},
"sanity": {
"value": 5,
"min": 0,
"max": 5
},
"biography": ""
}
},
"character": {
"templates": ["base"],
"attributes": {
"level": {
"value": 1
}
},
"abilities": {
"for": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/FortitudeIcon.webp"
},
"pru": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/PrudenceIcon.webp"
},
"jus": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/JusticeIcon.webp"
},
"cha": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/CharmIcon.webp"
},
"ins": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/InsightIcon.webp"
},
"tem": {
"value": 0,
"imagePath": "systems/pmtrpg/assets/TemperanceIcon.webp"
}
}
},
"npc": {
"templates": ["base"]
}
},
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.
10 replies