bluegreymouse
bluegreymouse
Accessing data in active effects via @ symbol
I noticed other systems are able to expose certain bits of data and access it in active effects eg: attribute: system.armor.ac mode: add value: @str.value However I can't seem to get the same functionality in my system. I have an actor data model module>data>actor.mjs file that just exports an actor class that extends foundry.abstract.TypeDataModel I have an actor document module>documets>actor.mjs that extends the actor data model in module>documents>actor.mjs I expose the abilities to the top level via getRollData()
getRollData() {
// Starts off by populating the roll data with a shallow copy of `this.system`
const data = { ...this.system }

// 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)
}
}

return data
}
getRollData() {
// Starts off by populating the roll data with a shallow copy of `this.system`
const data = { ...this.system }

// 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)
}
}

return data
}
However when I try and use this in an effect the value of the attribute I'm changing returns NaN I know my attribute is correct because if I change the @str.value to simply 1 I get the expected output
4 replies
effect in "add" mode continually re-applied to actor/sheet
I have a datamodel value of type new fields.ArrayField(new fields.BooleanField(), { initial: [false], }) And I have an effect in "add" mode that adds another false to the array. Which seems to work. however, when i close and re-open the character sheet I see that the array is now 3 [false, false, false]. Other datamodal attributes eg: number don't behave this way. Am I interpretting the ArrayField incorrectly?
5 replies
SchemaField with increasable max?
I'm trying to understand the new schema fields and have a situation where I sometimes want to increase the "max" value of a field. Is that possible? I have this
schema.carryLoad = new fields.SchemaField({
value: new fields.NumberField({
...requiredInteger,
initial: 0,
}),
min: new fields.NumberField({
...requiredInteger,
initial: 0
}),
max: new fields.NumberField({
...requiredInteger,
initial: 0,
})
});
schema.carryLoad = new fields.SchemaField({
value: new fields.NumberField({
...requiredInteger,
initial: 0,
}),
min: new fields.NumberField({
...requiredInteger,
initial: 0
}),
max: new fields.NumberField({
...requiredInteger,
initial: 0,
})
});
but it seems I cannot increase the max value via carryLoad.max += 10 for example
3 replies
update item attribute on actorsheet
I have an item type rangedweapon that has a property of consumes
"rangedweapon": {
....
"consumes": {
"type": "ammo",
"target": { "value": "" },
"amount": { "value": 1 }
},
...
"rangedweapon": {
....
"consumes": {
"type": "ammo",
"target": { "value": "" },
"amount": { "value": 1 }
},
...
And I want to allow the user to set the target value to another item id. So on the character sheet I have something like
{{#each rangedweapons as |item|}}
<select name="item.system.consumes.target.value">
{{selectOptions ../ammos selected=item.system.consumes.target.value nameAttr="_id" labelAttr="name" blank="none"}}
</select>
{{/each}}
{{#each rangedweapons as |item|}}
<select name="item.system.consumes.target.value">
{{selectOptions ../ammos selected=item.system.consumes.target.value nameAttr="_id" labelAttr="name" blank="none"}}
</select>
{{/each}}
And this renders the option's correctly with name and id as the value. And I can select it. but when I close and re-open the the character sheet. the item.system.consumes.target.value is still "" any idea what i'm missing or how i might debug this more?
4 replies
hook preCreateToken update token name
I'm trying to update the token name when dropping a token on a scene. I basically have something like this
Hooks.on("preCreateToken", async function (tokenDocument) {
tokenDocument.actor.update({name: "some dude"});
});
Hooks.on("preCreateToken", async function (tokenDocument) {
tokenDocument.actor.update({name: "some dude"});
});
I'm trying to follow the operation described here https://foundryvtt.com/article/v11-actor-delta/ but getting an error related to id and embeddedCollection how should I update a token in the preCreateToken hook
18 replies
empty pack
No description
3 replies
Error on package install
No description
15 replies