Skip to content

Instantly share code, notes, and snippets.

@birdbrainiac
birdbrainiac / instructions
Created September 14, 2018 08:37 — forked from fmonaca/instructions
Notes and instructions (sort of) about the HERO combat system scripts for Roll20
HERO combat system scripts for Roll20
There are 5 scripts in total: heroturntracker2.0, autocombat, effects, recovery, locations.
The first manages the turn tracker, subdividing the turns into phases in which it shows only the tokens acting during those phases depending on their SPD attribute. It supports delayed actions (by putting a "d" in place of the Dex of the token). It also keeps track of status like stunned, deeply stunned, bleeding, movement, actions, etc.
The second manages the weapon and their effects (or spells that damage the opponent). It can be used for modern weapons and for fantasy ones. Any spell that does damage can be
emulated by this script.
@birdbrainiac
birdbrainiac / turnorder
Created September 14, 2018 08:37 — forked from fmonaca/turnorder
Automatic Turn Order in Turn Tracker for HERO system campaigns
on('chat:message', function(msg) {
var command = msg.content.toLowerCase();
if (msg.type == "api" && command == "!combatstart"){
sendChat("GM", "Combat begins!");
var selected = msg.selected;
var aChars = new Array();
var nCount = 0;
_.each(selected, function(obj) {
if(obj._type != 'graphic') return;
@birdbrainiac
birdbrainiac / recovery
Created September 14, 2018 08:36 — forked from fmonaca/recovery
recovery for HERO Combat System for Roll20 - NEEDED as some commands are parsed here
on('chat:message', function(msg) {
if(msg.type != 'api') return; // We're only deal with API commands
//var parts = msg.content.toLowerCase().split(' ');
var parts = msg.content.split(';');
var command = parts.shift();
if(command == '!recovery')
{
//var page = getObj('page', Campaign().get('playerpageid'));
var selected = msg.selected;
@birdbrainiac
birdbrainiac / effects
Created September 14, 2018 08:36 — forked from fmonaca/effects
HERO Effects script, manages timed effects and spells like Drain, Aid, Entangle. Part of the HERO combat system scripts for Roll20
// {effect}[id]|[type:n[fixed/dice]]|[attribute]|[defence]|[frequency(type)][duration(number and type)][counter(0)][active][description][marker]{/effect}
// id a numeric, unique id - It is auto-generated when the Effect is applied by the macro
// dam:n[d/f]|aid:n[d/f]|fla:n[d]|ent:n[d] dam = damage (can also be used as a drain), aid = aid, fla = flash (not implemented yet), ent = entangle,
// n = number of dice | fixed value of effect, I.e. 3 dice of damage is dam:3d
// Special: if dam is set to 0 fixed, it means the attribute(s) is zeroed, if it is set to -1 fixed, the attribute(s) is halved - i.e. dam:0f, dam:-1f
// normal|killing|body|stun|str|dex|con|int|ego|pre|run|ocv|dcv|omcv|dmcv|end|pd|ed|rec|spd stat affected, can be more than one separated by "/". Type and hasDef are then common to all attributes in the list, though.
// hasdef:[pd][ed][rpd][red][powerdef][flashdef][mentaldef][no]
@birdbrainiac
birdbrainiac / locations
Created September 14, 2018 08:36 — forked from fmonaca/locations
HERO System combat locations (rollable table) for Roll20
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content == "!tableread") {
var locsMalus = [8,6,5,5,3,7,8,4,6,8];
var oTable = findObjs({name: "locs",_type: "rollabletable"});
var oItems = findObjs({_type: "tableitem", _rollabletableid: oTable[0].id});
for(var i=0;i<oItems.length;i++)
{
log("aLocsModifier["+i+"] = ["+locsMalus[i]+",'"+oItems[i].get('avatar')+"'];");
}
}
@birdbrainiac
birdbrainiac / createjournal
Created September 14, 2018 08:36 — forked from fmonaca/createjournal
Creates an empty HERO System character sheet in Roll20
on('chat:message', function(msg) {
if(msg.type == 'api' && msg.content.indexOf('!newsheet ') != -1)
{
var name = msg.content.substring(10);
var ocharacter = findObjs({
_type: "character",
_name: name,
});
if(ocharacter.length==0)
@birdbrainiac
birdbrainiac / autocombat
Created September 14, 2018 08:36 — forked from fmonaca/autocombat
HERO autocombat script - supports weapon and some spells through macros and descriptor strings to be put in gmnotes - part of the HERO combat system scripts for Roll20
/*
The macro sends the ID or name of the attacker, the ID or name of the defender, and optionally some other modifiers to the script:
attmod - Default = 0, optional OCV modifier (because of status like SET, BRACE or various types of bonus/malus);
distance - Default = 0, optional distance (in meters) - In case you have to manually specify a distance in metres;
shots - optional modifiers - can be: shots[n] - Number of shots firing for that phase for weapons with selective autofire [1 (max = autofire value)];
abort - optional modifier needed for "abort" type maneuvers like block and dodge.
manualroll - optional in case players want to roll manually to hit
macro example:
@birdbrainiac
birdbrainiac / heroturntracker2.0
Created September 14, 2018 08:35 — forked from fmonaca/heroturntracker2.0
HERO turn and phase tracker, part of the HERO combat system scripts for Roll20
/*
USAGE:
Select tokens and
!combatstart Initiate combat
!nextphase Advance to next phase in which at least one of the tokens in combat acts
!combatend End combat
!combatadd Add token(s) into combat
!combatremove Remove token(s) from combat
@birdbrainiac
birdbrainiac / copycharacter
Created September 14, 2018 08:35 — forked from fmonaca/copycharacter
Creates a copy of a Character object in case more tokens are linked to it, then assigns the newly created Character to the selected token
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content == "!spawn") {
var selected = msg.selected;
_.each(selected, function(obj) {
var newID = spawnCharacter(obj._id);
var oAttrib = findObjs({name: "STR",_type: "attribute", _characterid: newID}, {caseInsensitive: true})[0];
var attrib = parseInt(oAttrib.get('current'));
attrib += 10;
@birdbrainiac
birdbrainiac / turncounter
Created September 14, 2018 08:35 — forked from fmonaca/turncounter
Turn Counter
/* --------------------------------------------------------------------------------------------------- */
// Initiative Script
//
// Usage: Select the tokens you want the initiative to be rolled for and use the command "!initiative"
// This command rolls a die of the type specified using the "initiativeDie" variable, adds
// the result to the attribute specified using the "initiativeAttribute" variable (for each
// token), then sorts the tokens by the total achieved (higher to lower) and puts them into
// the Turn Tracker. Use the command "!nextround" to move to the next round and increase the
// counter.
//