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

Tokenmod script- why doesn't this work?

This script works for all parts except the hit points link. It's supposed to set the current and max HP to the value on the sheet, then de-link the HP so that the resulting token works for multiple uses of that monster. But, the bar1 spot is empty on current and max value after clicking the button. !token-mod {{ --set bar1_link|hp bar1_reset| bar2_link|npc_ac bar1_link| --off light_hassight --set light_radius|=0 light_dimradius|0 --off light_otherplayers --on showname showplayers_name showplayers_bar1 --set defaulttoken }} Thoughts?
1569549097
GiGs
Pro
Sheet Author
API Scripter
I'd try swapping the order of reset and link here --set bar1_link|hp bar1_reset|
So that didn't change anything, but I found out that it all works if I remove bar1_link| Problem is, then the token remains linked directly to the sheet's hit point value, which only works for named NPC creation.  When I want to make a generic creature like "goblin" the HP value on every token would be synced together.
1569550836

Edited 1569550873
GiGs
Pro
Sheet Author
API Scripter
If you use  --bar1_link| --bar1|@{selected|HP} it'll set the bars value and max to the HP of the currently selected character.  Just replace with whatever attribute name your sheet uses for HP.
That did the trick!