I have a script I wrote for someone to fix this at one point (below). This sets the ac as bar1 and the hp as bar3. It also sets the passive wisdom as bar2, you can disable that by putting // at the beginning of lines 23, 27, and 31. Additionally, it updates the character's default token to be correct.
You can use it on selected tokens with:
!fix-bars
Or do all tokens in the game with:
!fix-bars --all
If you want to use this, I highly recommend copying your game and trying it on that before using it on your primary game.
Script:
on('ready',()=>{
const attr = (c,n) => (findObjs({ type: 'attribute', characterid: c.id, name: n })[0]||{get:()=>0});
let characters = {};
const fixToken = (t) => {
let c = getObj('character',t.get('represents'));
if(c){
let npc = (attr(c,'npc').get('current')>0);
let ac = attr(c, (npc ? 'npc_ac' : 'ac'));
let wis = attr(c,'wisdom_mod');
let per_skill = attr(c,'perception_prof');
let per_base = attr(c,'npc_perception_base');
let senses = (`${attr(c,'npc_senses').get('current')}`.match(/passive\s+perception\s+(\d+)/i)||[0,0])[1];
let hp = attr(c,'hp');
let pb = attr(c,'pb');
let pw = attr(c,'passive_wisdom');
let passivePerception = 10 + (npc ? parseInt(per_base.get('current')) : (parseInt(wis.get('current')) + parseInt(((`${per_skill.get('current')}`.length>0) ? pb.get('current') : 0))));
t.set({
bar1_link: ( ac ? ac.id : (npc ? 'sheetattr_npc_ac' : 'sheetattr_ac' )),
bar2_link: (npc ? '' : (pw ? pw.id : 'sheetattr_passive_wisdom')),
bar3_link: ( npc ? '' : hp.id),
bar1_value: ac.get('current'),
bar2_value: (parseInt(senses) || passivePerception),
bar3_value: (npc ? hp.get('max') : hp.get('current')),
bar1_max: '',
bar2_max: '',
bar3_max: hp.get('max')
});
let p = getObj('page',t.get('pageid'));
let scale = parseFloat(p.get('snapping_increment'));
if( !characters.hasOwnProperty(c.id) && c.get('name') === t.get('name')) {
let w = parseInt(t.get('width'));
let h = parseInt(t.get('height'));
if(scale<1){
let mod = 1/scale;
t.set({
height: Math.floor(h*mod),
width: Math.floor(w*mod)
});
}
setDefaultTokenForCharacter(c,t);
if(scale<1){
t.set({
height: h,
width: w
});
}
characters[c.id] = true;
}
}
};
on('chat:message', (msg) => {
if('api'===msg.type && /^!fix-bars\b/i.test(msg.content) && playerIsGM(msg.playerid)) {
let args = msg.content.split(/\s+/).map(s => s.toLowerCase());
let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');
let workQueue = {};
if(args.includes('--all')){
workQueue = findObjs({type:'graphic'});
} else if(msg.selected){
workQueue = msg.selected
.map(o=>getObj('graphic',o._id))
.filter(g=>undefined !== g)
;
} else {
sendChat('Fix Bars', `/w "${who}" <div>Select one or more tokens to fix bar mappings on, or use <code>!fix-bars --all</code> to fix bar mappings on all tokens in the game.</div>`);
return;
}
let count = 0;
let timeMark = Date.now();
const drainQueue = ()=>{
let t = workQueue.shift();
if(t){
fixToken(t);
++count;
if((Date.now()-timeMark)>5000){
timeMark = Date.now();
sendChat('Fixing Tokens',`/w gm ...${count}`);
}
setTimeout(drainQueue,0);
} else {
characters = {};
sendChat('Fixing Tokens',`/w gm Finished Fixing Tokens`);
}
};
sendChat('Fixing Tokens',`/w gm Fixing ${workQueue.length} Tokens`);
drainQueue();
}
});
});