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

ED4E Targeting chosen Defense & Armor

1504723026
Dougansf
Pro
Sheet Author
I've gotten a request from players to have a macro button that targets the Defense and Armor of the targeted token.  I've been able to build such a macro, and now I'm trying to implement it into the character sheet.   The user selects Physical or Mystic from a drop down which sets the attribute  @{WeaponDamType} .  The options are either PA or MA. When I replace PA inside the targeting brackets, it can't find the Attribute. !power {{ --charid|@{character_id} --name|**@{Name} @{WeaponName}** --leftsub|Damage vs @{target|token_name} @{WeaponDamType} --Step|[[ ?{Step|@{DamStep}-@{Wounds}} ]] + [[ ?{Karma #|0} ]] Karma, [[ ?{Strain #|0} ]] Strain --Result|[^Result.base] vs @{target|token_name} @{WeaponDamType} --?? $Result.base <= @{target| PA }?? !Miss:|**No Damage** --?? $Result.base > @{target| PA }?? !Hit:|**Damage** [[ floor(([$Result] { [[{1e3, 8}<[[{?{Step} - 11, 0}kh1 % 11]] + floor([[{?{Step} - 11, 0}kh1]] / 11)]]d20! + [[{2, 4, 5, 6, 7}=[[{?{Step}, 0}kh1 % 11]] + {1, 3}=[[{?{Step}, 0}kh1]] + {1e3, 3}=[[{?{Step} - 11, 0}kh1 % 11]] * 2]]d[[{{(?{Step} - 1) * 2, 4}kh1, {12} }kl1]]! + [[{1e3, 8}<[[{?{Step}, 0}kh1]] * (1 - {3, 6, 10}=[[{?{Step}, 0}kh1 % 11]] + {1, 4, 8}=[[{?{Step}, 0}kh1 % 11]])]]d[[10 - {4, 5, 8, 9}=[[{?{Step}, 0}kh1 % 11]] * 4]]! + [[{1e3, 8}<[[{?{Step}, 0}kh1]] * ({0, 5, 7, 9}=[[{?{Step}, 1}kh1 % 11]] + 2 * {6, 10}=[[{?{Step}, 0}kh1 % 11]])]]d8! - [[{1, 2}=[[{?{Step}, 0}kh1]] * (3 - [[{?{Step}, 0}kh1]])]] + [?{Karma #|0} Karma] [[?{Karma #} * ({1e3, 8}<[[{@{KarmaStep} - 11, 0}kh1 % 11]] + floor([[{@{KarmaStep} - 11, 0}kh1]] / 11))]]d20! + [[?{Karma #} * ({2, 4, 5, 6, 7}=[[{@{KarmaStep}, 0}kh1 % 11]] + {1, 3}=[[{@{KarmaStep}, 0}kh1]] + {1e3, 3}=[[{@{KarmaStep} - 11, 0}kh1 % 11]] * 2)]]d[[{{(@{KarmaStep} - 1) * 2, 4}kh1, {12} }kl1]]! + [[?{Karma #} * ({1e3, 8}<[[{@{KarmaStep}, 0}kh1]] * (1 - {3, 6, 10}=[[{@{KarmaStep}, 0}kh1 % 11]] + {1, 4, 8}=[[{@{KarmaStep}, 0}kh1 % 11]]))]]d[[10 - {4, 5, 8, 9}=[[{@{KarmaStep}, 0}kh1 % 11]] * 4]]! + [[?{Karma #} * ({1e3, 8}<[[{@{KarmaStep}, 0}kh1]] * ({0, 5, 7, 9}=[[{@{KarmaStep}, 1}kh1 % 11]] + 2 * {6, 10}=[[{@{KarmaStep}, 0}kh1 % 11]]))]]d8! - [[?{Karma #} * ({1, 2}=[[{@{KarmaStep}, 0}kh1]] * (3 - [[{@{KarmaStep}, 0}kh1]]))]] } - @{target| PA }) ) ]] }} Thanks in advance.
<a href="https://wiki.roll20.net/Dice_Reference#Roll20_Dice" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Roll20_Dice</a>... states that abilities are expanded first which prevents you from doing what you are trying to do. &nbsp;I suspect an API script might allow what you are trying. Also, as an aside, what about effects that change the targets defenses (which ED has quite a few of)
1504739170
Dougansf
Pro
Sheet Author
Jason K. said: Also, as an aside, what about effects that change the targets defenses (which ED has quite a few of) I've looked into that a little bit, as the step after this one would be automatically assigning damage after armor reduction. So far as I can tell, it's possible, but you would need to have Edit Privileges over the token you're trying to change. &nbsp;Not a problem for GM's, but certainly an issue for PC's.
you will actually need to separate the defense from damage type for the calculations. IE Weapons (normally) are against physical defense and do physical damage (therefore against physical armor) Earth darts is against mystic defense, but does physical damage (therefore against physical armor) mind dagger is against mystic defense and does mystic damage (therefor against mystic armor) you could try something like this. &nbsp;I think it would work as expected. ?{Defense Type|Physical, @{target|PD}|Mystic, @{target|MD}, Social, @{target|SA}} and&nbsp; ?{Damage Type|Physical, @{target|PA}|Mystic, @{target|MA}}
1504826526
Dougansf
Pro
Sheet Author
That did help, in a roundabout way. I got rid of the conditional, and made the roll only target the token defense to reduce the roll result. Now I just need to figure out how to prevent it from returning negative numbers, so the minimum net result is zero. !power {{ --charid|@{character_id} --name|**@{Name} @{WeaponName}** --leftsub|Damage vs @{target|token_name} --Step|[[ ?{Step|@{DamStep}-@{Wounds}} ]] + [[ ?{Karma #|0} ]] Karma, [[ ?{Strain #|0} ]] Strain --Damage|[[ floor(( { [[{1e3, 8}&lt;[[{?{Step} - 11, 0}kh1 % 11]] + floor([[{?{Step} - 11, 0}kh1]] / 11)]]d20! + [[{2, 4, 5, 6, 7}=[[{?{Step}, 0}kh1 % 11]] + {1, 3}=[[{?{Step}, 0}kh1]] + {1e3, 3}=[[{?{Step} - 11, 0}kh1 % 11]] * 2]]d[[{{(?{Step} - 1) * 2, 4}kh1, {12} }kl1]]! + [[{1e3, 8}&lt;[[{?{Step}, 0}kh1]] * (1 - {3, 6, 10}=[[{?{Step}, 0}kh1 % 11]] + {1, 4, 8}=[[{?{Step}, 0}kh1 % 11]])]]d[[10 - {4, 5, 8, 9}=[[{?{Step}, 0}kh1 % 11]] * 4]]! + [[{1e3, 8}&lt;[[{?{Step}, 0}kh1]] * ({0, 5, 7, 9}=[[{?{Step}, 1}kh1 % 11]] + 2 * {6, 10}=[[{?{Step}, 0}kh1 % 11]])]]d8! - [[{1, 2}=[[{?{Step}, 0}kh1]] * (3 - [[{?{Step}, 0}kh1]])]] + [?{Karma #|0} Karma] [[?{Karma #} * ({1e3, 8}&lt;[[{@{KarmaStep} - 11, 0}kh1 % 11]] + floor([[{@{KarmaStep} - 11, 0}kh1]] / 11))]]d20! + [[?{Karma #} * ({2, 4, 5, 6, 7}=[[{@{KarmaStep}, 0}kh1 % 11]] + {1, 3}=[[{@{KarmaStep}, 0}kh1]] + {1e3, 3}=[[{@{KarmaStep} - 11, 0}kh1 % 11]] * 2)]]d[[{{(@{KarmaStep} - 1) * 2, 4}kh1, {12} }kl1]]! + [[?{Karma #} * ({1e3, 8}&lt;[[{@{KarmaStep}, 0}kh1]] * (1 - {3, 6, 10}=[[{@{KarmaStep}, 0}kh1 % 11]] + {1, 4, 8}=[[{@{KarmaStep}, 0}kh1 % 11]]))]]d[[10 - {4, 5, 8, 9}=[[{@{KarmaStep}, 0}kh1 % 11]] * 4]]! + [[?{Karma #} * ({1e3, 8}&lt;[[{@{KarmaStep}, 0}kh1]] * ({0, 5, 7, 9}=[[{@{KarmaStep}, 1}kh1 % 11]] + 2 * {6, 10}=[[{@{KarmaStep}, 0}kh1 % 11]]))]]d8! - [[?{Karma #} * ({1, 2}=[[{@{KarmaStep}, 0}kh1]] * (3 - [[{@{KarmaStep}, 0}kh1]]))]] } - ?{Damage Type|Physical, @{target|PA}|Mystic, @{target|MA}}) ) ]] }}
wrap the damage calculation in a ceil (0, damage) which will return damage or 0 if damage is less then 0
1504837290
Dougansf
Pro
Sheet Author
I can't seem to make that function work the way you suggest, even with a less complicated roll.
sorry... was thinking of wrong function Look at Grouping Rolls & Drop/Keep <a href="https://wiki.roll20.net/Dice_Reference#Drop.2FKeep" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Drop.2FKeep</a> make one of the 'rolls' 0 and the other your damage formula and have it keep the higher value IE: /roll {0d1,3d4-6}kh1 but replace the 3d4-6 with your damage formula
1504840061
Dougansf
Pro
Sheet Author
That's better. &nbsp;Thanks much. &nbsp;:)