Advertisement
Guest User

Untitled

a guest
Aug 16th, 2024
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. (async () => {
  2. // Get the currently selected token
  3. const selectedToken = canvas.tokens.controlled[0];
  4.  
  5. if (!selectedToken) {
  6. ui.notifications.error("No token is currently selected.");
  7. return;
  8. }
  9.  
  10. // Get the actor associated with the token
  11. const actor = selectedToken.actor;
  12.  
  13. if (!actor) {
  14. ui.notifications.error("No actor found for the selected token.");
  15. return;
  16. }
  17.  
  18. // Access the effects from the actor's active effects
  19. const effects = actor.effects.contents;
  20.  
  21. if (effects.length === 0) {
  22. ui.notifications.info("No effects to remove.");
  23. return;
  24. }
  25.  
  26. // Log the effects for debugging
  27. console.log(`Found ${effects.length} effects to remove.`);
  28. effects.forEach(effect => console.log(`Effect ID: ${effect.id}, Name: ${effect.name}`));
  29.  
  30. // Remove all effects
  31. for (let effect of effects) {
  32. await effect.delete();
  33. }
  34.  
  35. // Notify the user
  36. ui.notifications.info("All effects have been removed from the token.");
  37. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement