-
-
Save poltergeisha/50e4201f0afe96ad13690468ca381629 to your computer and use it in GitHub Desktop.
Limit HP Min Max
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on('ready',function(){ | |
"use strict"; | |
var constrainBar1ToMax = function (obj) { | |
if (obj.get("subtype") != "token" || obj.get("isdrawing") == "true") return; | |
if (parseInt(obj.get("bar3_value")) <= 0 && parseInt(obj.get("bar3_max")) > 0) obj.set("bar3_value", 0); | |
if (parseInt(obj.get("bar3_value")) > parseInt(obj.get("bar3_max"))) obj.set("bar3_value", parseInt(obj.get("bar3_max"))); | |
}; | |
on("change:token", constrainBar1ToMax); | |
if('undefined' !== typeof TokenMod && TokenMod.ObserveTokenChange){ | |
TokenMod.ObserveTokenChange(constrainBar1ToMax); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment