Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

From Roll20 Wiki

Jump to: navigation, search
Line 1: Line 1:
 
{{revdate}}
 
{{revdate}}
<p>The CommandMaster API is part of the RPGMaster suite of APIs for Roll20, which includes RoundMaster, InitiativeMaster, AttackMaster, MagicMaster and CommandMasterIt manages the initialisation of a Campaign to use the RPGMaster APIs, communication and command syntax updates between the APIs and, most importantly for the DM, easy menu-driven setup of Tokens and Character Sheets to work with the APIs.</p>
+
==General Database information==
{{script overview
+
<p>The RPGMaster APIs use a number of Character Sheets as databases to hold Ability Macros defining character classes, attack templates, spells, powers and magic items and their effectsThe API is distributed with many class, attack, spell, power & magic item definitions, and checks for, creates and updates these Character Sheet databases on start-up.  DMs can add their own character classes, attack templates, spells, items, weapons, ammo and armour to additional databases, but the databases provided are totally rewritten when new updates are released so the DM must add their own database sheets.  If the provided databases are accidentally deleted, they will be automatically recreated the next time the Campaign is opened. Additional databases should be named as follows:</p>
|name=CommandMaster
+
<table>
|author={{user profile|6497708|Richard E}}
+
<tr><th scope="row">Wizard Spells:</th><td>additional databases: MU-Spells-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
|version=1.020
+
<tr><th scope="row">Priest Spells:</th><td>additional databases: PR-Spells-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
|lastmodified=2022-01-09
+
<tr><th scope="row">Powers:</th><td>additional databases: Powers-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
|code=CommandMaster
+
<tr><th scope="row">Magic Items:</th><td>additional databases: MI-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
|dependencies=RoundMaster, InitiativeMaster, AttackMaster
+
<tr><th scope="row">Character Classes:</th><td>additional databases: Class-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
|conflicts=None}}
+
<tr><th scope="row">Attack Templates:</th><td>additional databases: Attacks-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
 
+
</table>
=How CommandMaster Works=
+
<p><b>However:</b> the system will ignore any database with a name that includes a version number of the form "v#.#" where # can be any number or group of numbers e.g. MI-DB v2.13 will be ignoredThis is so that the DM can version control their databases, with only the current one (without a version number) being live.</p>
<p>The CommandMaster API coordinates other APIs in the RPGMaster API series and provides the DM with facilities to set the Campaign up to use them. It will initialise a Campaign in Roll20 to use the RPGMaster series APIsAPIs can register their commands with CommandMaster and, should they change in the future, CommandMaster will search all Character Sheets and databases for that command and offer the DM the option to automatically update any or all of those found to the new command structure of that APISelected Tokens and their associated Character Sheets can be set up with the correct Token Action Buttons, with spell-users given spells in their spell book, fighters given weapon proficiencies, setting saving throws correctly, and linking token circles to standard Character Sheet fields.</p>
+
<p>There can be as many additional databases as you want. Other Master series APIs come with additional databases, some of which overlap - this does not cause a problem as version control and merging unique macros is managed by the APIs.</p>
==Initialising a Campaign==
+
<p><b>Important Note:</b> all Character Sheet databases <b><u><i>must</i></u></b> have their <i>\'ControlledBy\'</i> value (found under the [Edit] button at the top right of each sheet) set to <i>\'All Players\'</i>This must be for all databases, both those provided (set by the API) and any user-defined ones.  Otherwise, Players will not be able to run the macros contained in them.</p>
<p>Using the <b>--initialise</b> command will add a number of Player Macros for the DM that will run the most-used RPGMater DM commands, which can be flagged to appear in the Macro Bar at the bottom of the DM’s screen for ease of access.</p>
+
<p>Each database has a similar structure, with:</p>
==Setting up tokens & character sheets==
+
<ul>
<p>Selecting one or multiple tokens and running the <b>--abilities</b> command will allow token action buttons and RPGMaster API capabilities to be set up for all the represented Character Sheets at the same time, though all Character Sheets will be set up the same way.</p>
+
<li>Ability Macros named as the class, attack type, spell, power or magic item specified, and used to describe and provide effects for classes, attacks, spells, powers and magic items using the commands in the RPGMaster APIs;</li>
==Registering API commands==
+
<li>Custom Attributes with the attribute name "ct-ability-macro-name", one per Ability Macro, which defines the casting time and casting cost for spells & powers, and speed and MI type for magic items (not currently used for Class or Attack definitions, but they still have to exist);</li>
<p>Any API command can be registered with CommandMaster using the <b>--register</b> command.  This will allow the command registered to be added as a Token Action Button to Character Sheets by the  abilities command, and to be optionally updated in all Character Sheets wherever used should the details of the registration change.</p>
+
<li>An entry in a list on the character sheet in the spell book of the relevant Character Sheet tab (Spell Level of the spell defined, Powers tab, or various spell books for different Classes & Magic Items).</li>
==Editing Character Sheet abilities==
+
</ul>
<p><b>Danger:</b> this command is very powerful, and can ruin your campaign if mis-used! The <b>--edit</b> command can be used to change any string in Character Sheet ability macros to any other string, using ‘escaped’ characters to replace even the most complex stringsHowever, use with care!</p>
+
<p>However, as with all other Databases in the RPGMaster Suite of APIs, if the <i>Ability Macros</i> are correctly set up using the formats detailed in the Help Documentation, the <b>AttackMaster API</b> command <b>!attk --check-db database-name</b> will check the database and set up all other aspects for you, including the correct Custom Attributes and List entries.</p>
 +
<p>Ability Macros can be whatever the DM wants and can be as simple or as complex as desired. Roll Templates are very useful when defining class, spell, power and magic item ability macros, and are an essential part of Attack Templates.  When a Player or an NPC or Monster makes an attack, the AttackMaster API runs the relevant Ability Macro from the databases as if it had been run by the Player from the chat window. All Roll20 functions for macros are available.</p>
 +
<h3>Replacing Classes, Attacks, Spells & Items</h3>
 +
<p>If you want to replace any Ability Macro provided in any of the databases, you can do so simply by creating an Ability Macro in one of your own databases (a database with the same root name) with the Ability Macro you create having exactly the same name as the provided item to be replacedThe API gives preference to Ability Macros in user-defined databases, so yours will be selected in preference to the one provided with the APIs.</p>
 
<br>
 
<br>
==Syntax of CommandMaster calls==
+
==How Attacks Work==
<p>The CommandMaster API is called using !cmd.</p>
+
<p>In order to understand the Attacks Database, it is first important to understand how attacks are executed by the <b>AttackMaster API</b>.  Under <i>AD&D 2nd Edition</i>, attacks are quite complex, involving many factors that can vary from moment to moment.  Some say that this is why they prefer RPG systems that require less maths and are faster to execute, that the complexity of the AD&D2e combat system interrupts the flow of play.  The AttackMaster API handles attacks in such a way as to hide as much of that complexity from the players as possible, and thus allow game-play to flow and players to concentrate on the unfolding story.</p>
<pre>!cmd --initialise</pre>
+
<p>In order for the API to achieve this, it must evaluate many factors "on the fly" such as current magical effects in place (generally or on individuals), the current attributes of a character (which can vary as they are affected by game play), the type, range and properties of the weapon combinations used at that point in time for that particular attack, and the effects of the race, class, level and proficiency of the character, among several othersGiven that these factors can vary even during a single round, each attack must be fully evaluated from scratch each time it is made.</p>
<p>Commands to be sent to the CommandMaster API must be preceded by two hyphens ‘--’ as above for the --initialise commandParameters to these commands are separated by vertical bars ‘|’, for example:</p>
+
<p>Another issue is introduced by players feeling much more satisfied if they can see dice rolling for the attack, or they may want to use the Roll20 dice rolling mouse action, or even their own physical dice.  Unfortunately for API authors, at the time of writing the API it is only possible to display rolling 3D dice from Chat Window dice rolls, either typed in the entry box by the player or run from Macros displayed in the Chat Window - 3D dice will not work when called by or included in API calls and commands.</p>
<pre>!cmd --register action|description|api-call|api-command|parameters</pre>
+
<p>So how does the AttackMaster API achieve 3D dice rolls and attack calculations that can accelerate game-play?  The answer is that it uses Attack Template definitions which it parses and turns into Ability Macros on the Character Sheet of the character that selects to do an attack.  The Melee Weapon templates are parsed and the attack Ability Macros for each Melee weapon in-hand created on the Character Sheet as (in fact just before) the Attack chat window menu is displayed, and Ranged Weapon templates are parsed and their attack Ability Macros are created after the type of Ammo has been selected and just before the relevant range buttons on the Attack menu are enabled for the Player to selectWhen the Player selects a Melee weapon to attack with, or the relevant range button for a Ranged weapon, the API is then not actually involved at all - the Roll20 Chat Window button just selected is just doing a standard macro call to the relevant attack Ability Macro just created on the Character SheetThis also means the actual attacks happen at the fastest speed Roll20 can achieve as no API code is being run at that point.</p>
<p>Commands can be stacked in the call, for example:</p>
+
<pre>!cmd --initialise --abilities</pre>
+
<p>When specifying the commands in this document, parameters enclosed in square brackets [like this] are optional: the square brackets are not included when calling the command with an optional parameter, they are just for description purposes in this documentParameters that can be one of a small number of options have those options listed, separated by forward slash ‘/’, meaning at least one of those listed must be provided (unless the parameter is also specified in [] as optional): again, the slash ‘/’ is not part of the commandParameters in UPPERCASE are literal, and must be spelt as shown (though their case is actually irrelevant).</p>
+
 
<br>
 
<br>
=Command Index=
+
==The Attacks Database==
==Commands==
+
<p>The Attack Templates are stored in the Attacks Database, <i>Attacks-DB</i>, and any additional bespoke Attacks Databases the DM/Game Creator adds using the Character Sheet name <i>Attacks-DB-[added name]</i>.  There are 17 basic Attacks Templates:</p>
===Campaign setup===
+
<table>
<pre>--initialise
+
<tr><th scope="row">MW-ToHit</th><td>Melee Weapon calculation to assess and display the Armour Class hit by an attack</td></tr>
--abilities</pre>
+
<tr><th scope="row">MW-DmgSM</th><td>Melee Weapon calculation to assess the damage done to a Medium or smaller opponent if the hit was sucessful</td></tr>
===Character Sheet configuration===
+
<tr><th scope="row">MW-DmgL</th><td>Melee Weapon calculation to assess the damage done to Large or larger opponents as a result of a successful hit</td></tr>
<pre>--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]
+
<tr><th scope="row">MW-Targeted-Attk</th><td>Melee Weapon calculation for using a targeted attack which rolls all attack and damage dice at once, and then displays the AC hit, the damage vs. all types of opponents, and the current AC & HP of the targeted opponent</td></tr>
--add-profs
+
<tr><th scope="row">RW-ToHit</th><td>Ranged Weapon calculation to assess and display the Armour Class hit by an attack</td></tr>
--set-prof [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type
+
<tr><th scope="row">RW-DmgSM</th><td>Ranged Weapon calculation to assess the damage done to a Medium or smaller opponent if the hit was sucessful</td></tr>
--set-all-prof</pre>
+
<tr><th scope="row">RW-DmgL</th><td>Ranged Weapon calculation to assess the damage done to Large or larger opponents as a result of a successful hit</td></tr>
===Command and Ability maintenance===
+
<tr><th scope="row">RW-Targeted-Attk</th><td>Ranged Weapon calculation for using a targeted attack which rolls all attack and damage dice at once, and then displays the AC hit, the damage vs. all types of opponents, and the current AC & HP of the targeted opponent</td></tr>
<pre>--register action|description|api-call|api-command|parameters
+
<tr><th scope="row">Mon-Attk1</th><td>Monster/Creature attack 1 calculation to assess and display the Armour Class hit by an attack</td></tr>
--edit old-string | new-string</pre>
+
<tr><th scope="row">Mon-Attk2</th><td>Monster/Creature attack 2 calculation to assess and display the Armour Class hit by an attack</td></tr>
===Other commands===
+
<tr><th scope="row">Mon-Attk3</th><td>Monster/Creature attack 3 calculation to assess and display the Armour Class hit by an attack</td></tr>
<pre>--help
+
<tr><th scope="row">Mon-Dmg1</th><td>Monster/Creature damage 1 calculation to assess and display the damage done by an attack</td></tr>
--debug [ON/OFF]</pre>
+
<tr><th scope="row">Mon-Dmg2</th><td>Monster/Creature damage 2 calculation to assess and display the damage done by an attack</td></tr>
 +
<tr><th scope="row">Mon-Dmg3</th><td>Monster/Creature damage 3 calculation to assess and display the damage done by an attack</td></tr>
 +
<tr><th scope="row">Mon-Targeted-Attk1</th><td>Monster/Creature for a targeted attack 1 calculation to assess and display the Armour Class hit and damage done by an attack, along with the target\'s current AC and HP</td></tr>
 +
<tr><th scope="row">Mon-Targeted-Attk2</th><td>Monster/Creature for a targeted attack 2 calculation to assess and display the Armour Class hit and damage done by an attack, along with the target\'s current AC and HP</td></tr>
 +
<tr><th scope="row">Mon-Targeted-Attk3</th><td>Monster/Creature for a targeted attack 3 calculation to assess and display the Armour Class hit and damage done by an attack, along with the target\'s current AC and HP</td></tr>
 +
</table>
 +
<p>The Melee Weapon Attack Templates will be parsed for each Melee Weapon in-hand at the time of the attack, and the Ranged Weapon Attack Templates will be parsed for each possible range of the Ranged Weapon/Ammo combination selected for the attack. Two additional Melee Weapon Attack Templates are parsed if the character making the attack is a Rogue class:</p>
 +
<table>
 +
<tr><th scope="row">MW-Backstab-DmgSM</th><td>Melee Weapon calculation to assess the damage done to a Medium or smaller opponent if the hit was a Rogue doing a backstab and the attack was successful</td></tr>
 +
<tr><th scope="row">MW-Backstab-DmgL</th><td>Melee Weapon calculation to assess the damage done to a Large or larger opponent if the hit was a Rogue doing a backstab and the attack was successful</td></tr>
 +
</table>
 +
<p>All of the above templates are provided in the Attacks-DB database supplied with the AttackMaster API.  They are created to follow AD&D 2nd Edition rules: DMs and Game Creators can create their own attack and damage calculations following whatever rules they want in their own bespoke Attacks Database, using the information provided in the next section.</p>
 +
<p>It is possible to add additional Attack Templates that are specific to particular Races, Classes, or even individual weapons!  Indeed, the database supplied with the AttackMaster API includes an example of a bespoke Attack Template set for a thrown prepared Oil Flask.  When an attack is the action selected by the Player, the API will search the Attacks-DB and bespoke user Attacks Databases for Melee and Ranged Attack Templates in the following name order (replace the ?W with either MW or RW as appropriate):</p>
 +
<ol>
 +
<li><b>?W-ToHit-\<weapon name\></b> Searches for a weapon-specific Attack Template set for the weapon being used to attack with, but if not found then</li>
 +
<li><b>?W-ToHit-\<class name\></b> Searches for a class-specific Attack Template set for the class (or each class of a multi/dual class) of the attacking character, but if not found then</li>
 +
<li><b>?W-ToHit-\<race\></b> Searches for a race-specific Attack Template set for the race of the attacking character, but if not found then</li>
 +
<li><b>?W-ToHit</b> Uses the default Attack Template set.</li>
 +
</ol>
 
<br>
 
<br>
==Campaign setup==
+
==Attack Data Fields==
===Initialise for RPGMaster APIs===
+
<p>Attack Templates can take the form of any message or macro that can be held in a Roll20 Character Sheet Ability Macro and be displayed in the Chat Window when calledTypically, this will use a Roll Template (standard Roll20 functionality - see Roll20 Help for information), but it can be any format you desire as long as it results in the correct display of information to the Player.</p>
<pre>--initialise</pre>
+
<p>The Attack Template has a large number of template fields that it can call upon to use in its calculations - these are pre-calculated values supplied by the API that the DM / Game Creator writing a new Attack Template can use.  The standard Roll20 attribute value notation of @{selected|field-name} is not recommended for use in Attack Templates, as when the template is parsed, and then later the resulting Ability Macro run as part of the attack, there are circumstances where the token for the attacking Character may not be currently selected, resulting in the wrong value being used or, worse, an error occurring and the game haltingInstead, all the following template fields are available:</p>
<p>This command creates a number of Player Macros which can be found under the Player Macro tab in the Chat window (the tab that looks like three bulleted lines, next to the cog)These macros hold a number of DM commands that are useful in setting up and running a campaign.  It is recommended that the “Show in Bar” flags for these macros are set, and the “Show Macro Bar” flag is set (the macro bar is standard Roll20 functionality - see Roll20 Help Centre for more information).</p>
+
<p>The buttons added are:</p>
+
<ul>
+
<li><i>Maint-menu:</i> Runs the <b>!init --maint</b> command</li>
+
<li><i>Token-setup:</i> Runs the <b>!cmd --abilities</b> command</li>
+
<li><i>Add-items:</i> Runs the <b>!magic --gm-edit-mi</b> command</li>
+
<li><i>End-of-Day:</i> Runs the <b>!init --end-of-day</b> command</li>
+
<li><i>Initiative-menu:</i> Runs the <b>!init --init</b> command</li>
+
</ul>
+
<p>The DM can drag Macro Bar buttons around on-screen to re-order them, or even right-click them to change their name and colour of the button.  Feel free to do this to make the Macro Bar as usable for you as you desire.</p>
+
===Setup Tokens & Character Sheets===
+
<pre>--abilities</pre>
+
<p>Displays a menu with which one or more selected tokens and the Character Sheets they represent can be set up with the correct Token Action Buttons and data specific to the RPGMaster APIs, to work with the APIs in the best way.  The menu provides buttons to add any command registered with CommandMaster (see <b>--register</b> command) as a Token Action Button, add spells to spell books, add granted powers, add or change weapon proficiencies and proficiency levels for each weapon, set the correct saving throws based on race, class & level of character / NPC / creature, and optionally clear or set the Token ‘circles’ to represent AC (bar 1), base Thac0 (bar 2) and HP (bar 3).  Essentially, using this menu accesses the commands in section 2 without the DM having to run them individually.</p>
+
<p>All tokens selected when menu items are used will be set up the same way: exceptions to this are using the Set Saves button (sets saves for each selected token/character sheet correctly for the specifications of that sheet), and the Set All Profs button (sets weapon proficiencies to proficient based on the weapons in each individual token/character sheet’s item bag).  Different tokens can be selected and set up differently without having to refresh the menu.</p>
+
==Character Sheet configuration==
+
<p>The commands in this section can be accessed using the --abilities command menu.  The individual commands below are used less frequently.</p>
+
===Add spells to spell book===
+
<pre>--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]</pre>
+
<p>Displays a menu allowing spells in the Spells Databases to be added to the Character Sheet(s) represented by the selected Token(s).  If no spell type and/or spell level is specified, the initial menu shown is for Level 1 Wizard spells (MUSPELLS). Buttons are shown on the menu that allow navigation to other levels, spell types and powers.</p>
+
<p><b>Note:</b> adding spells / powers to a sheet does not mean the Character can immediately use themThey must be <i>memorised</i> first.  Use the commands in the <b>MagicMaster API</b> to memorise spells and powers.</p>
+
===Choose weapon proficiencies===
+
<pre>--add-profs</pre>
+
<p>Displays a menu from which to select proficiencies and level of proficiency for any weapons in the Weapon Databases.  Also provides a button for making the Character proficient in all weapons carried (i.e. those currently in their Item table).</p>
+
<p>All current proficiencies are displayed, with the proficiency level of each, which can be changed or removed.</p>
+
<p><b>Note:</b> this does more than just entering the weapon in the proficiency table.  It adds the <i>weapon group</i> that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the <b>AttackMaster API</b> to manage <i>related weapon</i> attacks and give the correct proficiency bonuses or penalties for the class and weapon used.</p>
+
===Add weapon proficiencies===
+
<pre>--set-prof  [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type </pre>
+
<p>Sets a specific weapon proficiency to a named level.  If the proficiency level is omitted, PROFICIENT is assumed.  If the weapon already exists in the proficiencies table, the existing proficiency level is updated to that specified.  Otherwise, the weapon (and its weapon group) are added to the table at the specified level.</p>
+
<p><b>Note:</b> this does more than just entering the weapon in the proficiency table.  It adds the weapon group that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the AttackMaster API to manage related weapon attacks and give the correct proficiency bonuses or penalties for the class and weapon used.</p>
+
===Add proficiencies for all carried weapons===
+
<pre>--set-all-prof</pre>
+
<p>Adds all currently carried weapons (those in the Items table) to PROFICIENT, saving them and their <i>weapon group</i> to the weapon proficiency table.  Those weapons found that are already in the table are reset to PROFICIENT (overwriting any existing different proficiency level).  Any other proficiencies already in the table are not altered.</p>
+
<p><b>Note:</b> this command always adds a weapon proficiency called <i>innate</i>.  This proficiency is used for attacks with innate weapons, such as claws and bites, but also for spells that require a <i>touch attack</i>.  Indeed, to make this even more specific, the weapons database distributed with the AttackMaster and MagicMaster APIs includes a weapon called <i>Touch</i>.</p>
+
<p><b>Tip:</b> if using the <b>MagicMaster API</b> then running the <b>!magic --gm-edit-mi</b> command and adding weapons before running this command can speed up setting up character sheets.</p>
+
==Command and Ability maintenance==
+
===Register an API command===
+
<pre>--register action|description|api-call|api-command|parameters</pre>
+
<p>Register an API command with the CommandMaster API to achieve two outcomes: allow the command to be set up as a Token Action Button, and/or automatically maintain & update the syntax of the commands in Character Sheet ability macros and the RPGMaster API databases.</p>
+
<p>This is a powerful and potentially hazardous commandRegistry of an API command is remembered by the system in the state variable, which is preserved throughout the life of the Campaign in Roll20.  If a subsequent registration of the same <b>action</b> has different parameters, the system detects this and searches all Character Sheet ability macros for the <i>old version</i> of the command and replaces all of them with the new command.  It also changes the parameters, using a syntax including a range of character \‘escapes\’ to substitute characters that Roll20 might otherwise interpret as commands itself.  In detail, the --register command takes:</p>
+
 
<table>
 
<table>
<tr><th scope="row">action:</th><td>the unique name given to this command in the whole system.  This can be any legal text name including A-Z, a-z, 1-9, -, _ only.  Must start with an alpha.  Case is ignored.</td></tr>
+
<thead>
<tr><th scope="row">description:</th><td>a short description of the command, which is displayed in the menu that allows the command to be added as a Token Action Button.</td></tr>
+
<tr><th colspan="2">All Attack Templates</th><tr>
<tr><th scope="row">api-call:</th><td>the API call <i>without</i> the !, e.g. cmd, or magic, etc</td></tr>
+
</thead>
<tr><th scope="row">api-command:</th><td>the command to be passed to the specified API, with the hyphens replaced by ~~ or plusses replaced by **, e.g. ~~cast-spell or **menu.</td></tr>
+
<tr><th scope="row">^^toWho^^</th><td>Resolves to a Roll20 whisper command to the Character making the attack</td></tr>
<tr><th scope="row">parameters:</th><td>the parameters (or initial parameters) to be passed as part of this command to replace the matching existing command parameters.  This string is \‘escaped\’ using the following character replacements:</td></tr>
+
<tr><th scope="row">^^toWhoPublic^^</th><td>Resolves to a Roll20 chat command to the GM if a GM controlled creature is making the attack, otherwise a public message to all Players</td></tr>
 +
<tr><th scope="row">^^defaultTemplate^^</th><td>Resolves to the name of the Default Roll Template name set in the AttackMaster API</td></tr>
 +
<tr><th scope="row">^^cname^^</th><td>Resolves to the Character Name of the attacking character</td></tr>
 +
<tr><th scope="row">^^tname^^</th><td>Resolves to the Token Name of the attacking character</td></tr>
 +
<tr><th scope="row">^^cid^^</th><td>Resolves to the Roll20 Character ID of the attacking character</td></tr>
 +
<tr><th scope="row">^^tid^^</th><td>Resolves to the Roll20 Token ID of the attacking character</td></tr>
 +
<tr><th scope="row">^^toHitRoll^^</th><td>Depending on if the Player chose for Roll20 to roll the attack dice or to roll their own dice, resolves to one of (a) the attack dice specification provided in the Attack Template\'s <i>Specs</i> field, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
<tr><th scope="row">^^thac0^^</th><td>Resolves to the base thac0 (value "to hit armour class 0") of the attacking character without any adjustments</td></tr>
 +
<tr><th scope="row">^^ACfield^^</th><td>Resolves to the Character Sheet field name that holds the target creatures current Armour Class (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^targetACfield^^</th><td>Resolves to the targeted token value Armour Class macro call <i>@{target|Select Target|tokenAC-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^targetHPfield^^</th><td>Resolves to the targeted token value Hit Points macro call <i>@{target|Select Target|tokenHP-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^HPfield^^</th><td>Resolves to the Character Sheet field name that holds the target creatures current Hit Points (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^magicAttkAdj^^</th><td>Resolves to any magical effect attack bonus or penalty resulting from magic currently in effect</td></tr>
 +
<tr><th scope="row">^^strAttkBonus^^</th><td>Resolves to the strength to-hit bonus/penalty of the attacking character</td></tr>
 +
<tr><th scope="row">^^strDmgBonus^^</th><td>Resolves to the strength damage bonus/penalty of the attacking character</td></tr>
 +
<tr><th scope="row">^^slashWeap^^</th><td>Resolves to 1 if the damage type of the weapon includes Slashing (or S), otherwise 0</td></tr>
 +
<tr><th scope="row">^^pierceWeap^^</th><td>Resolves to 1 if the damage type of the weapon includes Piercing (or P), otherwise 0</td></tr>
 +
<tr><th scope="row">^^bludgeonWeap^^</th><td>Resolves to 1 if the damage type of the weapon includes Bludgeoning (or B), otherwise 0</td></tr>
 +
<tr><th scope="row">^^weapType^^</th><td>Resolves to the 3 letter damage type of the weapon (S, P, B or any combination)</td></tr>
 +
<tr><th scope="row">^^ACvsNoMods^^</th><td>Resolves to the targeted standard Armour Class macro call <i>@{target|Select Target|AC-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsSlash^^</th><td>Resolves to the targeted Slashing damage Armour Class macro call <i>@{target|Select Target|SlashAC-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsPierce^^</th><td>Resolves to the targeted Piercing Armour Class macro call <i>@{target|Select Target|PierceAC-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsBludgeon^^</th><td>Resolves to the targeted Bludgeoning Armour Class macro call <i>@{target|Select Target|BludgeonAC-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsNoModsTxt^^</th><td>Resolves to the text "No Mods"</td></tr>
 +
<tr><th scope="row">^^ACvsSlashTxt^^</th><td>If this is a slashing weapon, resolves to the text "Slash", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsPierceTxt^^</th><td>If this is a piercing weapon, resolves to the text "Pierce", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsBludgeonTxt^^</th><td>If this is a bludgeoning weapon, resolves to the text "Bludgeon", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsSTxt^^</th><td>If this is a slashing weapon, resolves to the text "S", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsPTxt^^</th><td>If this is a piercing weapon, resolves to the text "P", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsBTxt^^</th><td>If this is a slashing weapon, resolves to the text "B", otherwise resolves to an empty string</td></tr>
 
</table>
 
</table>
{| class="wikitable"
 
|+
 
|-
 
! scope="row" | Character
 
|| Parameter separator || ? || [ || ] || &lt; || &gt; || @ || - || &#124; || : || & || { || }
 
|-
 
! scope="row" | Substitute
 
|| %% || ^ || &lt;&lt; || &gt;&gt; || || || ` || ~ || ¦ ||  || &amp;amp; || &amp;#123; || &amp;#125;
 
|-
 
! scope="row" | Alternative<br>(no ; )
 
|| \vbar || \ques || \lbrak || \rbrak || \lt || \gt || \at || \dash || \vbar || \clon || \amp || \lbrc || \rbrc
 
|}
 
<p>Commands cannot have a CR (carrage return/new line) in the middle of them, but CR can separate commands in multi-command sequences.</p>
 
<p>If the parameter string ends with $$, this will ensure that a complete command up to the next CR is to be replaced (including everything up to the CR even if not part of the command).  If there is not a $$ on the end of the parameter string, then only the command and parameters that are matched are replaced (using a parameter count of each old and new parameter separated by ‘%%’) - the rest of the line (including any remaining parameters not so matched) will be left in place.</p>
 
<p>Here are some examples of registration commands:</p>
 
<pre>--register Spells_menu|Open a menu with spell management functions|magic|~~spellmenu |\`{selected|token_id}
 
--register Use_power|Use a Power|magic|~~cast-spell|POWER%%\`{selected|token_id}
 
--register Attack_hit|Do an attack where Roll20 rolls the dice|attk|~~attk-hit|\`{selected|token_id}</pre><br>
 
===Edit ability macros===
 
<pre>--edit existing-string | new-string</pre>
 
<p style="background-color:yellow;"><b>Danger:</b> use this command with extreme care!  It can destroy your Campaign!  It is recommended that you make a backup copy of your Campaign before using this command.  --register is more controlled, as it has been tested with the RPGMaster command strings, and any future releases that change the API commands will be fully tested before release for their effect on Campaigns, with accompanying release notes.  Using the --edit function directly can have unintended consequences!</p>
 
<p>Replaces an existing ‘escaped’ string with a new replacement string in all ability macros on all Character Sheets including the API character sheet databases.  These strings both use the same escape sequence replacements as for the <b>--register</b> command (see section 3.1) as in fact <b>--register</b> and <b>--edit</b> use the same functionality.</p>
 
<p>Examples of its use are to change API command calls, or Character Sheet field name access in macros should the field names change.</p>
 
 
<br>
 
<br>
==Other Commands==
+
<table>
===Display help on these commands===
+
<thead>
<pre>--help</pre>
+
<tr><th colspan="2">Monster Attack Templates</th><tr>
<p>This command does not take any arguments. It displays a very short version of this document, showing the mandatory and optional arguments, and a brief description of each command.</p>
+
</thead>
===Switch on or off Debug mode===
+
<tr><th scope="row">^^attk1^^</th><td>Resolves to the name of the creature\'s attack 1, if provided (applies to monster attacks only)</td></tr>
<pre>--debug (ON/OFF)</pre>
+
<tr><th scope="row">^^attk2^^</th><td>Resolves to the name of the creature\'s attack 2, if provided (applies to monster attacks only)</td></tr>
<p>Takes one mandatory argument which should be ON or OFF.</p>
+
<tr><th scope="row">^^attk3^^</th><td>Resolves to the name of the creature\'s attack 3, if provided (applies to monster attacks only)</td></tr>
<p>The command turns on a verbose diagnostic mode for the API which will trace what commands are being processed, including internal commands, what attributes are being set and changed, and more detail about any errors that are occurring.  The command can be used by the DM or any Player – so the DM or a technical advisor can play as a Player and see the debugging messages.</p>
+
<tr><th scope="row">^^monsterCritHit^^</th><td>Resolves to the critical hit dice roll value of the creature (applies to monster/creature attacks only)</td></tr>
 +
<tr><th scope="row">^^monsterCritMiss^^</th><td>Resolves to the critical miss dice roll value of the creature (applies to monster/creature attacks only)</td></tr>
 +
<tr><th scope="row">^^monsterDmgMacro1^^</th><td>Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Monster Ability damage 1 Macro</td></tr>
 +
<tr><th scope="row">^^monsterDmgMacro2^^</th><td>Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Monster Ability damage 2 Macro</td></tr>
 +
<tr><th scope="row">^^monsterDmgMacro3^^</th><td>Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Monster Ability damage 3 Macro</td></tr>
 +
<tr><th scope="row">^^monsterDmg1^^</th><td>Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification for Monster attack 1, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
<tr><th scope="row">^^monsterDmg2^^</th><td>Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification for Monster attack 2, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
<tr><th scope="row">^^monsterDmg3^^</th><td>Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification for Monster attack 3, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
</table>
 +
<br>
 +
<table>
 +
<thead>
 +
<tr><th colspan="2">Melee Weapon Attack Templates</th><tr>
 +
</thead>
 +
<tr><th scope="row">^^weapAttkAdj^^</th><td>Resolves to the magical attack adjustment of the weapon</td></tr>
 +
<tr><th scope="row">^^weapStrHit^^</th><td>Resolves to a 1 if the character\'s strength to-hit bonus applies to this weapon, or 0 otherwise</td></tr>
 +
<tr><th scope="row">^^profPenalty^^</th><td>Resolves to any proficiency penalty incurred by the attacking character for using a non-proficient or related weapon</td></tr>
 +
<tr><th scope="row">^^specProf^^</th><td>Resolves to 1 if the attacking character is a specialist in the weapon, otherwise 0</td></tr>
 +
<tr><th scope="row">^^masterProf^^</th><td>Resolves to 1 if the attacking character is a master (double specialised) in the weapon, otherwise 0</td></tr>
 +
<tr><th scope="row">^^raceBonus^^</th><td>Resolves to the race bonus of the attacking character with this weapon</td></tr>
 +
<tr><th scope="row">^^twoWeapPenalty^^</th><td>Resolves to any penalty relevant if the attacking character is using two weapons to attack (is 0 for character classes that can use two weapons without penalty, such as rangers)</td></tr>
 +
<tr><th scope="row">^^weapDmgAdj^^</th><td>Resolves to the magical damage adjustment of the weapon</td></tr>
 +
<tr><th scope="row">^^magicDmgAdj^^</th><td>Resolves to any magical effect damage bonus or penalty resulting from magic currently in effect</td></tr>
 +
<tr><th scope="row">^^backstab^^</th><td>Resolves to a 1 if a backstab is being attempted, otherwise 0</td></tr>
 +
<tr><th scope="row">^^rogueLevel^^</th><td>Resolves to the Rogue class level of the attacking character</td></tr>
 +
<tr><th scope="row">^^weapon^^</th><td>Resolves to the name of the weapon</td></tr>
 +
<tr><th scope="row">^^weapCritHit^^</th><td>Resolves to the critical hit dice roll value of the weapon</td></tr>
 +
<tr><th scope="row">^^weapCritMiss^^</th><td>Resolves to the critical miss dice roll value of the weapon</td></tr>
 +
<tr><th scope="row">^^weapDmgSM^^</th><td>Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Medium and smaller opponents for the weapon, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
<tr><th scope="row">^^weapDmgL^^</th><td>Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Large and larger opponents for the weapon, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
<tr><th scope="row">^^weapStrDmg^^</th><td>Resolves to a 1 if the character\'s strength damage bonus applies to this weapon, or 0 otherwise</td></tr>
 +
<tr><th scope="row">^^mwSMdmgMacro^^</th><td>Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Melee weapon Ability damage Macro against Medium and smaller opponents</td></tr>
 +
<tr><th scope="row">^^mwLHdmgMacro^^</th><td>Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Melee weapon Ability damage Macro against Large and larger opponents</td></tr>
 +
</table>
 +
<br>
 +
<table>
 +
<thead>
 +
<tr><th colspan="2">Ranged Weapon Attack Templates</th><tr>
 +
</thead>
 +
<tr><th scope="row">^^weapon^^</th><td>Resolves to the name of the weapon</td></tr>
 +
<tr><th scope="row">^^dexMissile^^</th><td>Resolves to the dexterity missile adjustment of the attacking character</td></tr>
 +
<tr><th scope="row">^^weapDexBonus^^</th><td>Resolves to a 1 if the dexterity missile bonus applies to the weapon, otherwise 0</td></tr>
 +
<tr><th scope="row">^^strAttkBonus^^</th><td>Resolves to the strength to-hit bonus/penalty of the attacking character</td></tr>
 +
<tr><th scope="row">^^weapStrHit^^</th><td>Resolves to a 1 if the character\'s strength to-hit bonus applies to this weapon, or 0 otherwise</td></tr>
 +
<tr><th scope="row">^^profPenalty^^</th><td>Resolves to any proficiency penalty incurred by the attacking character for using a non-proficient or related weapon</td></tr>
 +
<tr><th scope="row">^^specProf^^</th><td>Resolves to 1 if the attacking character is a specialist in the weapon, otherwise 0</td></tr>
 +
<tr><th scope="row">^^masterProf^^</th><td>Resolves to 1 if the attacking character is a master (double specialised) in the weapon, otherwise 0</td></tr>
 +
<tr><th scope="row">^^raceBonus^^</th><td>Resolves to the race bonus of the attacking character with this weapon</td></tr>
 +
<tr><th scope="row">^^twoWeapPenalty^^</th><td>Resolves to any penalty relevant if the attacking character is using two weapons to attack (is 0 for character classes that can use two weapons without penalty, such as rangers)</td></tr>
 +
<tr><th scope="row">^^weapDmgAdj^^</th><td>Resolves to the magical damage adjustment of the weapon</td></tr>
 +
<tr><th scope="row">^^rangeMod^^</th><td>Resolves to the range attack modifier</td></tr>
 +
<tr><th scope="row">^^rangeN^^</th><td>Resolves to 1 if the range is "Near", otherwise 0</td></tr>
 +
<tr><th scope="row">^^rangePB^^</th><td>Resolves to 1 if the range is "Point Blank", otherwise 0</td></tr>
 +
<tr><th scope="row">^^rangeS^^</th><td>Resolves to 1 if the range is "Short", otherwise 0</td></tr>
 +
<tr><th scope="row">^^rangeM^^</th><td>Resolves to 1 if the range is "Medium", otherwise 0</td></tr>
 +
<tr><th scope="row">^^rangeL^^</th><td>Resolves to 1 if the range is "Long", otherwise 0</td></tr>
 +
<tr><th scope="row">^^rangeF^^</th><td>Resolves to 1 if the range is "Far", otherwise 0</td></tr>
 +
<tr><th scope="row">^^rangeSMLF^^</th><td>Resolves to 1 if the range is not "Near" or "Point Blank", otherwise 0</td></tr>
 +
<tr><th scope="row">^^ammoDmgAdj^^</th><td>Resolves to the magical damage adjustment of the selected ammunition of the ranged weapon</td></tr>
 +
<tr><th scope="row">^^magicDmgAdj^^</th><td>Resolves to any magical effect damage bonus or penalty resulting from magic currently in effect</td></tr>
 +
<tr><th scope="row">^^strDmgBonus^^</th><td>Resolves to the strength damage bonus/penalty of the attacking character</td></tr>
 +
<tr><th scope="row">^^weapCritHit^^</th><td>Resolves to the critical hit dice roll value of the weapon</td></tr>
 +
<tr><th scope="row">^^weapCritMiss^^</th><td>Resolves to the critical miss dice roll value of the weapon</td></tr>
 +
<tr><th scope="row">^^ACvsNoModsMissile^^</th><td>Resolves to the targeted Armour Class vs missiles macro call <i>@{target|Select Target|ACmissile-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsSlashMissile^^</th><td>Resolves to the targeted Slashing damage Armour Class vs missiles macro call <i>@{target|Select Target|SlashACmissile-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsPierceMissile^^</th><td>Resolves to the targeted Piercing Armour Class vs missiles macro call <i>@{target|Select Target|PierceACmissile-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsBludgeonMissile^^</th><td>Resolves to the targeted Bludgeoning Armour Class vs missiles macro call <i>@{target|Select Target|BludgeonACmissile-field}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
 +
<tr><th scope="row">^^ACvsNoModsMissileTxt^^</th><td>Resolves to the text "No Mods"</td></tr>
 +
<tr><th scope="row">^^ACvsSlashMissileTxt^^</th><td>If this is a slashing weapon, resolves to the text "Slash", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsPierceMissileTxt^^</th><td>If this is a piercing weapon, resolves to the text "Pierce", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsBludgeonMissileTxt^^</th><td>If this is a bludgeoning weapon, resolves to the text "Bludgeon", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsSmissileTxt^^</th><td>If this is a slashing weapon, resolves to the text "S", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsPmissileTxt^^</th><td>If this is a piercing weapon, resolves to the text "P", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ACvsBmissileTxt^^</th><td>If this is a slashing weapon, resolves to the text "B", otherwise resolves to an empty string</td></tr>
 +
<tr><th scope="row">^^ammoDmgSM^^</th><td>Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Medium and smaller opponents for the ammunition used, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
<tr><th scope="row">^^ammoDmgL^^</th><td>Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Large and larger opponents for the ammunition used, or (b) a Roll Query requesting the Player to enter a dice roll result</td></tr>
 +
<tr><th scope="row">^^ammoStrDmg^^</th><td>Resolves to a 1 if the character\'s strength damage bonus applies to the selected ammunition, or 0 otherwise</td></tr>
 +
<tr><th scope="row">^^ammoLeft^^</th><td>Resolves to the quantity of the selected ammunition left after this attack</td></tr>
 +
<tr><th scope="row">^^rwSMdmgMacro^^</th><td>Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Ranged weapon Ability damage Macro against Medium and smaller opponents</td></tr>
 +
<tr><th scope="row">^^rwLHdmgMacro^^</th><td>Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Ranged weapon Ability damage Macro against Large and larger opponents</td></tr>
 +
</table>
 +
<br>
 +
==Character (PC & NPC) Attack Templates==
 +
<p>As previously described, the Attacks Database contains Attack Templates as Ability Macro entries on the <i>Attributes and Abilities</i> tab of a Character Sheet.  For Characters and NPCs that attack using weapons "in-hand" (see AttackMaster API documentation for information on taking weapons "in-hand"), four standard Attack Templates are required: -ToHit; -DmgSM; -DmgL; and -Targeted-Attk.</p>
 +
===The "To Hit" Template===
 +
<p>The standard <i>To Hit</i> Attack Template looks like this:</p>
 +
<h4>MW-ToHit</h4>
 +
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^ </b>&{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> Attacks with their <b>^^weapon^^</b>}}<mark style="color:green">Specs=[MWtoHit,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[<b>^^thac0^^</b>]][Thac0])-([[(([[<b>^^weapAttkAdj^^</b>]][Weapon+])+([[(<b>^^strAttkBonus^^</b> * <b>^^weapStrHit^^</b>)]][Strength+])+([[<b>^^profPenalty^^</b>]][Prof Penalty]+[[<b>^^specProf^^</b>]][Specialist]+[[<b>^^masterProf^^</b>*3]][Mastery])+([[<b>^^raceBonus^^</b>]][Race mod])+([[<b>^^magicAttkAdj^^</b>]][Magic hit adj])+([[<b>^^twoWeapPenalty^^</b>]][2-weap penalty]))]][Adjustments])-<b>^^toHitRoll^^</b>cs\><b>^^weapCritHit^^</b>cf\<<b>^^weapCritMiss^^</b>]]<br>
 +
<b>^^ACvsSlashTxt^^</b> <b>^^ACvsPierceTxt^^</b> <b>^^ACvsBludgeonTxt^^</b> attack}}{{Total Adjustments=[[(([[<b>^^weapAttkAdj^^</b>]][Weapon+])+([[(<b>^^strAttkBonus^^</b> * <b>^^weapStrHit^^</b>)]][Strength+])+([[<b>^^profPenalty^^</b>]][Prof Penalty]+[[<b>^^specProf^^</b>]][Specialist]+[[<b>^^masterProf^^</b>*3]][Mastery])+([[<b>^^raceBonus^^</b>]][Race mod])+([[<b>^^magicAttkAdj^^</b>]][Magic hit adj])+([[<b>^^twoWeapPenalty^^</b>]][2-weap penalty]))]]}}<br>
 +
<b>^^toWho^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=Do Damage?}}{{desc=If successfully hit<br>
 +
[TSM Damage](~<b>^^mwSMdmgMacro^^</b>) or [LH Damage](~<b>^^mwLHdmgMacro^^</b>)}}</p>
 +
<p>As with all RPGMaster database items, the Attack Templatre has a <i>Specs</i> section:</p>
 +
<pre>Specs=[MWtoHit,AttackMacro,1d20,Attack]</pre>
 +
<p>The four fields in the <i>Specs</i> data are the standard four used in all Specs fields: Entry Type (MWtoHit), Entry Class (AttackMacro), Handedness (in this case replaced by toHit dice roll spec 1d20), and Entry Supertype (Attack).  The key field to note here is the <b>ToHit Dice Roll Specification</b> (which replaces the <i>Handedness</i> field).  This can be any valid dice roll, and will be used for the <i>^^toHitRoll^^</i> template field if the Player selects Roll20 to roll the attack dice.</p>
 +
<p>This Attack Template is formatted using a Roll20 Roll Template with a type specified using the <i>^^defaultTemplate^^</i> template field, but need not be - formatting is up to the creator of the Attack Template.  It is important this information is displayed to the right people - Players that control a character, all Players as a public post, or just the DM for attacks by creatures & NPCs.  The <i>^^toWhoPublic^^</i> template field will check if the attacking token represents a Character/NPC/Creature controlled by a Player and, if so, make a public post that all can see, but otherwise just whisper the results of the attack to the DM only.  Similarly, <i>^^toWho^^</i> will whisper the attack information either only to the Player(s) that control the attacking character/creature or, if no one does, then to the DM.</p>
 +
<p>The rest of the Attack Template defines the calculations using the API supplied data to display the Armour Class value that would be successfully hit by the attacking character, with the selected weapon under the current conditions.  It also defines a display of the adjustments that are made to the dice roll which the Players and DM can hover a mouse over to get an explanation of the calculations.  All the calculations and tag display are standard Roll20 functionality, so once the Attack Template Data Fields are replaced by actual values by the API and the resulting Ability Macro saved to the attacking character\'s Character Sheet, running it like any other Ability Macro will use only Roll20 functionality, and not involve use of the APIs.</p>
 +
<p>The Attack Template shown above is a To Hit template for a Melee weapon attack.  That for a Ranged weapon attack is very similar, just using some different and ranged attack related Template Fields.</p>
 +
===The "Damage" Templates===
 +
<p>There are always two damage Attack Templates to go with each <i>To Hit</i> Template, typically one for damage to Medium and smaller opponents and one for Large and larger.  However, as will be seen when discussing the <i>Oil Flask</i> bespoke Attack Templates below, those are not always the outcomes of the two damage Templates.  However, they <i>do</i> always start with MW-DmgSM and MW-DmgL for Melee weapon attacks, and RW-DmgSM and RW-DmgL for Ranged weapon attacks (optionally followed by a race, class or weapon name). The standard <i>Damage</i> Attack Template looks like this:</p>
 +
<h4>MW-DmgSM</h4>
 +
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> does damage with their <b>^^weapon^^</b>}}<mark style="color:green">Specs=[MWdmgSM,AttackMacro,1d20,Attack]</mark>{{Damage vs TSM=[[([[ ([[<b>^^weapDmgSM^^</b>]][Dice Roll])+([[<b>^^strDmgBonus^^</b>*<b>^^weapStrDmg^^</b>]][Strength+])+([[<b>^^weapDmgAdj^^</b>]][weapon+])+([[<b>^^magicDmgAdj^^</b>]][Magic dmg adj])+([[<b>^^specProf^^</b>*2]][Specialist+]+[[<b>^^masterProf^^</b>*3]][Mastery+])]][Adjustments])]] HP}}{{Total Plusses=[[[[<b>^^strDmgBonus^^</b>*<b>^^weapStrDmg^^</b>]][Strength+]+([[<b>^^weapDmgAdj^^</b>]][weapon+])+([[<b>^^magicDmgAdj^^</b>]][Magic dmg adj])+([[<b>^^specProf^^</b>*2]][Specialist+]+[[<b>^^masterProf^^</b>*3]][Mastery+])]]}}</p>
 +
<p>The damage Attack Template works in the same way as the other Attack Templates as explained above for the <i>ToHit</i> template.  While the <i>Specs</i> data includes the "To Hit" dice roll specification, this is not used in the damage Template, and is irrelevant.  That field just needs to hold something, and a dice roll specification is what is expected.  Hopefully, the rest of this damage Attack Template is self explanatory.</p>
 +
==Monster Attack Templates==
 +
<p>If a creature specified as a Monster on the Character Sheet uses in-hand weapons, as supported under the RPGMaster APIs, attacks with those weapons (Melee or Ranged) will use the standard <i>To Hit</i> and <i>Damage</i> Attack Templates described above.  However, attacks by creatures that are specified on the Monster tab of the Advanced 2nd Edition character sheet, and under AD&D 2nd Edition rules, are much simpler than character attacks with in-hand weapons.  The differences mean that such creatures require different Attack Templates.  Attacks specified on the Monster tab use the Monster Attack Templates: Mon-Attk1, Mon-Attk2, Mon-Attk3, and Mon-Dmg1, Mon-Dmg2, Mon-Dmg3 (or the Targeted Attack Templates, see later).  Remember that the AttackMaster API supports an extension of the Monster Attk fields on the Advanced 2nd Edition Character Sheet: each can contain a comma-separated list consisting of "attack name","dice roll","speed in segments" (see AttackMaster Help for details).</p>
 +
<p>The Monster Attack and Damage Templates look like this:</p>
 +
<h4>Mon-Attk1</h4>
 +
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> attacks with their <b>^^attk1^^</b>}}<mark style="color:green">Specs=[MonAttk1,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[ ( ([[<b>^^thac0^^</b>]][Thac0]) - ([[<b>^^magicAttkAdj^^</b>]][Magic hit adj]) - <b>^^toHitRoll^^</b>cs\><b>^^monsterCritHit^^</b>cf\<<b>^^monsterCritMiss^^</b> )]]}}<br>
 +
<b>^^toWho^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=Do Damage?}}{{desc=If this hits [Do Damage](~<b>^^monsterDmgMacro1^^</b>)}}</p>
 +
<br>
 +
<h4>Mon-Dmg1</h4>
 +
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> does damage with their <b>^^attk1^^</b>}}<mark style="color:green">Specs=[MonDmg1,AttackMacro,1d20,Attack]</mark>{{Damage=[[(([[<b>^^monsterDmg1^^</b>]][<b>^^attk1^^</b> Dmg])+([[<b>^^magicDmgAdj^^</b>]][Added Magic Dmg]))]] HP}}</p>
 +
<p>Unsurprisingly, these work in exactly the same way as other Attack Templates.</p>
 
<br>
 
<br>
=Character Sheet and Token setup for use with RPGMaster APIs=
+
==Targeted Attack Templates==
==Token configuration==
+
<p>The AttackMaster API supports the DM (and optionally, Players) using "targeted attacks".  This is an attack that prompts the DM / Player to select a target token, and then performs all attack and damage dice rolls at the same time, displaying the attack results alongside the Armour Class and Hit Points of the targeted opponent. This speeds the attack process even further than having the API do all the attack calculations.  <b>Note:</b> the results of the attack <i>are not</i> applied to the targeted opponent - the results are still open to interpretation by the Players and DM, and circumstantial adjustment before manually applying them to the Token / Character Sheet of the opponent.</p>
<p>The API can work with any Token configuration but requires tokens that are going to participate in API actions to represent a Character Sheet, so that actions relevant to the token and the character it represents can be selected. </p>
+
<p>The Ranged weapon Attack Template looks like this:</p>
<p>A single Character Sheet can have multiple Tokens representing it, and each of these are able to do individual actions made possible by the data on the Character Sheet jointly represented. However, if such multi-token Characters / NPCs / creatures are likely to encounter spells that will affect the Character Sheet (such as <i>Haste</i> and <i>Slow</i>) they must be split with each Token representing a separate Character Sheet, or else the one spell will affect all tokens associated with the Character Sheet, whether they were targeted or not!  In fact, <b>it is recommended that tokens and character sheets are 1-to-1 to keep things simple.</b></p>
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWho^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> Attacks @{Target|Select Target|Token_name} with their <b>^^weapon^^</b>}}<mark style="color:green">Specs=[RWtargetedAttk,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[<b>^^thac0^^</b>]][Thac0])-(([[<b>^^weapAttkAdj^^</b>]][Weapon+]) + ([[<b>^^ammoDmgAdj^^</b>]][Ammo+]) + ([[ <b>^^weapDexBonus^^</b>*[[<b>^^dexMissile^^</b>]]]][Dexterity+] )+([[[[<b>^^strAttkBonus^^</b>]]*[[<b>^^weapStrHit^^</b>]]]][Strength+])+([[<b>^^raceBonus^^</b>]][Race mod])+([[<b>^^profPenalty^^</b>]][Prof penalty])+([[<b>^^magicAttkAdj^^</b>]][Magic Hit+])+([[<b>^^twoWeapPenalty^^</b>]][2-weap penalty])+([[<b>^^rangeMod^^</b>]][Range mod]))-<b>^^toHitRoll^^</b>cs\><b>^^weapCritHit^^</b>cf\<<b>^^weapCritMiss^^</b> ]] }}{{Target AC=<b>^^ACvsNoModsTxt^^</b>:<b>^^ACvsNoModsMissile^^</b><br>
<p>The recommended Token Bar assignments for all APIs in the Master Series are:</p>
+
<b>^^ACvsSlashMissileTxt^^</b>:<b>^^ACvsSlashMissile^^</b> <b>^^ACvsPierceMissileTxt^^</b>:<b>^^ACvsPierceMissile^^</b> <b>^^ACvsBludgeonMissileTxt^^</b>:<b>^^ACvsBludgeonMissile^^</b>}}{{Damage if hit SM=[[ floor( [[<b>^^ammoDmgSM^^</b>]][Dice roll] * [[(<b>^^rangeN^^</b>*0.5)+(<b>^^rangePB^^</b>*(1+<b>^^masterProfPB^^</b>))+(<b>^^rangeSMLF^^</b>*1)]]) + ([[<b>^^rangePB^^</b>*<b>^^masterProfPB^^</b>*2]])+ (([[<b>^^ammoDmgAdj^^</b>]][Ammo+])+([[<b>^^magicDmgAdj^^</b>]][Magic dmg+]) +([[<b>^^strDmgBonus^^</b>*<b>^^ammoStrDmg^^</b>]][Strength+])) ]]HP}}{{Damage if hit LH=[[ floor( [[<b>^^ammoDmgL^^</b>]][Dice roll] * [[(<b>^^rangeN^^</b>*0.5)+(<b>^^rangePB^^</b>*(1+<b>^^masterProfPB^^</b>))+(<b>^^rangeSMLF^^</b>*1)]]) + ([[<b>^^rangePB^^</b>*<b>^^masterProfPB^^</b>*2]]) + (([[<b>^^ammoDmgAdj^^</b>]][Ammo+])+([[<b>^^magicDmgAdj^^</b>]][Magic dmg+]) +([[<b>^^strDmgBonus^^</b>*<b>^^ammoStrDmg^^</b>]][Strength+])) ]]HP}}{{Target HP=<b>^^targetHPfield^^</b> HP}}{{Ammo left=<b>^^ammoLeft^^</b>}}</p>
{| class="wikitable"
+
<p>The key difference, other than doing all of the calculations for the Armour Class hit and both the damage for Medium and smaller and Large and larger, is that several of the Template Fields used resolve to appropriately formatted Roll20 <i>@{target|...}</i> entries, that will display values from the targeted opponent\'s token and/or character sheet.  The API searches for the most appropriate token and character sheet fields to resolve the targeted Template Fields to (it searches the attacking creature\'s data, and assumes all tokens are set up the same way): if using the standard RPGMaster token settings (as set by the <b>CommandMaster API --abilities</b> command or [Token Setup] DM\'s Macro button) it will find the data it needs on the token; otherwise it will first search other token fields, then standard Character Sheet character tab fields, then Character Sheet monster tab fieldsIf the API can\'t find AC or HP data, it will display appropriate text saying the data was not found, but will not cause an error.  Thus it is sensible to use these Template Fields rather than statically defined <i>@{target|...}</i> commands.</p>
|+  
+
|-
+
! scope="row"| Bar1 (Green Circle):
+
|| Armour Class (AC field) – only current value
+
|-
+
! scope="row"| Bar2 (Blue Circle):
+
|| Base Thac0 (thac0-base field) before adjustments – only current value
+
|-
+
! scope="row"| Bar3 (Red Circle):
+
|| Hit Points (HP field) – current & max
+
|}
+
<p>It is recommended to use these assignments, and they are the bar assignments set by the <b>CommandMaster API</b> if its facilities are used to set up the tokensAll tokens must be set the same way, whatever way you eventually choose.</p>
+
 
<br>
 
<br>
==Use with various game system character sheets==
+
==8. Bespoke / Custom Attack Templates==
<p>The API issued is initially set up to work with the AD&D 2E character sheet (as this is what the author mostly plays).  However, it can be set up for any character sheetIn the AttackMaster API code, right at the top, is an object definition called 'fields': see section 3 for details.  This can be altered to get the API to work with other character sheets.</p>
+
<p>All of the above examples and discussion have explored the standard Attack Templates distributed with the AttackMaster API.  It will be the case that this will cater for around 95% of attacks and attack-like situations (e.g. there is a weapon called "Touch" which Spell Casters can use for touch-attack spells, which uses the standard Attack Templates without change to achieve the needed outcome).  However, for that other 5% (or perhaps closer to 1%) of special cases you can define your own bespoke or custom Attack TemplatesBeing able to change the way attacks are calculated is also essential if you wish to adapt the API to work for game systems other than Advanced Dungeons & Dragons 2nd Edition.</p>
<p>The coding of the API is designed to use the AD&D 2E system of attack calculations, armour class values and saving throw managementIf you use another system (e.g. the D&D 5e system) the API coding will need to change.  This might be a future enhancement.</p>
+
<p>As stated in Section 1, you <i>should not</i> add Attack Templates to the <i>Attacks-DB</i> database directly as, when updates are released, the whole database will be overwritten and your additions will be lostInstead, create your own Character Sheet named <i>Attack-DB-[any-name-you-want]</i> and add Attack Templates to it. If you want to replace the Attack Templates provided for Melee weapons, Ranged weapons and/or Monster attacks, just create ones in your added database with the same Ability Macro name and they will automatically be used in preference to the standard versions.</p>
==Matching the API to a type of Character Sheet==
+
<p>As also mentioned previously, while Attack Templates are always called with names of the format given in Section 3, they do not have to result in standard attacks or damage - the calculations and resulting information provided to players can be whatever is needed as a result of that attack action.  An example of this is included in the distributed <i>Attacks-DB</i>, the <b>Oil Flask Attack Template set</b>:</p>
<p>The API has an object definition called 'fields', which contains items of the form </p>
+
<h4>RW-ToHit-Oil-Flask</h4>
<pre>Internal_api_name: [sheet_field_name, field_attribute, optional_default_value, optional_set_with_worker_flag]</pre>
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> throws a prepared oil flask}}<mark style="color:green">Specs=[RWtoHit,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[<b>^^thac0^^</b>]][Thac0])-([[([[<b>^^weapAttkAdj^^</b>]][Weapon+]) + ([[<b>^^ammoDmgAdj^^</b>]][Ammo+]) + ([[ <b>^^weapDexBonus^^</b>*[[<b>^^dexMissile^^</b>]]]][Dexterity+] )+([[[[<b>^^strAttkBonus^^</b>]]*[[<b>^^weapStrHit^^</b>]]]][Strength+])+([[<b>^^raceBonus^^</b>]][Race mod])+([[<b>^^profPenalty^^</b>]][Prof penalty])+([[<b>^^</b>magicAttkAdj^^</b>]][Magic Hit+])+([[<b>^^twoWeapPenalty^^</b>]][2-weap penalty])+([[<b>^^rangeMod^^</b>]][Range mod])]][Adjustments])-<b>^^toHitRoll^^</b>cs\><b>^^weapCritHit^^</b>cf\<<b>^^weapCritMiss^^</b> ]]<br>
<p>A typical example might be:</p>
+
<b>^^ACvsSlashMissileTxt^^</b> <b>^^ACvsPierceMissileTxt^^</b> <b>^^ACvsBludgeonMissileTxt^^</b> attack}}{{Total Adjustments=[[([[<b>^^weapAttkAdj^^</b>]][Weapon+]) + ([[<b>^^ammoDmgAdj^^</b>]][Ammo+]) + ([[ <b>^^weapDexBonus^^</b>*[[<b>^^dexMissile^^</b>]]]][Dexterity+] )+([[[[<b>^^strAttkBonus^^</b>]]*[[<b>^^weapStrBonus^^</b>]]]][Strength+])+([[<b>^^raceBonus^^</b>]][Race mod])+([[<b>^^profPenalty^^</b>]][Prof penalty])+([[<b>^^magicAttkAdj^^</b>]][Magic Hit+])+([[<b>^^twoWeapPenalty^^</b>]][2-weap penalty])+([[<b>^^rangeMod^^</b>]][Range mod])]]}}{{Ammo left=<b>^^ammoLeft^^</b>}}<br>
<pre>Fighter_level:['level-class1','current'],
+
<b>^^toWho^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=Do Damage?}}{{desc=Select the appropriate result<br>
Or
+
[Direct hit](~<b>^^rwSMdmgMacro^^</b>) or [Grenade/Splash](~<b>^^rwLHdmgMacro^^</b>)}}</p>
MUSpellNo_memable:['spell-level-castable','current','',true],</pre>
+
<p>The <i>To Hit</i> Attack Template is very similar to a normal Ranged weapon Attack Template, except that instead of API buttons indicating damage rolls vs. different sized opponents, it provides one API button to select a [Direct Hit], and another selecting a [Grenade/Splash] outcomeEach of these still calls the same damage Attack Templates using the Template Fields provided but in this case, because the attack is with a weapon called <i>Oil Flask</i>, the Template Fields will resolve to calls to <b>RW-DmgSM-Oil-Flask</b> and <b>RW-DmgL-Oil-Flask</b> respectively, and these custom Attack Templates do damage in a very different way to a normal Ranged Weapon attack.</p>
<p>The <i>internal_api_name</i> <b><u>must not be altered!</u></b> Doing so will cause the system not to work.  However, the <i>sheet_field_name</i> and <i>field_attribute</i> can be altered to match any character sheet.</p>
+
<h4>RW-DmgSM-Oil-Flask</h4>
<p>Table names are slightly different: always have an <i>internal_api_name</i> ending in '_table' and their definition specifies the repeating table name and the index of the starting row of the table or -1 for a static field as the 1<sup>st</sup> row.</p>
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b>\'s oil flask scores a direct hit}}<mark style="color:green">Specs=[RWdmgSM,AttackMacro,1d20,Attack]</mark>{{subtitle=Fire damage}}{{Round 1=Fire damage [[2d6]]}}{{Round 2=Will be rolled next round}}<br>
<p><i>Internal_api_table: [sheet_repeating_table_name,starting_index]</i></p>
+
!rounds --aoe @{target|Who\'s the target?|token_id}|circle|feet|0|7|0|fire|true --target single|@{selected|token_id}|@{target|Who\'s the target?|token_id}|Oil-fire|1|-1|Taking fire damage from burning oil|three-leaves</p>
<p>An example is:</p>
+
<p>The <i>Oil Flask</i> version of the <i>RW-DmgSM</i> Attack Template caters for damage done by an Oil Flask successfully scoring a direct hit on an opponentThis results in a damage dice roll for this round of 2d6 with no modifiers, and then also makes an API call to the <b>RoundMaster API</b> with two stacked commands: an Area of Effect call to place fire on the opponent\'s token, and a Target call to add a status to the opponent\'s token which will last 2 rounds, causing a Status Effect to run in the second round to prompt for another damage roll of 1d6.</p>
<pre>MW_table:['repeating_weapons',0],</pre>
+
<h4>RW-DmgL-Oil-Flask</h4>
<p>The <i>internal_api_table</i> <b><u>must not be altered!</u></b> Doing so will cause the system not to work.  However, the <i>sheet_repeating_table_name</i> and <i>starting_index</i> can be altered to match any character sheet.</p>
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b>\'s oil flask smashes in a ball of flame}}<mark style="color:green">Specs=[RWdmgL,AttackMacro,1d20,Attack]</mark>{{subtitle=Fire damage}}{{Location=Drag the crosshair to where the oil flask smashed}}{{Splash=Those splashed take [[ceil([[1d6]]/2)]]HP fire damage}}<br>
<p>Each character sheet must have repeating tables to hold weapons, ammo and magic items, as well as other data.  By default, melee weapons 'in hand' are held in sections of the repeating_weapons table, melee weapon damage in the repeating_weapons-damage table, ranged weapons in the repeating_weapons2 table, ammo in the repeating_ammo table, and magic items are held in the repeating_potions table.  The table management system provided by the API expands and writes to repeating attributes automatically, and the DM & Players do not need to worry about altering or updating any of these tables on the Character Sheet. </p>
+
!rounds --aoe <b>^^tid^^</b>|circle|feet|[[(<b>^^rangeN^^</b>*5)+(<b>^^rangePB^^</b>*10)+(<b>^^rangeS^^</b>*10)+(<b>^^rangeM^^</b>*20)+(<b>^^rangeL^^</b>*30)+(<b>^^rangeF^^</b>*30)-5]]|4|0|fire</p>
==Character Attributes, Races, Classes and Levels==
+
<p>The <i>Oil Flask</i> version of the <i>RW-DmgL</i> Attack Template caters for an Oil Flask that either missed its intended target, or is deliberately used as a grenade-like missile.  This results in a dice roll of 1d3 splash damage to anyone in the area of effect, which is shown using a call to the <b>RoundMaster API</b> Area of Effect command which this time can be positioned where the oil flask landed.</p>
<p>Character Attributes of <i>Strength, Dexterity, Constitution, Intelligence, Wisdom</i> and <i>Charisma</i> are generally not directly important to the RPGMaster Series APIs, but the resulting bonuses and penalties are.  All Attributes and resulting modifiers should be entered into the Character Sheet in the appropriate places (that is in the Character Sheet fields identified in the 'fields' API object as noted in section 2 above).</p>
+
<h4>RW-Targeted-Attk-Oil-Flask</h4>
<p>The Character's race is also important for calculating saves and ability to use certain items.  The race should be set in the appropriate Character Sheet field.  Currently, the races <i>'dwarf', 'elf', 'gnome', 'halfelf', 'halfling', 'half-orc'</i> and <i>'human'</i> are implemented (not case sensitive, and spaces, hyphens and underscores are ignored).  If not specified, <i>human</i> is assumed. The race impacts saves, some magic items and armour, and bonuses on some attacks.</p>
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWho^^</b> &{template:<b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> throws a prepared oil flask at @{Target|Select Target|Token_name}}}<mark style="color:green">Specs=[RWtargetedAttk,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[<b>^^thac0^^</b>]][Thac0])-(([[<b>^^weapAttkAdj^^</b>]][Weapon+]) + ([[<b>^^ammoDmgAdj^^</b>]][Ammo+]) + ([[ <b>^^weapDexBonus^^</b>*[[<b>^^dexMissile^^</b>]]]][Dexterity+] )+([[[[<b>^^strAttkBonus^^</b>]]*[[<b>^^weapStrHit^^</b>]]]][Strength+])+([[<b>^^raceBonus^^</b>]][Race mod])+([[<b>^^profPenalty^^</b>]][Prof penalty])+([[<b>^^magicAttkAdj^^</b>]][Magic Hit+])+([[<b>^^twoWeapPenalty^^</b>]][2-weap penalty])+([[<b>^^rangeMod^^</b>]][Range mod]))-<b>^^toHitRoll^^</b>cs\\gt<b>^^weapCritHit^^</b>cf\\lt<b>^^weapCritMiss^^</b> ]] }}{{Target AC=<b>^^ACvsNoModsTxt^^</b>:<b>^^ACvsNoModsMissile^^</b><br>
<p>The system supports single-class and multi-class charactersClasses must be entered in the appropriate fields on the Character Sheet.  Classes and levels affect spell casting ability, ability to do two-weapon attacks with or without penalty, and the ability to backstab and the related modifiers, among other things.  Class and level also determine valid weapons, armour, shields, some magic items and saves.</p>
+
<b>^^ACvsSlashMissileTxt^^</b>:<b>^^ACvsSlashMissile^^</b> <b>^^ACvsPierceMissileTxt^^</b>:<b>^^ACvsPierceMissile^^</b> <b>^^ACvsBludgeonMissileTxt^^</b>:<b>^^ACvsBludgeonMissile^^</b>}}{{ =Direct Hit}}{{Target=[Direct hit on target](!rounds --aoe @{Target|Select Target|token_id}|circle|feet|0|6|0|fire|true --target single|@{selected|token_id}|@{Target|Select Target|token_id}|Oil-fire|1|-1|Taking fire damage from burning oil|three-leaves)}}{{Dmg Round 1=[[2d6]]HP fire damage}}{{Dmg Round 2=Roll next round}}{{. =Splash Damage}}{{Location=[Select where flask smashed](!rounds --aoe <b>^^tid^^</b>|circle|feet|[[(<b>^^rangeN^^</b>*5)+(<b>^^rangePB^^</b>*10)+(<b>^^rangeS^^</b>*10)+(<b>^^rangeM^^</b>*20)+(<b>^^rangeL^^</b>*30)+(<b>^^rangeF^^</b>*30)-5]]|4|0|fire)}}{{Damage=[[ceil([[1d6]]/2)]]HP fire damage}}{{Target HP=<b>^^targetHPfield^^</b> HP}}{{Ammo left=<b>^^ammoLeft^^</b>}}</p>
<p><b>Important Note:</b> on the Advanced D&D 2e Character Sheet, Fighter classes must be in the first class column, Wizard classes in the second column, Priest classes in the third, Rogues in the fourth, and Psions (or any others) in the fifth.  It is important that these locations are adhered to.</p>
+
<p>The <i>Oil Flask</i> version of the <i>RW-Targeted-Attk</i> Attack Template combines the functions and calculations of the other Oil Flask custom Attack Templates in a single result display, with appropriate API buttons to implement the various outcomes of the attack.</p>
<p><b>Note:</b> classes of Fighter and Rogue (such as Rangers and Bards) that can use clerical &/or wizard spells will automatically be allowed to cast spells once they reach the appropriate level by AD&D 2e rules, but not before.  They <b><u>do not</u></b> need to have levels set in the corresponding spell-caster columns - the casting ability & level is worked out by the system</p>
+
<p>Similar or entirely different custom Attack Templates can be created for other individual weapons with non-standard attack outcomes, or for individual classes of character, creatures, or racesJust use the Attack Template naming conventions described in Section 3, and add them to your own Attack Databases as described in Section 1, and you can give Players more interesting situations and means of dealing with themWhen combined with the features and capabilities of the RoundMaster API and other APIs of the RPGMaster suite, the possibilities are endless!</p>
 
+
<p>The following Classes are currently supported:</p>
+
{| class="wikitable"
+
|+
+
|-
+
! Fighter classes !! Wizard Classes !! Priest Classes !! Rogue Classes !! Psion Classes
+
|-
+
| Warrior || Wizard || Priest || Rogue || Psion
+
|-
+
| Fighter || Mage || Cleric || Thief ||  
+
|-
+
| Ranger || Abjurer || Druid || Bard ||
+
|-
+
| Paladin || Conjurer || Healer || Assassin ||
+
|-
+
| Beastmaster || Diviner || Priest of Life ||  ||
+
|-
+
| Barbarian || Enchanter || Priest of War || ||
+
|-
+
| Defender (Dwarven) || Illusionist || Priest of Light || ||
+
|-
+
| || Invoker || Priest of Knowledge || ||
+
|-
+
| || Necromancer || Shaman || ||
+
|-
+
| || Transmuter || || ||
+
|}
+
<p>The level for each class must be entered in the corresponding fieldMultiple classes and levels can be entered, and will be dealt with accordingly.  Generally, the most beneficial outcome for any combination will be used. </p>
+
==Magic Items and Equipment==
+
<p>All magic items and standard equipment, including weapons, armour, lanterns etc, are held in the Items table, which by default is set to the potions table, <i>repeating_potions</i>, on the Character Sheet.  As with other fields, this can be changed in the <i>'fields'</i> object.  The best way to put items into this table is by using the <b>MagicMaster API</b> commands <b>--edit-mi</b> or the GM-only command <b>--gm-edit-mi</b>.  Alternatively, the <b>AttackMaster --edit-weapons</b> command can be used to load weapons, ammunition and armour into the Items table.  It is generally possible to enter item names and quantities directly into the table and use them within the system, but only items that also exist in the supplied databases will actually work fully with the API (i.e. be recognised by the API as weapons, armour, ammo, etc).  Other items can be in the table but will not otherwise be effective.</p>
+
<p>Items can be added to the databases.  See the Database Handouts for more information on the databases.</p>
+
==Weapons and Ammo==
+
<p>For the APIs to work fully the melee weapons, damage, ranged weapons and ammo must be selected using the <b>AttackMaster --weapon</b> command to take the weapon 'in hand'.  This will display a menu to take weapons and shields from the Items table and take them in hand, ready to use.  This automatically fills all the correct fields for the weapons and ammo to make attacks, including many fields that are not displayed.  Entering weapon data directly into the melee weapon, damage, ranged weapon and ammo tables will generally work, but will be overwritten if the --weapon command is used.  Also, some API functions may not work as well or at all.</p>
+
<p>For the <b>InitiativeMaster API</b> to support weapon attack actions weapon name, speed and number of attacks are the most important fields.  For the <b>AttackMaster API</b> to support attack rolls, proficiency calculations, ranged attacks, strength and dexterity bonuses, and other aspects of functionality, fill in as many fields as are visible on the character sheet.  When entering data manually, ensure that the row a melee or ranged weapon is in matches the row damage or ammo is entered in the respective tables (there is no need to do this if using AttackMaster functions to take weapons in-hand, as the relevant lines are otherwise linked).</p>
+
==Weapon Proficiencies==
+
<p>Weapon Proficiencies must be set on the Character Sheet.  This is best done by using the <b>CommandMaster API</b> character sheet management functions, but can be done manually.  Both specific weapons and related weapon groups can be entered in the table, and when a Player changes the character's weapons in-hand the table of proficiencies will be consulted to set the correct bonuses and penalties.  Weapon specialisation and mastery (otherwise known as double specialisation) are supported by the CommandMaster functions, but can also be set by ticking/selecting the relevant fields on the Character Sheet weapon proficiencies table.  If a weapon or its related weapon group does not appear in the list, it will be assumed to be not proficient.</p>
+
==Spell books and memorisable spells==
+
<p>The best (and easiest) way to give a Character or NPC spells and powers is to use <b>CommandMaster API</b> to add spells and powers to the Character's spellbooks, and <b>MagicMaster API</b> to memorise and cast spells and use powers.  However, for the purposes of just doing initiative and selecting which spell to cast in the next round, the spells and powers can be entered manually onto the character sheet.  Spells are held in the relevant section of the Spells table, which by default is set to the character sheet spells table, <i>repeating_spells</i>.  As with other fields, this can be changed in the <i>'fields'</i> object.  Note that on the Advanced D&D 2e character sheet Wizard spells, Priest spells & Powers are all stored in various parts of this one very large table.</p>
+
<p>If you are just using the character sheet fields to type into, add spells (or powers) to the relevant “Spells Memorised” section (using the [+Add] buttons to add more as required) <b>a complete row at a time</b> (that is add columns before starting the next row).  Enter the spell names into the “Spell Name” field, and “1” into each of the “current” & “maximum” “Cast Today” fields - the API suite <i>counts down</i> to zero on using a spell, so in order for a spell to appear as available (not greyed out) on the initiative menus, the “current” number left must be > 0.  This makes spells consistent with other tables in the system (e.g. potion dose quantities also count down as they are consumed, etc).</p>
+
<p>Then, you need to set the “Spell Slots” values on each level of spell to be correct for the level of caster.  Just enter numbers into each of the “Level”, “Misc.” and “Wisdom” (for Priests) fields, and/or tick “Specialist” for the Wizard levels as relevant.  This will determine the maximum number of spells memorised each day, that will appear in the spells Initiative Menu.  Do the same for Powers using the “Powers Available” field.  As with other fields on the character sheet, each of these fields can be re-mapped by altering the <i>'fields'</i> object in the APIs.</p>
+
<p>Spells can only be cast if they have macros defined in the spell databases (see Spell Database Handout).  If the <b>CommandMaster API</b> is loaded, the DM can use the tools provided there to manage Character, NPC & creature spell books and granted powers from the provided spell & power databases.</p>
+
<p>The spells a spell caster can memorise (what they have in their spell books, or what their god has granted to them) is held as a list of spell names separated by vertical bars '|' in the character sheet attribute defined in <i>fields.Spellbook</i> (on the AD&D2E character sheet 'spellmem') of each level of spell.  On the AD&D2E sheet, the spell books are the large Spell Book text fields at the bottom of each spell level tab.  The spell names used must be identical (though not case sensitive) to the spell ability macro names in the spell databases (hence the hyphens in the names).  So, for example, a 1<sup>st</sup> level Wizard might have the following in their large Wizard Level 1 spell book field:</p>
+
<pre>Armour|Burning-Hands|Charm-Person|Comprehend-Languages|Detect-Magic|Feather-fall|Grease|Identify|Light|Magic-Missile|Read-Magic|Sleep</pre>
+
<p>Only these spells will be listed as ones they can memorise at level 1.  When they learn new spells and put them in their spell book, this string can be added to just by typing into it.  When they reach 3<sup>rd</sup> level and can have 2<sup>nd</sup> level spells, the following string might be put in the spell book on the Level 2 Wizard spells tab:</p>
+
<pre>Alter-Self|Invisibility|Melfs-Acid-Arrow|Mirror-Image|Ray-of-Enfeeblement</pre>
+
<p>Again, as they learn more spells and put them in their spell book, just edit the text to add the spells.</p>
+
<p>Once these spell books are defined, the DM or Player can use the <b>MagicMaster -mem-spell</b> command (or an action button and associated ability macro on the Character Sheet) to memorise the correct number of these spells in any combination and store those on the Character Sheet.</p>
+
==Powers==
+
<p>Powers can only be used if they are defined in the Powers database - see Database handoutsIf the <b>CommandMaster API</b> is also loaded, the DM can use the tools provided there to manage Character, NPC & creature spellbooks and granted powers.</p>
+
<p>Powers work in an almost identical way to Wizard & Priest spells, except that there is only 1 level of powersPowers that the character has are added to the spell book on the Powers tab in the same way as spells, and then memorised using the <b>--mem-spell</b> command (which also works for powers with the right parameters).</p>
+

Revision as of 13:58, 29 March 2022

Contents

General Database information

The RPGMaster APIs use a number of Character Sheets as databases to hold Ability Macros defining character classes, attack templates, spells, powers and magic items and their effects. The API is distributed with many class, attack, spell, power & magic item definitions, and checks for, creates and updates these Character Sheet databases on start-up. DMs can add their own character classes, attack templates, spells, items, weapons, ammo and armour to additional databases, but the databases provided are totally rewritten when new updates are released so the DM must add their own database sheets. If the provided databases are accidentally deleted, they will be automatically recreated the next time the Campaign is opened. Additional databases should be named as follows:

Wizard Spells:additional databases: MU-Spells-DB-[added name] where [added name] can be replaced with anything you want.
Priest Spells:additional databases: PR-Spells-DB-[added name] where [added name] can be replaced with anything you want.
Powers:additional databases: Powers-DB-[added name] where [added name] can be replaced with anything you want.
Magic Items:additional databases: MI-DB-[added name] where [added name] can be replaced with anything you want.
Character Classes:additional databases: Class-DB-[added name] where [added name] can be replaced with anything you want.
Attack Templates:additional databases: Attacks-DB-[added name] where [added name] can be replaced with anything you want.

However: the system will ignore any database with a name that includes a version number of the form "v#.#" where # can be any number or group of numbers e.g. MI-DB v2.13 will be ignored. This is so that the DM can version control their databases, with only the current one (without a version number) being live.

There can be as many additional databases as you want. Other Master series APIs come with additional databases, some of which overlap - this does not cause a problem as version control and merging unique macros is managed by the APIs.

Important Note: all Character Sheet databases must have their \'ControlledBy\' value (found under the [Edit] button at the top right of each sheet) set to \'All Players\'. This must be for all databases, both those provided (set by the API) and any user-defined ones. Otherwise, Players will not be able to run the macros contained in them.

Each database has a similar structure, with:

  • Ability Macros named as the class, attack type, spell, power or magic item specified, and used to describe and provide effects for classes, attacks, spells, powers and magic items using the commands in the RPGMaster APIs;
  • Custom Attributes with the attribute name "ct-ability-macro-name", one per Ability Macro, which defines the casting time and casting cost for spells & powers, and speed and MI type for magic items (not currently used for Class or Attack definitions, but they still have to exist);
  • An entry in a list on the character sheet in the spell book of the relevant Character Sheet tab (Spell Level of the spell defined, Powers tab, or various spell books for different Classes & Magic Items).

However, as with all other Databases in the RPGMaster Suite of APIs, if the Ability Macros are correctly set up using the formats detailed in the Help Documentation, the AttackMaster API command !attk --check-db database-name will check the database and set up all other aspects for you, including the correct Custom Attributes and List entries.

Ability Macros can be whatever the DM wants and can be as simple or as complex as desired. Roll Templates are very useful when defining class, spell, power and magic item ability macros, and are an essential part of Attack Templates. When a Player or an NPC or Monster makes an attack, the AttackMaster API runs the relevant Ability Macro from the databases as if it had been run by the Player from the chat window. All Roll20 functions for macros are available.

Replacing Classes, Attacks, Spells & Items

If you want to replace any Ability Macro provided in any of the databases, you can do so simply by creating an Ability Macro in one of your own databases (a database with the same root name) with the Ability Macro you create having exactly the same name as the provided item to be replaced. The API gives preference to Ability Macros in user-defined databases, so yours will be selected in preference to the one provided with the APIs.


How Attacks Work

In order to understand the Attacks Database, it is first important to understand how attacks are executed by the AttackMaster API. Under AD&D 2nd Edition, attacks are quite complex, involving many factors that can vary from moment to moment. Some say that this is why they prefer RPG systems that require less maths and are faster to execute, that the complexity of the AD&D2e combat system interrupts the flow of play. The AttackMaster API handles attacks in such a way as to hide as much of that complexity from the players as possible, and thus allow game-play to flow and players to concentrate on the unfolding story.

In order for the API to achieve this, it must evaluate many factors "on the fly" such as current magical effects in place (generally or on individuals), the current attributes of a character (which can vary as they are affected by game play), the type, range and properties of the weapon combinations used at that point in time for that particular attack, and the effects of the race, class, level and proficiency of the character, among several others. Given that these factors can vary even during a single round, each attack must be fully evaluated from scratch each time it is made.

Another issue is introduced by players feeling much more satisfied if they can see dice rolling for the attack, or they may want to use the Roll20 dice rolling mouse action, or even their own physical dice. Unfortunately for API authors, at the time of writing the API it is only possible to display rolling 3D dice from Chat Window dice rolls, either typed in the entry box by the player or run from Macros displayed in the Chat Window - 3D dice will not work when called by or included in API calls and commands.

So how does the AttackMaster API achieve 3D dice rolls and attack calculations that can accelerate game-play? The answer is that it uses Attack Template definitions which it parses and turns into Ability Macros on the Character Sheet of the character that selects to do an attack. The Melee Weapon templates are parsed and the attack Ability Macros for each Melee weapon in-hand created on the Character Sheet as (in fact just before) the Attack chat window menu is displayed, and Ranged Weapon templates are parsed and their attack Ability Macros are created after the type of Ammo has been selected and just before the relevant range buttons on the Attack menu are enabled for the Player to select. When the Player selects a Melee weapon to attack with, or the relevant range button for a Ranged weapon, the API is then not actually involved at all - the Roll20 Chat Window button just selected is just doing a standard macro call to the relevant attack Ability Macro just created on the Character Sheet. This also means the actual attacks happen at the fastest speed Roll20 can achieve as no API code is being run at that point.


The Attacks Database

The Attack Templates are stored in the Attacks Database, Attacks-DB, and any additional bespoke Attacks Databases the DM/Game Creator adds using the Character Sheet name Attacks-DB-[added name]. There are 17 basic Attacks Templates:

MW-ToHitMelee Weapon calculation to assess and display the Armour Class hit by an attack
MW-DmgSMMelee Weapon calculation to assess the damage done to a Medium or smaller opponent if the hit was sucessful
MW-DmgLMelee Weapon calculation to assess the damage done to Large or larger opponents as a result of a successful hit
MW-Targeted-AttkMelee Weapon calculation for using a targeted attack which rolls all attack and damage dice at once, and then displays the AC hit, the damage vs. all types of opponents, and the current AC & HP of the targeted opponent
RW-ToHitRanged Weapon calculation to assess and display the Armour Class hit by an attack
RW-DmgSMRanged Weapon calculation to assess the damage done to a Medium or smaller opponent if the hit was sucessful
RW-DmgLRanged Weapon calculation to assess the damage done to Large or larger opponents as a result of a successful hit
RW-Targeted-AttkRanged Weapon calculation for using a targeted attack which rolls all attack and damage dice at once, and then displays the AC hit, the damage vs. all types of opponents, and the current AC & HP of the targeted opponent
Mon-Attk1Monster/Creature attack 1 calculation to assess and display the Armour Class hit by an attack
Mon-Attk2Monster/Creature attack 2 calculation to assess and display the Armour Class hit by an attack
Mon-Attk3Monster/Creature attack 3 calculation to assess and display the Armour Class hit by an attack
Mon-Dmg1Monster/Creature damage 1 calculation to assess and display the damage done by an attack
Mon-Dmg2Monster/Creature damage 2 calculation to assess and display the damage done by an attack
Mon-Dmg3Monster/Creature damage 3 calculation to assess and display the damage done by an attack
Mon-Targeted-Attk1Monster/Creature for a targeted attack 1 calculation to assess and display the Armour Class hit and damage done by an attack, along with the target\'s current AC and HP
Mon-Targeted-Attk2Monster/Creature for a targeted attack 2 calculation to assess and display the Armour Class hit and damage done by an attack, along with the target\'s current AC and HP
Mon-Targeted-Attk3Monster/Creature for a targeted attack 3 calculation to assess and display the Armour Class hit and damage done by an attack, along with the target\'s current AC and HP

The Melee Weapon Attack Templates will be parsed for each Melee Weapon in-hand at the time of the attack, and the Ranged Weapon Attack Templates will be parsed for each possible range of the Ranged Weapon/Ammo combination selected for the attack. Two additional Melee Weapon Attack Templates are parsed if the character making the attack is a Rogue class:

MW-Backstab-DmgSMMelee Weapon calculation to assess the damage done to a Medium or smaller opponent if the hit was a Rogue doing a backstab and the attack was successful
MW-Backstab-DmgLMelee Weapon calculation to assess the damage done to a Large or larger opponent if the hit was a Rogue doing a backstab and the attack was successful

All of the above templates are provided in the Attacks-DB database supplied with the AttackMaster API. They are created to follow AD&D 2nd Edition rules: DMs and Game Creators can create their own attack and damage calculations following whatever rules they want in their own bespoke Attacks Database, using the information provided in the next section.

It is possible to add additional Attack Templates that are specific to particular Races, Classes, or even individual weapons! Indeed, the database supplied with the AttackMaster API includes an example of a bespoke Attack Template set for a thrown prepared Oil Flask. When an attack is the action selected by the Player, the API will search the Attacks-DB and bespoke user Attacks Databases for Melee and Ranged Attack Templates in the following name order (replace the ?W with either MW or RW as appropriate):

  1. ?W-ToHit-\<weapon name\> Searches for a weapon-specific Attack Template set for the weapon being used to attack with, but if not found then
  2. ?W-ToHit-\<class name\> Searches for a class-specific Attack Template set for the class (or each class of a multi/dual class) of the attacking character, but if not found then
  3. ?W-ToHit-\<race\> Searches for a race-specific Attack Template set for the race of the attacking character, but if not found then
  4. ?W-ToHit Uses the default Attack Template set.


Attack Data Fields

Attack Templates can take the form of any message or macro that can be held in a Roll20 Character Sheet Ability Macro and be displayed in the Chat Window when called. Typically, this will use a Roll Template (standard Roll20 functionality - see Roll20 Help for information), but it can be any format you desire as long as it results in the correct display of information to the Player.

The Attack Template has a large number of template fields that it can call upon to use in its calculations - these are pre-calculated values supplied by the API that the DM / Game Creator writing a new Attack Template can use. The standard Roll20 attribute value notation of @{selected|field-name} is not recommended for use in Attack Templates, as when the template is parsed, and then later the resulting Ability Macro run as part of the attack, there are circumstances where the token for the attacking Character may not be currently selected, resulting in the wrong value being used or, worse, an error occurring and the game halting. Instead, all the following template fields are available:

<thead>

</thead>

All Attack Templates
^^toWho^^Resolves to a Roll20 whisper command to the Character making the attack
^^toWhoPublic^^Resolves to a Roll20 chat command to the GM if a GM controlled creature is making the attack, otherwise a public message to all Players
^^defaultTemplate^^Resolves to the name of the Default Roll Template name set in the AttackMaster API
^^cname^^Resolves to the Character Name of the attacking character
^^tname^^Resolves to the Token Name of the attacking character
^^cid^^Resolves to the Roll20 Character ID of the attacking character
^^tid^^Resolves to the Roll20 Token ID of the attacking character
^^toHitRoll^^Depending on if the Player chose for Roll20 to roll the attack dice or to roll their own dice, resolves to one of (a) the attack dice specification provided in the Attack Template\'s Specs field, or (b) a Roll Query requesting the Player to enter a dice roll result
^^thac0^^Resolves to the base thac0 (value "to hit armour class 0") of the attacking character without any adjustments
^^ACfield^^Resolves to the Character Sheet field name that holds the target creatures current Armour Class (only used in targeted attacks)
^^targetACfield^^Resolves to the targeted token value Armour Class macro call @{target|Select Target|tokenAC-field} vs. a targeted opponent (only used in targeted attacks)
^^targetHPfield^^Resolves to the targeted token value Hit Points macro call @{target|Select Target|tokenHP-field} vs. a targeted opponent (only used in targeted attacks)
^^HPfield^^Resolves to the Character Sheet field name that holds the target creatures current Hit Points (only used in targeted attacks)
^^magicAttkAdj^^Resolves to any magical effect attack bonus or penalty resulting from magic currently in effect
^^strAttkBonus^^Resolves to the strength to-hit bonus/penalty of the attacking character
^^strDmgBonus^^Resolves to the strength damage bonus/penalty of the attacking character
^^slashWeap^^Resolves to 1 if the damage type of the weapon includes Slashing (or S), otherwise 0
^^pierceWeap^^Resolves to 1 if the damage type of the weapon includes Piercing (or P), otherwise 0
^^bludgeonWeap^^Resolves to 1 if the damage type of the weapon includes Bludgeoning (or B), otherwise 0
^^weapType^^Resolves to the 3 letter damage type of the weapon (S, P, B or any combination)
^^ACvsNoMods^^Resolves to the targeted standard Armour Class macro call @{target|Select Target|AC-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsSlash^^Resolves to the targeted Slashing damage Armour Class macro call @{target|Select Target|SlashAC-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsPierce^^Resolves to the targeted Piercing Armour Class macro call @{target|Select Target|PierceAC-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsBludgeon^^Resolves to the targeted Bludgeoning Armour Class macro call @{target|Select Target|BludgeonAC-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsNoModsTxt^^Resolves to the text "No Mods"
^^ACvsSlashTxt^^If this is a slashing weapon, resolves to the text "Slash", otherwise resolves to an empty string
^^ACvsPierceTxt^^If this is a piercing weapon, resolves to the text "Pierce", otherwise resolves to an empty string
^^ACvsBludgeonTxt^^If this is a bludgeoning weapon, resolves to the text "Bludgeon", otherwise resolves to an empty string
^^ACvsSTxt^^If this is a slashing weapon, resolves to the text "S", otherwise resolves to an empty string
^^ACvsPTxt^^If this is a piercing weapon, resolves to the text "P", otherwise resolves to an empty string
^^ACvsBTxt^^If this is a slashing weapon, resolves to the text "B", otherwise resolves to an empty string


<thead>

</thead>

Monster Attack Templates
^^attk1^^Resolves to the name of the creature\'s attack 1, if provided (applies to monster attacks only)
^^attk2^^Resolves to the name of the creature\'s attack 2, if provided (applies to monster attacks only)
^^attk3^^Resolves to the name of the creature\'s attack 3, if provided (applies to monster attacks only)
^^monsterCritHit^^Resolves to the critical hit dice roll value of the creature (applies to monster/creature attacks only)
^^monsterCritMiss^^Resolves to the critical miss dice roll value of the creature (applies to monster/creature attacks only)
^^monsterDmgMacro1^^Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Monster Ability damage 1 Macro
^^monsterDmgMacro2^^Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Monster Ability damage 2 Macro
^^monsterDmgMacro3^^Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Monster Ability damage 3 Macro
^^monsterDmg1^^Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification for Monster attack 1, or (b) a Roll Query requesting the Player to enter a dice roll result
^^monsterDmg2^^Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification for Monster attack 2, or (b) a Roll Query requesting the Player to enter a dice roll result
^^monsterDmg3^^Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification for Monster attack 3, or (b) a Roll Query requesting the Player to enter a dice roll result


<thead>

</thead>

Melee Weapon Attack Templates
^^weapAttkAdj^^Resolves to the magical attack adjustment of the weapon
^^weapStrHit^^Resolves to a 1 if the character\'s strength to-hit bonus applies to this weapon, or 0 otherwise
^^profPenalty^^Resolves to any proficiency penalty incurred by the attacking character for using a non-proficient or related weapon
^^specProf^^Resolves to 1 if the attacking character is a specialist in the weapon, otherwise 0
^^masterProf^^Resolves to 1 if the attacking character is a master (double specialised) in the weapon, otherwise 0
^^raceBonus^^Resolves to the race bonus of the attacking character with this weapon
^^twoWeapPenalty^^Resolves to any penalty relevant if the attacking character is using two weapons to attack (is 0 for character classes that can use two weapons without penalty, such as rangers)
^^weapDmgAdj^^Resolves to the magical damage adjustment of the weapon
^^magicDmgAdj^^Resolves to any magical effect damage bonus or penalty resulting from magic currently in effect
^^backstab^^Resolves to a 1 if a backstab is being attempted, otherwise 0
^^rogueLevel^^Resolves to the Rogue class level of the attacking character
^^weapon^^Resolves to the name of the weapon
^^weapCritHit^^Resolves to the critical hit dice roll value of the weapon
^^weapCritMiss^^Resolves to the critical miss dice roll value of the weapon
^^weapDmgSM^^Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Medium and smaller opponents for the weapon, or (b) a Roll Query requesting the Player to enter a dice roll result
^^weapDmgL^^Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Large and larger opponents for the weapon, or (b) a Roll Query requesting the Player to enter a dice roll result
^^weapStrDmg^^Resolves to a 1 if the character\'s strength damage bonus applies to this weapon, or 0 otherwise
^^mwSMdmgMacro^^Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Melee weapon Ability damage Macro against Medium and smaller opponents
^^mwLHdmgMacro^^Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Melee weapon Ability damage Macro against Large and larger opponents


<thead>

</thead>

Ranged Weapon Attack Templates
^^weapon^^Resolves to the name of the weapon
^^dexMissile^^Resolves to the dexterity missile adjustment of the attacking character
^^weapDexBonus^^Resolves to a 1 if the dexterity missile bonus applies to the weapon, otherwise 0
^^strAttkBonus^^Resolves to the strength to-hit bonus/penalty of the attacking character
^^weapStrHit^^Resolves to a 1 if the character\'s strength to-hit bonus applies to this weapon, or 0 otherwise
^^profPenalty^^Resolves to any proficiency penalty incurred by the attacking character for using a non-proficient or related weapon
^^specProf^^Resolves to 1 if the attacking character is a specialist in the weapon, otherwise 0
^^masterProf^^Resolves to 1 if the attacking character is a master (double specialised) in the weapon, otherwise 0
^^raceBonus^^Resolves to the race bonus of the attacking character with this weapon
^^twoWeapPenalty^^Resolves to any penalty relevant if the attacking character is using two weapons to attack (is 0 for character classes that can use two weapons without penalty, such as rangers)
^^weapDmgAdj^^Resolves to the magical damage adjustment of the weapon
^^rangeMod^^Resolves to the range attack modifier
^^rangeN^^Resolves to 1 if the range is "Near", otherwise 0
^^rangePB^^Resolves to 1 if the range is "Point Blank", otherwise 0
^^rangeS^^Resolves to 1 if the range is "Short", otherwise 0
^^rangeM^^Resolves to 1 if the range is "Medium", otherwise 0
^^rangeL^^Resolves to 1 if the range is "Long", otherwise 0
^^rangeF^^Resolves to 1 if the range is "Far", otherwise 0
^^rangeSMLF^^Resolves to 1 if the range is not "Near" or "Point Blank", otherwise 0
^^ammoDmgAdj^^Resolves to the magical damage adjustment of the selected ammunition of the ranged weapon
^^magicDmgAdj^^Resolves to any magical effect damage bonus or penalty resulting from magic currently in effect
^^strDmgBonus^^Resolves to the strength damage bonus/penalty of the attacking character
^^weapCritHit^^Resolves to the critical hit dice roll value of the weapon
^^weapCritMiss^^Resolves to the critical miss dice roll value of the weapon
^^ACvsNoModsMissile^^Resolves to the targeted Armour Class vs missiles macro call @{target|Select Target|ACmissile-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsSlashMissile^^Resolves to the targeted Slashing damage Armour Class vs missiles macro call @{target|Select Target|SlashACmissile-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsPierceMissile^^Resolves to the targeted Piercing Armour Class vs missiles macro call @{target|Select Target|PierceACmissile-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsBludgeonMissile^^Resolves to the targeted Bludgeoning Armour Class vs missiles macro call @{target|Select Target|BludgeonACmissile-field} vs. a targeted opponent (only used in targeted attacks)
^^ACvsNoModsMissileTxt^^Resolves to the text "No Mods"
^^ACvsSlashMissileTxt^^If this is a slashing weapon, resolves to the text "Slash", otherwise resolves to an empty string
^^ACvsPierceMissileTxt^^If this is a piercing weapon, resolves to the text "Pierce", otherwise resolves to an empty string
^^ACvsBludgeonMissileTxt^^If this is a bludgeoning weapon, resolves to the text "Bludgeon", otherwise resolves to an empty string
^^ACvsSmissileTxt^^If this is a slashing weapon, resolves to the text "S", otherwise resolves to an empty string
^^ACvsPmissileTxt^^If this is a piercing weapon, resolves to the text "P", otherwise resolves to an empty string
^^ACvsBmissileTxt^^If this is a slashing weapon, resolves to the text "B", otherwise resolves to an empty string
^^ammoDmgSM^^Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Medium and smaller opponents for the ammunition used, or (b) a Roll Query requesting the Player to enter a dice roll result
^^ammoDmgL^^Depending on if the Player chose for Roll20 to roll the damage dice or to roll their own dice, resolves to one of (a) the damage dice specification vs. Large and larger opponents for the ammunition used, or (b) a Roll Query requesting the Player to enter a dice roll result
^^ammoStrDmg^^Resolves to a 1 if the character\'s strength damage bonus applies to the selected ammunition, or 0 otherwise
^^ammoLeft^^Resolves to the quantity of the selected ammunition left after this attack
^^rwSMdmgMacro^^Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Ranged weapon Ability damage Macro against Medium and smaller opponents
^^rwLHdmgMacro^^Resolves to the correct Ability Macro name to use in an API button or macro call to run the matching Ranged weapon Ability damage Macro against Large and larger opponents


Character (PC & NPC) Attack Templates

As previously described, the Attacks Database contains Attack Templates as Ability Macro entries on the Attributes and Abilities tab of a Character Sheet. For Characters and NPCs that attack using weapons "in-hand" (see AttackMaster API documentation for information on taking weapons "in-hand"), four standard Attack Templates are required: -ToHit; -DmgSM; -DmgL; and -Targeted-Attk.

The "To Hit" Template

The standard To Hit Attack Template looks like this:

MW-ToHit

^^toWhoPublic^^ &{template:^^defaultTemplate^^}{{name=^^tname^^ Attacks with their ^^weapon^^}}<mark style="color:green">Specs=[MWtoHit,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[^^thac0^^]][Thac0])-([[(([[^^weapAttkAdj^^]][Weapon+])+([[(^^strAttkBonus^^ * ^^weapStrHit^^)]][Strength+])+([[^^profPenalty^^]][Prof Penalty]+[[^^specProf^^]][Specialist]+[[^^masterProf^^*3]][Mastery])+([[^^raceBonus^^]][Race mod])+([[^^magicAttkAdj^^]][Magic hit adj])+([[^^twoWeapPenalty^^]][2-weap penalty]))]][Adjustments])-^^toHitRoll^^cs\>^^weapCritHit^^cf\<^^weapCritMiss^^]]
^^ACvsSlashTxt^^ ^^ACvsPierceTxt^^ ^^ACvsBludgeonTxt^^ attack}}{{Total Adjustments=[[(([[^^weapAttkAdj^^]][Weapon+])+([[(^^strAttkBonus^^ * ^^weapStrHit^^)]][Strength+])+([[^^profPenalty^^]][Prof Penalty]+[[^^specProf^^]][Specialist]+[[^^masterProf^^*3]][Mastery])+([[^^raceBonus^^]][Race mod])+([[^^magicAttkAdj^^]][Magic hit adj])+([[^^twoWeapPenalty^^]][2-weap penalty]))]]}}
^^toWho^^ &{template:^^defaultTemplate^^}Template:Name=Do Damage?{{desc=If successfully hit
[TSM Damage](~^^mwSMdmgMacro^^) or [LH Damage](~^^mwLHdmgMacro^^)}}

As with all RPGMaster database items, the Attack Templatre has a Specs section:

Specs=[MWtoHit,AttackMacro,1d20,Attack]

The four fields in the Specs data are the standard four used in all Specs fields: Entry Type (MWtoHit), Entry Class (AttackMacro), Handedness (in this case replaced by toHit dice roll spec 1d20), and Entry Supertype (Attack). The key field to note here is the ToHit Dice Roll Specification (which replaces the Handedness field). This can be any valid dice roll, and will be used for the ^^toHitRoll^^ template field if the Player selects Roll20 to roll the attack dice.

This Attack Template is formatted using a Roll20 Roll Template with a type specified using the ^^defaultTemplate^^ template field, but need not be - formatting is up to the creator of the Attack Template. It is important this information is displayed to the right people - Players that control a character, all Players as a public post, or just the DM for attacks by creatures & NPCs. The ^^toWhoPublic^^ template field will check if the attacking token represents a Character/NPC/Creature controlled by a Player and, if so, make a public post that all can see, but otherwise just whisper the results of the attack to the DM only. Similarly, ^^toWho^^ will whisper the attack information either only to the Player(s) that control the attacking character/creature or, if no one does, then to the DM.

The rest of the Attack Template defines the calculations using the API supplied data to display the Armour Class value that would be successfully hit by the attacking character, with the selected weapon under the current conditions. It also defines a display of the adjustments that are made to the dice roll which the Players and DM can hover a mouse over to get an explanation of the calculations. All the calculations and tag display are standard Roll20 functionality, so once the Attack Template Data Fields are replaced by actual values by the API and the resulting Ability Macro saved to the attacking character\'s Character Sheet, running it like any other Ability Macro will use only Roll20 functionality, and not involve use of the APIs.

The Attack Template shown above is a To Hit template for a Melee weapon attack. That for a Ranged weapon attack is very similar, just using some different and ranged attack related Template Fields.

The "Damage" Templates

There are always two damage Attack Templates to go with each To Hit Template, typically one for damage to Medium and smaller opponents and one for Large and larger. However, as will be seen when discussing the Oil Flask bespoke Attack Templates below, those are not always the outcomes of the two damage Templates. However, they do always start with MW-DmgSM and MW-DmgL for Melee weapon attacks, and RW-DmgSM and RW-DmgL for Ranged weapon attacks (optionally followed by a race, class or weapon name). The standard Damage Attack Template looks like this:

MW-DmgSM

^^toWhoPublic^^ &{template:^^defaultTemplate^^}{{name=^^tname^^ does damage with their ^^weapon^^}}<mark style="color:green">Specs=[MWdmgSM,AttackMacro,1d20,Attack]</mark>{{Damage vs TSM=[[([[ ([[^^weapDmgSM^^]][Dice Roll])+([[^^strDmgBonus^^*^^weapStrDmg^^]][Strength+])+([[^^weapDmgAdj^^]][weapon+])+([[^^magicDmgAdj^^]][Magic dmg adj])+([[^^specProf^^*2]][Specialist+]+[[^^masterProf^^*3]][Mastery+])]][Adjustments])]] HP}}{{Total Plusses=[[[[^^strDmgBonus^^*^^weapStrDmg^^]][Strength+]+([[^^weapDmgAdj^^]][weapon+])+([[^^magicDmgAdj^^]][Magic dmg adj])+([[^^specProf^^*2]][Specialist+]+[[^^masterProf^^*3]][Mastery+])]]}}

The damage Attack Template works in the same way as the other Attack Templates as explained above for the ToHit template. While the Specs data includes the "To Hit" dice roll specification, this is not used in the damage Template, and is irrelevant. That field just needs to hold something, and a dice roll specification is what is expected. Hopefully, the rest of this damage Attack Template is self explanatory.

Monster Attack Templates

If a creature specified as a Monster on the Character Sheet uses in-hand weapons, as supported under the RPGMaster APIs, attacks with those weapons (Melee or Ranged) will use the standard To Hit and Damage Attack Templates described above. However, attacks by creatures that are specified on the Monster tab of the Advanced 2nd Edition character sheet, and under AD&D 2nd Edition rules, are much simpler than character attacks with in-hand weapons. The differences mean that such creatures require different Attack Templates. Attacks specified on the Monster tab use the Monster Attack Templates: Mon-Attk1, Mon-Attk2, Mon-Attk3, and Mon-Dmg1, Mon-Dmg2, Mon-Dmg3 (or the Targeted Attack Templates, see later). Remember that the AttackMaster API supports an extension of the Monster Attk fields on the Advanced 2nd Edition Character Sheet: each can contain a comma-separated list consisting of "attack name","dice roll","speed in segments" (see AttackMaster Help for details).

The Monster Attack and Damage Templates look like this:

Mon-Attk1

^^toWhoPublic^^ &{template:^^defaultTemplate^^}{{name=^^tname^^ attacks with their ^^attk1^^}}<mark style="color:green">Specs=[MonAttk1,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[ ( ([[^^thac0^^]][Thac0]) - ([[^^magicAttkAdj^^]][Magic hit adj]) - ^^toHitRoll^^cs\>^^monsterCritHit^^cf\<^^monsterCritMiss^^ )]]}}
^^toWho^^ &{template:^^defaultTemplate^^}Template:Name=Do Damage?{{desc=If this hits [Do Damage](~^^monsterDmgMacro1^^)}}


Mon-Dmg1

^^toWhoPublic^^ &{template:^^defaultTemplate^^}{{name=^^tname^^ does damage with their ^^attk1^^}}<mark style="color:green">Specs=[MonDmg1,AttackMacro,1d20,Attack]</mark>{{Damage=[[(([[^^monsterDmg1^^]][^^attk1^^ Dmg])+([[^^magicDmgAdj^^]][Added Magic Dmg]))]] HP}}

Unsurprisingly, these work in exactly the same way as other Attack Templates.


Targeted Attack Templates

The AttackMaster API supports the DM (and optionally, Players) using "targeted attacks". This is an attack that prompts the DM / Player to select a target token, and then performs all attack and damage dice rolls at the same time, displaying the attack results alongside the Armour Class and Hit Points of the targeted opponent. This speeds the attack process even further than having the API do all the attack calculations. Note: the results of the attack are not applied to the targeted opponent - the results are still open to interpretation by the Players and DM, and circumstantial adjustment before manually applying them to the Token / Character Sheet of the opponent.

The Ranged weapon Attack Template looks like this:

^^toWho^^ &{template:^^defaultTemplate^^}{{name=^^tname^^ Attacks @{Target|Select Target|Token_name} with their ^^weapon^^}}<mark style="color:green">Specs=[RWtargetedAttk,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[^^thac0^^]][Thac0])-(([[^^weapAttkAdj^^]][Weapon+]) + ([[^^ammoDmgAdj^^]][Ammo+]) + ([[ ^^weapDexBonus^^*[[^^dexMissile^^]]]][Dexterity+] )+([[[[^^strAttkBonus^^]]*[[^^weapStrHit^^]]]][Strength+])+([[^^raceBonus^^]][Race mod])+([[^^profPenalty^^]][Prof penalty])+([[^^magicAttkAdj^^]][Magic Hit+])+([[^^twoWeapPenalty^^]][2-weap penalty])+([[^^rangeMod^^]][Range mod]))-^^toHitRoll^^cs\>^^weapCritHit^^cf\<^^weapCritMiss^^ ]] }}{{Target AC=^^ACvsNoModsTxt^^:^^ACvsNoModsMissile^^
^^ACvsSlashMissileTxt^^:^^ACvsSlashMissile^^ ^^ACvsPierceMissileTxt^^:^^ACvsPierceMissile^^ ^^ACvsBludgeonMissileTxt^^:^^ACvsBludgeonMissile^^}}{{Damage if hit SM=[[ floor( [[^^ammoDmgSM^^]][Dice roll] * [[(^^rangeN^^*0.5)+(^^rangePB^^*(1+^^masterProfPB^^))+(^^rangeSMLF^^*1)]]) + ([[^^rangePB^^*^^masterProfPB^^*2]])+ (([[^^ammoDmgAdj^^]][Ammo+])+([[^^magicDmgAdj^^]][Magic dmg+]) +([[^^strDmgBonus^^*^^ammoStrDmg^^]][Strength+])) ]]HP}}{{Damage if hit LH=[[ floor( [[^^ammoDmgL^^]][Dice roll] * [[(^^rangeN^^*0.5)+(^^rangePB^^*(1+^^masterProfPB^^))+(^^rangeSMLF^^*1)]]) + ([[^^rangePB^^*^^masterProfPB^^*2]]) + (([[^^ammoDmgAdj^^]][Ammo+])+([[^^magicDmgAdj^^]][Magic dmg+]) +([[^^strDmgBonus^^*^^ammoStrDmg^^]][Strength+])) ]]HP}}{{Target HP=^^targetHPfield^^ HP}}{{Ammo left=^^ammoLeft^^}}

The key difference, other than doing all of the calculations for the Armour Class hit and both the damage for Medium and smaller and Large and larger, is that several of the Template Fields used resolve to appropriately formatted Roll20 @{target|...} entries, that will display values from the targeted opponent\'s token and/or character sheet. The API searches for the most appropriate token and character sheet fields to resolve the targeted Template Fields to (it searches the attacking creature\'s data, and assumes all tokens are set up the same way): if using the standard RPGMaster token settings (as set by the CommandMaster API --abilities command or [Token Setup] DM\'s Macro button) it will find the data it needs on the token; otherwise it will first search other token fields, then standard Character Sheet character tab fields, then Character Sheet monster tab fields. If the API can\'t find AC or HP data, it will display appropriate text saying the data was not found, but will not cause an error. Thus it is sensible to use these Template Fields rather than statically defined @{target|...} commands.


8. Bespoke / Custom Attack Templates

All of the above examples and discussion have explored the standard Attack Templates distributed with the AttackMaster API. It will be the case that this will cater for around 95% of attacks and attack-like situations (e.g. there is a weapon called "Touch" which Spell Casters can use for touch-attack spells, which uses the standard Attack Templates without change to achieve the needed outcome). However, for that other 5% (or perhaps closer to 1%) of special cases you can define your own bespoke or custom Attack Templates. Being able to change the way attacks are calculated is also essential if you wish to adapt the API to work for game systems other than Advanced Dungeons & Dragons 2nd Edition.

As stated in Section 1, you should not add Attack Templates to the Attacks-DB database directly as, when updates are released, the whole database will be overwritten and your additions will be lost. Instead, create your own Character Sheet named Attack-DB-[any-name-you-want] and add Attack Templates to it. If you want to replace the Attack Templates provided for Melee weapons, Ranged weapons and/or Monster attacks, just create ones in your added database with the same Ability Macro name and they will automatically be used in preference to the standard versions.

As also mentioned previously, while Attack Templates are always called with names of the format given in Section 3, they do not have to result in standard attacks or damage - the calculations and resulting information provided to players can be whatever is needed as a result of that attack action. An example of this is included in the distributed Attacks-DB, the Oil Flask Attack Template set:

RW-ToHit-Oil-Flask

^^toWhoPublic^^ &{template:^^defaultTemplate^^}{{name=^^tname^^ throws a prepared oil flask}}<mark style="color:green">Specs=[RWtoHit,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[^^thac0^^]][Thac0])-([[([[^^weapAttkAdj^^]][Weapon+]) + ([[^^ammoDmgAdj^^]][Ammo+]) + ([[ ^^weapDexBonus^^*[[^^dexMissile^^]]]][Dexterity+] )+([[[[^^strAttkBonus^^]]*[[^^weapStrHit^^]]]][Strength+])+([[^^raceBonus^^]][Race mod])+([[^^profPenalty^^]][Prof penalty])+([[^^magicAttkAdj^^</b>]][Magic Hit+])+([[^^twoWeapPenalty^^]][2-weap penalty])+([[^^rangeMod^^]][Range mod])]][Adjustments])-^^toHitRoll^^cs\>^^weapCritHit^^cf\<^^weapCritMiss^^ ]]
^^ACvsSlashMissileTxt^^ ^^ACvsPierceMissileTxt^^ ^^ACvsBludgeonMissileTxt^^ attack}}{{Total Adjustments=[[([[^^weapAttkAdj^^]][Weapon+]) + ([[^^ammoDmgAdj^^]][Ammo+]) + ([[ ^^weapDexBonus^^*[[^^dexMissile^^]]]][Dexterity+] )+([[[[^^strAttkBonus^^]]*[[^^weapStrBonus^^]]]][Strength+])+([[^^raceBonus^^]][Race mod])+([[^^profPenalty^^]][Prof penalty])+([[^^magicAttkAdj^^]][Magic Hit+])+([[^^twoWeapPenalty^^]][2-weap penalty])+([[^^rangeMod^^]][Range mod])]]}}{{Ammo left=^^ammoLeft^^}}
^^toWho^^ &{template:^^defaultTemplate^^}Template:Name=Do Damage?{{desc=Select the appropriate result
[Direct hit](~^^rwSMdmgMacro^^) or [Grenade/Splash](~^^rwLHdmgMacro^^)}}

The To Hit Attack Template is very similar to a normal Ranged weapon Attack Template, except that instead of API buttons indicating damage rolls vs. different sized opponents, it provides one API button to select a [Direct Hit], and another selecting a [Grenade/Splash] outcome. Each of these still calls the same damage Attack Templates using the Template Fields provided but in this case, because the attack is with a weapon called Oil Flask, the Template Fields will resolve to calls to RW-DmgSM-Oil-Flask and RW-DmgL-Oil-Flask respectively, and these custom Attack Templates do damage in a very different way to a normal Ranged Weapon attack.

RW-DmgSM-Oil-Flask

^^toWhoPublic^^ &{template:^^defaultTemplate^^}{{name=^^tname^^\'s oil flask scores a direct hit}}<mark style="color:green">Specs=[RWdmgSM,AttackMacro,1d20,Attack]</mark>Template:Subtitle=Fire damage{{Round 1=Fire damage 2d6}}Template:Round 2=Will be rolled next round
!rounds --aoe @{target|Who\'s the target?|token_id}|circle|feet|0|7|0|fire|true --target single|@{selected|token_id}|@{target|Who\'s the target?|token_id}|Oil-fire|1|-1|Taking fire damage from burning oil|three-leaves

The Oil Flask version of the RW-DmgSM Attack Template caters for damage done by an Oil Flask successfully scoring a direct hit on an opponent. This results in a damage dice roll for this round of 2d6 with no modifiers, and then also makes an API call to the RoundMaster API with two stacked commands: an Area of Effect call to place fire on the opponent\'s token, and a Target call to add a status to the opponent\'s token which will last 2 rounds, causing a Status Effect to run in the second round to prompt for another damage roll of 1d6.

RW-DmgL-Oil-Flask

^^toWhoPublic^^ &{template:^^defaultTemplate^^}{{name=^^tname^^\'s oil flask smashes in a ball of flame}}<mark style="color:green">Specs=[RWdmgL,AttackMacro,1d20,Attack]</mark>Template:Subtitle=Fire damageTemplate:Location=Drag the crosshair to where the oil flask smashed{{Splash=Those splashed take [[ceil(1d6/2)]]HP fire damage}}
!rounds --aoe ^^tid^^|circle|feet|[[(^^rangeN^^*5)+(^^rangePB^^*10)+(^^rangeS^^*10)+(^^rangeM^^*20)+(^^rangeL^^*30)+(^^rangeF^^*30)-5]]|4|0|fire

The Oil Flask version of the RW-DmgL Attack Template caters for an Oil Flask that either missed its intended target, or is deliberately used as a grenade-like missile. This results in a dice roll of 1d3 splash damage to anyone in the area of effect, which is shown using a call to the RoundMaster API Area of Effect command which this time can be positioned where the oil flask landed.

RW-Targeted-Attk-Oil-Flask

^^toWho^^ &{template:^^defaultTemplate^^}{{name=^^tname^^ throws a prepared oil flask at @{Target|Select Target|Token_name}}}<mark style="color:green">Specs=[RWtargetedAttk,AttackMacro,1d20,Attack]</mark>{{Hits AC=[[([[^^thac0^^]][Thac0])-(([[^^weapAttkAdj^^]][Weapon+]) + ([[^^ammoDmgAdj^^]][Ammo+]) + ([[ ^^weapDexBonus^^*[[^^dexMissile^^]]]][Dexterity+] )+([[[[^^strAttkBonus^^]]*[[^^weapStrHit^^]]]][Strength+])+([[^^raceBonus^^]][Race mod])+([[^^profPenalty^^]][Prof penalty])+([[^^magicAttkAdj^^]][Magic Hit+])+([[^^twoWeapPenalty^^]][2-weap penalty])+([[^^rangeMod^^]][Range mod]))-^^toHitRoll^^cs\\gt^^weapCritHit^^cf\\lt^^weapCritMiss^^ ]] }}{{Target AC=^^ACvsNoModsTxt^^:^^ACvsNoModsMissile^^
^^ACvsSlashMissileTxt^^:^^ACvsSlashMissile^^ ^^ACvsPierceMissileTxt^^:^^ACvsPierceMissile^^ ^^ACvsBludgeonMissileTxt^^:^^ACvsBludgeonMissile^^}}Template:=Direct Hit{{Target=[Direct hit on target](!rounds --aoe @{Target|Select Target|token_id}|circle|feet|0|6|0|fire|true --target single|@{selected|token_id}|@{Target|Select Target|token_id}|Oil-fire|1|-1|Taking fire damage from burning oil|three-leaves)}}{{Dmg Round 1=2d6HP fire damage}}Template:Dmg Round 2=Roll next roundTemplate:. =Splash Damage{{Location=[Select where flask smashed](!rounds --aoe ^^tid^^|circle|feet|[[(^^rangeN^^*5)+(^^rangePB^^*10)+(^^rangeS^^*10)+(^^rangeM^^*20)+(^^rangeL^^*30)+(^^rangeF^^*30)-5]]|4|0|fire)}}{{Damage=[[ceil(1d6/2)]]HP fire damage}}{{Target HP=^^targetHPfield^^ HP}}{{Ammo left=^^ammoLeft^^}}

The Oil Flask version of the RW-Targeted-Attk Attack Template combines the functions and calculations of the other Oil Flask custom Attack Templates in a single result display, with appropriate API buttons to implement the various outcomes of the attack.

Similar or entirely different custom Attack Templates can be created for other individual weapons with non-standard attack outcomes, or for individual classes of character, creatures, or races. Just use the Attack Template naming conventions described in Section 3, and add them to your own Attack Databases as described in Section 1, and you can give Players more interesting situations and means of dealing with them. When combined with the features and capabilities of the RoundMaster API and other APIs of the RPGMaster suite, the possibilities are endless!