![](https://s3.amazonaws.com/files.d20.io/images/235413533/XmZsSEPQp45ip6DnMW6iIw/thumb.png?1626879841963)
I had a friend write a script for me so that tokens sharing the same npc sheet don't affect other tokens sharing the same sheet. It somewhat works however there are several issues that I can't seem to figure out with my sub-basic understanding of javascript. When placing two or more of the same token the initial deduction of hp from one token works flawlessly. Then if the same token takes damage or heals it sets every other token to the same hp as the damaged token was at when its hp changed, as if the other tokens had taken the initial damage numbers. If another token takes damage it resets the other tokens, including the one that initially took the damage to full HP, this also functions the same for adding health. I can't figure out exactly what the issue is but it seems like the script is on the right track. I'm also using Aura/Tint HealthColors and there seems to be some strange interactions there as the involving the auto death markers as if you remove the X token marker from a token that shouldn't be dead it will mark the other tokens as being 0 hp. Moving one token sets its marker and returns all the other tokens to full hp. Am I just banging my head against the wall for no reason or is there a way this could work? Thanks in advance for all you guys do here in the API community. on('ready', function() { // Cache the HP of tokens independently let tokenHP = {}; // When a graphic (token) changes on('change:graphic', function(obj, prev) { // Ensure the token represents a character and has bar1 (HP) value if (obj.get('represents') && obj.get('bar1_value') !== undefined) { let tokenID = obj.get('id'); let charID = obj.get('represents'); let currentHP = obj.get('bar1_value'); // Initialize or update the tokenHP cache if (!tokenHP[tokenID]) { tokenHP[tokenID] = currentHP; } else { let cachedHP = tokenHP[tokenID]; if (cachedHP !== currentHP) { // HP has changed, update cache tokenHP[tokenID] = currentHP; // Apply the change only to this token and not others sharing the same character sheet let allTokens = findObjs({ type: 'graphic', represents: charID }); allTokens.forEach(function(token) { if (token.id !== tokenID) { token.set('bar1_value', cachedHP); } }); } } } }); });