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

API changing Max HP & AC

For the past several weeks, I log in to find that the PCs in my game have all had their Max HP drastically reduced. A couple of them routinely have their AC reduced as well. The Roll20 Helpdesk suggested I reach out here to get help. The only scripts I added around the time this started happening were Resting In Style and Spawn Default Token. Could one of these scripts be altering character stats like that upon loading the game?
1649436729

Edited 1649436741
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Possibly Spawn default token, depending on how the tokens are set up. Can you drag a fresh token out from your journal and show how the bars are set?
When I drag a fresh token out the bars are set the same as I've always had them. Bar 1 - hp, Bar 2 - ac, Bar 3 - nothing
1649458984

Edited 1649459066
Oosh
Sheet Author
API Scripter
Carnie DM said: When I drag a fresh token out the bars are set the same as I've always had them. Bar 1 - hp, Bar 2 - ac, Bar 3 - nothing You mean they're linked as per usual, or the hp & ac values are correct on the fresh token? I wouldn't have thought Spawn ever changes the parent token, but I could be wrong about that. AC is automatically calculated by the 5e sheet - if you're using that sheet and entering AC manually without switching off the auto option, it could potentially be correcting itself, though that wouldn't explain the HP. Resting in Style doesn't modify max HP, only current, and doesn't touch AC. Which other scripts do you have installed? Neither of these ones seems likely to be the culprit. Even if Spawn does modify the parent token, it's activated via CLI and has no sheet:opened event handler. Same goes for Resting in Style - it needs to be manually activated. Just to eliminate another option - are any players promoted GMs?
The bars are linked to the HP and AC numbers on the character sheets. So when I pull a fresh token onto the board, it reflects the wrong numbers because all the character sheets have been altered.  I have been able to figure out that the AC alteration seems to be specific to AC altering abilities and equipment. We don't alter the AC manually. It has always been calculated by the 5e sheet. I found that the warforged had their AC reduced by 1, but if I uncheck Integrated Protection (a +1 global AC modifier) and then re-check it the AC adjusts back to where it should be. The same thing happens when another character checks and unchecks their cloak of protection. The only other active scripts I'm running are Group Check and Group Initiative. And no promoted GMs.
1649475455
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Could it be a case of (in the case of HP), the player mistakenly entering their current hit points in the max field instead of the current field? It is unlikely that any of the scripts you list would be altering character sheet values in the way you describe. This sounds more like a procedural error somewhere. The AC sounds like it is functioning normally from your description.
No. For starters, the HP alteration effects all 6 PCs at the same time. And the AC isn't working correctly. The calculation changes without the global modifier being unchecked. I'm just able to finish it by unclicking and reclicking the global modifier.  After some more testing, I've determined its gotta be the Spawn Default Token script. I fixed one of the character's sheets so her HP and AC were correct. I logged in and out and it was still fine. Then once I used the script to spawn the party on a new map the problem occurred. The spawned tokens had the right numbers in the bars, but the player's actual character sheet was altered once again. Some how the script is rewriting the character sheet. 
1649480259
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, I'm not familiar enough with that script to know what it might be doing. Best to drop it if you've identified it as the problem.
1649486390
Oosh
Sheet Author
API Scripter
What command are you using for Spawn?
I had the following script as a macros button on a token. The idea being you put the token on the board, and then click the macros to spawn the party in marching order rather than drag them onto the map one at a time. !Spawn{{ --name|Willow Bet --offset|6,0 }} !Spawn{{ --name|Aanna Amatas --offset|1,0 }} !Spawn{{ --name|Verdena Kemble --offset|3,0 }} !Spawn{{ --name|Ash of the Emberwood Clan --offset|5,0 }} !Spawn{{ --name|Tal'vo'shira --offset|4,0 }} !Spawn{{ --name|Fenic --offset|2,0 }} Not going to be doing that anymore, but still don't see why this would overwrite the PCs character sheets.  
Your problem is 100% spawndefaulttoken, I forget what exactly causes it but I think its even addressed in the thread for the api script.  It is why I stopped using the spawndefaulttoken for player character sheets.  The script is great for spelltemplate bots and summons, but for some reason it constantly screws up player characters stats that are linked to the bars.  
Thanks. I'll keep using it for the druid's summoning, but never to put PC tokens on the amp again. Thanks all for your assistance. 
I've had a similar issue recently and know of several other players that have had the issue too with HP going to zero and the AC breaking on a character sheet.  And this is without using Spawn Token.   I suspect it may have something to do with the new load optimization logic, as this was a huge change to the underlying code recently.   Will
1649595393

Edited 1649631755
David M.
Pro
API Scripter
See this post about using the Spawn script to generate instances of PC tokens. This was something that popped up after Nick O's video touted that specific application (something I hadn't considered when writing the script). If the default token is not updated every time the PCs level up, then there will be a problem. If the default token only has 5hp for example and that bar value is linked to the character sheet, things will get overwritten with the values from when the default token was last save. As mentioned in the name, the script simply spawns a copy of the default token ;). Since nobody is going to reliably maintain PC default tokens that way (updating default token every time they level), take a look at the linked post to see how you should handle spawning PC tokens. The "Example" macro is what I use in my current games, pasted here to make it easy: !Spawn {{ --name|CharName --offset|1,0 --bar1|@{CharName|hp}/@{CharName|hp|max} KeepLink --bar2|@{CharName|ac} KeepLink --bar3|@{CharName|hp_temp} KeepLink }} Just make a macro that uses this pattern for as many PCs as you need, and omit the bar values you don't use.