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 .
×
Advertisement Create a free account

MACRO not picking up the targets correct AC

1618884431
Hi there, I'm not very good at macros yet. I learnt this from youtube. It seems to work of (have not actually included a visual or sound effect yet). The problem I'm having is that when I use the macro and click on the targets at, it is not picking up the correct AC to roll against. For example I targeted a helmed horror and it said target AC is 11 when its actually a 20. Does anyone know what may be going wrong? Thanks in advance. MACRO !power {{  --name|Ray of Frost  --leftsub|Ranged Spell Attack  --rightsub|60 ft Range  --npc_qualities_summary @{target|character_id}  --Attack:|[[ [$Atk] ?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + @{spell_attack_bonus} ]] vs AC @{target|AC}  --?? $Atk >= @{target|AC} AND $Atk.base <> 20 ?? Damage:|[[ [$Dmg] 2d8 ]]  --?? $Atk.base == 20 ?? Critical Hit|[[ [$CritDmg] 4d8 ]]  --soundfx|_audio,play,nomenu|freezeRay  --vfx_opt|@{selected|token_id} @{target|token_id} beam-frost   --?? $Atk >= @{target|AC} ?? Slowed:|Target's speed is reduced by 10 ft until start of your next turn  --?? $Atk >= @{target|AC} ?? api_token-mod|_ids @{target|token_id} _ignore-selected _set statusmarkers|tread  --?? $Atk >= @{target|AC} ?? api_act|-1 1 _Slow  --?? $Atk >= @{target|AC} AND $Atk.base <> 20 ?? alterbar1|_target|@{target|token_id} _bar|1 _amount|-[^Dmg] _show|all  --?? $Atk.base == 20 ?? alterbar2|_target|@{target|token_id} _bar|1 _amount|-[^CritDmg] _show|all }}
1618888667

Edited 1618888816
Kraynic
Pro
Sheet Author
You need to specify which character sheet you are using.  Also, if you are using a sheet that has a PC and NPC display switch, it is likely that the NPC version uses different attributes than the PC version for certain things (like AC). Edit:  If nothing else, you can right click on the attribute on the sheet and select "Inspect Element" from the menu.  That should bring up the console with the bit of html highlighted that holds that value, which will include an entry like: name="attr_attribute_name_here".  You drop the attr_ bit, and the rest is what you use in your attribute calls in macros.
1618897066

Edited 1618897075
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Assuming this is the D&D 5th Edition by Roll20 Sheet (since the example is Helmed Horror AC20), the attribute for AC on the NPC sheet is npc_ac . It has a different attribute because PC ACs are figured from formulas, but monster ACs are generally an arbitrary number. So one is figured internally, and the other is entered manually.
1618899792
Ok that is fantastic thankyou for your help. I will try you advice tonight when I can get on. Alternatively, is it possible to get them to to use the attribute in one of the tokens bars? I have all my monster tokens set up with their AC in the second bar.
1618905327
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can set this on your campaign settings page and then use Apply In game Settings in the Settings tab while logged in. It may take a while, but should affect everything except for saved default tokens.
1618917879
OK so I have checked the "Inspect Element" and the name is attr_npc_ac. Dropping the attr_ leaves it as npc_ac which is what you gave me keithcurtis. I have tried this but still cannot get it to pick up the correct ac. The new macro is !power {{  --name|Ray of Frost  --leftsub|Ranged Spell Attack  --rightsub|60 ft Range  --npc_qualities_summary @{target|character_id}  --Attack:|[[ [$Atk] ?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + @{spell_attack_bonus} ]] vs npc_ac @{target|npc_ac}  --?? $Atk >= @{target|npc_ac} AND $Atk.base <> 20 ?? Damage:|[[ [$Dmg] 2d8 ]]  --?? $Atk.base == 20 ?? Critical Hit|[[ [$CritDmg] 4d8 ]]  --soundfx|_audio,play,nomenu|freezeRay  --vfx_opt|@{selected|token_id} @{target|token_id} beam-frost   --?? $Atk >= @{target|npc_ac} ?? Slowed:|Target's speed is reduced by 10 ft until start of your next turn  --?? $Atk >= @{target|npc_ac} ?? api_token-mod|_ids @{target|token_id} _ignore-selected _set statusmarkers|tread  --?? $Atk >= @{target|npc_ac} ?? api_act|-1 1 _Slow  --?? $Atk >= @{target|npc_ac} AND $Atk.base <> 20 ?? alterbar1|_target|@{target|token_id} _bar|1 _amount|-[^Dmg] _show|all  --?? $Atk.base == 20 ?? alterbar2|_target|@{target|token_id} _bar|1 _amount|-[^CritDmg] _show|all }} Sorry for the hassle
1618928026
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Sorry, I no speak PowerCard, so I can't be of much help there. Now that you have the right attribute, you might try posting to the current PowerCard thread, for more skilled help. And yeah, the attr_ prefix is only used internally by the sheet designer. You can drop it whenever you see it when you want to use it in a macro.
1618961804
Thanks again keithcurtis :). I have it working. By changing it to npc_ac it gained the ability to call from NPC sheets but lost the ability to call from players sheets. Since changing it to bar2 everything is working better. I am also changing the bonuses to call stat mods and rolls from the sheets. I will check out the posts about the jukebox to sort my issue with that. Lastly I will try to get it to call from the 5e OGL script so I can get it to use ammo tracking. Thanks again for your help keithcurtis and Kraynic!
1619014408
Julian S. said: Thanks again keithcurtis :). I have it working. By changing it to npc_ac it gained the ability to call from NPC sheets but lost the ability to call from players sheets. Since changing it to bar2 everything is working better. I am also changing the bonuses to call stat mods and rolls from the sheets. I will check out the posts about the jukebox to sort my issue with that. Lastly I will try to get it to call from the 5e OGL script so I can get it to use ammo tracking. Thanks again for your help keithcurtis and Kraynic! Another workaround would be to use the npc_ac attribute, and on your PC character sheets add the npc_ac attribute with a 'current' value of '@{ac}'.  So when the call is made to the character sheet for npc_ac, it'll then pull from ac.
1619056921
Right, I did not think of that. Thanks Jarren :)