Eclipxs
Eclipxs
Trouble with Synthetic Actors (unlinked tokens)
When I create a token from an actor and try to update something like its hp, I get the following error: "actors is not a valid embedded Document within the Token Document". If I link the token to the actor, everything works as expected. Though, being linked, it updates all tokens. This would be problematic If I want to create one "goblin" actor, and have several different goblins in a scene.
Is there something different you need to do to handle updates when the token is unlinked?
24 replies
calculating range/distance
I am trying to calculate the distance between two tokens to make sure they are in range of one another before applying an action. Though I am not sure the best way to go about this. I have tried the following which works, but it feels wrong. What is the best way to get an actors token?
// t comes from game.users.current.targets as I iterate through the current targets of the user

// needing to go from actor to the sheet to get the token seems weird!
const actorToken = actor.sheet.token;
const distance = canvas.grid.measureDistance({ x: actorToken.x, y: actorToken.y }, { x: t.x, y: t.y });
if (distance < 10) {
target = t.actor;
}
// t comes from game.users.current.targets as I iterate through the current targets of the user

// needing to go from actor to the sheet to get the token seems weird!
const actorToken = actor.sheet.token;
const distance = canvas.grid.measureDistance({ x: actorToken.x, y: actorToken.y }, { x: t.x, y: t.y });
if (distance < 10) {
target = t.actor;
}
4 replies
tiered status effects
If I have a status effect that can come from an ability, for example, burning comes from an ability with 'incendiary', but this 'incediary' can have varying degrees of strength. Do I need multiple status effects? like burning 1, burning 2... burning 5 to go with the levels of incendiary? Or just one burning for all incendiaries? same for things like stunned, where the increased level may affect how long the stun effect lasts.
4 replies
how to handle items and effects?
I've been working on a system for a game that needs a concept that seems like it might be a good fit for active effects. Though i'm not sure if effects are the right way to go. Some of these effects can temporarily raise or lower a stat, seems like a fit for effects. While some of these effects may deal damage, give your current attack an AoE, or grant you an ability to use this turn. Some of these things i'm not sure do fit into effects. Some of these effects may target the player, and others may target the player's target. The last thing that I'm struggling with is how to model these things. I don't want to have to create an active effect on every item that has one, as they are sometimes reused across several items. I was planning on using Items so I could have a sheet to manage them and pre-built effects ready to go in the compendium. Then I can easily drag on drop the effects onto the items/actor they should belong to. Though I got stuck trying to apply my new effect (item) to a a weapon (item), due to default drag and drop behaviour not existing for item->item. My questions are if these things sound like a good fit for active effects? Should I try and model effects as items to be able to reuse them easily? How do I handle drag and drop to add an item to an item?
7 replies
Advice on the general programming model a system should follow
I'm brand new to foundry dev and I want to make sure I am gaining the correct understanding of the environment before I get too far. would it be fair to make this comparison with Foundry systems and the MVVM pattern? Model (document) | View (html/hbs templates) | ViewModel (sheets) or should I think of it as something else? I've seen some docs referring to sheets as applications, in which case maybe the mvvm comparison is not totally valid but perhaps it still is. should I think of a sheet more like a little "spa/client app" and the document likes its backend? I'm curious about the general programming model a system should be following. When do you put something in a document vs a sheet, etc?
4 replies
Advice for compendium data in a custom system
Hello, i'm new here! I was wondering if I could get a little direction for storing data about my games items/actors. I looked at how it is done in pf2e and dnd5e. They both seem to have gone different directions. DnD5e uses .db files for their packs data https://github.com/foundryvtt/dnd5e/tree/master/packs while PF2E uses .json files https://github.com/foundryvtt/pf2e/tree/master/packs Should I be using .db files or .json files for my packs? and how should I prepare these files so Foundry can see the data in the packs? One thing I tried to do was to: - create an empty world - set up a compendium pack by hand using my systems sheets - used the foundry cli tool to 'unpack' my worlds pack data - moved those json files into my systems /packs folder.
- updated my manifest so it would point to the correct /packs, and restarted my other test world to see if it could use the packs provided by my system. The pack folders are there, but non of the items are inside. In the future, I would like to be able to curate the data into a .db file / .json files in an automated way to avoid a bunch of manual data entry through my sheets.
11 replies