Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Issues with Bloodied and Dead script by The Aaron in Jumpgate.

Hello! I'm hoping someone can provide help with a new issue I've run into. I've recently converted my long term D&D campaign from the old engine to Jumpgate, and haven't run into any problems until now. My group and I have been in a long roleplay period without any combat encounters, and until last weekend hadn't run a combat encounter. While fighting, token markers kept disappearing from tokens whenever a tokens bars was modified. It took me a bit to figure out where the issue came from, and through a lot of script disabling, I finally found the culprit; a script written years ago by The Aaron himself. The script is a favourite among my players, so I'm hoping someone can tell me what goes wrong with it, and, if possible, supply a solution. The script itself: /* global TokenMod */ on('ready',()=>{ // CONFIGURE const bar = 3; const bloodied = "bloodied::5488131"; const dead = "dead"; // no edit below here // const unpackSM = (stats) => stats.split(/,/).reduce((m,v) => { let p = v.split(/@/); p[0]=p[0].toLowerCase(); let n = parseInt(p[1] || '0', 10); if(p[0].length) { m[p[0]] = Math.max(n, m[p[0]] || 0); } return m; },{}); const packSM = (o) => Object.keys(o) .map(k => ('dead' === k || true === o[k] || o[k]<1 || o[k]>9) ? k : `${k}@${parseInt(o[k])}` ).join(','); const handleBarChange = (obj) => { const bv = parseFloat(obj.get(`bar${bar}_value`)); const bm = parseFloat(obj.get(`bar${bar}_max`)); if(Number.isNaN(bm)){ return; } let sm = unpackSM(obj.get('statusmarkers')); if(bv <= (bm / 2) && bv > 0) { sm[bloodied] = true; } else{ delete sm[bloodied]; } if(bv <= 0) { sm[dead] = true; } else { delete sm[dead]; } obj.set({ statusmarkers: packSM(sm) }); }; on(`change:graphic:bar${bar}_value`, handleBarChange); if('undefined' !== typeof TokenMod && TokenMod.ObserveTokenChange){ TokenMod.ObserveTokenChange(handleBarChange); } }); The bar it checks as well as the marker it places for bloodied have been changed, but the script is otherwise original.
Have you tried DeathTracker? It seems to work for on my Jumpgate games.
1728010725
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Do you have the same set of token markers in each game? const bloodied = "bloodied::5488131"; ... needs to refer to a marker installed in the game. Also, which character sheet are you using. The 2024 sheet will almost certainly break the script.