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

Need help with ScriptCards - Sorcerous Burst

I'm learning ScriptCards and am loving what it can do and thought I'd try a script to help with Sorcerous Burst.

This is what I have so far.

!scriptcard {{
--#title|Sorcerous Burst
--#overridetemplate|gothic
--#sourceToken|@{selected|token_id}
--#targetToken|@{target|token_id}
--#emoteText|@{selected|token_name} attacks @{target|token_name}
--=Wisdom|@{selected|wisdom_mod}
--=TargetAC|@{target|ac}
--=AttackRoll|1d20 + [$Wisdom] [WIS] + @{selected|pb} [PROF]
--+Attack: |@{selected|token_name} rolls [$AttackRoll]
--?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit
--+Miss|The attack missed.
--^Final|
--:Hit|
--=Damage|1d8
--=DamageType|?{Damage Type?|Acid|Cold|Fire|Lightning|Poison|Psychic|Thunder|}
--+HIT!|The attack hit @{target|token_name} for [$Damage] [$DamageType.Text] damage.
}}

This works great but what I can't figure out how to do is if the damage rolls an 8, you get to roll another d8. You can do this a number of times up to your spellcasting modifier. 

Also need to be able to add in a d8 at 5th, 11th and 17th levels. I can figure this one out but when it is 2d8s, how do I check to see the value of both of those independently?

Not an urgent issue but any help would be great.

March 23 (1 week ago)

Edited March 23 (1 week ago)

Heyas, 

So SC can take the dice rolled and add that to an array that you can move through and see if each die is an 8 or not. Maybe something like this:

--=NumberOfRerollsLeft|Spellcasting Mod

--/Make Array from rolled damage dice
--~|array;fromrollvar;DiceRolled;Damage;rolled

--/This will loop through the array and compare each entry to see if it is an 8
--%Rerolls|foreach;DiceRolled
    --/If it is an 8, it will roll another d8 and add it to damage, then decrement the number of rerolls left based on casting mod.
    --?[&Rerolls] -eq 8|[
        --:RollAgain|
        --=AdditionalDamage|1d8
        --=Damage|[$Damage] + [$AdditionalDamage]
        --=NumberOfRerollsLeft|[$NumberOfRerollsLeft] - 1
        --/If the rerolls left is 0, the loop will exit
        --?[$NumberOfRerollsLeft] -eq 0|%!
        --/If the extra d8 is an 8, it will go up and roll another.
        --?[$AdditionalDamage] -eq 8|RollAgain
    --]|
--%|


There may be a more compact way to do this, but I believe this should suit your purpose.