Roll20 macro and character/monster building tutorials.

A place to discuss any PnP (Pen and Paper) role-playing games you are working on.
Post Reply
Heartfirepony
Posts: 12
Joined: Sat Oct 31, 2015 6:21 pm
Location: Arizona (Utc-7, no DST)
Contact:

Roll20 macro and character/monster building tutorials.

Post by Heartfirepony » Tue Nov 03, 2015 6:21 pm

Roll20 is a pretty awesome resource, especially for this system. The robust and still growing macro system they have can let you automate a lot of the time consuming math of the system down into a few clicks and queries. I'll be sharing as much as i know and have developed for it in this thread, in no particular order. All updates will be edited into the top few replies (i'll be trying to make them somewhat categorical.)
Anyone who wants to add in more or better ways to do things is welcome to post them, i'll test what you send me and add it to the tutorial posts (with credits).

The macro's section of the roll 20 wiki is a really good starting point for understanding how all of it works: https://wiki.roll20.net/Macros
General Macros

Starting with one of the first big hurdles i had, the mathematics of how barter skill worked into buying and selling confused me a lot initially, since the barter skill essentially i used to determine the vendor markup from the base value of an item. With some help from a more math savvy friend i wrote out a pair of macros for buying and selling.
The buying macro:
Spoiler: show
/desc You buy some stuff!
Buy Value: [[ceil(?{itemValue|0}*(1.55-(?{barter|0}*0.0045))*?{modifier|1.00})]]
The Selling macro:
Spoiler: show
/desc you sell some stuff!
Sell Value: [[ceil(?{itemValue|0}*(0.45+(?{barter|0}*0.0045))*?{modifier|1.00})]]
The /desc is a gm command for descriptive messages, i start all my macros with either /desc or /me, because these flavor text boxes help separate things out and reduces confusion.
The double square brackets are for inline text, generating a yellow box with a number in it instead of a big picture of dice. It also helps highlight the numbers.
The macro itself rounds up and is made up mostly of queries, asking for the base value of the item, the buying characters barter skill and ending with a percentile multiplier for disposition, sales and such. at 100 barter skill with no other modifiers, an item is at a minimal markup (11% i think), so a player with 115 barter for their cutie mark skill can buy things at a fairly low 4% markup, and master trader lets them buy things UNDER value.
I kind of had to assume that the barter skill was meant to affect the percentage of markup, because the formula exactly as written in the core rules ended up always making a difference of 100 caps, no matter the item.
The selling macro works the same way, but affects at what percentage of the items value the player can sell the item for. 90% of value for 100 barter skill, 97% for 115, and 45% if you somehow have 0 barter.

Using queries you can also make a macro for pretty much any standard, single shot weapon, (rate of fire gets slightly more complicated).
Its a bit slow and cumbersome, so for your PC's you're better off using one of the macros i'll be posting below for your own equipment, and gms will want to bake enemies attacks into their character sheets as well, however its useful to have a general attack macro around for when someone wants to do something unexpected, like pick up a pipe off the ground when no other weapons are available, and they don't have a macro for that type of weapon already at hand.
General Attack Macro:
Spoiler: show
/me attacks their enemy!

