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

Make a damage macro that will remove HP from the target token

I'm looking to make a macro that will pull stats from the selected token and targeted tokens. In this example below, bar3 represents bonus damage on the attack and bar2 represents the target's Damage reduction.  /roll 2d6+@{selected|bar3} -@{target|bar2} How can I make it so that it subtracts the damage from the target's current HP? So if the target has 50HP, and the result of that die roll is that it took 11 damage, can I make it automatically adjust his current HP to go to 39?
1523688386

Edited 1523688409
Ajax
Pro
Using the API, Power Cards and AlterBars will do that...  Here is a Macro that will have a PC Target a Monster/NPC, Roll (selecting Normal, Advantage, or Disadvantage) an Attack, then Dish out the Damage to the Target on a hit. !power {{ --tokenid|@{selected|token_id} --emote|** @{selected|token_name} slashes with his Rapier. ** --corners|10 --name|Rapier --leftsub|Melee Attack --rightsub|Range: Close --Target|@{target||token_name} --Attack|[[ [$Atk] ?{Advantage?| Normal, 1d20 + [[@{selected|dexterity_mod}]] [DEX] + [[@{selected|pb}]] [PROF]] | Advantage, 2d20KH1 + [[@{selected|dexterity_mod}]] [DEX] + [[@{selected|pb}]] [PROF]] | Disadvantage, 2d20KL1 + [[@{selected|dexterity_mod}]] [DEX] + [[@{selected|pb}]] [PROF]]} ]] vs **AC** [[@{target||npc_ac}]] --?? $Atk < @{target||npc_ac} ?? !Missed|**You missed!** --?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? Hit:|[[ [$Dmg] 1d8+[[@{selected|dexterity_mod}]]]] piercing damage --?? $Atk >= @{target||npc_ac} AND $Atk.base <> 20 ?? alterbar1|_target|@{target||token_id} _bar|1 _amount|-[^Dmg] _show|all --?? $Atk.base == 20 ?? Critical Hit:|[[ [$CritDmg] 2d8+[[@{selected|dexterity_mod}]]]] piercing damage --?? $Atk.base == 20 ?? alterbar2|_target|@{target||token_id} _bar|1 _amount|-[^CritDmg] _show|all --?? $Atk.base == 1 ?? !|**Fumble: }} -Ajax
Thank you! What language do the macros use? I read through the Macros page on the roll20 Wiki and alterbar wasn't mentioned there at all, I'm trying to find a list of all the commands that I can use. 
1523735979
Gen Kitty
Forum Champion
alterbar is not a macro, it is an API script that is called via macros :)
Hey GenKitty. I'm very new to roll20. I'm using the module for LMoP and I'm trying to set up as a DM for an in-person game with my family. I'm trying to get everything set up as automated as possible, but this macro is not working for me. It does give me options to select a target, but doesn't do anything after. Any help would be greatly appreciated.
1523756046

Edited 1523756174
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You'll need to make sure you have power cards and alterbars installed in your API scripts page (accessible from the settings drop down of your games splash page). I don't have the link for the scripts atm, but you should be able to find them with a forum search of the API scripts forum. Also, welcome to Roll20, and don't lose hope. It will all seem overwhelming at first, but just take it like you would eat an elephant (one bite at a time) and you'll gradually get it all.
Awesome. Thanks Scott.
I'm looking through the dropdown menu, and did a quick search, but can't find power cards or alterbars. Would they be contained in any of the 5e APIs or under the It's a Trap! APIs?
1523756532
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Nope, they are separate. Sky never put them into the repo. I would actually recommend using chatsetattr instead of alterbars. Do a forum search of the API scripts forum for powercards.
1523756632
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Actually, I forgot, Kurt took over powercards after sky left roll20: <a href="https://app.roll20.net/forum/post/6264588/script-powercards-3-thread-5#post-6271345" rel="nofollow">https://app.roll20.net/forum/post/6264588/script-powercards-3-thread-5#post-6271345</a>
Ok. Thanks a lot for the direction. I think I have everything loaded up now. I'm running a test now.
Awesome sauce. It is working like a champ!! With the fear of being to needy. I was wondering if there is a macro out there that would do the same as this one, but read the selected token's weapons and give a drop down to select which weapon to use? I feel like a really big newb for asking.
The questions you're asking are ones that I would either be trying to figure out on my own or asking about later, so I'm glad to hear them now&nbsp;