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

Specific Exploding Dice

January 01 (1 year ago)

Is there a way to make dice explode only if you reach the maximum value multiple times. So if you have 3d6, and you roll 1, 6,6, it only explodes into 1 additional d6 and not 2. Also is there a way for dice to explode into bigger dice, so if you roll 4d4, and they explode into d6s instead of 4s. Thank you for any help you might be able to provide. I was told there might be a way using API?

January 01 (1 year ago)

Edited January 01 (1 year ago)
GiGs
Pro
Sheet Author
API Scripter

Yes, you can do this with a custom script. There's no way to do either of these with the default mechanics.

Yiou might ask in the scriptCards thread - that is a very flexible script that can do a lot of things.

ScriptCards has some exploding dice support. See ScriptCards wiki. But I don't think it has native support to do exactly what you describe with its dice roller. You can do conditional things in your own ScriptCard though. Here's an example that would roll however many d4's inputted and if multiple 4's come up, then roll 1 fewer d6 for each max d4. Which combines both of your examples in one.

!scriptcard {{
    --&numberOfDice|?{Number of dice|2}
    --&originalDieSize|d4
    --&explodingDieSize|d6
    --=Roll|[&numberOfDice][&originalDieSize]
    --=ExplodingRoll|0
    --?[$Roll.Aces] -gt 1|[
        --&numberOfExplodingDice|[= [$Roll.Aces] - 1]
        --=ExplodingRoll|[&numberOfExplodingDice][&explodingDieSize]
    --]|
    --=TotalRoll|[$Roll] [ROLL] + [$ExplodingRoll] [EXPLODE]
    --+Results|Orig:[$Roll] + Exploding:[$ExplodingRoll] = [$TotalRoll]
}}

Maybe someone else knows more about ScriptCards native rolling options but I don't think the ScriptCards roller has exactly what you describe natively so I think it would require custom logic like the example above.

January 02 (1 year ago)


Joshua N. said:

ScriptCards has some exploding dice support. See ScriptCards wiki. But I don't think it has native support to do exactly what you describe with its dice roller. You can do conditional things in your own ScriptCard though. Here's an example that would roll however many d4's inputted and if multiple 4's come up, then roll 1 fewer d6 for each max d4. Which combines both of your examples in one.

!scriptcard {{
    --&numberOfDice|?{Number of dice|2}
    --&originalDieSize|d4
    --&explodingDieSize|d6
    --=Roll|[&numberOfDice][&originalDieSize]
    --=ExplodingRoll|0
    --?[$Roll.Aces] -gt 1|[
        --&numberOfExplodingDice|[= [$Roll.Aces] - 1]
        --=ExplodingRoll|[&numberOfExplodingDice][&explodingDieSize]
    --]|
    --=TotalRoll|[$Roll] [ROLL] + [$ExplodingRoll] [EXPLODE]
    --+Results|Orig:[$Roll] + Exploding:[$ExplodingRoll] = [$TotalRoll]
}}

Maybe someone else knows more about ScriptCards native rolling options but I don't think the ScriptCards roller has exactly what you describe natively so I think it would require custom logic like the example above.


It says there are some unexpected tokens with it, could you assist?


Perhaps you can include a screenshot. When I run that in a game where the ScriptCard mod is installed, I get the following output:

Can you confirm that you have the ScriptCards Mod installed in your game? You can test with:

!script {{ }}

ScriptCards is available via the 1Click install. In the Mod Output Console of the API Sandbox you should see a line like:

That shows ScriptCards is loaded. Perhaps you can confirm whether or not ScriptCards is installed and running ok and the !script {{ }} works and provide a screenshot of the error you are getting. As of now, I'm not able to reproduce your error so any and all details you can provide might help.

January 02 (1 year ago)

I installed the script card mod and it was running okay, but when I used the sample script
!script {{ }}

It gave me the same error


I am not sure how an open curly brace is unexpected there.

Do other mods you have installed work fine in your game? Say TokenMod, a really common Mod,

!token-mod --config

 I cannot replicate that so far in Firefox on Linux or Chrome on Windows. Can you describe your setup? Browser? OS? Screenshot of all the mods in your game? Language or keyboard setup? Just trying to think what might be different and causing issues here.

I have tried in a brand new game with a fresh install of ScriptCards and all of the above code works each time. I cannot seem to replicate the issue you are having. When I copy any of those into chat, they run fine each time. I cannot yet explain what the issue is but if your game is having no other issues other than ScriptCards, it's probably not worth a huge time investment to figure out why. It's just bizarre to me and I cannot seem to replicate it.

January 02 (1 year ago)

I only have the two mods that you recommended, the Token one and the Scrpit one, I am using an English keyboard, Chrome and Windows, and this is a new game

January 02 (1 year ago)

Edited January 02 (1 year ago)

Oh I see. Thank you for the screenshot. No the code above is a ScriptCard, it's meant to be run in the Roll20 game itself, either pasted directly in the chat or via a Macro or Character Ability. It is not a Mod itself.

When you have ScriptCards installed, !script or !scriptcard sent in the game's chat let's ScriptCards know to process the chat message. Similar to how if you type /r or /gmroll into the game chat things happen.

EDIT:

Nick Olivo has some recent youtube videos about using ScriptCards to automate things that might help as well.

Here is a screenshot of this as well

So just copy the code above into the chat and hit enter and it will be processed by the ScriptCards mod.

January 02 (1 year ago)

Ohhhhh, okay okay I think I understand now thanks!

January 02 (1 year ago)

Just one last quick question, how would you add a modifier question to this? So it prompts you for your modifier asking for like a +5 or +7 ect

Joshua N. said:

Oh I see. Thank you for the screenshot. No the code above is a ScriptCard, it's meant to be run in the Roll20 game itself, either pasted directly in the chat or via a Macro or Character Ability. It is not a Mod itself.

When you have ScriptCards installed, !script or !scriptcard sent in the game's chat let's ScriptCards know to process the chat message. Similar to how if you type /r or /gmroll into the game chat things happen.

EDIT:

Nick Olivo has some recent youtube videos about using ScriptCards to automate things that might help as well.

Here is a screenshot of this as well


So this line is where it prompts for the number of dice to roll:

--&numberOfDice|?{Number of dice|2}

That uses the Roll20 Roll Query syntax of ?{Prompt} to set a ScriptCards String variable with --&.

So if you want to have a second prompt for a modifier you could do something like:

--&modifier|?{Modifier}

And then you could use that in a ScriptCards roll variable to add to the dice roll with something like:

--=Roll|1d6 + [&modifier]

Alternatively if the modifier is an attribute, you could do something like the following:

!script {{
  --#sourceToken|@{selected|token_id}
  --&AttributeName|Agility
  --=Roll|2d6 + [*S:[&AttributeName]] [MOD]
  --+Result|[$Roll]
}}

That ScriptCard would use the selected token when run and look for an Attribute of the character linked to that token named Agility. And then add that to the Roll and display the Result.