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 .
×

Random Hitpoint Maximum

Is there a way that when a monster is dragged to the map it will assign a random HP for it? For example, when a goblin is dragged onto the map it always assigns an HP maximum of 7. I would rather have the HP 2d6 assigned for each one. Is this possible? 
MonsterHitDice script Using API scripts requires the game creator to have a Roll20 Pro subscription.  
1649562737

Edited 1649562775
I have a ScriptCards macro that lets me select a group of monsters and then select from a list of options to populate the HP. Default Random based on Formula Random 2 rolls take the highest Random 5 rolls take the highest Random 10 rolls take the highest Random 2 rolls take the lowest Random 5 rolls take the lowest Random 10 rolls take the lowest It also asks for a default adder that is applied globally to all the options above.  To run this you need to be a Pro user and have scriptcards and tokenmod api installed. !script {{ --/|Script Name : Set Monster HP --/|Version : 1.0 --/|Requires SC : 1.4.0+, (Also requires tokenmod API Script) --/|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| --<| }}
1649564511
GiGs
Pro
Sheet Author
API Scripter
Just as a point of clarification: If you're a Pro subscriber: yes. If you're not a Pro Subscriber: no. You need access to the API for this (and the two previous comments are ways of using it), and that only comes with a Pro subscription.
The Monster Hit Dice script in the Roll20 library does this automatically in the background whenever you drag a monster from the Journal onto the map.
Bill (Do Not Kill) said: The Monster Hit Dice script in the Roll20 library does this automatically in the background whenever you drag a monster from the Journal onto the map. It also does this to copied and pasted tokens, which screws up my druids wildshapes, whom I have set to roll hitdice when she shapes/summons npc sheets so when she goes across maps I have to disable MHD, wish there was a block on MHD where it wouldn't reroll sheets assigned to players.