
As i'm ajusting the Shadowrun Charactersheet to my needs for a custom Campain, i realized, that displaying the Physical-Bealthbar just did not work, since in Shadowrun you count your wounds and not your Life left. So i ajusted the template a bit and scriptet a eventlistener, to fix this. Now even so my wounds go up(in Charsheet), my healthbar goes down(on Table). The bar on the Table Still showes the life and not the wounds but for me that's ok. so now here is what i did, if someone wants to use it ;) In the Charactersheet html around line 302 you will find: <div class="sheet-item sheet-tiny">
<input type="number" name="attr_woundmod" value="[[floor(@{physical}/@{paintolerance}) + floor(@{stun}/@{paintolerance})]]" disabled="true" />
</div>
just add this inside the div behind the input.
<div style="display:none;">
<input type="number" name="attr_health_physical" value="[[@{physical_max}-@{physical}]]" disabled="true" class="hidden"/>
<input type="number" name="attr_health_stun" value="[[@{stun_max}-@{stun}]]" disabled="true" class="hidden"/>
<input type="number" name="attr_health_physical_max" value="[[@{physical_max}]]" disabled="true" class="hidden"/>
<input type="number" name="attr_health_stun_max" value="[[@{stun_max}]]" disabled="true" class="hidden"/>
</div> now if you link: Bar1 to health_phisica Bar2 to health_stun changes you make in the sheet will affect the tokens changes to the token will not affect the sheet. So i screiped this little friend of mine here ;) function getAttrObject(charObj,attrName){
return findObjs({_type: "attribute", name: attrName, _characterid: charObj.id})[0];
}
on("change:graphic:bar1_value", function(obj, prev) {
//Do something with "obj" here. "prev" is a list of previous values.
if(obj.get("represents") != "") {
var character = getObj("character", obj.get("represents"));
var attribute = getAttrObject(character,"physical");
attribute.set("current",(obj.get("bar1_max") - obj.get("bar1_value")));
}
});
on("change:graphic:bar2_value", function(obj, prev) {
if(obj.get("represents") != "") {
var character = getObj("character", obj.get("represents"));
var attribute = getAttrObject(character,"stun");
attribute.set("current",(obj.get("bar2_max") - obj.get("bar2_value")));
}
});
I hope it will help ppl.