Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlinked Actor effect tracking for toggles. #223

Open
NuptupTDOW opened this issue Jul 1, 2022 · 1 comment
Open

Unlinked Actor effect tracking for toggles. #223

NuptupTDOW opened this issue Jul 1, 2022 · 1 comment

Comments

@NuptupTDOW
Copy link

Not sure if relevant here or in the Active Effects module, but figured I'd ask here.

Anyway, I was hoping to be able to use a power that simply calls this post-use macro to run to toggle on or off the Guard Drake's bonus damage when within 2 of an ally. Anyway, if the token isn't Linked to the Actor, which is mandatory for enemies where there are multiple copies of it, (unless you make copies of the enemy entries) then it doesn't work. As soon as I turn on link actor data it works flawlessly. Is it possible for an effect like this to be usable with unlinked actors, so the token refers to it's own specific stats, not the base actor?

const effect = actor.effects.filter(i => i.data.label === 'Within 2 of Ally')[0];
if(!effect) return ui.notifications.error('Error: Effect not found.');
await effect.update({'disabled': !effect.data.disabled});

For example, when unlinked, I can take my guard drake in the actor directory and drop it to the field, and token mold assigns it it's own unique name. When I double click that token, it opens a new, separate sheet that isn't the original guard drake sheet. Is it possible for my toggle to work using THAT sheet instead of having to duplicate the actor and have them all linked?

@EndlesNights
Copy link
Owner

Stop gap fix you can use, instead of calling actor call this.data.actor, while I get around to fixing this.

const effect = this.data.actor.effects.filter(i => i.data.label === 'Within 2 of Ally')[0];
if(!effect) return ui.notifications.error('Error: Effect not found.');
await effect.update({'disabled': !effect.data.disabled});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants