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 suggestion - add random HP to token

I think the script I want is TokenMod, but I want to ask to be sure. I've got all my monsters made up as character sheets, and they all have a value for Hit Dice on their character sheets as a dice formula (e.g. 3d8+3). What I'd like to be able to do is pull their tokens onto the play area, select one or more of them, and then have a script automatically roll hit points for them based on their Hit Dice attribute, and place this figure in bar 1. Suggestions?
1430672461
vÍnce
Pro
Sheet Author
The Aaron has a script that rolls HD. <a href="https://app.roll20.net/forum/post/1273423/#post-1831157" rel="nofollow">https://app.roll20.net/forum/post/1273423/#post-1831157</a>
Yes, that works for a quick and dirty solution. I had to change the script since I use Bar 1 for HP, and that script uses Bar 2 (look at me ma, I'm coding!). However, after seeing this in action, there are a couple tweaks that would make it much more useful: 1. Right now it seems to just roll HP based on the Hit Dice attribute, and then place a number in the bar, but doesn't actually change the HitPoints attribute of the token. I'd like for it to change the Hit Points attribute as well, or ideally just the Max of the HitPoints attribute, so that I have a record of how many hit points each mook started with (for calculating XP later). 2. This only seems to work if characters are added from the journal. When I tried to copy and paste, the value in Bar 1 didn't change. Also, I have some already prepared maps with monsters on the GM level, ready to be dropped on PCs. Would there be a possibility to modify this script to work on tokens already on the map?
1430702854
The Aaron
Pro
API Scripter
hmm.. I think I need to understand your use cases more: 1. Are you saying you have all your mooks set up individually as characters? If not, wouldn't changing the hit points on the character change it for all the mooks of that type? 2. Tokens that don't have a character wouldn't have anywhere for the script to find the hit dice? The copy/paste issue is something I've been meaning to fix though. So I guess my questions would be this: 1. Are your tokens representing to a character? 2. Is Bar2 tied to an attribute?
Oh, you're right, I wasn't thinking correctly. I have them set up as mooks. There is one character sheet (Orc, for example), but the bars are not actually tied to the sheet. So that won't work. EDIT: However, I would like to be able to select a group of tokens on the map and have it randomize their hit points for me, if that's possible.
1430714552
The Aaron
Pro
API Scripter
So, this script should work for you for the drag in case for mooks, right? Select and reroll is definitely possible to write. I need to redo that script anyway because it's a complete hack I threw together a year ago (character sheets didn't exist when I made it, so maybe more than a year?)
Yes, the drag and drop works fine. I'll find another way to track their starting HP. I hope you don't mind me bringing up all your old scripts for re-write. I'm just now getting into mentor status, and I'm digging through the repository to see what goodies I can find.
Next up I've got some tweaks for TempHPAndStatus...but that's another thread :) Or would it be best to PM you?
1430715374
The Aaron
Pro
API Scripter
Another thread is fine. That's a bit of a hack as well, and one I've been meaning to rewrite...
I actually did it myself - I changed the parameters of what's completely dead (as opposed to "mostly dead"), added a "scarred" status for -6 HP or below, and changed the Assume Heal status to false.
1430717340
The Aaron
Pro
API Scripter
Sweet!
But there's a problem. Now that I have these two scripts running together, it seems that every token I pull onto the table gets a "bloodied" status... I could remove the bloodied status from the TempHPAndStatus script, but I kind of like having it in there - it will give my players a sense of how they're doing on damaging the opponent without giving away exact HP status. Any suggestions? Or time to open a new thread?
1430718064
The Aaron
Pro
API Scripter
I'll have to take a look in the morning..almost 1:00am and I'm laying in bed. :) Definitely a fixable problem.
Ok, I'll just post this, and you can look at it at your leisure. It doesn't seem to be happening for all monsters. If the monster has a "+" in it's Hit Dice formula (e.g. 2d8+2), then the token doesn't get a bloodied status. But if it's just a straight roll without a "+" (e.g. 3d8), the monster gets a bloodied token when it's added. I'll PM you a join link, so you can see if it's my changes that are doing something screwy.
UPDATE: While you were sleeping, I installed TokenNameNumber, and whatever that script does seems to take away the issue of mooks being added to the table with a bloodied marker. In addition, just changing the HP seemed to above the max rolled returned the HP to max rolled, and did away with the bloodied marker. I am noticing more of a delay though, as I draw tokens out and place them on the table - is there a functional limit for number of scripts installed?
1430749637
The Aaron
Pro
API Scripter
The delay has to do with TokenNameNumber's implementation. Some of Stephen's recent work has given me an idea about a better way to handle it, but currently, TNN gets the event that a graphic has been created, but the graphic is not completely formed yet and I have to delay setting the name until later.