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

TokenMod API for altering and REaltering the Armor Class

Hi,

Scenario

I am using a PowerCard Macro for a Condition....for example "Frightened". With this condition, the target looses -1 on the AC. I have two macros....one for "frightening on" and one for "frightening off".

The AC is displayed in bar 2


Issue:

In the "on" macro, i have this line:

!token-mod --set bar2_value|[[ (@{selected|armor_class}-1) ]]

It works and subtracts 1 from the AC......so far so good/wrong :-)

With this line, it "defines" a new AC...so when i am using the "off" macro with this line:

!token-mod --set bar2_value|[[ (@{selected|armor_class}-0) ]]

It does nothing because of the "new defined" AC from the first macro. Of course....i can add +1 again.....but is there anyway to "keep the original AC" and to do the temporary decrease / increase from the condition?


Hopefully you understand what i am trying to say :-)

Steve / H0ND0







July 12 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

Sounds like you have the AC bar linked to the stat on the character. Changing one changes the other. You'd need to unlink those to prevent it from modifying the attribute. 

July 12 (5 years ago)

Edited July 12 (5 years ago)

Yes....that is correct. But if i unlink it, i can't use the same macro for a PC with a linked sheet and a monster/npc without a sheet. So there is no solution for this?


EDIT: Perhaps i can "unlink and set new value" in the "condition ON" macro......and in the "condition OFF" macro i link it again with the original value from the sheet? If this will work.....how can i tell TokenMod to do it? :-)

July 12 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

Should be:

!token-mod --set bar2_link| bar2_value|[[ (@{selected|armor_class}-1) ]]

And:

!token-mod --set bar2_link|armor_class



Perfect !!!!!! Thank you very much for the quick help !!!! TokenMod is really cool (and with your help, it is even usable for noobs like me)!

July 13 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

=D. No problem!