
I'm trying to write a script that will splatter blood any time a token's hp is reduced. Here's my script so far. It seems to work, but I'm not seeing the splatter effect. I tried zooming out to see if maybe it was just in a weird location, but as far as I can tell it's not firing at all. I'm also not getting any errors or logs regarding the call. var hpValues = {}; on("change:token", function(obj) { var tokenHp = hpValues[obj.get("id")]; var currentHp = parseInt(obj.get("bar1_value")); if (tokenHp == null){ hpValues[obj.get("id")] = currentHp; } if (tokenHp > currentHp){ sendChat(obj.get("name"), "/em took " + (tokenHp - currentHp).toString() + " damage!")
// Right here... I get the above message, then nothin... spawnFx(obj.get("left"), obj.get("top"), "splatter-blood"); } hpValues[obj.get("id")] = currentHp; }); on("add:token", function(obj){ var hpString = obj.get("bar1_value"); if (hpString != null && obj.get("layer") == "objects"){ hpValues[obj.get("id")] = parseInt(hpString); log("Added " + obj.get("name") + " to hp table"); } })