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

[Script] Pathfinder 2E Treat Wounds

1610266060

Edited 1616105851
Mark S.
API Scripter
Treat Wounds Source: <a href="https://bitbucket.org/desertwebdesigns/roll20/src/master/TreatWounds/" rel="nofollow">https://bitbucket.org/desertwebdesigns/roll20/src/master/TreatWounds/</a> UPDATE (2021-01-12): Treat Wounds is now available as a one-click install from the API Script Library! Introduction I'm currently running two PF2E campaigns, one with my kids and one with 2 first time players (of any tabletop RPG, not just Pathfinder). With the current Covid Pandemic we have moved the game with friends online. To help streamline the multiple decisions and checks made just in the name of healing, I decided to write this script. With Treat Wounds, a simple macro can prompt you for all the information needed to heal an ally including selecting the DC of the check, who you want to heal, and whether or not you want to perform Risky Surgery on them :o Requirements Treat Wounds relies on the modifiers and bonuses taken from the character sheet (developed using the Roll20 PF2E Character Sheet). In order to perform the check, the script requires either the character name or the token Id of a token representing the character doing the healing. If there is no character sheet with the name provided or the token selected does not represent a character, the script will exit. The player calling the script must also have control of the character/token selected, either explicitly or through 'All Players' control. Commands !treatwounds,config Show current config settings !treatwounds,config ,shownotes Toggle setting to show Medicine Skill notes in rolls. This does not affect, nor change, the global "Show notes in rolls" sheet setting. This way you can show notes just for these specific rolls, but keep them globally off for instance. This can also be set as a one-click option during install from the Script Library !treatwounds,&lt;&lt;Token ID|Character Name&gt;&gt;,&lt;&lt;Risky Surgery&gt;&gt;,&lt;&lt;DC&gt;&gt;,&lt;&lt;Character #1 to Heal&gt;&gt; ,&lt;&lt;Character #2 to Heal&gt;&gt; ,&lt;&lt;Character #N to Heal&gt;&gt; The command parameters are fairly straightforward: Token ID|Character Name - (str) The Token ID (likely passed from @{target|token_id}) or Character Name (as on the sheet) of the character doing the healing. This character/token must &nbsp;be controlled by the calling player, either explicitly or through 'All Players' control Risky Surgery - (bool) Boolean value of 1 (Yes) or 2 (No) whether or not to perform Risky Surgery as per the character feat. DC - (str) The DC of the check being performed. This is a string that is returned as part of the roll template, but must &nbsp;contain the integer value of the actual DC (Example: "Trained DC: 15") Character(s) to Heal - (str) Name of the character(s) to heal.&nbsp;All arguments from the 4th and onward are considered Character Names to heal (useful for multi-target healing with Ward Medic feat).These are passed in messages when damage is dealt to the character(s) due to Risky Surgery or a Critical Failure on the check, as well as listed when healing is done. The following Macro makes calling the API command a breeze: !treatwounds,@{target|token_id},?{Risky Surgery| Yes,1| No,0 },?{Medicine Check Difficulty| Trained (DC 15),Trained DC: 15| Expert (DC 20),Expert DC: 20| Master (DC 30),Master DC: 30| Legendary (DC 40),Legendary DC: 40 },?{Who to Heal (comma separated)} Updates Version 0.1 (2021-01-03) Initial version of script Version 1.0 (2021-01-09 Updated script to follow API Programming Guide and Best Practices Renamed primary command from !performsurgery to !treatwounds Converted to use async/await to allow for parsing of dice rolls and taking actions based on results (such as for critical success/failures) Heal double on critical success Better handling of critical successes and failures Version 1.1 (2021-01-25) Names now shown in the roll to know who healing was done to Ability to provide multiple character names to heal multiple targets at once (Ward Medic Feat) Show Medicine Skill notes in rolls (configurable option) Version 1.2 (2021-03-10) Critical successes on treat wounds checks now roll 4d8 plus proficiency bonus instead of (2d8)*2, as written in CRB. Planned Updates These changes may or may not happen as I continue to work on, and use, the script depending on whether I think it's necessary and/or player feedback Send error message back to chat on failure Rename args array in handleInput for ease of use/readability Setup proper installer and allow for default settings and simpler command call with defaults Allow for generic tokens that don't represent a character (requires sending healing modifier with api call) Check for Risky Surgery Feat before prompting Check for Proficiency and build option list from there Above two options require sending API Buttons back to user when calling API. User will call script and API will send back a button with the appropriate user prompts depending on character sheet (ie, don't prompt for Risky Surgery if user does not have it in feats, don't allow Master/Legendary difficulty if user is only Expert, etc) Show medicine skill notes in roll Configurable option to roll separate checks/heals for separate users Add options/bonuses received from medic archetype Notes Feedback, bug reports, and suggestions for improvement are all welcome. Side Note I have been playing Pathfinder for about 10 years now, most of it as a GM. I'm approaching 2k hours in Roll20 (at the time of this post). I've used the API extensively and dabbled with some minor script modifications in the past, but this script is my first foray into actual Roll20 API programming, let alone my first publicly released script . I love programming and automation, being a database engineer for going on 12 years now, and have used, and even written, many APIs in the past just never for my Roll20 games. I'm sure my script may not be as clean as others out there or utilize built-in Roll20 functions or the Underscore.js library (first time using) to full effect, but I am really happy with the results so far. As mentioned above, feedback is definitely welcome, even if it just relates to coding standards/best practices. I've written Javascript for years on the side as a web developer, but am by no means a professional and am just getting converted to ES6 standards.
This looks really awesome, I'll try to test it out this week! Is there an option for showing the PC's Medicine notes?
@Persephone Not currently. I'll add it to my list of planned updates to have it as a configurable option.
Version 1.1 updates: Names now shown in the roll to know who healing was done to Ability to provide multiple character names to heal multiple targets at once (Ward Medic Feat) Show Medicine Skill notes in rolls (configurable option) @Persephone
While testing this I noticed it seems to double the 2d8 result on a critical success, rather than roll 4d8 (how it works in the CRB). Might wanna allow that to be toggled by the user.
Persephone said: While testing this I noticed it seems to double the 2d8 result on a critical success, rather than roll 4d8 (how it works in the CRB). Might wanna allow that to be toggled by the user. You're right, that is a mistake. It should be 4d8 RAW. I'll make that an option, because I know some people do prefer to just double it
Is there a way to make this work on a character sheet?
Wedge said: Is there a way to make this work on a character sheet? Do you mean like clicking/activating it from the character sheet? As far as I know, I don't think that is possible to call the command directly from a character sheet button. That would require a customized character sheet. The easiest thing to do would be to create an ability/macro to call with all the options (example above) and display it as either a character action or in the macro bar.
Update v1.2 (2021-03-10) Critical successes on treat wounds checks now roll 4d8 plus proficiency bonus instead of (2d8)*2, as written in CRB. This will be a user-defined option in the future to either double the roll or roll 4d8 RAW Persephone said: While testing this I noticed it seems to double the 2d8 result on a critical success, rather than roll 4d8 (how it works in the CRB). Might wanna allow that to be toggled by the user.
Thanks for the update! =D