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 .
×

[Help] Multi-sided token based on attribute

1516922213
Hawkin
Roll20 Production Team
Hello, I'm new to coding, but having played with a few API scripts for various games (Blades in the Dark/SW FFG) I wanted to try my hand at coding something simple (hopefully) to fit my own needs. However, I wanted to ensure the idea was possible in the first place. I'm currently playing a Star Wars FFG game, and I'd like to make a script for multi-sided token linked to attributes. Hull Trauma: I'd like the make a token for the ship that switches between Green (0%) and Red (50%) to show how damaged the enemy is. The max value of Hull Trauma changes constantly based on the type of ship and so on, so I can't just put an arbitrary value to trigger the switch. Is this possible?
1516926760
GiGs
Pro
Sheet Author
API Scripter
yes, this is possible. 
1516933113
The Aaron
Pro
API Scripter
Swapping out the image is certainly something you could do.  You might find it easier to have a greyscale token and use the tint to change it from green to red.
1516972443
Hawkin
Roll20 Production Team
Doing that would work poorly with the transparency though. 
1516977184
The Aaron
Pro
API Scripter
I don't think it has any issues with transparency, but you might not get as vivid a result as you want. Anyway, just an option to be aware of. =D
1517076807
Hawkin
Roll20 Production Team
Oh, well that works definitely better than I thought. I don't know why, but I had this memory of the tint option just looking atrocious with tokens and haven't used it since!