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

Subtract damage from target Token?

  Trying to set up a macro to automatically subtract damage from one of the token bars.This is what I have so far: /emas @{selected|token_name} Attacks rolling a  [[1d20+?{modifier|0}]] at @{target|target1|token_name}  [Roll Damage](! [[ 1d6 ]]) Any help would be greatly appreciated. Thank you in advance. :]
1566459913
vÍnce
Pro
Sheet Author
Macros can only read attribute values.  You'll need to use an API script (Pro perk), like TokenMod or ChatsetAttr in order to manipulate attribute values using a macro.  
Vince said: Macros can only read attribute values.  You'll need to use an API script (Pro perk), like TokenMod or ChatsetAttr in order to manipulate attribute values using a macro.   So TokenMod and/or ChatsetAttr can be implemented to automatically deduct say, HPS, from a token bar? So does that mean I can abandon my effort to sideways-jam alterbars into Power Cards (more specifically PC Macro Helper)? 
1566491707

Edited 1566491770
yes, most definitely. - I have it combined with a more complicated macro, see here for a quick clip of it on youtube... <a href="https://youtu.be/mcipzeFUSnw?t=250" rel="nofollow">https://youtu.be/mcipzeFUSnw?t=250</a> Definitely no need to combine it with powercards.
I can probably get pro next week or so(bills), how does api work? Is it hard to understand? Sorry, I do not have that much experience with that sort of thing and have had to reference youtube videos to learn macros.
1566504393
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
API is simple to use, but requires JavaScript programming to innovate with. Basically, your game will have an API page that allows you to Add script by choosing from a drop down (super easy), paste in custom scripts from other sources (easy), to program your own (as easy or hard as programming might be for you). Scripts add commands and behaviors to your game not otherwise available. If you want to know more, ask in a new thread, so asa not to hijack this one, or consult the wiki.
Thank you all for the information, this is really a wonderful community!
Godthedj Please post the code that subtracts damage from&nbsp; a token.
godthedj said: yes, most definitely. - I have it combined with a more complicated macro, see here for a quick clip of it on youtube... <a href="https://youtu.be/mcipzeFUSnw?t=250" rel="nofollow">https://youtu.be/mcipzeFUSnw?t=250</a> Definitely no need to combine it with powercards. I have been getting into Power Cards. I like them for the aesthetics, but what I really think is great are the replacement and template functions: a single macro for an attack is all that's needed for any PC or NPC, any weapon on any character sheet. It makes everything streamlined and easy . I just cant figure out how to get alterbars to work on it.&nbsp; I&nbsp; h ave it working per weapon as a macro but its not ideal. The alterbar macro I am using automatically deducts hit points from a token when a successful attack is made upon it. The template I am using is perfect except for that one function. I'm so close to doing it but it just eludes me.
The way I use the chatsetattr API is to combine it with this global macro. I have it set as a 'token action'. When I want to run it, i need to have the token selected.... /emas The enemy takes [[?{How much damage? (RES to @{selected|npc_resistances})|0}]] damage! !token-mod --set bar1_value|-[[?{How much damage? (RES to @{selected|npc_resistances})|0}]] This tells everyone that the enemy has been damaged by giving me a prompt, the prompt also reminds me of anything that the enemy is resistant to... If I wanted to 'autoroll' the damage, I assume I could change it to say.... /emas The enemy takes some damage! !token-mod --set bar1_value|-[[?{Damage roll? (eg. 1d6)}]] However... because the API's 'rolls' are done outside roll20, you won't be able to actually see what number was rolled, and will only be able to work it out by comparing the monsters HP now, Vs. what it was a moment ago.... I combine my version with a nice attack description too, which is made up of 400+ combat descriptions like this....