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

[Custom Sheet] Changing Fumble and Critical Condition

March 23 (2 weeks ago)

Edited March 23 (2 weeks ago)

Hey!
I'm trying to modify the rolltemplate in the HTML of my custom sheet so that fumbles occur on a natural roll of 20, and criticals happen when the result is equal to the skill points plus modifiers.

Can someone help me out? Thanks!


March 23 (2 weeks ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

You do this with the roll expression you send in your fields:

[[1d20cf>20c<1]]

March 23 (2 weeks ago)

Edited March 23 (2 weeks ago)

You mean that i have to type that for every single time I write a roll in the sheet HTML?

March 23 (2 weeks ago)
vÍnce
Pro
Sheet Author

LU MASTER said:

You mean that i have to type that for every single time I write a roll in the sheet HTML?

You either have to update your sheet macros/rolls or you build (or modify) the roll template to handle the logic you want.

March 23 (2 weeks ago)

Edited March 23 (2 weeks ago)


vÍnce said:

You either have to update your sheet macros/rolls or you build (or modify) the roll template to handle the logic you want.

Can I ask you how? I'll give you my codes. I clearly prefer to change the whole template since it will apply for every skill in the sheet.

That's a roll example:

&{template:skill-general}{{skill= RIFLESSI}}{{character= @{character_name}, Luck: @{Luck_Base}, @{handle} }}{{total= [[1d20+{{@{DEX}+?{modificatore?|0},0}>21}*(@{DEX}+?{modificatore?|0}-20) + 0]]}} {{treshold= [[{@{DEX}+(?{modificatore?|0}),20}kl1]]}} {{fumble=  [***Fumble!***](!#fumbleabilità) }}


That's the roll template (taken from Tony R. Cyberpunk 2020 Character Sheet)

     <rolltemplate class="sheet-rolltemplate-skill-general">
<table class="sheet-skill-general">
<tr>
<th colspan="2">{{skill}}</th>
</tr>
<tr>
<td colspan="2"><i><b>{{character}}</b></i></td>
</tr>
<tr>
<td><span><b>Total</b></span><td><i>{{total}}</i></td>
</tr>
<td><span><b>Treshold</b></span><td><i>{{treshold}}</i></td>
</tr>
{{#rollWasFumble() total}}
<tr>
<td><span><b>Fumble</b>:</span><td><i>{{fumble}}</i></td>
</tr>
{{/rollWasFumble() total}}
{{#notes}}
<tr>
<td colspan="2">{{notes}}</td>
</tr>
{{/notes}}
</table>
</rolltemplate>





March 23 (2 weeks ago)

Edited March 23 (2 weeks ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

You have two options:

  1. modify the rolls you send so that they trigger the proper template helper functions (e.g. rollWasFumble).
  2. swap what functions you are using (e.g. rollWasCrit instead of rollWasFumble) and then add css to your template that styles a critical like a fumble and a fumble like a critical.

I can't really recommend option 2 because anyone that uses your template for a custom roll will not get the expected results if they follow the dice reference documentation on the R20 wiki, but it is an option.

EDIT: Also, it looks like the code you posted is missing the start of the rollWasFumble call; there is only the {{/rollWasFumble() total}} that would end the conditionally displayed text for a fumble.

March 23 (2 weeks ago)


Scott C. said:

EDIT: Also, it looks like the code you posted is missing the start of the rollWasFumble call; there is only the {{/rollWasFumble() total}} that would end the conditionally displayed text for a fumble.

Yeah, I inadvertently delete that part while writing it her on forum.

Scott C. said:


  1. modify the rolls you send so that they trigger the proper template helper functions (e.g. rollWasFumble).
  2. swap what functions you are using (e.g. rollWasCrit instead of rollWasFumble) and then add css to your template that styles a critical like a fumble and a fumble like a critical.

Problem is, I have no Idea how to do both options. I'm not exactly pratical with coding, and I'm just trying to do stuff with attempts. Can you give me an example?



March 23 (2 weeks ago)

Edited March 23 (2 weeks ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

See my first post for how to do option 1. For option 2, see the wiki pages on building roll templates and css wizardry. I'd also recommend looking at some css guides.

Note: Option 2 is easier, but like many things, the easy path isn't necessarily the best path (see my critique of option two in my previous post).

March 23 (2 weeks ago)

Edited March 23 (2 weeks ago)

Ok. Problem is, I've try to done option 1, but is not working. It doesn't even do the roll. I've change it like that for the fumble, and is working: 1d20cf20

Also, your formula does not include the threshold as a critical option. The threshold should be equal to the skill value plus modifiers.

I'm starting to wandering if it's possible to do it in a simple way, since the treshold will be different for every single skill.

March 23 (2 weeks ago)

Edited March 23 (2 weeks ago)
vÍnce
Pro
Sheet Author

You can add some CSS that styles your inlinerolls to override what the vtt's default logic for crit and fail.
example (added '.sheet-crit' to style crits); As Scott mentioned this could be confusing for anyone using the skill-general template and expecting the default crit/fail logic.

.sheet-rolltemplate-skill-general .inlinerollresult.fullcrit {border: 2px solid red;}
.sheet-rolltemplate-skill-general .sheet-crit i .inlinerollresult {border: 2px solid green;}
.sheet-rolltemplate-skill-general .inlinerollresult.fullfail {border: 2px solid transparent;}

If 'treshold' is your test for a crit (I'm not 100%), you should be able to do something like;  I also added a {{crit}} key in your macro similar to {{fumble}}. 

<button type="roll" value="&{template:skill-general}{{skill= RIFLESSI}}{{character= @{character_name}, Luck: @{Luck_Base}, @{handle} }}{{total= [[1d20+{{@{DEX}+?{modificatore?|0},0}>21}*(@{DEX}+?{modificatore?|0}-20) + 0]]}} {{treshold= [[{@{DEX}+(?{modificatore?|0}),20}kl1]]}} {{crit= [***Crit!***](!#crit)}} {{fumble= [***Fumble!***](!#fumbleabilità) }}">Roll Skill</button>

Not sure if you want/need that.  Hopefully this gets you closer.

<rolltemplate class="sheet-rolltemplate-skill-general">
<table class="sheet-skill-general">
<tr>
<th colspan="2">{{skill}}</th>
</tr>
<tr>
<td colspan="2"><i><b>{{character}}</b></i></td>
</tr>
<!-- roll was a fumble -->
{{#rollWasCrit() total}}
<tr>
<td><span><b data-i18n="total">Total</b></span>
<td><i>{{total}}</i></td>
<td><span><b>Treshold</b></span>
<td><i>{{treshold}}</i></td>
</tr>
<tr>
<td><span><b data-i18n="fumble">Fumble</b>:</span>
<td><i>{{fumble}}</i></td>
</tr>
{{/rollWasCrit() total}}

{{#^rollWasCrit() total}}
<!-- roll was a crit -->
{{#rollTotal() total treshold}}
<tr>
<td><span><b data-i18n="total">Total</b></span>
<td class="sheet-crit"><i>{{total}}</i></td>
<td><span><b>Treshold</b></span>
<td><i>{{treshold}}</i></td>
</tr>
<tr>
<td><span><b data-i18n="crit">Crit</b>:</span>
<td><i>{{crit}}</i></td>
</tr>
{{/rollTotal() total treshold}}
<!-- roll is normal -->
{{#^rollTotal() total treshold}}
<tr>
<td><span><b data-i18n="total">Total</b></span>
<td><i>{{total}}</i></td>
<td><span><b>Treshold</b></span>
<td><i>{{treshold}}</i></td>
</tr>
{{/^rollTotal() total treshold}}
{{/^rollWasCrit() total}}

{{#notes}}
<tr>
<td colspan="2">{{notes}}</td>
</tr>
{{/notes}}
</table>
</rolltemplate>

fyi: I'm not great with roll template logic but I think this covers what you are looking for.

1st roll was a "normal" roll
2nd was a nat 20
3rd roll matched the 'treshold' value (but I'm not sure that's the target. Adjust as needed)

March 23 (2 weeks ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

LU MASTER said:

Ok. Problem is, I've try to done option 1, but is not working. It doesn't even do the roll. I've change it like that for the fumble, and is working: 1d20cf20

Also, your formula does not include the threshold as a critical option. The threshold should be equal to the skill value plus modifiers.

I'm starting to wandering if it's possible to do it in a simple way, since the treshold will be different for every single skill.

your roll expression is not quite correct. you need to include a comparison operator (<,>, or =). e.g.:

1d20cf>20

Note that this also needs to be in inline roll brackets.

For the dynamic comparison, as long as your threshold is stored on the sheet as an attribute, you can do it by just referencing the threshold attribute. As an example, if your acrobatics skill threshold attribute was acrobatics_threshold, it'd look like:

1d20cf>@{acrobatics_threshold}

March 24 (2 weeks ago)
GiGs
Pro
Sheet Author
API Scripter

Is this a Pendragon dice roll? You'll get the best help if you describe the complete logic of a roll - how its made if you were sitting at the game table and not using roll20.

March 24 (1 week ago)

Edited March 24 (1 week ago)

Thank you to all of you! I will try your codes vincè.

GiGs, yes, or at least it works as per Pendragon. So whenever a roll hit the treshold is a crit, and 20 is a fumble. BUT when when the skill value is 20 or more, everything above 20 is added to the roll and any roll result of 20 or more is a critical.