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] RandomHitPoints (for DnD 5e)

This script rolls the monsters Hit Dice (+any con) and sets this as it's Hit Points in one of the "bubbles" above the token Git link: <a href="https://github.com/rr3636/roll20-Rino" rel="nofollow">https://github.com/rr3636/roll20-Rino</a> To use: By design it only works with DnD 5e character sheet from Actoba (default DnD 5e charsheet) It only works for NPCs The NPC must have an charactersheet, and it must be clicked to "NPC Sheet" (top selection when inside the sheet) The field "HP Hit Dice" must be filled out without any Con bonus (i.e. "6d6" is correct. "6d6+5" is not correct) The "CON" stat on the npc sheet must be filled out By default it will not roll Hit Points below "One third Hit Dice + Con bonus". That is a little below average. If you want to have the posibility to have all range of HP, you should set the variable "useMinimumOneThirdHP" to "false". The variable is set long up in the script. You must set which "bubble" you will use for HP. By default it uses the RED bubble (the one to the left). If you want to change to another bubble, example: Green, you need to set the variable "HP_BAR_ID" (3=red, 2=blue, 1=green). The variable is set long up in the script. Do NOT link this bubble to the character sheet's Hit Points. The bubble should stay UNLINKED. Everytime you now drag this icon to the map, it's HP will by rolled for - creating unique Hit points pr token.
1426640571
The Aaron
Pro
API Scripter
It's always nice to see how other people solve a problem. (I have a script for this too!). In the API, we have access to the Underscore.js library , you might find you like some of the features of it better than the raw Javascript equivalent. _.contains() and _.without are really clean (to me) alternatives to checking Array.indexof() and calling Array.splice(). Anyway, nice looking script! I like the min 1/3rd bit.
The Aaron said: It's always nice to see how other people solve a problem. (I have a script for this too!). In the API, we have access to the Underscore.js library , you might find you like some of the features of it better than the raw Javascript equivalent. _.contains() and _.without are really clean (to me) alternatives to checking Array.indexof() and calling Array.splice(). Anyway, nice looking script! I like the min 1/3rd bit. Thanks :) I first redesigned by using underscore as you suggested. Seems cleaner. But after checking up events, it was sometimes not triggering correctly. I looked into you RandomTokenNumber script for the timing there (SetTimeOut). I fixed it to 1 second. I can see in your code you calculate it based on previously timing... didn't understand all of that. Anyway, completely new code uploaded. Should work 100% now. ( version 0.4 )