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

Marco to tally tokens and add to dice roll?

I have a somewhat niche macro need, and I should preface that I have access to the API and all the options that brings, including TokenMod. I have a fairly weak homebrew enemy in my campaign that my players have easily cut down before, and I'm looking to put a twist on it: an ability that increases the creature's accuracy, damage, and dodge based on the total number of said creatures currently in play. Obviously I could just build my macro for these with a query that asks me to type in the current total and adds it to the dice roll, but with large numbers of this enemy in play it could become cumbersome to tally and track. I was wondering if there's a way to have Roll20 automatically total up the number of 'creature' tokens on the map instead, or more accurately the number of tokens using the 'creature' character option from the Character Journal. Any and all insights appreciated!
1629907733
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Although this could probably be done with an API script, it might be easiest to make a reference character that has an attribute called something like "ScaleMod". You could reference that in your custom builds: Damage = 1d6 + @{referencecharacter|ScaleMod}. Then you would only need to change that reference character's ScaleMod value before a battle and the calculation would be available throughout the encounter without constant querying.
1629907875
GiGs
Pro
Sheet Author
API Scripter
And if you link that attribute to a character's token bubble, you can update the number manually during an encounter.
Gotta say, that is a very clever solution. You two are awesome! I just did a test run and your ideas panned out perfectly. It'll be a lot easier to update one hidden token as the fight progresses rather than what I was originally expecting to need to do. Thank you very much!!