Disclaimer - I have no idea how the API's work. You Guru's are on a higher plane of existence than a mere mortal like me! Every week my players create area of effect attacks, which I manage using Jacobs latest 'GroupCheck' API. It also uses his addon bit 'ApplyDamage'. In addition to this, I also use 'DeathTracker.js' from Robin Kuipera AND fancy script from Aaron which I just call 'Health Tracker' (which I've since forgotten it's purpose!). - It may duplicate the effect of 'Death Tracker'. I can't remember any more. I may be duplicating things. on('ready', () => {
const HPBarNum = 1;
const bar = `bar${HPBarNum}_value`;
const max = `bar${HPBarNum}_max`;
const constrainHPBarToMax = (obj) => {
const hpMax = parseInt(obj.get(max),10);
if(!isNaN(hpMax) && 'token' === obj.get('subtype') && !obj.get('isdrawing') ){
let hp = parseInt(obj.get(bar),10);
let changes = {};
if(hp > hpMax) {
hp = hpMax;
changes[bar] = hp;
changes.status_dead = false;
} else if(hp <= 0) {
hp=0;
changes[bar] = hp;
changes.status_dead = true;
} else {
changes.status_dead = false;
}
obj.set(changes);
}
};
on("change:token", constrainHPBarToMax);
if('undefined' !== typeof TokenMod && TokenMod.ObserveTokenChange){
TokenMod.ObserveTokenChange(constrainHPBarToMax);
}
}); Anyway. - One/both? of these script watches for any tokens that either goes into negative HP, or 0 HP, then it will make the negative HP just '0' and then it ALSO adds the big red cross 'Death' token over the top. It works super well. However, when I 'Apply Damage' using Jakobs script, the damage is applied but since I'm not manually changing a figure, I don't think that the other API's are being 'notified?' that a change has occurred. I don't know if this is anything to do with the term 'Sheetworkers' that I've heard of? Anyway. - I can adjust it by going onto each effected monster, go to his health (which may say -10) and then just press enter. - It then sort of 'refreshes' and the API check kicks in and changes the HP to 0 and applies the death marker correctly. Is there a way that this minor issue can be fixed? Either by me reselecting all effected monsters in the API and clicking a "Hey, there has been a change, please check these numbers again" button.... or better still, one where maybe the 'apply damage' script has a final bit added to the end where it also 'Notifies the other scripts there has been a change'.... I hope that this makes sense to anyone reading this. If not, I can try to re-explain, maybe with pictures! - Thanks!