Roll number associated to body part - Part II

Hi. Here is the code I made for a basic attack with the rule of ARCANA. I did post on a similar topic a couple of weeks ago but the formula evolved and the code is not working anymore. I hope I am posting in the right thread. Sorry if it’s not the case!

The code is working fine BUT I still need to associated a body part with the RollB. The thing is that the players roll d20 and d10 and d6. The matching sequence of the UNITY number of the RollA and RollB create a special result - Critical Hit. Also, if RollA, RollB and RollC matches, it is also a special result called Legendary Strike.

I need to find a way to associate a (IF syntax?) to RollB = 10 = Head, RollB = 1 = Body, RollB = 2 = Body, RollB = 3 = Body, RollB = 4 = Body, RollB = 5 = Body, RollB = 6 = R.Arm, RollB = 7 = L.Arm, RollB = 8 = R.Leg and RollB = 9 = L.Leg. Without affecting the matching result numbers of RollA, RollB and RollC

Is there a way to make it work? Thanks in advance!

> To hit {RollA = !(1d20min1)}
> Body Part {RollB = !(1d10min1)}
• Damage {RollC = !(1d6min1)}
{(RollA == 1) ? “Fumble!” : “”}
{(RollA == 20) ? “DOMINATION!” : “”}
{(RollA == RollB) or {(RollA == 11 and RollB == 1) or {(RollA == 12 and RollB == 2) or {(RollA == 13 and RollB == 3) or {(RollA == 14 and RollB == 4) or {(RollA == 15 and RollB == 5) or {(RollA == 16 and RollB == 6) or {(RollA == 17 and RollB == 7) or {(RollA == 18 and RollB == 8) or {(RollA == 19 and RollB == 9) or {(RollA == 20 and RollB == 10) ? “CRITICAL STRIKE” : “”}
{(RollC == RollB) and (RollC == RollA) or {(RollA == 11 and RollB == 1 and RollC == 1) or {(RollA == 12 and RollB == 2 and RollC == 2) or {(RollA == 13 and RollB == 3 and RollC == 3) or {(RollA == 14 and RollB == 4 and RollC == 4) or {(RollA == 15 and RollB == 5 and RollC == 5) or {(RollA == 16 and RollB == 6 and RollC == 6) ? “LEGENDARY STRIKE” : “”}

You only use the braces { } around the outside of the test @Lefort_Stephane .

You might be confusing the parser with all the embedded braces.

This part has a bunch of {left braces. Only put braces around the code you want to be evaluated, but around all of the code. I’ve split it up to be easier to read, which I recommend doing in notepad (or notepad++, if you’re willing to learn a somewhat different text editor) when working with long blocks of code like this. You’ll need to put it back onto one line in order to use it. Also, I don’t know how much it matters, but the code you put here had “these quotes” instead of “these quotes”. That might mess up the parser. Not sure.

{
  (RollA == RollB) 
  or (RollA == 11 and RollB == 1) 
  or (RollA == 12 and RollB == 2) 
  or (RollA == 13 and RollB == 3) 
  or (RollA == 14 and RollB == 4) 
  or (RollA == 15 and RollB == 5) 
  or (RollA == 16 and RollB == 6) 
  or (RollA == 17 and RollB == 7) 
  or (RollA == 18 and RollB == 8) 
  or (RollA == 19 and RollB == 9) 
  or (RollA == 20 and RollB == 10)
  ? "CRITICAL STRIKE" : ""} 

However, looking at this I can also see that it would be easier to write this particular code slightly differently.

RollA == RollB or RollA - 10 == RollB ? "CRITICAL STRIKE" : ""

In your next block, you’re handling RollC == RollB, but only in the event that it’s already a critical strike? That’s what it looks like anyway. If so, the following should work:

(RollA == RollB or RollA - 10 == RollB) and (RollB == RollC) ? "LEGENDARY STRIKE" : ""

If you do have a legendary strike, it’ll display

To hit  16
Body part  6
Damage  6


CRITICAL STRIKE
LEGENDARY STRIKE

Is that how you’d like it to work?

Hi Blarghedy. It is very nice of you taking time to write these codes! I will try for sure! I did manage to make it work with a friend but I will be more than happy to try your coding! Again thanks a lot!!!

Hi Blarghedy. It worked perfectly!! Love the idea of (-10 in the code).

It looks like this . And I attached an image showing how it look on screen!

Toucher {Roll1 = !(1d20min1)}
Cible {Roll2 = !(1d10min1)} {(Roll2 == 1) ? “POITRINE” : 2 (Roll2 == 2) ? “VENTRE” : 3 (Roll2 == 3) ? “VENTRE” : 4 (Roll2 == 4) ? “BAS-VENTRE” : 5 (Roll2 == 5) ? “BAS-VENTRE” : 6 (Roll2 == 6) ? “BRAS-D.” : 7 (Roll2 == 7) ? “BRAS-G.” : 8 (Roll2 == 8) ? “JAMBE D.” : 9 (Roll2 == 9) ? “JAMBE G.” : 10 (Roll2 == 10) ? “TÊTE” : “”}
Dégâts {Roll3 = !(1d6min1)}
{(Roll1 == 20) ? “DOMINATION!” : “”}{(Roll1 == 1) ? “MALADRESSE!” : “”}
{Roll1 == Roll2 or Roll1 - 10 == Roll2 ? “FRAPPE CRITIQUE” : “”}
{(Roll1 == Roll2 or Roll1 - 10 == Roll2) and (Roll2 == Roll3) ? “FRAPPE LÉGENDAIRE” : “”}

Avantage dégât +1, attaque deuxième et encombrement 2