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 1720637318
Heyo!  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 . ----------------------------- New --> 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.  You need to change the macro for each attack in the unofficial sheet to either #ROLL-ATTACK-MULTIPLE-TARGETS <attack name> #ROLL-ATTACK-SINGLE-TARGET <attack> ---------------------------- Features Attack Rolls Standard attack -> chooses correct active defense of target based on range or melee Area effect attacks ->  targets roll evade with half damage on suceed,  Perception attacks -> attack roll skipped Multiple targeting  -> with separate attack rolls for all attack types Multiattack -> mechanics for single and multi attack and damage bonuses now factored in Attacking Minions -> Can choose to take 10 against minions Defenseless -> 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 -> are supported Wounds and Conditions -> damage automaticall applied to target on failed save Alternate Resistance -> applied if applicable Attacking Minions  -> does most damaging effect on hit Defenseless  -> can shoose to roll to hit and do critical damage  Critical Hit -> can do extra damage on criticals Other Minions -> set minion status mode on character sheet   API toggle -> turn use of API on or off on the character sheet Conditions ->  setting and unsetting conditions, whether by character sheet or due to failed saves updates modifiers and triggers related conditions.  Superseded condition are taken into account. Critical Hit  -> and miss logic for attacks and damage implemented Hero Points Logic -> implemented for attack and damage implemented Transaction integrity ->  pressing chat buttons more than once in error will not cause duplicate attacks or damage rolls  Overrides -> 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   grab character sheet html, roll20 api script, and custom macros  here Add the js file in the link to your  Mod (API) Scripts In game setting, choose custom character sheet and paste the  HTML provided to the  character sheet HTML  edit  field Bring the css from the existing official  roll 20 character sheet  into the CSS if your  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 use these you dont want to use modified character sheet template  Just import the macros included through the  collections tab  of the game.  Add custom abilities to your characters using the attack macros. The two main macros for attacks are:              # ROLL-ATTACK-MULTIPLE TARGETS <your attack name>        #ROLL-ATTACK-SINGLE-TARGET <your attack name> 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 
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 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', () => {   on('chat:message', (msg) => {     // ...   }); }); 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  -> set minion status on character sheet, can choose to take 10 against minions,  does most damaging effect on hit Defenseless  -> can shoose to auto hit defenseless target or can shoose to roll to hit and do critical damage  Critical Hit  -> can do extra damage on criticals API toggle ->  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>