Attack: [[1d100]] Vs: [[?{Skill|0}+?{Modifer|0}]]
Damage: [[(?{BaseDamage|0}+?{Dice|1}d10)*?{Weapon_condintion_mult|1.0}]]
This macro rolls a base d100 next to a line with a query for the characters relevant attack skill, plus or minus the modifier. (always use a positive sign for your queries like this, its easier to understand to put a - sing when you have a negative modifier, and roll20 doesn't like doubled up math symbols.
The damage line then queries for the weapons based damage, the number of d10's, and the condition multiplier.

Initiative: This one is pretty important. There's a few different ways to do it, either on the player side or a globally available one made by the gm, but no matter what they're basically going to be the same thing.
Starting with what i consider to be the BEST way to do it, it just means that everyone needs to use the same format for their specials (ie, all full words or all three letter abbreviations, or one letter abbreviations).
Spoiler: show
/me readies for battle! [[1d10+@{selected|AGI}+(@{selected|PER}*0.01)&{tracker}]]
This automatically gets the agility and perception from the selected token, rolls a d10 and adds agility, then turns perception into a decimal. This resolves most ties automatically once the turn tracker is sorted (unless two people roll the same number for init AND have the same perception.)
In theory you could add +(@{selected|lck}*0.001) before the tracker extension, and it would include luck in this calculation as well and you should almost never have to sort out ties on your own...seems like using a sledgehammer to hang a picture.
If for some reason you can't have uniform special stats on every character, you can replace the @{selected|stat} lines with a ?{stat|5}. using queries like this often results in your players rolling their initiative without their token selected, and having to do it again.

My next post will detail how to setup your PC's character sheet for minimal time-wasting in game.
Last edited by Heartfirepony on Wed Nov 04, 2015 3:53 pm, edited 3 times in total.
I'm pretty much exclusively here to try and contribute content or technical support for the PnPrpg. Message me if there's anything you need which you think i can provide.

Heartfirepony
Posts: 12
Joined: Sat Oct 31, 2015 6:21 pm
Location: Arizona (Utc-7, no DST)
Contact:

Re: Roll20 macro and character/monster building tutorials.

Post by Heartfirepony » Tue Nov 03, 2015 6:21 pm

For making your Pc you're going to be using the "Attribute and Abilities" tab of your character sheet to do all the automation work. for a lot of more popular systems roll20 has built in character sheets with built in automation, but i lack the knowledge to code one for this.
It's possible to eliminate the need for a google sheets character sheet...but i suggest using mine or Firewarrior's (when its done) still. They're much better at organizing the information and calculate all your derived stats for you. When i GM i require everybody to use a uniform Gsheets character sheet.

First off you're going to want to put a bunch of key stats into the "Attributes" column. You just hit the "+ add" button and type in a name and a number (with an optional max number.)
You'll want to put in your Special stats, (i like abbreviating them to one or three letters, but you don't HAVE to.), Hp, AP, and relevant racial stats (strain, trick points.). You can benefit from putting EVERY skill your character has down a bit later in this tutorial, but you can also just put in your character's major skills that you'll be rolling most often. ( a bit of a side note, you'll probably not benefit as much from tracking strain or trick points in your
I also keep track of the following stats for 2-3 weapons: Base Damage, Additional D10's, Condition modifier(1.0 for good, 0.9 for used, etc.), you can even track the name.
The general idea for this is so that when you level up and gain perks, or get new weapons, you can plug the new data in instead of having to manually modify every macro you have. For the lazy, you can just include all of this data directly in macros instead of referencing it. It's less work at the time but will require you to go back and edit those numbers a lot more.
Starting out with one of my favorite pieces of automation, were going to make a macro which lets you roll any special check from a single button press.
You're going to first make 7 macros, which you probably don't want to display on your token or macro bar. They're just going to sit in the character sheet until you ask for them.
Your 7 special macros will all look something like this, and you'll again benefit from giving them short names later when you write your master-macro.
Spoiler: show
/me tests her might!
[[1d10cs<10cf>1]] Vs. [[@{Str}+?{Modifier|0}]]
The /me at the beginning is your flavor text and also functions as a label, so you know who rolled what. you'll want that when everyone rolls perception checks for example.

After that you have the d10 roll (inline again, because it takes up less space). The cs and cf numbers after that change the highlighting, so the number box is green on a 1 and 10 on a red. the Vs. is again a label, the other side of that line has your actual stat, with whatever modifier number the gm gives you. The @{Str} section calls the strength attribute you already entered, make sure it matches the name you gave the attribute and change it out for each stat. The second part of that roll (i say roll, its just math) is a query which asks you for the modifier number, with a label so you know what it is, and a default at 0.

Once you've written one of these for each of your special stats, you're going to make your master macro, which will give you a drop down menu to select a stat (and take up only one space on your macro bar!)
Special Macro:
Spoiler: show
?{Which Stat? |Strength,%{Amber Might|Str}| Perception,%{Amber Might|Per}| Endurance,%{Amber Might|End}| Charisma,%{Amber Might|Cha}| Intelligence,%{Amber Might|Int}| Agility,%{Amber Might|Agi}| Luck,%{Amber Might|lck} }
This macro is essentially a query with preset options, those options being the macros you already made to hide in the background. This one in particular is one i wrote for one of my less technically adept players. If you name all of your macros with the 3 letter abbreviations you could copy/paste this and replace the names. I'll still describe the functions of it, however if you need help with this macro, checking out the roll20 wiki might also be helpful.

The query at the beginning is like any other, just asking you which stat you want to roll, and then giving you a drop down menu. After that the vertical line | is used to indicate that this is a dropdown menu. The format is like this:
Spoiler: show
| Name,%{Character Name|Ability Name}|
the space before the start of the next ability in the menu is necessary for some reason.

Next up, weapons and attacks!
If you want to be really fancy you can include your crit success and failure numbers as attributes.
A side note on the CS function, The < and > greater than and lesser than symbols are both have an invisible "Or equal to" attached to them.
When naming my attack macros i like to include their AP cost.
The standard format i use for single fire, or burst fire weapons looks like this:
Spoiler: show
/me fires her @{W1name}

Attack: [[1d100cs<[[@{critS}]]cf>[[@{critF}]]]] Vs. [[@{Firearms}+?{Modifier|0}]]
Damage: [[floor((@{w1dam}+@{w1d10}d10)*@{W1cnd})]]
Pierces [[5]] DT
I put effects after the damage lines, like the DT piercing, and obviously when you're writing your own macro you'll want to make sure you reference the appropriate weapon skill and include the effects unique to that weapon. Since those vary a lot it's not so automatable.

For burst fire you can include extra lines for each shot, and for weapons that hit multiple times with one attack roll, separate your inline damage rolls with /'s.

The blank space under the emote line prevents your attack roll and attack target number from being on different lines, that can be annoying.

You'll notice a neat thing in this macro: it uses NESTED inline macros. That's because the CS and CF functions don't like formulas or queries or references. However when running a macro, just like parenthesis in mathematics, it performs the inner functions first. As far as the cs and cf functions are concerned, there's just a number there. (you can also include queries or stat references to crit penalties or bonuses on your weapons if you want to, inside that inline roll.)

It also uses the floor function to round the final number down, because if you have a perfect condition weapon or a damaged weapon, you could end up with some decimals. You can use the ceil function to round up, or the round function to round to nearest.

For rate of fire weapons i use a different format, since their mechanics include an additional hit if you rolled an even attack number. So remember that your rate of fire weapons actually fire twice their RoF bullets when you're tracking your ammo consumption. (i seriously don't recommend doing this in your in-game character sheet)

