
Hi all,
Definitely having an off day today, can't seem to wrap my head around anything(quitting cold turkey from a severe nicotine habit, my head feels like an overfilled balloon).
I'm trying to fancy up the 'ol scriptcard attack roll using a d20 image. The way in which I'm trying to do that is calling to a roll table, there might be a better way, open to anything. Currently, the attack roll and table roll are seperate, as I can't even think of a way to combine them, atm. Here's the current code...
!scriptcard {{ --/|**********Customizable Variables*************** --#overridetemplate|mydnd --:DoSetup| --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --&SpellLevel|cantrip --&SpellName|Chill Touch --Rfind|@{selected|character_id};[&SpellName];repeating_spell-[&SpellLevel];spellname --#emoteText|[*S:character_name] Casts [*R:spellname]. --#title|[*R:spellname] [*R:innate] --#leftsub|@{selected|character_name} (@{selected|caster_level}) --?[*R:spelllevel] -eq cantrip|&spllvl;cantrip --?[*R:spelllevel] -eq 1|&spllvl;1st-level --?[*R:spelllevel] -eq 2|&spllvl;2nd-level --?[*R:spelllevel] -eq 3|&spllvl;3rd-level --?[*R:spelllevel] -eq 4|&spllvl;4th-level --?[*R:spelllevel] -eq 5|&spllvl;5th-level --?[*R:spelllevel] -eq 6|&spllvl;6th-level --?[*R:spelllevel] -eq 7|&spllvl;7th-level --?[*R:spelllevel] -eq 8|&spllvl;8th-level --?[*R:spelllevel] -eq 9|&spllvl;9th-level --#rightsub|[i][&spllvl] [*R:spellschool][/i] --+Casting Time:|[*R:spellcastingtime] --+Range:|[*R:spellrange] --+Target:|[*R:spelltarget] --&zSCV|V --?"[*R:spellcomp_v]" -inc "v=1"|ENDSCV --&zSCV| --:ENDSCV| --&zSCS|S --?"[*R:spellcomp_s]" -inc "s=1"|ENDSCS --&zSCS| --:ENDSCS| --&zSCM|M --?"[*R:spellcomp_m]" -inc "m=1"|ENDSCM --&zSCM| --:ENDSCM| --?"[*R:spellcomp_m]" -ninc "m=1"|[ --&materials| --]|[ --&materials|([*R:spellcomp_materials]) --]| --+Components:|[&zSCV][&zSCS][&zSCM] [&materials] --+Duration:|[*R:spellduration] --+|[*R:spelldescription] --~Len|string;length;[*R:spellathigherlevels] --?[$Len] -le 5|END_HV_CHECK --+|[b][i]At Higher Levels.[/i][/b][*R:spellathigherlevels] --:END_HV_CHECK| --~HowFarAway|distance;@{selected|token_id};@{target|token_id} --=HowFar|[$HowFarAway] * 5 --?[$HowFar] -gt 120|tooFar --=CritRoll|20 --=AttackModifier|@{selected|spellcasting_ability} --=DamageModifier|0 --&AttackModifierType|[WIS] --=FeatDamage|0 --&FeatDamageType|[FEAT] --=ProficiencyBonus|@{selected|pb} --=DamageDice|1d8 --=CritDice|1d8 --&DamageType|necrotic --&DamageFX|burn-death --&MarkerA|chilltouch --&MarkerB|Disadvantage --/|****************DO NOT CHANGE****************** --=TargetAC|@{target|npc_ac} --=Damage|0 --=Resistance|0 --=Immunity|0 --=Vulnerability|0 --=TotalDamage|0 --=AttackRoll|?{Attack|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --/|*******************Main************************ -->MakeAttack| -->PlayEffects| -->CalculateDamage| -->ApplyDamage|@{target|token_id};1;-[$TotalDamage] --X| --/|****************Subroutines******************** --:MakeAttack| --=Attack|[$AttackRoll] + [$AttackModifier] [&AttackModifierType] + [$ProficiencyBonus] [PROF] --=AttackTable|[T#D20] --&AttackDie|[$AttackTable] --&D20Text|[$AttackTable.tableEntryText] --&D20Image|[$AttackTable.tableEntryImgURL] --+|[c][img height=100 width=100][&D20Image][/img][/c] --+|Attack Roll:[$Attack], Base: [$AttackRoll] --+|[br] --?[$AttackRoll.Base] -eq [$CritRoll]|Crit --?[$Attack.Total] -ge [$TargetAC]|Hit --?[$Attack.Total] -lt [$TargetAC]|Miss --<| --:Crit| --=Damage|[$DamageDice] + [$CritDice] [CRIT] + [$DamageModifier] [&AttackModifierType] + [$FeatDamage] [&FeatDamageType] --+[#ff0000]Critical Hit[/#]| for [$Damage] [&DamageType] damage! --a|chill_touch --@token-mod|_ids @{target|token_id} _ingore-selected _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| --<| --:Hit| --=Damage|[$DamageDice] + [$DamageModifier] [&AttackModifierType] + [$FeatDamage] [&FeatDamageType] --+Hit| for [$Damage] [&DamageType] damage! --a|chill_touch --@token-mod|_ids @{target|token_id} _ingore-selected _set statusmarkers|[&MarkerA] -->CheckResistances| -->CheckUndead| --<| --:Miss| --a|chill_touch --=Damage|0 --+|[f18]The attack [#ff0000]missed[/#]![/f] --<| --:CheckResistances| --?"[*T:npc_resistances]" -inc [&DamageType]|ApplyResistance --?"[*T:npc_immunities]" -inc [&DamageType]|ApplyImmunity --?"[*T:npc_vulnerabilities]" -inc [&DamageType]|ApplyVulnerability --<| --:ApplyResistance| --=Resistance|[$Damage] \ 2 --*|Creature is resistant to [&DamageType] damage! --<| --:ApplyImmunity| --=Immunity|[$Damage] --*|Creature is immune to [&DamageType] damage! --<| --:ApplyVulnerability| --=Vulnerability|[$Damage] --*|Creature is vulnerable to [&DamageType] damage! --<| --:CheckUndead| --?"@{target|npc_type}" -inc "undead" |ApplyDisadvantage --<| --:ApplyDisadvantage| --*|Creature is undead, and has disadvantage until the end of the players next turn! --~|turnorder;addcustom;Disadvantage;1;-1 --a|chill_touch --@token-mod|_ids @{target|token_id} _ingore-selected _set statusmarkers|[&MarkerB] --<| --:PlayEffects| --vtoken|@{target|token_id} [&DamageFX] --<| --:CalculateDamage| --=TotalDamage|[$Damage]-[$Resistance]-[$Immunity]+[$Vulnerability] --<| --:ApplyDamage| --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| --:tooFar| --+|The target is too far away. --X| }}