Skip to content

Instantly share code, notes, and snippets.

@twelverobots
Last active December 24, 2015 20:49
Show Gist options
  • Save twelverobots/6861060 to your computer and use it in GitHub Desktop.
Save twelverobots/6861060 to your computer and use it in GitHub Desktop.
Flash Point: Fire Rescue Scripts for Roll20.net
var methods = methods || {};
methods.showExplosion = function () {
var exp = findObjs({name:"explosion"})[0];
toFront(exp);
exp.set("height", 720);
exp.set("width", 720);
exp.set("left", 800);
exp.set("top", 500);
sendChat("System", "The Building Collapsed");
}
methods.changes = function (obj, subtract) {
var cards = findObjs({"_cardid":"-J59z_chkn7mYvN19rlA"});
var txt = getObj("text", "-J5A6AtNDxgr9BbTRZv6");
var size;
if (subtract) {
size = cards.length - 1;
} else {
size = cards.length;
}
txt.set("text", "Damage Count: " + size);
if(cards.length >= 25) {
methods.showExplosion();
}
}
on('ready', function () {
on('add:card', methods.changes);
on('destroy:graphic', function(obj) {
methods.changes(obj, true);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment