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
(RW-Targeted-Attk-Oil-Flask)
Line 1: Line 1:
 
{{revdate}}
 
{{revdate}}
==General Database information==
+
==Character Sheet and Token setup for use with RPGMaster APIs==
<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 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:</p>
+
===Token configuration===
<table>
+
<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>
<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>
+
<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>
<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>
+
<p>The recommended Token Bar assignments for all APIs in the Master Series are:</p>
<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>
+
<pre>Bar1 (Green Circle): Armour Class (AC field) - only current value
<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>
+
Bar2 (Blue Circle): Base Thac0 (thac0-base field) before adjustments - only current value
<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>
+
Bar3 (Red Circle): Hit Points (HP field) - current & max</pre>
<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>
+
<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 tokens. All tokens must be set the same way, whatever way you eventually choose.</p>
</table>
+
<p>The APIs always try to search the Token fields for appropriate Character Sheet linked fields, but will revert to the assignments above if they fail to match linked fields.  These assignments can be changed in each API, by changing the fields object near the top of the API script (<b>note:</b> 'bar#' and 'value' or 'max' are separate entries in an array of 2 elements).  <b><i><u>All APIs must use the same field definitions</u></i></b>:</p>
<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 ignored.  This is so that the DM can version control their databases, with only the current one (without a version number) being live.</p>
+
<pre>fields.Token_AC: defines the token field for the AC value (normally ['bar1','value'])
<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>
+
fields.Token_MaxAC: defines the token field for the AC max (normally ['bar1','max'])
<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>
+
fields.Token_Thac0: defines the token field for the Thac0 value (normally ['bar2','value'])
<p>Each database has a similar structure, with:</p>
+
fields.Token_MaxThac0: defines the token field for the Thac0 max (normally ['bar2','max'])
<ul>
+
fields.Token_HP: defines the token field for the HP value (normally ['bar3','value'])
<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>
+
fields.Token_MaxHP: defines the token field for the HP max (normally ['bar3','max'])</pre>
<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>Alter the bar numbers appropriately or, <b><u><i>if you are not wanting one or more of these assigned</i></u></b>: leave the two elements of the array as [' ',' ']The system will generally work fine with reassignment or no assignment, but not alwaysSpecifically, some effects in the Effects-DB, which implement spell effects on Character Sheets and Tokens, may not set the right values if no assignment of one or more of HP, AC & Thac0 are made to the Token.</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>
+
</ul>
+
<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 TemplatesWhen 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 windowAll 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 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.</p>
+
 
<br>
 
<br>
 
