Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (async () => {
- // Get the currently selected token
- const selectedToken = canvas.tokens.controlled[0];
- if (!selectedToken) {
- ui.notifications.error("No token is currently selected.");
- return;
- }
- // Get the actor associated with the token
- const actor = selectedToken.actor;
- if (!actor) {
- ui.notifications.error("No actor found for the selected token.");
- return;
- }
- // Access the effects from the actor's active effects
- const effects = actor.effects.contents;
- if (effects.length === 0) {
- ui.notifications.info("No effects to remove.");
- return;
- }
- // Log the effects for debugging
- console.log(`Found ${effects.length} effects to remove.`);
- effects.forEach(effect => console.log(`Effect ID: ${effect.id}, Name: ${effect.name}`));
- // Remove all effects
- for (let effect of effects) {
- await effect.delete();
- }
- // Notify the user
- ui.notifications.info("All effects have been removed from the token.");
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement