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 .
×
May your rolls be chill this holiday season!
Create a free account

Help request with a Scriptcard half damage line

The below script rolls a save vs DC and auto deducts cantrip damage on the target on a failed save. Works great but I want to add that if the target makes the save then it deducts 0d0 damage from the target (This way I can change the damage for cantrips that do half damage.) Can anyone help? !scriptcard  {{   --#title|Cantrip: Sacred Flame   --#leftsub|Save VS Dexterity   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --#emoteText|@{selected|token_name} attacks @{target|token_name}   --=SelectedDC|8+@{selected|abilitymodifier}   --=AttackRoll|1d20 + @{target|dexterity_save_bonus} [Ability]   --+Attack|@{target|token_name} rolls [$AttackRoll] vs DC [$SelectedDC] Dexterity Save.   --?[$AttackRoll.Total]  -lt  [$SelectedDC.Total]|Hit   --+Miss|The attack missed.   --^Final|   --:Hit| --=DiceNumber|[*S:level] + 1 \ 6 + 0.5 {ROUND}   --=Damage|[$DiceNumber]d8   --+Hit!|The attack hit @{target|token_name} for [$Damage] ``Radiant`` damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage]   --^Final|   --:Final| }}
1763974984

Edited 1763979942
Hi Barry, started off suggesting a couple of tweaks to make that happen and then it got complicated when it didn't need to be.&nbsp; So, here's my Toll the Dead Cantrip - if you like anything just CnPaste. I follow the same format for all my scripts just so when I edit I can do it in autopilot The bit at the start around saves ensures that if the target has an enhanced save (for example, assassin has +3 Dex Mod, but a +6 Dex save), then we use the enhanced figure we use an "i" button to select our target (my pref - I don't like those R20 query boxes popping up before a script runs - you could instead ask for targetToken at the start) We set the save multiplier using &amp;Effect at the start - that way we can reference it throughout a script and only have to change it once at the start, for Toll the Dead it is a 0, but change to 0.5 for half damage cantrips I check resistances using Kurt's 5ELIB, feel free to bin this if you do it manually !script{{ +++5Elib;snlib;ActionMenuAddons;dnd5elib;LibSiG+++ --#titlecardBackgroundImage|url('<a href="https://files.d20.io/images/428791142/KEwGr8c5jlEfTO5tZcq2YA/med.png" rel="nofollow">https://files.d20.io/images/428791142/KEwGr8c5jlEfTO5tZcq2YA/med.png</a>'); background-size: 25% 100%; background-repeat: no-repeat; --#titleCardBackground|#011009 --#titleFontColor|#fad105 --#subtitleFontColor|#fad105 --#sourceToken|@{selected|token_id} --#emoteBackground|#223030 --#emoteFontColor|#ad2430 --/|Here we question what variables should be --&amp;EnergyType|Necrotic --? [*S:level] -ge 1|&amp;DiceNumber;1 --? [*S:level] -ge 5|&amp;DiceNumber;2 --? [*S:level] -ge 11|&amp;DiceNumber;3 --? [*S:level] -ge 17|&amp;DiceNumber;4 --=MaxTargets|1 --&amp;SaveType|wis --c[&amp;SaveType]|str:&amp;Save2;strength|dex:&amp;Save2;dexterity|con:&amp;Save2;constitution|int:&amp;Save2;intelligence|wis:&amp;Save2;wisdom|cha:&amp;Save2;charisma --&amp;Effect|0 --/|Now set up the card and run the script --#title|Toll the Dead --#leftsub|Cantrip --#rightsub|DC:[*S:spell_save_dc] [&amp;Save2] save --#emoteText|[*S:t-name] Tolls the Dead! --#whisper|self,gm --i Click target;Target|t;NewTarget;Cantrip Target --#targetToken|[&amp;NewTarget] --&gt;DetermineOutcome| --:X| --:DetermineOutcome| --+|[t border=3 width=100%][th][td style="width:100px"][c]Target[/c][/td][td style="width:50px"][c]Save[/c][/td][td style="width:50px"][c]P/F?[/c][/td][td style="width:50px"][c]DAM[/c][/td][/th] --?[*T:t-bar1_value] -ge [*T:t-bar1_max]|&amp;Dice;d8|&amp;Dice;d12 --=SpellDamage|[&amp;DiceNumber][&amp;Dice] --/|#targetToken|[*[&amp;loop]:t-id] --&gt;PlayEffects|[*S:t-id];[*T:t-id];burn-magic;burst-death;beam-magic --?[*T:npc] -eq 1 -and [*T:npc_[&amp;SaveType]_save_flag] -gt 0|&amp;Save;npc_[&amp;SaveType]_save|&amp;Save;[&amp;Save2]_save_bonus --=TargetSave|1d20 + [*T:[&amp;Save]] --?[$TargetSave] -ge [*S:spell_save_dc] | [ --&amp;DidSave|P --&amp;FontColor|009900 --=MidDamage|[$SpellDamage] * [&amp;Effect] {FLOOR} {MIN:0} --]|[ --&amp;DidSave|F --&amp;FontColor|990000 --=MidDamage|[$SpellDamage] --]| --&amp;ResistType| --&gt;Lib5E_CheckDamageModifiers|ResistType;[&amp;EnergyType] --=FinalDamage|[$MidDamage][&amp;ResistType] --+|[t border=3 width=100%][tr][td style="width:100px"][c][*T:character_name][/c][/td][td style="width:50px"][c][$TargetSave][/c][/td][td style="width:50px"][#[&amp;FontColor]][b][c][&amp;DidSave][/c][/b][/#][/td][td style="width:50px"][c][$FinalDamage][/c][/td][/tr] --+|Dice size [&amp;Dice] [$SpellDamage] --&gt;LibSN_APPLY_DAMAGE_OR_HEALING|[*T:t-id];1;-[$FinalDamage];0 --&gt;PlayEffects;[*S:t-id];[*T:t-id];burn-magic;burst-magic;beam-magic --%| --+|[/t] --X| --:PlayEffects|Parameters are : sourcetoken; targettoken; source effect; target effect; line effect; sound effect --a|gravebell --vtoken|[%2%] [%4%] --&lt;| }} For cantrips with multiple targets I swap out the "i" button for a loop - happy to share that if needed -made a couple of tweaks to above since there were remnants of that left in, so tidied up
Thank&nbsp; you Simon! I plan to study your amazing script.&nbsp; Also I looked for Kurt's Discord but didn't see it yet. Would you let me know the Discord name? I appreciate your reply A LOT.
1763998380

Edited 1763998403
Hi Barry, my pleasure - the libraries listed at the start will make life much easier - LibSiG is my own stuff, so you can strip that out, but 5Elib, snlib, and dnd5elib are pretty essential to me now.&nbsp; dnd5elib is being replaced by 5Elib as Kurt updates code.&nbsp; The server is Kurt's Gaming Chat
There is a link to the Discord on the ScriptCards wiki &nbsp;in the ScriptCards Links menu near the top right.