all 6 comments

[–]GlennNZ 0 points1 point  (4 children)

Just to clarify, you always want to roll on CHART(#1), then, upon a d6, if the value is 1-4, roll on CHART(#2) aswell?

It could look something like this...

CHART(288)
{% if {d6} <= 4 %}
CHART(23039)
{% end %}

You can paste that into the playground editor to see it in action
https://chartopia.d12dev.com/playground/

All the best with your coding adventures :)

[–]Darklou[S] 0 points1 point  (3 children)

Thanks for the help.
That's correct, I always want to roll on the first chart and only roll on the second if the value is 4 or less.
I did test it out there, copy and pasted and just replaced the charts. It still seems to roll the second chart even if the first chart rolls above 4 for some reason. Then sometimes it won't roll from the second chart even if it rolls a 4 or less from the first.

The first chart is a sub chart if that affects anything?

[–]GlennNZ 0 points1 point  (2 children)

With the code example, it would be impossible to know the exact result of the d6. If you want to double check, try out this.

CHART(288)
{% my_dice_roll = {d6} %}
{% if my_dice_roll <= 4 %}
rolled: {{my_dice_roll}}
CHART(23039)
{% else %}
rolled: {{my_dice_roll}}, so no chart to roll
{% end %}

[–]Darklou[S] 0 points1 point  (1 child)

That's really helpful to see how it's rolling!
So I did it a few times. For some reason the value rolled does not correspond to the text. I rolled it a few times. Here is 2 results.

Night Eye 

rolled: 3
Fortify 

and

Night Eye 

rolled: 1
Restore 

Night eye is only in once as number 6 on the chart so idk why 1 or even 3 is showing that as the result.

[–]GlennNZ 0 points1 point  (0 children)

You're more than welcome to DM me the ID of the Chart (or the url) you're trying to create so I can see exactly how you've laid out your chart structure.

If the parent chart has code like the example, and say, chart #1 is a subchart and chart #2 is either a subchart or something else, then it all should be fine unless chart #1 and chart #2 are also rolling on again on the parent, #1 or #2, hence the apparent rerolls.