@Phnord, you were exactly correct. The current HP on that character sheet is calculated based on a bunch of checkboxes. It might be nice if it were updated to have a manual HP field that could be used instead.
We decided to create an attribute on each character named manual_HP, and fill it with the current HP, then link the tokens to that. I wrote a script to handle this for him:
on('ready',function(){
'use strict';
var fixNewObj= function(obj) {
var p = obj.changed._fbpath,
new_p = p.replace(/([^\/]*\/){4}/, "/");
obj.fbpath = new_p;
return obj;
},
SetupHitPoints = function(token) {
var attr = findObjs({type: 'attribute', characterid: token.get('represents'), name: 'manual_HP'})[0],
srcHP = getAttrByName(token.get('represents'),'hp-current', 'max');
if(!attr) {
attr=fixNewObj(createObj('attribute', {
name: 'manual_HP',
characterid: token.get('represents'),
current: srcHP,
max: srcHP
}));
} else {
attr.set({
current: srcHP,
max: srcHP
});
}
token.set({
bar3_link: attr.id
});
};
on('chat:message',function(msg){
var args;
if (msg.type !== "api") {
return;
}
args = msg.content.split(/\s+/);
switch(args.shift()) {
case '!setup-hp':
_.chain(msg.selected)
.map(function(o){
return getObj('graphic',o._id);
})
.reject(_.isUndefined)
.reject(function(t){
return undefined === t.get('represents');
})
.each(SetupHitPoints)
;
break;
}
});
log('Setup-HP: ready!')
});
To use it, you'd just setup the token as normal with it representing a character, then select them and run:
!setup-hp
This will cause the script to go through each of the selected tokens, and if they represent a character, find or create an attribute on that character named manual_HP, set it's current and max to the value of "hp-current", then change bar3 of the token to link to it.
At that point, it can be added to the character sheet as a default token. Calling the command again is a handy way to update the manual_HP field when the character's calculated HP changes.
I'm going to drop a generalized version of this in the github repo, next time I'm working on such. =D