# How can I set up a Roll20 macro to roll certain additional dice depending on the results of an initial die roll?

I am playing a wonderful homebrew campaign running D&D 5E via Roll20 (I have a Basic account), and I have just rerolled as a wizard. One of my spells, prismatic spray, requires that I roll 1d8 for each creature, and based off that result, the target gets one of 8 effects afflicted upon them.

I am trying to find a macro - or find a way to make a macro - that rolls certain additional dice depending on the result of a die roll, since 6 out of the 8 effects of prismatic spray require further die rolls.

For example, if I cast this spell, and roll a 1 on the d8, I need to then roll 10d6. And I would have to repeat this process for every creature hit by the spell. I am trying to make this as easy as possible on both myself, my GM, and my team so that we don't end up just waiting for me to roll die, and I don't lose out on a great spell.

• I have posted a similar question at the roll20 forums regarding the dice rolling functionality; when and if I get an answer I'll see if it fits your problem. (We don't have identical problems, but the answer may be similar enough). Are you able to write API scripts (are you a pro or plus user, or a basic user?) – KorvinStarmast Jan 20 at 3:18
• Basic user unfortunately – Pethrax Jan 20 at 3:29

## There is no way to do a Macro for Prismatic Spray as you want it.

While this isn't the answer you want, it is the truth. Macros can't make conditional statements or multiple separate dynamic rolls, for that you would need an API, but you're a basic user so it isn't an option for you. I discussed with some content creators from Roll20 and search other answers at the Roll20 community and their answers about doing this with only macros were all the same.

• So IF I had access to an API on Roll20, this would be possible, but not as a basic user with just basic macros, correct? – Pethrax Jan 20 at 19:22
• @Pethrax Yes, you're are correct. But I recommend you to research API before upgrading your account if you're doing it with this as main reason. It isn't that easy to work on them but if you're good with programming it shouldn't be an issue for long. – Aguinaldo Silvestre Jan 20 at 20:06
• Damn, well thank you for enlightening me. I ran away from programming because I've seen the headaches it causes, and have no desire for that kind of stress in my life. Was hoping there'd be a simple macro, but oh well. – Pethrax Jan 21 at 1:30

You can achieve those results using a call macro macro:

/em Dekkar Cast Elemental Infusion
/roll 1d6
[1](!&#13;#ElFire ), [2](!&#13;#ElFrost ), [3](!&#13;#Elwind ), [4](!&#13;#ElWater ), [5](!&#13;#ElEarth ), [6](!&#13;#ElLight )


and then have a macro with the appropriate names in your macro tab:

/me strikes out at the target!
@{Dekkar|wtype}&{template:atkdmg} {{mod=+5}} {{rname=Elemental Fire}} {{r1=[[@{Dekkar|d20}cs>20 + 3[STR] + 2[PROF]]]}} @{Dekkar|rtype}cs>20 + 3[STR] + 2[PROF]]]}} {{attack=1}} {{range=self}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + 3[STR]]]}} {{dmg1type=Slashing }} {{damage=1}} {{dmg2flag=1}} {{dmg2=[[5]]}} {{dmg2type=Fire }} {{crit1=[[2d8[CRIT]]]}} {{desc=Channeling arcane energy into your weapon you cause an additional 5 fire damage each round for one  minute.}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Dekkar|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Dekkar|global_damage_mod_type}}} ammo= @{Dekkar|charname_output}

• Welcome to RPG.SE! Take the tour if you haven't already, and check out the help center for more guidance. It would help to indicate the parts of your answer that are "code" for the Roll20 macro by using code formatting. For inline code formatting, put backticks () around the code; if it's on its own line, you can start the line with four spaces to mark the whole line as code, or surround the code block on both sides with lines of 3 backticks (). – V2Blast May 3 at 4:11
• Ah, it does work if you run a call macro macro for each target indeed. I was trying to make one that you run only once after you input the number of targets but couldn't make conditional statements. – Aguinaldo Silvestre May 3 at 18:53