Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Is it possible to implement the ToA Death Save Variant Rule with the 5E OGL Companion Script?

Hey all, Newb question from a guy who doesn't even know what "API" stands for. Basically I'm wondering if it's possible to have the Death Save tracking feature in the 5E OGL Companion API Script adhere to the ToA variant "Meat Grinder" rule of death saving throws succeeding on a roll of 15 or higher instead of the usual 10. I can turn it off and just manually track it, but I've been so spoiled lately with all of the sweet, sweet automation. 
It's a simple change. Just add a new script in your game with the following code. I will post a step-by-step with images after the code for you to follow if you don't know what I mean. var handledeathsave = function(msg,character) { var result = msg.inlinerolls[0].results.total ? msg.inlinerolls[0].results.total : false; var resultbase = msg.inlinerolls[0].results.rolls[0].results[0].v ? msg.inlinerolls[0].results.rolls[0].results[0].v : false; var resultoutput = ""; if(result === false) { log("FAILED TO FIND DEATH SAVE ROLL RESULT"); } else if(resultbase === 20) { resultoutput = "CRITICAL SUCCESS: 1HP"; var hp = findObjs({type: 'attribute', characterid: character.id, name: "hp"}, {caseInsensitive: true})[0]; if(!hp) { createObj("attribute", {name: "hp", current: 1, max: "", characterid: character.id}); } else { hp.set({current:1}); } cleardeathsaves(character); } else if(result < 15 || resultbase === 1) { var fail1 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_fail1"}, {caseInsensitive: true})[0]; var fail2 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_fail2"}, {caseInsensitive: true})[0]; var fail3 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_fail3"}, {caseInsensitive: true})[0]; if(!fail1) { fail1 = createObj("attribute", {name: "deathsave_fail1", current: "0", max: "", characterid: character.id}); //var fail1 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_fail1"}, {caseInsensitive: true})[0]; } if(!fail2) { fail2 = createObj("attribute", {name: "deathsave_fail2", current: "0", max: "", characterid: character.id}); //var fail2 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_fail2"}, {caseInsensitive: true})[0]; } if(!fail3) { fail3 = createObj("attribute", {name: "deathsave_fail3", current: "0", max: "", characterid: character.id}); //var fail3 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_fail3"}, {caseInsensitive: true})[0]; } if(fail2.get("current") === "on" || (fail1.get("current") === "on" && resultbase === 1)) { fail3.set({current:"on"}); resultoutput = "DECEASED"; cleardeathsaves(character); } else if(fail1.get("current") === "on" || resultbase === 1) { fail2.set({current:"on"}); resultoutput = "FAILED 2 of 3"; } else { fail1.set({current:"on"}); resultoutput = "FAILED 1 of 3"; } } else { var succ1 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_succ1"}, {caseInsensitive: true})[0]; var succ2 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_succ2"}, {caseInsensitive: true})[0]; var succ3 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_succ3"}, {caseInsensitive: true})[0]; if(!succ1) { succ1 = createObj("attribute", {name: "deathsave_succ1", current: "0", max: "", characterid: character.id}); //var succ1 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_succ1"}, {caseInsensitive: true})[0]; } if(!succ2) { succ2 = createObj("attribute", {name: "deathsave_succ2", current: "0", max: "", characterid: character.id}); //var succ2 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_succ2"}, {caseInsensitive: true})[0]; } if(!succ3) { succ3 = createObj("attribute", {name: "deathsave_succ3", current: "0", max: "", characterid: character.id}); //var succ3 = findObjs({type: 'attribute', characterid: character.id, name: "deathsave_succ3"}, {caseInsensitive: true})[0]; } if(succ2.get("current") === "on") { succ3.set({current:"on"}); resultoutput = "STABILIZED"; cleardeathsaves(character); } else if(succ1.get("current") === "on") { succ2.set({current:"on"}); resultoutput = "SUCCEEDED 2 of 3"; } else { succ1.set({current:"on"}); resultoutput = "SUCCEEDED 1 of 3"; } } if(state.FifthEditionOGLbyRoll20.deathsavetracking != "quiet") { if(getAttrByName(character.id, "wtype") === "") { sendChat(msg.who, "<div class='sheet-rolltemplate-simple' style='margin-top:-7px;'><div class='sheet-container'><div class='sheet-label' style='margin-top:5px;'><span>" + resultoutput + "</span></div></div></div>"); } else { sendChat(msg.who, "/w gm <div class='sheet-rolltemplate-desc'><div class='sheet-desc'><div class='sheet-label' style='margin-top:5px;'><span>" + resultoutput + "</span></div></div></div>"); } } };
Add a new script. Note that this should be done after adding the 5th Edition Companion script to the game.    2. Give it a name and add the script, then hit save.     3. Test it out.
Thanks so much! Super easy instructions! It is up and running in my game!