else if (actorType === 'npc') {
// @ts-expect-error bad definition
creatureType = token.actor.data.items.find((i) => i.type === 'class').name;
}
I've got an animated token that's just a floating light source that one of my players controls. I'm pretty sure that's the one that's breaking this, but it literally has no Items attached to the character. Assuming the rest of your code can handle a creature without a class, you can just adding a ? in there for optional chaining (e === 'class')?.name;)
Edit: I guess I didn't specifically say it, I'm getting an error whenever the scene loads
at Object.creatureType (systems.js:91)
at helpers.js:281
at Generator.next (<anonymous>)
at helpers.js:7
at new Promise (<anonymous>)
at __awaiter (helpers.js:3)
at lookupTokenBloodColor (helpers.js:272)
at SplatToken.<anonymous> (SplatToken.js:58)
at Generator.next (<anonymous>)
at SplatToken.js:7
Ok I just tried it out locally... Plus nullish coalescing to a string makes it work (so (e === 'class')?.name ?? '';)
Specifically this bit
I've got an animated token that's just a floating light source that one of my players controls. I'm pretty sure that's the one that's breaking this, but it literally has no Items attached to the character. Assuming the rest of your code can handle a creature without a class, you can just adding a
?
in there for optional chaining (e === 'class')?.name;
)Edit: I guess I didn't specifically say it, I'm getting an error whenever the scene loads
Ok I just tried it out locally... Plus nullish coalescing to a string makes it work (so
(e === 'class')?.name ?? '';
)