Spoke too soon.
Elegant Wookie said:
Hello, everyone.
I'm working on a Powercard that is detailed below but I've run into a particular problem regarding the "Attack" line of code.
Currently
this character has two "Global Attack Modifiers" (Archery Style and a
Bless attack bonus). The code that adds the global attack bonus,
@{selected|global_attack_mod}, automatically takes both attack modifiers
and adds it to this melee attack.
What I'm looking for is how to
specify which of his two global modifiers to add to the melee attack. In
other instances, in particular repeating resources, I've used the $0 or
$1 to reference different rows but I can't seem to get this one to
work.
Can anyone offer some advice? I've placed the line of code I'm having issues with in bold. Thanks in advance!
!power {{
--emote|@{selected|character_name} attacks @{target|character_name}
--charid|@{selected|character_id}
--target_list|@{target|token_id}
--name|Medger's Rapier Attack
--leftsub|Melee Attack
--rightsub|5 ft Range
--:Attack|
--hroll|[[ [$Sneak] ?{Sneak Attack|No, 0|Yes, 1} + 0d0 ]]
--Attack:|
Rolled [[ [$atk]
?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} +
@{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF] +
@{selected|global_attack_mod} [Bless] ]]
--?? $atk.base == 20 ?? skipto*2|Critical
--?? $atk.base == 1 ?? skipto*3|Fumble
--:Hit|
--?? $Sneak == 1 ?? skipto*4|Sneak Hit
--HIT-Piercing:|In the FACE! [[ [$Dmg] @{selected|dexterity_mod} [DEX] + 1d8 ]] damage!
--skipto*5|EndOfCard
--:Sneak Hit|
--HIT-Piercing
and Sneak:|Sneaky Backstab [[ [$SneakDmg] @{selected|dexterity_mod}
[DEX] + 1d8 +@{selected|global_damage_mod_roll} [SNEAK] ]] damage!
--skipto*6|EndOfCard
--:Fumble|
--Fumble|You Critically MISS! [Critical Miss](! #CritMiss)
--skipto*7|EndOfCard
--:Critical|
--?? $Sneak == 1 ?? skipto*8|CritSneakHit
--Critical Hit|You strike a decisive blow for [[ [$CritDmg] @{selected|dexterity_mod} [DEX] + 2d8 ]] damage!
--skipto*9|EndOfCard
--:CritSneakHit|
--Critical
Sneak Hit|You strike a decisively sneaky blow for [[ [$SneakCritDmg]
@{selected|dexterity_mod} [DEX] + 2d8
+@{selected|global_damage_mod_roll} [SNEAK1]
+@{selected|global_damage_mod_roll} [SNEAK2] ]] damage!
--skipto*10|EndOfCard
--:EndOfCard|
}}
The repeating attribute section for global attack modifiers is called "repeating_tohitmod", so it has attributes like:
- repeating_tohitmod_$0_global_attack_active_flag (1 if active, 0 if unchecked)
- repeating_tohitmod_$0_global_attack_name
- repeating_tohitmod_$0_global_attack_roll
The attribute "global_attack_mod" is a summarization of all of the active rolls.
If you want to separate them out, you would need to do something like:
--Attack:|
Rolled [[ [$atk]
?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} +
@{selected|dexterity_mod} [DEX] + @{selected|pb} [PROF] +
@{selected|repeating_tohitmod_$0_global_attack_roll} [@{selected|repeating_tohitmod_$0_global_attack_name}] + @{selected|repeating_tohitmod_$1_global_attack_roll} [@{selected|repeating_tohitmod_$1_global_attack_name}] ]]
However,
with PowerCards there is no way to determine how many global attack
modifiers their are or to determine if any given modifier is active. To
do that you would need to use the newer ScriptCards API script, which is
its own programming language for writing macros that produce
PowerCards-style output and has support for repeating sections.
-----------------------------------------
I didn't quote properly. Sorry. New question below.
So the code worked great for specifying which attack mod to add but I ran into an unexpected problem. Now, even if I have the attack mod for Bless turned off (unchecked), the code still adds the 1d4 to the attack roll.
Is there a way to check if Bless is turned on or off and add the 1d4 when appropriate?