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

Toggle global damage modifier, attack, then toggle off (dual wielding)

OK, I hope this is the place to ask this, if not I am sure someone will correct me. I have a rogue that is now going to dual wield weapons.  Sneak attack only happens once per turn, so I can only add the extra 2d6 on the rapier, not the scimitar (or whatever my second weapon is).  I have sneak attack as a global modifier since most of the time, I do get to add it. I know I could set the sneak attack as damage 2, but I am using that for when I get assassinate.  In hindsight, perhaps I should set damage 2 to sneak attack and make assassinate a global modifier since it happens so much more infrequently.  However, the question I think still is valid. I installed the ChatSetAttr api on so I can use it to toggle the damage modifier.  It is working, but it making the toggle after the attack is rolled.  I want it to toggle on, roll the attack with the modifier, toggle off.  I removed the toggle off command so I could see if the toggle was even working.  It is, but like I said, even though the command is before the attack the toggle isn't happening first. Here is what I have: !setattr --silent --name Keythy Zedthiona --repeating_damagemod_$0_global_damage_active_flag|1 %{selected|repeating_attack_$0_attack} In the end, I will add the !setattr...flag|0 on the third line so that it toggles back off, but for now, I just want it to work. Any ideas on why the attack is being rolled and then the damage being toggled on?  Thanks in advance for any help.  
1603368888
GiGs
Pro
Sheet Author
API Scripter
When you run a macro, roll20 combines all referenced macros and abilities into one macro, and then gets the values of all attributes mentioned as they were at the moment the macro was triggered, and uses them through the entire macro. So when it runs the line %{selected|repeating_attack_$0_attack} it uses attribute values from before the macro started. This is the way roll20 works. There's no way to avoid it. If you ran two separate macros, you can have the values updated and then do the attack. BUT these must be completely separate macros. You cant use another macro to call them at the same time - because all the macros listed are combined into one. 
1603380729
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can put a query into your global damage bonus. This way it would ask on each attack if the damage was to be included: ?{Use Damage Bonus?|2}
Thank you for the information.  I did not know that was how it worked and i'm glad to know that I wasn't doing something wrong.  That's probably why some of my other macros produced screwy results too.  So I will keep that in mind on future macros. In the meantime, It sounds like for this particular case I just have to stop being lazy and open the character sheet to manually toggle the one little checkbox for the handful of times I actually use it. I may also try the query too.   Thanks again.