#M&M Macros #1:Set Hero Points
1 messages · Page 1 of 1 (latest)
//Set Hero Points by Gazkhan - Jules with minor tinkering by DeviousHearts
//Required: Sequencer Module.
//Ensure you have all the file paths updated in order for this to run properly for the files the macro calls for.
//This sets up a dialog box to enter a number into and either hit "Okay" to set the Hero Points or Cancel to not set them.
const dialog = new Dialog({
title: 'Set Hero Points',
content: `
<p>What do you want to set the Hero Points to?</p>
<form>
<div class="form-group">
<input type="text" id="text-input" name="text-inputName" width = 10></textarea>
</div>
</form>
`
,
buttons: {
no: {
label: 'Cancel',
},
yes: {
label: 'OK',
callback: dispatch,
},
},
default: 'yes',
});
dialog.render(true);
async function dispatch(html){
let input = (html[0].querySelector("#text-input").value)
for(let tok of canvas.tokens.controlled){
await tok.actor.update({'system.heroisme': parseInt(input)});
//This sets up the type setting for the text animation below.
const hpstyle = {
"fill": "blue",
"stroke": "yellow",
"fontFamily": "Arial Black",
"fontSize": 18,
"strokeThickness": 4
}
//Beginning of animation to show on the token how much the Hero Points were set to.
new Sequence()
.effect()
.atLocation(tok)
.text(`Hero Points: ${input}`,hpstyle)
.scaleIn(0, 500)
.fadeOut(6000)
.play()
await Sequencer.Helpers.wait(300)
}
//End of animation.
//Beginning of Sound
new Sequence()
.sound()
.file("/Audio/Music-Stings/220173__gameaudio__spacey-1uppower-up.ogg")
.endTime(600)
.volume(.5)
.fadeOutAudio(500)
.play()
//End of sound
}```
The sound file is only meant to notify the players of an action done. It is a short note. I got it from Freesound - https://freesound.org/browse/tags/sound-effects/ and converted it to an .ogg file to optimize storage. You can easily find it there and it is free to have an account to download many different sounds. 🙂
Freesound: collaborative database of creative-commons licensed sound for musicians and sound lovers. Have you freed your sound today?
Icon for your "Set Hero Points" Macro
Hi guys! trying to do this macro and the spend one, butI have seen that they not update in the character sheet... is there something that I have to change?
@fair tinsel Yes, the macros dealing with Hero Points rely on updating the chosen Token on the Canvas. If an an actor doesn't have their Actor Data Linked, then it won't update the Character Sheet. Eliminate any tokens on the canvas and open a character from the Actor List on the right. Click on Prototype Token under Identity and the third item down is Link Actor Data. Make sure that is checked then click Update Token. 🙂
hmmm I did it, but it doesn't upload either 🤔
Did you first eliminate the tokens on the canvas, update the PROTOTYPE TOKEN from the character sheet NOT from the Token but from the Actor List?
Just tested it on this end. Works perfectly.
I did like you texted me. Still the same! maybe I have to do the macro again?
Okay, I did it! I had a space that it shouldn't be there. Thanks a lot! So sorry for the inconvenience 😢