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

Percentage Macro

I'm trying to make a macro that uses a percentage of the target HP and add it to the damage of the weapon. What am I missing here? [[floor((25/100*[[@{target|hp|max}]][25% of Max HP]) + 1d8 + 7)]] I tried it several ways (e.g. using 0.25 instead of 25/100) and so on. 
1605072298

Edited 1605072470
Oosh
Sheet Author
API Scripter
When you're grabbing the 'max' value of an Attribute with a target call, you need to supply a target label. It's a good idea to use them all the time anyway - avoid issues  like this and it can make your macros easier to use. This: [[floor(0.25*@{target|foe|hp|max})[25% HP] + 1d8 + 7]] should do the trick. edit - or, once you're happy it's working how you want it, if you want to pretty up the tooltip you can wrap the floor calculation in another set of squackets: [[[[floor(0.25*@{target|foe|hp|max})]][25% HP] + 1d8 + 7]]
Thanks a lot, it worked really well