The first question goes to Dedric:
Dedric wrote:
How would you set this up?
Roll a 1d20+mods (check to see if just the 1d20 was a 20) if true Critical Hit{14+1d6} if not {1d10+4}
Ugly MacroCode:
[DiceRoll = 1d20]
[DiceRoll + Modifier]
[if(DiceRoll == 20,14+1d6,1d10+4)]
Line by line- Rolls 1d20 and stores it in DiceRoll
- Prompts the user for the Modifier, adds it to DiceRoll
- Checks the value of DiceRoll, if it is 20 then roll 14+1d6 otherwise roll 1d10+4
Ugly OutputQuote:
« DiceRoll = 1d20 = DiceRoll = 17 = 17 » « DiceRoll + Modifier = 17 + 4 = 21 » « if(DiceRoll == 20,14+1d6,1d10+4) = 6 »
Note that you can verify that the proper dice roll is used for 20s by changing line 1 to be [DiceRoll = 20]Beautimufied MacroCode:
<!--[DiceRoll = 1d20]
[Modifier = Modifier]-->
You rolled {DiceRoll} on 1d20 with a {if(Modifier > 0,"+","")}{Modifier} for {DiceRoll + Modifier}. That's a {if(DiceRoll == 20, "Critical Hit", "Normal Hit")} of {if(DiceRoll == 20,14+1d6,1d10+4)}.
Block by blockRemember that [ ] and { } are both macro blocks
- Use <!-- --> around the ugly bits to hide them
- Set DiceRoll = 1d20 (set it to = 20 to test Critical Hits)
- Get the value of Modifier from the user and store it for later use
- {DiceRoll} prints the value of the 1d20 rolled
- {if(Modifier > 0,"+","")} will print a + if the Modifier is positive and do nothing if it is negative
- {Modifier} shows the value of the Modifier the user entered
- {DiceRoll + Modifier} gives us the total roll
- {if(DiceRoll == 20, "Critical Hit", "Normal Hit")} if DiceRoll was 20 then print Critical Hit otherwise print Normal Hit
- {if(DiceRoll == 20,14+1d6,1d10+4)} if DiceRoll was 20 then roll 14+1d6 otherwise roll 1d10 + 4
Pretty OutputQuote:
You rolled 13 on 1d20 with a +4 for 17. That's a Normal Hit of 8.