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

Mutants and Masterminds 3e Attack Automation For Official Character Sheet

1716344362

Edited 1726288542
Heyo!&nbsp; I have created a couple of roll20 API scripts that automate damage, area effect and affliction based attacks. The work with the official roll 20 character sheet . <a href="https://gist.github.com/thomasjeffreyandersontwin/a4e585b20cd122b94caea0d39b69898a" rel="nofollow">https://gist.github.com/thomasjeffreyandersontwin/a4e585b20cd122b94caea0d39b69898a</a> ----------------------------- New --&gt; the module also supports the mm3e Unofficial Character sheet. For best results paste attack details like range, area effect, multi attack, affliction details, other extras, etc directly from herolab as is into the "effect names" text box for each attack.&nbsp; You need to change the macro for each attack in the unofficial sheet to either #ROLL-ATTACK-MULTIPLE-TARGETS &lt;attack name&gt; #ROLL-ATTACK-SINGLE-TARGET &lt;attack&gt; ---------------------------- Features Attack Rolls Standard attack -&gt; chooses correct active defense of target based on range or melee Area effect attacks -&gt;&nbsp; targets roll evade with half damage on suceed,&nbsp; Perception attacks -&gt; attack roll skipped Multiple targeting &nbsp;-&gt; with separate attack rolls for all attack types Multiattack -&gt; mechanics for single and multi attack and damage bonuses now factored in Attacking Minions -&gt; Can choose to take 10 against minions Defenseless -&gt; can shoose to auto hit defenseless targets Damage Save rolls Auto rolls Defense Save of target on attack confirm, using correct defense based on attack Afflictions and Damage Effect -&gt; are supported Wounds and Conditions -&gt; damage automaticall applied to target on failed save Alternate Resistance -&gt; applied if applicable Attacking Minions &nbsp;-&gt; does most damaging effect on hit Defenseless &nbsp;-&gt; can shoose to roll to hit and do critical damage&nbsp; Critical Hit -&gt; can do extra damage on criticals Other Minions -&gt; set minion status mode on character sheet &nbsp; API toggle -&gt; turn use of API on or off on the character sheet Conditions -&gt;&nbsp; setting and unsetting conditions, whether by character sheet or due to failed saves updates modifiers and triggers related conditions.&nbsp; Superseded condition are taken into account. Critical Hit &nbsp;-&gt; and miss logic for attacks and damage implemented Hero Points Logic -&gt; implemented for attack and damage implemented Transaction integrity -&gt; &nbsp;pressing chat buttons more than once in error will not cause duplicate attacks or damage rolls&nbsp; Overrides -&gt; GM/players can force hit, re-roll attack, or cancel damage to handle unforseen circumstances To Do auto resist affliction on trailing round deplete hero point on use support for "other powers" (TBD) Instructions &nbsp; grab character sheet html, roll20 api script, and custom macros&nbsp; here Add the js file in the link to your&nbsp; Mod (API) Scripts In game setting, choose custom character sheet and paste the&nbsp; HTML provided to the&nbsp; character sheet HTML &nbsp;edit &nbsp;field Bring the css from the existing official&nbsp; roll 20 character sheet &nbsp;into the CSS if your&nbsp; custom character sheet activate the game and go to a character sheet where you want to turn automation on, and toggle Use API to "on" Attack macros are also provided. O nly&nbsp;use these you dont want to use modified character sheet template &nbsp;Just import the macros included through the&nbsp; collections tab &nbsp;of the game.&nbsp; Add custom abilities to your characters using the attack macros. The two main macros for attacks are:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;# ROLL-ATTACK-MULTIPLE TARGETS &lt;your attack name&gt; &nbsp; &nbsp; &nbsp; &nbsp;#ROLL-ATTACK-SINGLE-TARGET &lt;your attack name&gt; Check out the other macros provided that help to debug / view /set values on your character sheet, they should be somewhat self explanatory.
Added
-added support for perception based attacks - force hit, cancel damage buttons added to chat cards
- damage roll now checks for Alternate Resistance - If you replace the Official Roll-20 character sheet HTML with included HTML file then automated attacks can be initiated directly from the attack roll button on the character sheet&nbsp;
You can now turn on or off the automation on a character by character basis go into the attributes sheet of your character and add an attribute "use_api" set it to 0 to turn automation off, and any other value to turn it on
1716906392
timmaugh
Pro
API Scripter
That is an impressive amount of work, Jeff! Can I make one or two small suggestions? 1) Wrap up your script functions in your own namespace to avoid collisions with other scripts... all of the scripts in a game are concatenated into a long JS file before being read into the sandbox, so if another script has also created a&nbsp;GetCharacterTokenSheetFromTokenId function in the root space and you each return objects of different types/properties, something is going to break. A good pattern -- obviously not the only one -- is the Revealing Module Pattern . Actually, now that I look around, this post has Aaron's most current RMP template... and here is the RMP template I use. 2) Nest your on-chat event in an on-ready event: on('ready', () =&gt; { &nbsp; on('chat:message', (msg) =&gt; { &nbsp; &nbsp; // ... &nbsp; }); }); You can see this already set up in the RMP template linked just above in that the registerEventHandlers function connects the chat event to the handleInput function, but it is only called in the ready event. This change will allow metascripts to interact with and provide extra functionality to your command line. 3) Another seed of a potential time-saver you can plant now is to implement The Aaron's API_Meta object trick. You can see the verbiage in both his updated RMP template and in my template, both linked above... but a fuller discussion of it (and how to "opt-in" as a scripter) is in this ScriptInfo post . ScriptInfo is a way to disambiguate line error numbers in the error messages users receive. You can use it to turn an error's line number (referencing some line in that potentially very long, concatenated list of scripts I mentioned) into a specific reference to a specific line in a particular script. Just going by what you've done on this project, you seem comfortable troubleshooting javascript, but this trick can help you when someone else has your script installed in their game and is telling you they've received an error. Who knows how many scripts they have installed or in what order, so the line number won't help. But if you've implemented the API_Meta trick and you have the user install ScriptInfo, they can quickly tell you exactly which line in your script failed, allowing you to start investigating why. Anyway, like I said, this is an impressive amount of work. I hope these suggestions help!
Hey thanks! I am a complete roll20api noob and not very well versed in js to be honest, so really appreciate these tips, not getting the right js line when things go wrong was driving me crazy lol, so yes will make all of the above fixes.
- accidental (or malicious YOU CHEATERS) duplicates presses of attack and damage chat buttons are now caught and prevented from triggering attack or damage save rolls - critical hits and misses now work
- fixed a whack load of niggly defects - hero point mechanics now work
Minions &nbsp;-&gt; set minion status on character sheet, can choose to take 10 against minions,&nbsp; does most damaging effect on hit Defenseless &nbsp;-&gt; can shoose to auto hit defenseless target or can shoose to roll to hit and do critical damage&nbsp; Critical Hit &nbsp;-&gt; can do extra damage on criticals API toggle -&gt;&nbsp; turn use of API on or off on the character sheet
Some major bug fixes for the unofficial character sheet. Damage from attacks now update injuries. Jest unit tests added. <a href="https://gist.github.com/thomasjeffreyandersontwin/a4e585b20cd122b94caea0d39b69898a" rel="nofollow">https://gist.github.com/thomasjeffreyandersontwin/a4e585b20cd122b94caea0d39b69898a</a>