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

Randomly setting HP on monsters (5E)

I have a macro that among other things, does: !token-mod --set bar1|[[@{selected|npc_hpformula}]] This has always worked in the past but doesn't seem to work any more.  I purchased Mordenkainen's Tome of Foes today and added it to my game. I noticed that all of the monsters in that book in the compendium have the current hp and max hp set to the same amount. I went back and looked at creatures that I **KNOW** this worked on before, and found that the above token-mod doesn't work with them either, any more... and they are now also set the same way. I don't know if they were set that way before but I know the macro worked because I've been using it for the last two years. But, the macro no longer works, even on tokens it worked on in the past. Any ideas? Did Roll20 break something? This is only since buying MToF since it worked yesterday, and doesn't work today after the purchase.
I just tried the macro on a random npc monster and it worked for me. First, do you have the most recent version of TokenMod installed, and is your sandbox currently running (make sure there's no visible error on the API page). I'd restart your API just to make sure as well before retrying the macro. What happens if you put @{selected|npc_hpformula} directly into chat? You should get a dice expression for the creature (something like 2d8 +3) - make sure you have a creature selected. What happens if you put [[@{selected|npc_hpformula}]] directly into chat? You should get a resolved dice roll (something like 12) If you're not getting any result from the plain attribute call, it means that it's an issue with the character sheet, and the npc had their hpformula changed in some way. Double check that on the character sheet.
1647736749
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Another possibility: Check to see if your sandbox has crashed.
I use MHD for this.  I only use tokenmod to roll hp for my wildshape druids sheets.  Even then it worked for me just tonight in our session for sure.  
I know no one is going to believe me but... I've had issues where APIs don't function at all and the sandbox has not crashed. They just all stop working. Restarting the sandbox usually fixes that problem. But, that is not the issue with setting the hp using token-mod in this case. Other APIs were working fine, it's just that setting the hp was not working. And, like I said, I noticed this issue just after purchasing a Mordenkainen's Tome of Foes and I noticed that tokens were having their "max hp" set to their "current hp" and I'm wondering if that is the issue.
Both of those expressions put into chat work just fine. As far as I know, I have the most recent version of TokenMod installed, and yes, the sandbox was running and yes, other API's were working just fine. And, no, restarting the sandbox did not fix the problem with setting the hp values. And, yes, I did check the character sheet to make sure the formulas were correct. I'll see what happens today. Very often the problems I have with Roll20 seem randomized, often unreproducible by others, and a complete mystery. Jarren said: I just tried the macro on a random npc monster and it worked for me. First, do you have the most recent version of TokenMod installed, and is your sandbox currently running (make sure there's no visible error on the API page). I'd restart your API just to make sure as well before retrying the macro. What happens if you put @{selected|npc_hpformula} directly into chat? You should get a dice expression for the creature (something like 2d8 +3) - make sure you have a creature selected. What happens if you put [[@{selected|npc_hpformula}]] directly into chat? You should get a resolved dice roll (something like 12) If you're not getting any result from the plain attribute call, it means that it's an issue with the character sheet, and the npc had their hpformula changed in some way. Double check that on the character sheet.
1647795715

Edited 1647795940
Saul J. said: I know no one is going to believe me but... I've had issues where APIs don't function at all and the sandbox has not crashed. They just all stop working. Restarting the sandbox usually fixes that problem. But, that is not the issue with setting the hp using token-mod in this case. Other APIs were working fine, it's just that setting the hp was not working. And, like I said, I noticed this issue just after purchasing a Mordenkainen's Tome of Foes and I noticed that tokens were having their "max hp" set to their "current hp" and I'm wondering if that is the issue. I’ll just say that lots of people believe you - ‘silent’ API crashes are definitely a known bug.  New question:  I’m also wondering if possibly you have more than one character sheet with the same name  if you added monsters from MToF that you already had versions of, then it’s possible that the linked tokens are connected to the old character sheet, but the new character sheet is the one being updated (or vide-versa). This is also a known issue. If you’d like an outside perspective to see if I see anything weird  I’m happy to take a look if you send me a game invite (don’t post game links publicly).
Saul J. said: I know no one is going to believe me but... I've had issues where APIs don't function at all and the sandbox has not crashed. They just all stop working. Restarting the sandbox usually fixes that problem. But, that is not the issue with setting the hp using token-mod in this case. Other APIs were working fine, it's just that setting the hp was not working. And, like I said, I noticed this issue just after purchasing a Mordenkainen's Tome of Foes and I noticed that tokens were having their "max hp" set to their "current hp" and I'm wondering if that is the issue. I fully believe you, they still have never fixed this and plenty talked about it but its one of those things that we all see but can't show its happening.  Happens all the time, its like your tab open to the sandbox is frozen and you have to refresh it and when you do, you see its idled and is rebooting when you just used it a second ago.  
I can replicate this problem by changing my giant awesome wiildshape token mod macro to also link each npc sheet to bar 1 hitpoints.  I believe what is happening is a feedback loop due to someone having the sheet actually open while the api is sitting on a delay to access the sheets data as it also needs to spin up the sheet like all of us do, so the sheet takes precedent.  Are the MTF creatures bars linked?  That seems like a huge mistake if it is and I'd be annoyed if I had to go in and unlink all of them manually.  
It's possible that there are multiple character sheets with the same name.  I'm running Tomb of Annihilation. The module loads in a lot of creatures, some of which are also in the Monster Manual, VGtM, and MToF. I've been doing a lot over the last 3 days preparing stuff so I don't know right now if it was failing on monsters that have duplicates. Another potential possibility is that I've been creating new monsters and making duplicates of NPC sheets to use as basis for the new monsters. For example, tonight while I was working I made a copy of the basic skeleton sheet in order to create a new monster that had a lot of the same data but was slightly different. I'm fairly certain that when I was having problem with setting the hp points it was on the new monsters that I first noticed the problem, but then had problems with already existing monsters on other pages (including those that came with ToA) that I know worked in the past. Tonight though, unlike last night, I didn't have any problems with randomly setting the hp so it's possible it was either (a) a timing issue due to load since Saturday is a busy day on Roll20, (b) silent crashes of the api or (c) random unexplained weirdness. Jarren said: Saul J. said: I know no one is going to believe me but... I've had issues where APIs don't function at all and the sandbox has not crashed. They just all stop working. Restarting the sandbox usually fixes that problem. But, that is not the issue with setting the hp using token-mod in this case. Other APIs were working fine, it's just that setting the hp was not working. And, like I said, I noticed this issue just after purchasing a Mordenkainen's Tome of Foes and I noticed that tokens were having their "max hp" set to their "current hp" and I'm wondering if that is the issue. I’ll just say that lots of people believe you - ‘silent’ API crashes are definitely a known bug.  New question:  I’m also wondering if possibly you have more than one character sheet with the same name  if you added monsters from MToF that you already had versions of, then it’s possible that the linked tokens are connected to the old character sheet, but the new character sheet is the one being updated (or vide-versa). This is also a known issue. If you’d like an outside perspective to see if I see anything weird  I’m happy to take a look if you send me a game invite (don’t post game links publicly).
The MToF creature's bars are not linked by default. I link them as I use them so that as I'm running my game, I don't have to keep looking things like AC up. I do not link the hp bar though.  DM Eddie said: I can replicate this problem by changing my giant awesome wiildshape token mod macro to also link each npc sheet to bar 1 hitpoints.  I believe what is happening is a feedback loop due to someone having the sheet actually open while the api is sitting on a delay to access the sheets data as it also needs to spin up the sheet like all of us do, so the sheet takes precedent.  Are the MTF creatures bars linked?  That seems like a huge mistake if it is and I'd be annoyed if I had to go in and unlink all of them manually.  
Saul J. said: It's possible that there are multiple character sheets with the same name.&nbsp; I'm running Tomb of Annihilation. The module loads in a lot of creatures, some of which are also in the Monster Manual, VGtM, and MToF. I've been doing a lot over the last 3 days preparing stuff so I don't know right now if it was failing on monsters that have duplicates. Another potential possibility is that I've been creating new monsters and making duplicates of NPC sheets to use as basis for the new monsters. For example, tonight while I was working I made a copy of the basic skeleton sheet in order to create a new monster that had a lot of the same data but was slightly different. I'm fairly certain that when I was having problem with setting the hp points it was on the new monsters that I first noticed the problem, but then had problems with already existing monsters on other pages (including those that came with ToA) that I know worked in the past. Tonight though, unlike last night, I didn't have any problems with randomly setting the hp so it's possible it was either (a) a timing issue due to load since Saturday is a busy day on Roll20, (b) silent crashes of the api or (c) random unexplained weirdness. If this is the issue, then I can offer a suggestion of the approach I've taken.&nbsp; I have several duplicate monsters from different modules (especially low level monsters like Goblins, Zombies, etc.) so TheAaron was nice enough to whip up a couple scripts for me: The first one is what I use to append a tag onto monsters from different modules; e.g. Goblin LMoP, Goblin DoIP, etc. <a href="https://app.roll20.net/forum/post/9488944/script-to-change-character-name/?pageforid=9488944#post-9488944" rel="nofollow">https://app.roll20.net/forum/post/9488944/script-to-change-character-name/?pageforid=9488944#post-9488944</a> Here is the macro I use for 'mooks' (unnamed NPCs): !?{GM Notes Name?|@{selected|character_name}} !?{Token Name?|@{selected|character_name}} !?{Add Number?|Yes, %%NUM%%|No,""} !?{Darkvision?|Yes,has_night_vision|No,} !?{Darkvision Distance?|60} !?{Size?|Medium/Small,1|Large,2|Tiny,0.5|Huge,3|Gargantuan,4} !?{Passive Perception?|@{selected|passive_wisdom}} !token-mod {{ --on showname showplayers_name showplayers_aura1 ?{Darkvision?} --off playersedit_name playersedit_bar1 playersedit_bar2 playersedit_bar3 playersedit_aura1 playersedit_aura2 showplayers_bar1 showplayers_bar2 showplayers_bar3 showplayers_aura2 --set name|"?{Token Name?}?{Add Number?}" controlledby|= bar1_link| bar2_link|npc_ac bar2_max| bar3_link|passive_wisdom bar3_max| bar3_current|?{Passive Perception?} aura2_color|#0000ff night_vision_distance|?{Darkvision Distance?} scale|?{Size?}u bar_location|overlap_bottom compact_bar|on }} !setattr {{ --silent --sel --replace --hp|'' --advantagetoggle|'{{query=1}} {{normal=1}} {{r2=\lbrak\lbrak0d20' --rtype|'\at{advantagetoggle}' --wtype|\ques{Whisper\ques\|Public Roll,\|Whisper Roll,/w gm }| --npc_name|\at{selected\|token_name} }} !delattr {{ --silent --sel --npc_name_flag --dtype }} !set-gmnote Token Name: ?{GM Notes Name?} !wself Mook Token Full Setup for @{selected|character_name} The second one I use to swap a token name with a name on the GM notes for a token.&nbsp; That way I can still use a 'generic' token name (Goblin 1, 2, 3, etc.) and if one of them actually has a name or some other identifier then I can quickly make that the token name as needed. <a href="https://app.roll20.net/forum/post/9438195/looking-for-script-to-swap-token-gm-notes-and-token-name/?pageforid=9438195#post-9438195" rel="nofollow">https://app.roll20.net/forum/post/9438195/looking-for-script-to-swap-token-gm-notes-and-token-name/?pageforid=9438195#post-9438195</a> And here is the macro I use to swap the token name and GM Notes name: !swap-token-name !token-mod {{ --set aura2_radius|!0.25 --off showplayers_aura2 }}
@Jarren: thanks for that. I have my own set of macros that I use that do what I need them to (when they work, when the Roll20 gods allow it :-) My macros do part of what you do in setting up "mooks". It wasn't until recently that I had lots of different versions of the same low level creatures. I'm not sure that's the problem though. I'll keep an eye out but if it looks like that's the problem, I can modify your script for my own use. I'm not convinced that the multiple copies are really the problem, though.