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

reset all tokens to max HP

1679775134
Siveron
Pro
Marketplace Creator
Is there an API or script that will set a tokens HP to max?
1679775667
Siveron
Pro
Marketplace Creator
Nevermind, I figured it out. TokenMod with the following command will do this !token-mod --set bar1_reset| bar3_reset|
Here's a scriptcard that will do that with some additional options for various randomizations based on the HP formula.  Straight Random, Take the higher or lower of 2,5 or 10 random rolls.  Will also allow you to apply an adder.   !script {{ --/|Script Name : Set Monster HP --/|Version : 3.1.2023 --/|Requires SC : 2.0+, TokenMod --/|Author : Will M. --/|Description : Utility function that resets all selected NPC hps based on the HPFormula (with a twist) --/| Twist - It allows for the following HP calcs: --/| Default - Standard static HP based on HPFormula (no randomness) --/| Random - Uses the HPFormula to derive HP --/| Random High (x Rolls) - Will take the highest value of x(2,5, or 10) rolls. --/| Random Low (x Rolls) - Will take the lowest value of x(2,5, or 10) rolls. --/| --/| Adder - A value (+/-) to add to the final result --#title|Set Monster HP --#reentrant|SetMonsterHP --#titleCardBackground|#932729 --#whisper|self --#oddRowBackground|#FFFFFF --#evenRowBackground|#FFFFFF --#buttonbackground|#FFFFFF --#buttontextcolor|#0905f2 --#buttonbordercolor|#FFFFFF --#bodyFontSize|11px --#debug|1 --/| Modes 0-Default,1-Random,2-Random (High), 3 Random (Low) --&Mode|2 --&HPField|bar1 --&Adder|0 --&HP_ROLL_COUNT|10 --&Mode|?{HP Set Mode?|Default,0|Random,1|Random High(2 Rolls),2.2|Random High(5 Rolls),2.5|Random High(10 Rolls),2.10|Random Low(2 Rolls),3.2|Random Low(5 Rolls),3.5|Random Low(10 Rolls),3.10} --&Adder|?{Additional Adder|0} --+Adder|[&Adder] --?[&Mode] -eq 2.2|[ --&Mode|2 --&HP_ROLL_COUNT|2 --]| --?[&Mode] -eq 2.5|[ --&Mode|2 --&HP_ROLL_COUNT|5 --]| --?[&Mode] -eq 2.10| [ --&Mode|2 --&HP_ROLL_COUNT|10 --]| --?[&Mode] -eq 3.2|[ --&Mode|3 --&HP_ROLL_COUNT|2 --]| --?[&Mode] -eq 3.5|[ --&Mode|3 --&HP_ROLL_COUNT|5 --]| --?[&Mode] -eq 3.10|[ --&Mode|3 --&HP_ROLL_COUNT|10 --]| --=i|0 --/| !token-mod --set bar1|[[@{selected|npc_hpformula}]] --/| For each selected Token --~Token|getselected --+TokenCount|[&TokenCount] --+Mode|[&Mode] --:MAIN_LOOP_TOP| --?[$i.Raw] -eq [&TokenCount]|MAIN_LOOP_EXIT --=i|[$i] + 1 --/| If it is an NPC token associated with a monster sheet then proceed --/| Get the npc_hpformula --&CharId|[*[&Token[$i.Raw]]:t-represents] --&HPFormula|[*[&CharId]:npc_hpformula] --/| Based on Mode - determine HP --C[&Mode]|0:MODE_DEFAULT|1:MODE_RANDOM|2:MODE_RAND_HIGH|3:MODE_RAND_LOW --/|Case 0 - Default --:MODE_DEFAULT| --=HP|[*[&CharId]:hp^] + [&Adder] --^END_CASE| --/|Case 1 - Random --:MODE_RANDOM| --=HP|[&HPFormula] + [&Adder] --^END_CASE| --/|Case 2 - Random - High --:MODE_RAND_HIGH| -->HP_RAND_HIGH| --^END_CASE| --/|Case 3 - Random - Low --:MODE_RAND_LOW| -->HP_RAND_LOW| --^END_CASE| --:END_CASE| --+[*[&Token[$i.Raw]]:t-name]|[r][&HPFormula]: [$HP][/r] --@token-mod|_set [&HPField]|[$HP.Raw] statusmarkers|=blue|-blue _ids [&Token[$i.Raw]] _ignore-selected --/|Apply Calculated HP --/| Next token --^MAIN_LOOP_TOP| --:MAIN_LOOP_EXIT| --+Done!| --X| --:HP_RAND_HIGH| --=HP|-500 --=j|0 --:HPRH_LOOP_TOP| --?[$j.Raw] -eq [&HP_ROLL_COUNT]|HPRH_LOOP_END --=x|[&HPFormula] + [&Adder] --+MRH(x / HP)|[$x] / [$HP] --~HP|math;max;[$HP];[$x] --=j|[$j] + 1 --^HPRH_LOOP_TOP| --:HPRH_LOOP_END| --<| --:HP_RAND_LOW| --=HP|500 --=j|0 --:HPRL_LOOP_TOP| --?[$j.Raw] -eq [&HP_ROLL_COUNT]|HPRL_LOOP_END --=x|[&HPFormula] + [&Adder] --+MRL(x / HP)|[$x] / [$HP] --~HP|math;min;[$HP];[$x] --=j|[$j] + 1 --^HPRL_LOOP_TOP| --:HPRL_LOOP_END| --<| }}
Here's a script by TheAaron that will set an NPC's hitpoints to the highest possible value for its hit point formula (which is different than resetting the current value to the max value, which is the same as a 'full heal'). It's configured for the D&amp;D 5E by Roll20 character sheet. <a href="https://app.roll20.net/forum/permalink/9936930/" rel="nofollow">https://app.roll20.net/forum/permalink/9936930/</a>