Hi Tony, The Mad! Try this: on('ready', () => { let playSound = function (trackname, action) { let track = findObjs({ type: 'jukeboxtrack', title: trackname })[0]; if (track) { track.set('playing', false); track.set('softstop', false); if (action == 'play') { track.set('playing', true); } } else { sendChat('Damage Sound', '/w gm No Track Found...'); log("No track found " + trackname); } } on("change:graphic:bar1_value", function (obj, prev) { if (prev.bar1_value > obj.get("bar1_value")) { const sounds = ["ouch", "bam", "smash", "pow", "thud", "argh", "wilhelm_scream"];
const random = Math.floor(Math.random() * sounds.length);
playSound(sounds[random], 'play');
} });
});
This is just a quick re-write of my door noise script. To use: change "ouch" to the name of your sound as it is called in the Jukebox change "bar1_value" wherever it occurs to the bar you are using for HP. Above code edited to reflect requested changes from below