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

Magic Missile Macro Help

1593495555

Edited 1593495670
Hello! I am fairly new to macros. I've been able to cobble this one together from various sources (and cannot thank my fellow roll20 DMs posting here enough!) but was wondering if there was a way to increase the efficiency of this magic missile macro. I've currently got it working so any character can input the spell level and roll individual darts as one token action. Is there a way to have the macro also auto-calculate the total damage and input to a separate line? That way we don't have to add each dart during gameplay for total damage?  @{selected|output_option} &{template:5e-shaped} {{character_name=@{selected|token_name}}} {{title=Magic Missile}} {{spell=1}} {{spell_first_line=1}} @{selected|attacher_spell} @{selected|attacher_spell_level_1} {{spell_level=^{1ST_LEVEL}}} {{school=^{EVOCATION}}} {{casting_time=^{1_ACTION}}} {{range=120 feet}} {{components=^{COMPONENTS_V_S}}} {{materials=}} {{duration=^{INSTANTANEOUS}}} @{selected|hide_gm_info} {{@{selected|shaped_d20}=1}} {{content=You create three glowing darts of magical force. Each dart hits a creature of your choice that you can see within range. A dart deals 1d4 + 1 force damage to its target. The darts all strike simultaneously, and you can direct them to hit one creature or several. **}} {{higher_level=At Higher Levels.** When you cast this spell using a spell slot of 2nd level or higher, the spell creates one more dart for each slot level above 1st.}} {{attack_type_macro=[Ranged Spell Attack:](~-M3xEYpvVsMC_b40cluI|repeating_spell0_-M7BHN4IiROGImlSVC6y_attack)}} {{attack_damage_type=force}} {{has_attack_damage=1}} {{attack_damage= ?{Spell level?|1, 1st Level:[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |2, 2nd Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |3, 3rd Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |4, 4th Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |5, 5th Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |6, 6th Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |7, 7th Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |8, 8th Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] |9, 9th Level: [[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]]-[[1d4+1]] }}} This is what it currently looks like:  I'd like to include a line below the hit area. So in this case it would read "Total Damage: 27".  Alternatively, if that doesn't work, would there be a way to have a total damage line that doesn't calculate from the previously rolled darts but does still do damage based on the spell's level query without having to input the level query twice? I tried adding the following to the bottom of the macro but the problem then was that I had to input the spell's level twice and the difference is noticeable.   ?{Spell level|1|2|3|4|5|6|7|8|9} {{Force Damage= [[[[2+?{Spell level}]]d4+[[2+?{Spell level}]]]]}} It looked like this:  Though the individual dart macro works great, if there's a way to auto-calculate the damage easily, I'd love to include it. Thanks in advance for any help/advice!  Edited to add: I am using the 5e Shaped sheet! Sorry, I forgot to include that info the first time!
1593496320

Edited 1593497598
Oosh
Sheet Author
API Scripter
The easiest way, by far would be to replace your damage outputs with this: [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] You'd need to mouse over for individual damage. There is another method that works like this: [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] total --- ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]] $[[5]] $[[6]]) Paste that into chat and look at the output, that might be what you want. Getting the total to appear after the individual rolls, and on a new line, is a bit trickier and requires another approach. The third option is to do the math outside the template fields. This allows you to call the nested (individual missile) rolls before the outer total. An example for level 1 or 2 missiles: &{template:default}{{name=Magic Missile}} ?{Cast at what level?|1,[[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]]{{1st level cast=$[[0]]$[[1]]$[[2]]}}{{Total damage=$[[3]]| 2,[[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] {{2nd level cast=$[[0]]$[[1]]$[[2]]$[[3]]}}{{Total damage=$[[4]]}}} This is getting tricky when using in a more complex macro - those $[[0]] calls will be thrown out by any other inline rolls coming before them in the macro. Should be ok for Magic Missile because it has no saving throw, but if you had to account for advantage/non-advantage attack rolls coming before it you'd be in strife.
Oosh, my dude! Thank you, you're an absolute genius! That's exactly what I wanted! I will definitely look into the nesting for future spell attacks with multiple darts/rays too.  Here's the output now, showing both the total and the individual darts which is going to save so much time and ease for everyone involved! Here's the final code in case this helps any other newbie DMs or macro folks!  @{selected|output_option} &{template:5e-shaped} {{character_name=@{selected|token_name}}} {{title=Magic Missile}} {{spell=1}} {{spell_first_line=1}} @{selected|attacher_spell} @{selected|attacher_spell_level_1} {{spell_level=^{1ST_LEVEL}}} {{school=^{EVOCATION}}} {{casting_time=^{1_ACTION}}} {{range=120 feet}} {{components=^{COMPONENTS_V_S}}} {{materials=}} {{duration=^{INSTANTANEOUS}}} @{selected|hide_gm_info} {{@{selected|shaped_d20}=1}} {{content=You create three glowing darts of magical force. Each dart hits a creature of your choice that you can see within range. A dart deals 1d4 + 1 force damage to its target. The darts all strike simultaneously, and you can direct them to hit one creature or several. **}} {{higher_level=At Higher Levels.** When you cast this spell using a spell slot of 2nd level or higher, the spell creates one more dart for each slot level above 1st.}} {{attack_type_macro=[Ranged Spell Attack:](~-M3xEYpvVsMC_b40cluI|repeating_spell0_-M7BHN4IiROGImlSVC6y_attack)}} {{attack_damage_type=force}} {{has_attack_damage=1}} {{attack_damage= ?{Spell level?|1, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]]) |2, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]]) |3, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]]) |4, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]] $[[5]]) |5, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]] $[[5]] $[[6]]) |6, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]] $[[5]] $[[6]] $[[7]]) |7, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]] $[[5]] $[[6]] $[[7]] $[[8]]) |8, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]] $[[5]] $[[6]] $[[7]] $[[8]] $[[9]]) |9, [[ [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]] $[[4]] $[[5]] $[[6]] $[[7]] $[[8]] $[[9]] $[[10]]) }}} I can't thank you enough! :D
1593498494

Edited 1593498540
Oosh
Sheet Author
API Scripter
No worries! Just a side note, now that I look at the output from that particular template - it has some rather large crit colouring on it which makes the total look unimportant by comparison. You could put a box around the total damage by adding a 0 die roll at the start, if that bothers you. So the 2nd level would change to: |2, [[ 1d0cs0cf0 + [[1d4+1]]+[[1d4+1]]+[[1d4+1]]+[[1d4+1]] ]] Total ($[[0]] $[[1]] $[[2]] $[[3]]) This will put a blue box on the total (blue won't be used anywhere else in this roll). May not bother you at all, but it would bother me :)
That looks awesome, thank you. It does look much better outlined by the box.