+
===Use with various game system character sheets===
==How Attacks Work==
+
<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 will work with any character sheet, though the values used and altered by the APIs may not be visible or may appear in unexpected places.  To work properly with your choice of Character Sheet, the mapping in the APIs must be altered. In each API code, right at the top, is an object definition called 'fields': see section 3 for detailsThis can be altered to get the API to work with other character sheets.</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 playThe 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>
+
<p>The APIs are designed to use attack calculations, armour class values and saving throw management defined in a number of databases, supplied in the APIs and created in the Campaign as a set of Character Sheets.  If you use another system (e.g. the D&D 5e system), the calculations can be altered by replacing the provided calculations with your ownRefer to the documentation for each API and database, provided as handouts in the Campaign and as Roll20 Wiki pages, to discover how to do this.</p>
<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>
+
===Matching the API to a type of Character Sheet===
<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>
+
<p>The API has an object definition called 'fields', which contains items of the form </p>
<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 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.</p>
+
<pre>Internal_api_name: [sheet_field_name, field_attribute, optional_default_value, optional_set_with_worker_flag]</pre>
<br>
+
<p>A typical example might be:</p>
==The Attacks Database==
+
<pre>Fighter_level:['level-class1','current'],<br>
<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>
+
Or<br>
<table>
+
MUSpellNo_memable:['spell-level-castable','current','',true],</pre>
<tr><th scope="row">MW-ToHit</th><td>Melee Weapon calculation to assess and display the Armour Class hit by an attack</td></tr>
+
<p>The <i>internal_api_name</i> <b><u>must not be altered!</b></u> 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>
<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>
+
<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>
<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>
+
<p><i>Internal_api_table: [sheet_repeating_table_name,starting_index]</i></p>
<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>
+
<p>An example is:</p>
<tr><th scope="row">RW-ToHit</th><td>Ranged Weapon calculation to assess and display the Armour Class hit by an attack</td></tr>
+
<pre>MW_table:['repeating_weapons',0],</pre>
<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>
+
<p>The <i>internal_api_table</i> <b><u>must not be altered!</b></u> 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>
<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>
+
<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 tableThe 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>
<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>
+
===Character Attributes, Races, Classes and Levels===
<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>
+
<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>
<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>
+
<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>
<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>
+
<p>The system supports single-class and multi-class characters. Classes 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>
<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>
+
<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>
<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>
+
<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</b></u> need to have levels set in the corresponding spell-caster columns - the casting ability & level is worked out by the system</p>
<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>
+
<p>The following Classes are currently supported:</p>
<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>
+
<table><thead><tr><td>Fighter classes</td><td>Wizard Classes</td><td>Priest Classes</td><td>Rogue Classes</td></tr></thead>
<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><td>Warrior</td><td>Wizard</td><td>Priest</td><td>Rogue</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>
+
<tr><td>Fighter</td><td>Mage</td><td>Cleric</td><td>Thief</td></tr>
</table>
+
<tr><td>Ranger</td><td>Abjurer</td><td>Druid</td><td>Bard</td></tr>
<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>
+
<tr><td>Paladin</td><td>Conjurer</td><td>Healer</td><td>Assassin</td></tr>
<table>
+
<tr><td>Beastmaster</td><td>Diviner</td><td>Priest of Life</td></tr>
<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><td>Barbarian</td><td>Enchanter</td><td>Priest of War </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>
+
<tr><td>Defender (Dwarven)</td><td>Illusionist</td><td>Priest of Light</td></tr>
</table>
+
<tr><td> </td><td>Invoker</td><td>Priest of Knowledge</td></tr>
<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>
+
<tr><td> </td><td>Necromancer</td><td>Shaman</td></tr>
<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>
+
<tr><td> </td><td>Transmuter</td></tr></table>
<ol>
+
<p>The level for each class must be entered in the corresponding field. Multiple classes and levels can be entered, and will be dealt with accordingly.  Generally, the most beneficial outcome for any combination will be used. </p>
<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>
+
===Magic Items and Equipment===
<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>
+
<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>
<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>
+
<p>Items can be added to the databasesSee the Database Handouts for more information on the databases.</p>
<li><b>?W-ToHit</b> Uses the default Attack Template set.</li>
+
===Weapons and Ammo===
</ol>
+
<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 useThis automatically fills all the correct fields for the weapons and ammo to make attacks, including many fields that are not displayedEntering 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>
<br>
+
<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 sheetWhen 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>
==Attack Data Fields==
+
===Weapon Proficiencies===
<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 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.</p>
+
<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 manuallyBoth 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 penaltiesWeapon 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>
<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>
+
===Spell books and memorisable spells===
<table>
+
<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 powersHowever, 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 sheetSpells 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>
<tr><th colspan="2">All Attack Templates</th><tr>
+
<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>
<tr><th scope="row">^^toWho^^</th><td>Resolves to a Roll20 whisper command to the Character making the attack</td></tr>
+
<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 MenuDo 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>
<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>
+
<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>
<tr><th scope="row">^^defaultTemplate^^</th><td>Resolves to the name of the Default Roll Template name set in the AttackMaster API</td></tr>
+
<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>
<tr><th scope="row">^^cname^^</th><td>Resolves to the Character Name of the attacking character</td></tr>
+
<pre>Armour|Burning-Hands|Charm-Person|Comprehend-Languages|Detect-Magic|Feather-fall|Grease|Identify|Light|Magic-Missile|Read-Magic|Sleep</pre>
<tr><th scope="row">^^tname^^</th><td>Resolves to the Token Name of the attacking character</td></tr>
+
<p>Only these spells will be listed as ones they can memorise at level 1When 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>
<tr><th scope="row">^^cid^^</th><td>Resolves to the Roll20 Character ID of the attacking character</td></tr>
+
<pre>Alter-Self|Invisibility|Melfs-Acid-Arrow|Mirror-Image|Ray-of-Enfeeblement</pre>
<tr><th scope="row">^^tid^^</th><td>Resolves to the Roll20 Token ID of the attacking character</td></tr>
+
<p>Again, as they learn more spells and put them in their spell book, just edit the text to add the spells.</p>
<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>
+
<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>
<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>
+
===Powers===
<tr><th scope="row">^^ACfield^^</th><td>Resolves to the Character Sheet field name that holds the target creature's current Armour Class (only used in targeted attacks)</td></tr>
+
<p>Powers can only be used if they are defined in the Powers database - see Database handouts.  If 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>
<tr><th scope="row">^^targetACfield^^</th><td>Resolves to the targeted token value Armour Class macro call <i>@{target|Select Target|^^ACfield^^}</i> vs. a targeted opponent (only used in targeted attacks)</td></tr>
+
<p>Powers work in an almost identical way to Wizard & Priest spells, except that there is only 1 level of powers.  Powers 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>
<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">^^targetHPfield^^</th><td>Resolves to the targeted token value Hit Points macro call <i>@{target|Select Target|^^HPfield^^}</i> vs. a targeted opponent (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>
+
<br>
+
<table>
+
<tr><th colspan="2">Monster Attack Templates</th><tr>
+
<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>
+
<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>
+
<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>
+
<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>
+
<tr><th colspan="2">Melee Weapon Attack Templates</th><tr>
+
<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>
+
<tr><th colspan="2">Ranged Weapon Attack Templates</th><tr>
+
<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 SheetFor 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><nowiki>&{template:</nowiki><b>^^defaultTemplate^^</b>}{{name=<b>^^tname^^</b> Attacks with their <b>^^weapon^^</b>}}<span style="color:green">Specs=[MWtoHit,AttackMacro,1d20,Attack]</span>{{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> <nowiki>&{template:</nowiki><b>^^defaultTemplate^^</b><nowiki>}{{name=Do Damage?}}{{desc=</nowiki>If successfully hit<br>
+
[TSM Damage](~<b>^^mwSMdmgMacro^^</b>) or [LH Damage](~<b>^^mwLHdmgMacro^^</b>)<nowiki>}}</nowiki></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 conditionsIt 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 attackThat 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 largerHowever, 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 TemplatesHowever, 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>}}<span style="color:green">Specs=[MWdmgSM,AttackMacro,1d20,Attack]</span>{{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> templateWhile 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 aboveHowever, 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 weaponsThe 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>}}<span style="color:green">Specs=[MonAttk1,AttackMacro,1d20,Attack]</span>{{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> <nowiki>&{template:</nowiki><b>^^defaultTemplate^^</b><nowiki>}{{name=Do Damage?}}{{desc=</nowiki>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>}}<span style="color:green">Specs=[MonDmg1,AttackMacro,1d20,Attack]</span>{{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>
+
 
+
==Targeted Attack Templates==
+
<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 opponentThis 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 Ranged weapon Attack Template looks like this:</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>}}<span style="color:green">Specs=[RWtargetedAttk,AttackMacro,1d20,Attack]</span>{{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>
+
<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>
+
<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 sheetThe 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 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 <i>@{target|...}</i> commands.</p>
+
<br>
+
 
+
==8. Bespoke / Custom Attack Templates==
+
<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 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.</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 lost.  Instead, 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>
+
<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>
+
====RW-ToHit-Oil-Flask====
+
<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}}<span style="color:green">Specs=[RWtoHit,AttackMacro,1d20,Attack]</span>{{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>
+
<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>
+
<b>^^toWho^^</b> <nowiki>&{template:</nowiki><b>^^defaultTemplate^^</b><nowiki>}{{name=Do Damage?}}{{desc=</nowiki>Select the appropriate result<br>
+
[Direct hit](~<b>^^rwSMdmgMacro^^</b>) or [Grenade/Splash](~<b>^^rwLHdmgMacro^^</b>)<nowiki>}}</nowiki></p>
+
<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] outcome.  Each of these still calls the same damage Attack Templates using the Template Fields provided <b><i>but in this case</i></b>, 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>
+
 
+
====RW-DmgSM-Oil-Flask====
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> <nowiki>&{template:</nowiki><b>^^defaultTemplate^^</b><nowiki>}{{name=</nowiki><b>^^tname^^</b>'s oil flask scores a direct hit}}<span style="color:green">Specs=[RWdmgSM,AttackMacro,1d20,Attack]</span><nowiki>{{subtitle=Fire damage}}{{Round 1=Fire damage [[2d6]]}}{{Round 2=Will be rolled next round}}</nowiki><br><nowiki>
+
!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</nowiki></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>
+
 
+
====RW-DmgL-Oil-Flask====
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWhoPublic^^</b> <nowiki>&{template:</nowiki><b>^^defaultTemplate^^</b><nowiki>}{{name=</nowiki><b>^^tname^^</b>'s oil flask smashes in a ball of flame}}<span style="color:green">Specs=[RWdmgL,AttackMacro,1d20,Attack]</span><nowiki>{{subtitle=Fire damage}}{{Location=Drag the crosshair to where the oil flask smashed}}{{Splash=Those splashed take [[ceil([[1d6]]/2)]]HP fire damage}}</nowiki><br>
+
!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>
+
<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>
+
 
+
====RW-Targeted-Attk-Oil-Flask====
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><b>^^toWho^^</b> <nowiki>&{template:</nowiki><b>^^defaultTemplate^^</b><nowiki>}{{name=</nowiki><b>^^tname^^</b> throws a prepared oil flask at @{Target|Select Target|Token_name}}}<span style="color:green">Specs=[RWtargetedAttk,AttackMacro,1d20,Attack]</span><nowiki>{{Hits AC=[[([[</nowiki><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>
+
<b>^^ACvsSlashMissileTxt^^</b>:<b>^^ACvsSlashMissile^^</b> <b>^^ACvsPierceMissileTxt^^</b>:<b>^^ACvsPierceMissile^^</b> <b>^^ACvsBludgeonMissileTxt^^</b>:<b>^^ACvsBludgeonMissile^^</b>}}<nowiki>{{ =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 </nowiki><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)<nowiki>}}{{Damage=[[ceil([[1d6]]/2)]]HP fire damage}}{{Target HP=</nowiki><b>^^targetHPfield^^</b> HP}}{{Ammo left=<b>^^ammoLeft^^</b>}}</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>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!</p>
+

Revision as of 09:02, 1 April 2022

Contents

Character Sheet and Token setup for use with RPGMaster APIs

Token configuration

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.

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 Haste and Slow) 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, it is recommended that tokens and character sheets are 1-to-1 to keep things simple.

The recommended Token Bar assignments for all APIs in the Master Series are:

Bar1 (Green Circle):	Armour Class (AC field) - only current value
Bar2 (Blue Circle):	Base Thac0 (thac0-base field) before adjustments - only current value
Bar3 (Red Circle):	Hit Points (HP field) - current & max

It is recommended to use these assignments, and they are the bar assignments set by the CommandMaster API if its facilities are used to set up the tokens. All tokens must be set the same way, whatever way you eventually choose.

The APIs always try to search the Token fields for appropriate Character Sheet linked fields, but will revert to the assignments above if they fail to match linked fields. These assignments can be changed in each API, by changing the fields object near the top of the API script (note: 'bar#' and 'value' or 'max' are separate entries in an array of 2 elements). All APIs must use the same field definitions:

fields.Token_AC:	defines the token field for the AC value (normally ['bar1','value'])
fields.Token_MaxAC:	defines the token field for the AC max (normally ['bar1','max'])
fields.Token_Thac0:	defines the token field for the Thac0 value (normally ['bar2','value'])
fields.Token_MaxThac0: defines the token field for the Thac0 max (normally ['bar2','max'])
fields.Token_HP:	defines the token field for the HP value (normally ['bar3','value'])
fields.Token_MaxHP:	defines the token field for the HP max (normally ['bar3','max'])

Alter the bar numbers appropriately or, if you are not wanting one or more of these assigned: leave the two elements of the array as [' ',' ']. The system will generally work fine with reassignment or no assignment, but not always. Specifically, some effects in the Effects-DB, which implement spell effects on Character Sheets and Tokens, may not set the right values if no assignment of one or more of HP, AC & Thac0 are made to the Token.


Use with various game system character sheets

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 will work with any character sheet, though the values used and altered by the APIs may not be visible or may appear in unexpected places. To work properly with your choice of Character Sheet, the mapping in the APIs must be altered. In each 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.

The APIs are designed to use attack calculations, armour class values and saving throw management defined in a number of databases, supplied in the APIs and created in the Campaign as a set of Character Sheets. If you use another system (e.g. the D&D 5e system), the calculations can be altered by replacing the provided calculations with your own. Refer to the documentation for each API and database, provided as handouts in the Campaign and as Roll20 Wiki pages, to discover how to do this.

Matching the API to a type of Character Sheet

The API has an object definition called 'fields', which contains items of the form

Internal_api_name: [sheet_field_name, field_attribute, optional_default_value, optional_set_with_worker_flag]

A typical example might be:

Fighter_level:['level-class1','current'],<br>
Or<br>
MUSpellNo_memable:['spell-level-castable','current','',true],

The internal_api_name must not be altered!</b> Doing so will cause the system not to work. However, the sheet_field_name and field_attribute can be altered to match any character sheet.</p> <p>Table names are slightly different: always have an internal_api_name 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 1st row.</p> <p>Internal_api_table: [sheet_repeating_table_name,starting_index]</p> <p>An example is:</p>

MW_table:['repeating_weapons',0],

<p>The internal_api_table <b>must not be altered!</b> Doing so will cause the system not to work. However, the sheet_repeating_table_name and starting_index can be altered to match any character sheet.</p> <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>

Character Attributes, Races, Classes and Levels

<p>Character Attributes of Strength, Dexterity, Constitution, Intelligence, Wisdom and Charisma 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> <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 'dwarf', 'elf', 'gnome', 'halfelf', 'halfling', 'half-orc' and 'human' are implemented (not case sensitive, and spaces, hyphens and underscores are ignored). If not specified, human is assumed. The race impacts saves, some magic items and armour, and bonuses on some attacks.</p> <p>The system supports single-class and multi-class characters. Classes 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>

<p><b>Important Note:
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.

Note: 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 do not</b> need to have levels set in the corresponding spell-caster columns - the casting ability & level is worked out by the system</p> <p>The following Classes are currently supported:</p>

<thead></thead>
Fighter classesWizard ClassesPriest ClassesRogue Classes
WarriorWizardPriestRogue
FighterMageClericThief
RangerAbjurerDruidBard
PaladinConjurerHealerAssassin
BeastmasterDivinerPriest of Life
BarbarianEnchanterPriest of War
Defender (Dwarven)IllusionistPriest of Light
InvokerPriest of Knowledge
NecromancerShaman
Transmuter

<p>The level for each class must be entered in the corresponding field. Multiple 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, repeating_potions, on the Character Sheet. As with other fields, this can be changed in the 'fields' object. The best way to put items into this table is by using the <b>MagicMaster API
commands --edit-mi or the GM-only command --gm-edit-mi. Alternatively, the AttackMaster --edit-weapons 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.

Items can be added to the databases. See the Database Handouts for more information on the databases.

Weapons and Ammo

For the APIs to work fully the melee weapons, damage, ranged weapons and ammo must be selected using the AttackMaster --weapon 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.

For the InitiativeMaster API to support weapon attack actions weapon name, speed and number of attacks are the most important fields. For the AttackMaster API 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).

Weapon Proficiencies

Weapon Proficiencies must be set on the Character Sheet. This is best done by using the CommandMaster API 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.

Spell books and memorisable spells

The best (and easiest) way to give a Character or NPC spells and powers is to use CommandMaster API to add spells and powers to the Character's spellbooks, and MagicMaster API 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, repeating_spells. As with other fields, this can be changed in the 'fields' 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.

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) a complete row at a time (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 counts down 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).

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 'fields' object in the APIs.

Spells can only be cast if they have macros defined in the spell databases (see Spell Database Handout). If the CommandMaster API 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.

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 fields.Spellbook (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 1st level Wizard might have the following in their large Wizard Level 1 spell book field:

Armour|Burning-Hands|Charm-Person|Comprehend-Languages|Detect-Magic|Feather-fall|Grease|Identify|Light|Magic-Missile|Read-Magic|Sleep

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 3rd level and can have 2nd level spells, the following string might be put in the spell book on the Level 2 Wizard spells tab:

Alter-Self|Invisibility|Melfs-Acid-Arrow|Mirror-Image|Ray-of-Enfeeblement

Again, as they learn more spells and put them in their spell book, just edit the text to add the spells.

Once these spell books are defined, the DM or Player can use the MagicMaster -mem-spell 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.

Powers

Powers can only be used if they are defined in the Powers database - see Database handouts. If the CommandMaster API is also loaded, the DM can use the tools provided there to manage Character, NPC & creature spellbooks and granted powers.

Powers work in an almost identical way to Wizard & Priest spells, except that there is only 1 level of powers. Powers 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 --mem-spell command (which also works for powers with the right parameters).