So here is one option you can use: !script {{
--/|VARIABLES TO SET
--&TargetACAttribute|npc_ac
--&DamageAbilityMod|wisdom_mod
--&SpellAttackBonus|spell_attack_bonus
--&AutoApplyDamage|true
--&HPBar|1
--#title|Shilleagh attack
--#rightsub|Range : 5 feet
--#sourceToken|@{selected|token_id}
--#targetToken|@{target|token_id}
--=Atk|?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} + [*S:[&SpellAttackBonus]] [Ability + pb]
--/|Output the static Atk roll variable with the target's AC value
--+Attack|[$Atk] vs AC [*T:[&TargetACAttribute]]
--/|Do not roll damage on a natural 1 or if the attack roll is less than the target's ac
--?[$Atk.Base] -eq 1 -or [$Atk] -lt [*T:[&TargetACAttribute]]|Done
-->GetshillelaghDice|[*S:level];ShillelaghDice
--?[$Atk.Base] -eq 20|[
--=Damage|[&ShillelaghDice] + [*S:[&DamageAbilityMod]] [MOD]
--=CritDmg|[&ShillelaghDice(replace,d,m)]
--=TotalDmg|[$Damage] + [$CritDmg] [CRIT]
--+CRITICAL HIT|[$Damage] + [$CritDmg] for [$TotalDmg] total ``force`` damage
--]|[
--=TotalDamage|[&ShillelaghDice] + [*S:[&DamageAbilityMod]] [MOD]
--+Rolled [&ShillelaghDice]|for [$TotalDamage] ``force`` Damage at level [*S:level]
--]|
--?"[&AutoApplyDamage]" -ne "true"|Done
--!t:[*T:t-id]|bar[&HPBar]_value:-=[$TotalDamage]
--:Done|
--X|
--:GetshillelaghDice|CharacterLevel;StringVariableToSet
--&[%2%]|1d8
--?[%1%] -lt 5|<
--&[%2%]|1d10
--?[%1%] -lt 11|<
--&[%2%]|1d12
--?[%1%] -lt 17|<
--&[%2%]|2d6
--<|
}} So ScriptCards Roll Modifiers can be used to check for lots of things in the roll including what the roll was before any additional modifiers with .Base. So changing the target AC check to also check for natural 1's could go like this: --?[$Atk.Base] -eq 1 -or [$Atk] -lt [*T:[&TargetACAttribute]]|Done That line will check if the Base of the Atk roll variable is a 1 and if so then jump to the Done label of the script. If the Base of the Atk roll variable is not a 1 then it will compare the total of the Atk roll variable to the target's armor class attribute set at the top of the scriptcard. The .Base roll modifier can also be used to check for natural 20's. So: --?[$Atk.Base] -eq 20|[
--=Damage|[&ShillelaghDice] + [*S:[&DamageAbilityMod]] [MOD]
--=CritDmg|[&ShillelaghDice(replace,d,m)]
--=TotalDmg|[$Damage] + [$CritDmg] [CRIT]
--+CRITICAL HIT|[$Damage] + [$CritDmg] for [$TotalDmg] total ``force`` damage
--]|[
--=TotalDamage|[&ShillelaghDice] + [*S:[&DamageAbilityMod]] [MOD]
--+Rolled [&ShillelaghDice]|for [$TotalDamage] ``force`` Damage at level [*S:level]
--]| If the Atk roll modifier's base roll was a 20, it will roll damage as normal but also roll CritDmg. --=CritDmg|[&ShillelaghDice(replace,d,m)] That line will take the returned String variable set, which for example is 1d10 and replace the d with an m. So the CritDmg roll variable line would look like: --CritDmg|1m10 As per the wiki, roll variables can use an m to roll max XmY 3m8 Roll a Y-sided die X times, but always use this highest number on the die. Ex: 3m8 will always roll 24. If the Atk roll was not a natural 20, then roll damage as before. As for the npc_ac, the easiest thing to do is to change the TargetAC variable at the top of the script: --&TargetACAttribute|npc_ac If this ScriptCard is meant for a PC or PCs attacking NPCs and your game is using the D&D 5e sheet by Roll20, then that's pretty much the easiest thing to do. If you want the ScriptCard to be more versatile, you can check if the Target is an npc. Again using attributes for the D&D 5e sheet by Roll20, that can be done with something like: --?[*T:npc] -eq 1|JumpToNPCSection|JumpToPCSection Where that would look at the target for an attribute named npc and check if it is set to 1, if so then jump to the label JumpToNPCSection and if the target doesn't have an attribute npc equal to 1, then jump to the label JumpToPCSection. Or in this case you could set a variable: --?[*T:npc] -eq 1|&TargetACAttribute;npc_ac|&TargetACAttribute;ac
--/|Output the static Atk roll variable with the target's AC value
--+Attack|[$Atk] vs AC [*T:[&TargetACAttribute]] That would check if the target had an attribute named npc equal to 1, which for D&D 5e sheets by Roll20 is the case and set the String variable TargetACAttribute to npc_ac and if the target does not have an attribute named npc equal to 1, then it will set the String variable TargetACAttribute to ac. This is done before the comparison of the attack roll to the target's armor class.