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

Macro for Qin dice roll

1607726123

Edited 1607726539
Baleine
Sheet Author
Hi guys, I'm trying to find the way to represent correctly the way to handle the dice roll for Qin Warring States. It's not that complex, but I have a hard time to handle it correctly in Roll20. Here's how the system works : You roll 2 10-sided dice. One is Yin, the other is Yang. The result is the absolute value of the difference between the 2 dice. I shall specify that the face 0 means 0, not 10. If the 2 dice rolled the same value, then it's a critical success, except if the dice rolled 0, in which case it's a critical failure instead When you attack an opponent, you do your rolls and if you get a critical success, you add the face value of one of the dice (they're both the same) and you add it to the damage of your weapon (which is a fixed value). So let's say I'm attacking with a sword that does 6 damage, if I roll 2 sixes, I do 12 damage. If your yang dice is higher than your yin dice, you add the difference to your damage. I would like to make an attack rolltemplate that roll for attack and tells how much damage you do if the GM says the attack is a success. So, I came with that kind of roll template : &{template:simpleRoll} {{title=^{AttackRoll}}} {{roll= [[ @{Metal} + @{metalskilllvl} + [[ abs( [[1d10-1]] - [[1d10-1]] ) ]] ]] }} {{Yin=$[[0]]}}  {{Yang=$[[1]]}}  {{diff=$[[2]]}}  {{result=$[[3]]}} {{damage=[[ @{weaponDamage}+@{Metal} ]]}} But now, how can I handle the result and alter the damage based on a critical succes or a higher Yang dice? Something like {{critdamage=[[ @{metdmg}+@{Metal} + $[[0]] ]] }} does obviously not work since I cannot use a rollId in a mathematic operation. I didn't found a way to do that inside the rolltemplate html presentation. Maybe using a sheetworker would work, but I have no idea how, since javascript is as strange to me as a shoe would be to a shark. And I gave up using powercards since I cannot figure a way to nest a RollId inside another RollId (since I need to store the difference between the dice) I'd be impressed and very thankful if anyone would see a way to handle that. Thanks for your time.
1607733951

Edited 1607734660
Oosh
Sheet Author
API Scripter
I think this should work, though I've never written a sheet or roll template: {{#rollLess() diff 0}} {{critdamage=@{metdmg}+@{Metal} + $[[3]]}} {{/rollLess diff}} {{#rollTotal() diff 0}} {{critdamage=@{metdmg}+@{Metal} + $[[0]]}} {{/rollTotal() diff}} I believe the roll template helpers use actual greater than and less than, not the greater-than-or-equal-to from the dice roller. And Yang is the second roll, correct? So the first line displays if the difference is negative (Yang is higher) and adds the absoluted result to the crit damage. The second line displays if the diff is zero (a match), and adds the value of one of the dice. Not 100% on the syntax, you might need to include the "0" in the {{/}} closing handlebars, not sure. edit - I misread your brackets... it would need another set inside the abs() for the above to make sense: [[ abs([[ [[1d10-1]] - [[1d10-1]] ]]) ]] ...is it an intended effect of this system that rolling a crit can result in zero crit damage? Or do you get a +10 for rolling double eggs?
1607735841

Edited 1607736740
Baleine
Sheet Author
Oosh said: Not 100% on the syntax, you might need to include the "0" in the {{/}} closing handlebars, not sure. Yeah, you need to close the tag with the same content in the opening tag Double egg is a critical failure. I tried to explain that in the second bullet, but maybe I didn't made myself very clear on that. The problem with your solution is that $[[3]] won't be interpreted as a number. That's why I have an issue
1607753533

Edited 1607753550
Oosh
Sheet Author
API Scripter
Ugh, yeah sorry, I shouldn't post before coffee. You did explain that just fine, my brain is the problem. I think the only way to do it without using API is the same as above, but move the roll reference outside the calculation: {{critdamage=[[@{metdmg}+@{Metal}]] + $[[3]] }} It'll give you two separate numbers, but it's the easiest solution. If you want those added together into a total, it's going to need the API to do the rolling, I'm pretty sure. If you need that number in multiple places for different operations, there's not really any way around that I can see.
No troubles, this kind of thing happens (and I'm not a native english writer, so I may explain things in a bizarre way). Thank you for your answer. I thought as much, but I hoped something was eluding me.