
I've got a pretty simple script that adds or takes away value from bars and it is pretty much the backbone of the homebrew system I use for my group. I've been wondering if there's a method to simply code AoE damage or Damage over time values in a similar way? I figure the latter may need use of TokenMod in some form. I've tried using SmartAoE, but as we have a tendency to use generic tokens; it doesn't appear to work on anything without a character sheet to pull from. Ideal examples: If a target token is selected; deal rolled damage to enemies within two squares If a target token is selected; deal damage every turn as long as they have a status marker on them. The script is below, I did not write it; I'll be honest I can't remember where we even got it from, we've been using it for years: // USER CONFIGURATION // Set the PREVENT_OVERMAX variable to true to prevent the value of a // token's bar from being greater than its max value. If there is no max // value set, it will not stop the current bar value from increasing. var PREVENT_OVERMAX = true; // Set the ANNOUNCE_CHANGE variable to true to send a message to the chat // window, announcing which token gained or lost points on a bar. var ANNOUNCE_CHANGE = true; // BAR CONFIGURATION - These are used to identify which bar to adjust. The // example below was made for a specific Roll20 user's preferences. These // bar keys must be lowercase, though players can use any case in their // macro since the script converts everything to lower case. var Bar1Key = "h"; // (H)ealth var Bar2Key = "s"; // (S)hielding var Bar3Key = "e"; // (E)nergy // BAR NAMES - These names are used if ANNOUNCE_CHANGE is set to true. The // format of the annoucement is: Name gained/lost # BarName. var BarNames = ["Health", "Shielding", "Energy"]; on("chat:message", function(msg) { // Exit if not an api command if (msg.type != "api") return; // Get the API Command msg.who = msg.who.replace(" (GM)", ""); msg.content = msg.content.replace("(GM) ", ""); var n = msg.content.split(" "); var command = n[0].toLowerCase(); // Alter the Selected or Targeted Token's Bars // Usage : !alter target bar amount // Example : !alter @{selected|token_id} h -4 // Example : !alter @{target|token_id} m ? if (command == "!alter") { // Define variables... var Target = getObj("graphic", n[1]); var Bar = 0; Bar = (n[2].toLowerCase() == Bar1Key) ? 1 : 0; Bar = (n[2].toLowerCase() == Bar2Key) ? 2 : Bar; Bar = (n[2].toLowerCase() == Bar3Key) ? 3 : Bar; if (Bar == 0) { sendChat("ERROR", "/w " + msg.who + " That is not a valid bar. Please use the first letter as follows: H(ealth), S(hielding), or E(nergy)."); return; } var AlterValue = n[3]; var TargetBarCurrent = parseInt(Target.get("bar" + Bar + "_value")); var TargetBarMax = parseInt(Target.get("bar" + Bar + "_max")); var StartingValue = TargetBarCurrent; // Check for a + or - sign at the start of the AlterValue... var OperandCheck = AlterValue.charAt(0); AlterValue = (OperandCheck == "-") ? AlterValue.substring(1) : AlterValue; AlterValue = (OperandCheck == "+") ? AlterValue.substring(1) : AlterValue; if (AlterValue.indexOf("d") != -1) { sendChat("", "/r " + AlterValue, function(outs) { AlterValue = parseInt(JSON.parse(outs[0].content).total); if (OperandCheck != "-") { if (PREVENT_OVERMAX == true) { AlterValue = (AlterValue + TargetBarCurrent > TargetBarMax) ? TargetBarMax - TargetBarCurrent : AlterValue; } Target.set("bar" + Bar + "_value", TargetBarCurrent += AlterValue); if (ANNOUNCE_CHANGE) sendChat("", Target.get("name") + " gained " + AlterValue + " " + BarNames[Bar-1] + "."); } else { Target.set("bar" + Bar + "_value", TargetBarCurrent -= AlterValue); if (ANNOUNCE_CHANGE) sendChat("", Target.get("name") + " lost " + AlterValue + " " + BarNames[Bar-1] + "."); } }); } else { if (OperandCheck != "-") { AlterValue = parseInt(AlterValue); if (PREVENT_OVERMAX == true) { AlterValue = (AlterValue + TargetBarCurrent > TargetBarMax) ? TargetBarMax - TargetBarCurrent : AlterValue; } Target.set("bar" + Bar + "_value", TargetBarCurrent += AlterValue); if (ANNOUNCE_CHANGE) sendChat("", Target.get("name") + " gained " + AlterValue + " " + BarNames[Bar-1] + "."); } else { Target.set("bar" + Bar + "_value", TargetBarCurrent -= AlterValue); if (ANNOUNCE_CHANGE) sendChat("", Target.get("name") + " lost " + AlterValue + " " + BarNames[Bar-1] + "."); } } } });