The format for RoF weapons:
Spoiler: show
/me opens fire with his @{w2name}

Attacks Vs [[@{Mew}-(5*@{w2rof})+?{modifier}]]
[[1d100cs<[[@{w2cs}]]cf>[[@{w2cf}]]]] Dam: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]] Even: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]]
[[1d100cs<[[@{w2cs}]]cf>[[@{w2cf}]]]] Dam: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]] Even: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]]
[[1d100cs<[[@{w2cs}]]cf>[[@{w2cf}]]]] Dam: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]] Even: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]]
[[1d100cs<[[@{w2cs}]]cf>[[@{w2cf}]]]] Dam: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]] Even: [[floor((@{w2dam}+@{w2d10}d10)*@{w2cnd}))]]
That macro looks really huge, but it's much shorter when you actually roll it, additionally, you actually only need to write each line once. The output of this gives you the target number at the top and your attack and damage rolls underneath, plus a second damage roll to use for even attack rolls.

Next up for unicorns and alicorns who like to fight with their facial-spikes, macro's for damaging spells. I'll be detailing an energy strike and an eldritch knives spell here. Since spells generally have less variable damage, these are slightly simpler macros most of the time. Spellcasters can also just include their regular crit stats since their horn doesn't have condition modifiers.You don't need rounding functions either since you should always be
first off, an expert level Energy Strike (Fire!)
Spoiler: show
/me fires a mighty fireball from her horn!

Attack: [[1d100cs<[[@{cf}]]cf>[[@{cf}]]]] vs [[@{Science}+?{Modifier|0}]]
Damage: [[30+(@{Potency}*4)+4d10]] in a [[@{Potency}*2]] Area
Ignores DT, reduced by Fire Resistance
Target burns for 2d10 damage each turn until they pass a luck check. Cannot be extinguished for [[@P[potency}]] turns.
Ponies using mighty-spell may want to create queries for their potency or versatility multipliers for spells. you would replace all the @{Potency} references with (@{Potency}*?{Multiplier|1}) and then continue the macro as normal.

Eldritch knives is a bit of a funky spell, and potentially really devastating, its one of my favorites!
Spoiler: show
/me attacks a target with arcane blades!

