Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This will reset a token to it's defaults & remove all conditions
- let macroA = game.macros.getName("Remove Conditions");
- for ( let token of canvas.tokens.controlled ){
- console.log("############# Starting to process a token.");
- let showingName = token.actor.data.name;
- remove();
- console.log("############# Conditions should now be removed.");
- // This sets the token's maxHP to the value stored in FVTT for that token
- let maxHP = token.actor.data.data.attributes.hp.max;
- token.actor.update({"data.attributes.hp.value": maxHP});
- console.log("############# Creating chat message.");
- let messageContent = `${showingName} has been reset to ${maxHP} hit points. And all conditions have been removed.`;
- ChatMessage.create({user : game.user._id, content : messageContent, whisper : ChatMessage.getWhisperRecipients("GM") // Whispering this is important so you don't show everyone maxHP!
- });
- console.log("############# Reached the end of processing a token.");
- }
- // This async function removes all existing conditions & overlays
- async function remove() {
- await macroA.execute();
- }
Advertisement
Add Comment
Please, Sign In to add comment