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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Newbie request whether an API is required to update a custom field on a character sheet with a macro

1547293980

Edited 1547294091
I am a Newbie as far as using API scripts are concerned. Here is what I am trying to accomplish. One of my players wants to play a Banner / Hulk type character in D&D 5e Storm Kings Thunder. The idea is to use two different tokens that are connected to their own independent character sheets. The Banner type is set up as an artificer. The Hulk is set up as a Barbarian The rules around changing from one character to the other is the topic. When the Hulk character is in battle, every time he gets hit by a critical hit he has to make a wisdom saving throw versus a DC, that decrements by 2 every time he gets hit with a crit. The idea is that starting off in a battle his chances of NOT changing back to his other character are really good, but as the battle goes on, every time the Hulk gets hit by a crit it becomes easier for him to revert back. The simplest solution to this would be to create a custom variable in the character sheet for persisting the DC value. Then have one macro to reset the DC (whenever the Hulk appears) and another macro to decrement the DC field while the Hulk is in battle. The solution does not need to be event driven based on the roll of critical hits. I am fine with triggering this with a macro manually. My thought is if I can figure out how to handle the transformation from the Hulk back to Banner, that I would be able to figure out myself how to handle the transformation from Banner to the Hulk in a similar fashion. The main goal is to not have to keep track of the DC manually on paper during a battle everytime it changes for a crit against the Hulk. Is there a particular API that I would need to activate in order to be able to update a variable on a character sheet or is there a different way to accomplish this? If there is not an existing API that would enable this, does anyone have an API snipet that would enable the updating of a custom variable on the character sheet?
Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} I solved the problem myself using the ammo reduction API Here is the macro that I used to decrement the transformation DC by 3 every time a crtiical hit takes place   !ammo @{character_id} Renn_trans_DC -3 DC   Here is the macro that I used to make the transformation roll using the transformation DC.   /em rolls some dice /w GM @{selected|token_name} makes a transformation roll of [[1d20 + @{npcd_con_mod} [Constitution Mod]]]. /w GM A transformation takes place at the end of the round, if the roll meets or beats the following DC [[@{Renn_trans_DC} [Renn transformation DC]]]
1547303470
The Aaron
Pro
API Scripter
Great!  If you want to try another option, chatsetattr is another script you can do this with. It’s more general purpose than Ammo so the messaging is probably better suited. 
Thanks for the suggestion