Attack: [[1d100cs<[[@{cf}]]cf>[[@{cf}]]]] vs [[@{Science}+?{Modifier|0}]]
[[floor((@{Potency/2)+13)]] Damage * [[(@{versatility}+7]] Knives.
[[[[floor((@{Potency/2)+13)]]*[[(@{versatility}+7]]]] Total damage, reduced by (Dt/2)*[[@{versatility+7]]
I like to include instructions for the damaged party to calculate their total damage received, it can help speed things up.
I'll write about making monsters a little later, i need a break from writing!
Last edited by Heartfirepony on Tue Nov 03, 2015 8:48 pm, edited 2 times in total.
I'm pretty much exclusively here to try and contribute content or technical support for the PnPrpg. Message me if there's anything you need which you think i can provide.

Heartfirepony
Posts: 12
Joined: Sat Oct 31, 2015 6:21 pm
Location: Arizona (Utc-7, no DST)
Contact:

Re: Roll20 macro and character/monster building tutorials.

Post by Heartfirepony » Tue Nov 03, 2015 6:21 pm

Reserved for Monster tutorials.
I'm pretty much exclusively here to try and contribute content or technical support for the PnPrpg. Message me if there's anything you need which you think i can provide.

User avatar
f1r3w4rr10r
Posts: 629
Joined: Wed Aug 01, 2012 11:26 am
Location: Germany (UTC+1)
Contact:

Re: Roll20 macro and character/monster building tutorials.

Post by f1r3w4rr10r » Wed Nov 04, 2015 5:00 am

A few notes from me:
Buy and sell value:
They really shouldn't just simply make a difference of 100 caps. I pretty much have the same implementation apart from the modifier and it works for me. Concerning the modifier, there are lists in the default rules for how NPC disposition affect buy and sell value as well as a list for Item Condition doing the same.
Here is my implementation for the character sheet in Google Apps Script / Javascript:
Spoiler: show

Code: Select all

// Trade Prices /////////////////////////////////////////////////////////////////////

/**
 * Calculates the buy value of an item
 * @param {number} StockValue the stock value of the item
 * @param {number} Barter the character's barter skill
 * @param {string} Disposition the disposition towards the trade partner
 * @param {string} NamedCondition the condition name
 * @param {number} PercentageCondition the percentage condition value
 * @customfunction
 */
function calcBuyValue(StockValue, Barter, Disposition, NamedCondition, PercentageCondition) {
  var stockValue = setDefault(StockValue);
  if(stockValue == 0) {
    return 0;
  }
  if(Disposition == "") {
    return 0;
  }
  var disposition = getNPCDispoAttribute(Disposition, 3);
  stockValue *= (1.55 - Barter * 0.0045) * disposition;
  if(getConfigurationItemConditionMode().getValue() == "Named") {
    if(NamedCondition == "") {
      return 0;
    }
    return Math.ceil(stockValue * getNamedCNDAttribute(NamedCondition, 7));
  } else {
    return Math.ceil(stockValue * setDefault(PercentageCondition));
  }
}

/**
 * Calculates the sell value of an item
 * @param {number} StockValue the stock value of the item
 * @param {number} Barter the character's barter skill
 * @param {string} Disposition the disposition towards the trade partner
 * @param {string} NamedCondition the condition name
 * @param {number} PercentageCondition the percentage condition value
 * @customfunction
 */
function calcSellValue(StockValue, Barter, Disposition, NamedCondition, PercentageCondition) {
  var stockValue = setDefault(StockValue);
  if(stockValue == 0) {
    return 0;
  }
  if(Disposition == "") {
    return 0;
  }
  var disposition = getNPCDispoAttribute(Disposition, 3);
  stockValue *= (0.45 + Barter * 0.0045) * disposition;
  if(getConfigurationItemConditionMode().getValue() == "Named") {
    if(NamedCondition == "") {
      return 0;
    }
    return Math.ceil(stockValue * getNamedCNDAttribute(NamedCondition, 7));
  } else {
    return Math.ceil(stockValue * setDefault(PercentageCondition));
  }
}
Attack macros:
I also had a really nice macro that spit out the results in table format for an attack into the chat. Sadly it seems I deleted the campaign where I kept it. :/ It used a Roll template which is a really neat way of doing it, in my opinion.

Character Sheets:
I have looked into those as well and wanted to write one myself, but the roll20 sheets are even more limited than the roll20 sheets. They are basically just digitized paper sheets with barely any ability to calculate derived values by themselves. So for now I really recommend sticking with Google Spreadsheets.

I also didn't know about the controls for critical success and critical failure, that's definitely going to be helpful.
Nice going on the drop down menu there.

Things to add:
You forgot the most useful macro ever! Initiative! Every GM should have that available globally for all their players:
Spoiler: show
/r 1d10+@{selected|Agility} &{tracker}
Check "Show as Token Action" and make it available to all players. That way you can select your token, press the macro button and your rolled initiative is automatically added to the turn tracker.

Heartfirepony
Posts: 12
Joined: Sat Oct 31, 2015 6:21 pm
Location: Arizona (Utc-7, no DST)
Contact:

Re: Roll20 macro and character/monster building tutorials.

Post by Heartfirepony » Wed Nov 04, 2015 3:32 pm

Hah, i cant believe i forgot the initiative macro. i had actually wanted to code one which pulled perception for a tiebreaker.
And my current buy/sell macro does work, it was the first attempt at it which was broken (mainly due to bad math on my part when implementing it).
Adding initiative macros to the main post after writing this.
I'm pretty much exclusively here to try and contribute content or technical support for the PnPrpg. Message me if there's anything you need which you think i can provide.

Post Reply