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

HP bar modifications for mob npcs

Im trying to run HP calculations on a bar on a npc/enemy that gets copy pasted multiple times (think say a skeleton for instance) ive tried using: !token-mod --set bar3|+5! for the bar set, bar 3 being the hp of this token, note that bar 3 has 15/15 set but not linked to a attribute, I have it this way as there can be multiple of this npc on the board at a time and they all have separate hp. (yes I have tokenmod installed and saved, willing to grab/try other apis aswell). In this current example im trying to update bar 3 to add +5 to whatever the bar3 currently reads. Ive also tried:!token-mod --@{target|token_id} bar3_value|+5! And: !token-mod --set bar3|+5!
1716877693

Edited 1716877723
Andrew R.
Pro
Sheet Author
The simplest (& best?) way to do this is with the MetaScript Toolbox, which will allow you to run TokenMod on all the mob tokens in one go, setting them all to a calculated new value. 
Andrew R. said: The simplest (& best?) way to do this is with the MetaScript Toolbox, which will allow you to run TokenMod on all the mob tokens in one go, setting them all to a calculated new value.  do you happen to have a link for that? struggling to find it. Additionally the goal was to modify bar 3 on one token but not modify it on the others.. Would this still work for that?
The bar is currently 15/15 and you want it to be 20/20? Then you need to remove the ! because that will bound the value by the current maximum.  ! token-mod --set bar3|+5 If you want to add 5 to the ‘current’ value without adjusting the ‘max’ value then you can use  !token-mod --set bar3_value|+5!
Found a solution myself, first grab&nbsp;&nbsp; <a href="https://app.roll20.net/forum/post/1216260/script-alter-bar-on-token/?pageforid=1216260#post-1216260" rel="nofollow">https://app.roll20.net/forum/post/1216260/script-alter-bar-on-token/?pageforid=1216260#post-1216260</a> &nbsp;Alter bar on token script, add to your game, then post something like this:&nbsp;!alter @{target|token_id} 3 -5 Selected for selected token, target for a target token you click on, 1 2 or in this case 3 for the different bar options and then ethier + or - the number required gets what I wanted.
1716903988
timmaugh
Forum Champion
API Scripter
Hey Robbie... here are some links to the Metascript Toolbox Andrew mentioned... The Meta-Toolbox More Meta-Toolbox There's a bunch of links I keep for pointing people to information, but it is a bit daunting to just present everything. There is... a lot. I'm hoping to get it all consolidated to a wiki article once the wiki login bug is solved. In any case, what Andrew was talking about (I think) was the ability to use a SelectManager "forselected" handle in front of the TokenMod command to get individual, differentiated results for your selected tokens. !forselected token-mod --set bar3|+5 It can get more complex if you want a randomized value. I discussed that pretty thoroughly here . Also, you can make live easier on yourself with other SelectManager constructions. For instance, if you had a horde of skeletons attached to a B 3 , and when the Boss cast a spell the skeletons who were still "upright" (eg, they have hitpoints) each got 1d8+3 HP added to their bar1 value... you would normally be in a place where you would have to either 1) select all of those skeleton tokens, or 2) have precollected their IDs and hardcoded them somewhere to include in that forselected-TokenMod command. However. SelectManager lets you "virtually" select the tokens as long as you can identify them someway. If you know that every skeleton on the page is a part of the minions the B 3 &nbsp;will buff with this spell, you could just name them something similar (like "Skeleton01") and then select them by name , filtering by those who still have a greater-than-zero value in bar1: {&amp;select Skeleton*, +bar1 &gt; 0}&nbsp; Quick Note About Setup If you want to use that but you don't want to go through the effort of renaming/numbering your tokens, just so 2 minutes of between-sessions prep-work: 1) Manually select the tokens to name according to this name+number pattern 2) Run this command: !forselected token-mod --set name|Skeleton{&amp;i} That will number them starting from Skeleton0 and counting up to one less than however many tokens you have selected. If you'd rather start at 1, run: !forselected token-mod --set name|Skeleton{&amp;i+1} If you are concerned about some tokens having fewer characters in their name (those numbered 0-9 vs those numbered 10-99), you could split the tokens into the first 10 (if you start your numbering at 0, otherwise the first 9 if you start at 1), and then run this command: !forselected token-mod --set name|Skeleton0{&amp;i} Then you can select the rest of the horde (well, up to the 99th token, if you have that many), and run: !forselected token-mod --set name|Skeleton{&amp;i} (Remember to add change both of those to the {&amp;i+1} variation if you want to start at 1) Another option, if you've opted into the experimental/enhanced sandbox, is that you can "tag" all of the creatures (of any type or any name, not necessarily a similar naming pattern) with all of their potential NPC group affiliations, and select based on that tag : {&amp;select *, +#SkelGroup1, +bar1 &gt; 0} Adding these {&amp;select} statements to the forselected-TokenMod command line will virtually select the designated tokens without you having to interact with the VTT (or change who/what you have selected).