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

Set Hit Points Current and Maximum for NPC Token

I have a token that is linked to my Orc npc journal, Bar 2 is linked to npc_ac, Bar 3 is linked to npc_speed. Now, if I link Bar 1 to HP, it will have the HP of the Orc Stat Block, but then if I have more than one Orc, this is no good because a change to one Orc token current Bar 1 will make all of them change.  Apparently, there is nothing one can do about that and you just have to unlink that Bar 1 and manually enter the Max and Current HP in Bar 1 for every individual token of a type. Linking to HP for a character is fine, but for a "typical orc" you have to do all of them individually.  So, what I am trying to do is to find a way to have a macro button in my macro quick bar (or as a token macro, that would be fine, too) that rolls the hpformula for the selected token and writes that value into its Bar1 and Bar1|max.  I made a macro that grabs that hpformula and rolls the dice, but I can't seem to pass that to the Bar1 and Bar1|max.
1666082126

Edited 1666082164
Gauss
Forum Champion
For HP the usual process is to link then immediately de-link the bar to set the hp to the value you want.  However, for what you are asking for you need an Mod (API script) to roll dice and then push the rolled value to the token's bar. Mods require a Pro account. 
As Gauss said, you need a Pro account to do this with a Mod script such as TokenMod.  Here's an example of what I use to set up a new token: !?{Token Name?|@{selected|character_name}} !{Add Number?|Yes, %%NUM%%|No,""} !?{Darkvision?|Yes,has_night_vision|No,} !?{Darkvision Distance?|60} !?{Passive Perception?|@{selected|passive_wisdom}} !?{Size?|Medium/Small,1|Large,2|Tiny,0.5|Huge,3|Gargantuan,4} !setattr {{   --silent   --sel   --replace   --hp|''   --passive_wisdom|?{Passive Perception?}   --advantagetoggle|'{{query=1}} {{normal=1}} {{r2=\lbrak\lbrak0d20'   --rtype|'\at{advantagetoggle}'   --wtype|\ques{Whisper\ques\|Public Roll,\|Whisper Roll,/w gm }|    --npc_name|\at{selected\|token_name} }} !delattr {{   --silent   --sel    --npc_name_flag    --dtype }} !token-mod {{ --on showname showplayers_name showplayers_aura1 ?{Darkvision?} --off playersedit_name playersedit_bar1 playersedit_bar2 playersedit_bar3 playersedit_aura1 playersedit_aura2 showplayers_bar1 showplayers_bar2 showplayers_bar3 showplayers_aura2 --set name|"?{Token Name?} %%NUMBERED%%" controlledby|= bar1_link|  bar2_link|npc_ac bar2_max|  bar3_link|passive_wisdom bar3_max|  bar3_current|?{Passive Perception?} aura2_color|#0000ff aura2_radius|  night_vision_distance|?{Darkvision Distance?} scale|?{Size?}u bar_location|overlap_bottom compact_bar|on defaulttoken }} /w gm Mook Token Full Setup for @{selected|character_name} !token-mod --set name|"?{Token Name?}" bar1|@{selected|hp|max} I'm using several Mod scripts, including TokenMod , ChatSetAttr , MonsterHitDice , and TokenNameNumber .
Hey, so I just want to make sure I understand. Lets say the token bar 1 attribute is set to "hp", and the token is set to represent "Orc", a character in my journal, and Orc has this same token set as its default.  Is there any way to roll the hp formula and have the result populate "bar1" and "bar1|max"? It doesn't have to be a macro, what about from the character sheet? Anything other than an API script?
1666585899

Edited 1666585954
Gauss
Forum Champion
Waargrin said: Hey, so I just want to make sure I understand. Lets say the token bar 1 attribute is set to "hp", and the token is set to represent "Orc", a character in my journal, and Orc has this same token set as its default.  Is there any way to roll the hp formula and have the result populate "bar1" and "bar1|max"? It doesn't have to be a macro, what about from the character sheet? Anything other than an API script? No, there is no way to automatically set rolled values except via an API script. You will have to manually set them if you don't want to go the API route.