MapTool macro: Star Wars d6 / OpenD6 dice

I’m beginning to like Twitter.

Wednesday evening, I happened to check Twitter just before heading to bed. I was just in time to see an exchange between @NewbieDM (aka Enrique of NewbieDM.com) and @MarkMeredith (aka Dice Monkey). They had just finished trying to play some Star Wars d6 via Google+ hangouts, and it hadn’t worked all that well. Enrique was about to show Mark some MapTool stuff. I chimed in, and they invited me to join them on Skype.

Even though he hasn’t been using MapTool very long, Enrique has already built some extensive stuff for his Neverwinter campaign (using my MapTool framework as a base, I’m humbly proud to say). He started showing Mark the ropes, and it soon became clear that Star Wars d6 was a little bit different in terms of the way die rolling works. I knew nothing about the game, so Mark explained it.

The basic dice mechanic is this (as I understand it, this is the mechanic for all OpenD6 games):

  • You roll a certain number of six-sided dice, depending on your skill at the task at hand. For this example, we’ll say you have a skill of 3, so you’re rolling 3d6.
  • One of the dice is the wild die; the other dice are rolled normally.
  • If you roll a 6 on the wild die, it “explodes”. That is, you roll it again and add both rolls together. If you roll another 6, you keep on going.
  • However, if you roll a 1 on the wild die, it counts as a zero, and it also cancels out the highest non-wild die that you rolled. So, if you roll a 2 and a 3 on your normal dice and a 1 on the wild die, your total is just 2 (because the 1 on the wild die cancels out the 3 from your best normal die).

I knew that MapTool had a built-in roll option to handling exploding dice, but I don’t know of any roll options to have a certain die cancel another die roll. So, I wrote a macro:

[h: x=input("NumDice|0|How many dice are you rolling?")]
[h: abort(x)]

This brings up a prompt for the user to tell the program how many dice to roll. If they hit Cancel, the macro stops.

[h: RegTotal=0]
[h: RegMax=0]

I establish starting values of zero for the total of the regular (non-wild) dice and the maximum of any regular die.

Regular dice:
[for(i, 0, NumDice-1), CODE:
 {

I display the words “Regular dice: ” in the chat window, then start a loop. Note that loops begin with 0 rather than 1 in MapTool by default, so I go with that. I want to loop through all of the dice except the wild die, so I stop at NumDice-1. I then open a CODE block with a curly bracket; everything in this block will be executed a number of times equal to the number of dice minus one.

  [NewRoll=d6]

First, I roll a d6 and store the value as NewRoll. Note that I didn’t use the h: roll option here as I do in most lines of code. This is because I don’t want the value of NewRoll to be hidden (the h:). Since this is a FOR loop, MapTool will put a comma between the iterations. So, if this was the only thing in the CODE block, MapTool would display “Regular dice: 2, 4” if it rolled a 2 and then a 4 on the two iterations.

  [h: RegTotal=RegTotal+NewRoll]
  [h: RegMax=if(NewRoll>RegMax,NewRoll,RegMax)]
 }
]

I add this new die roll to the running total of the regular dice (which started at zero). I then check to see if this new roll is higher than any of the previous regular die rolls. If it is, I set the value of RegMax to equal the new die roll; otherwise, I leave RegMax where it was. I then close the FOR loop.

[h: WildResult=d6e]
<br>Wild die=[WildResult]

Now I roll the wild die and store the result as WildResult. I use an “e” on the end of the die roll expression to represent “exploding” which MapTool already has built in. Nice! I then put in a line break (the <br>) in the chat window and then display the words “Wild die=” followed by the result of the exploding die roll.

[h: FinalTally=if(WildResult==1, RegTotal-RegMax, RegTotal+WildResult)]
<br>Total=<b>[FinalTally]</b><br>

I now figure out and display the final result of the whole roll. If the wild die was a 1, the total for the roll is whatever I rolled on the regular dice, minus the highest regular die (the 1 from the wild die is not added). Otherwise, the total for the roll is the total of the regular dice plus the result of the wild die (including any explosions). I pop in another line break and display the final result in bold (the <b> and </b> surrounding the value of FinalTally).

The result will look something like this:

Regular dice: 2 , 3
Wild die=2
Total=7

There you have it – the basic Star Wars d6 dice macro! Now I just need to learn to play the game.

-Michael, the OnlineDM (@OnlineDM1 on Twitter)

 

Complete macro:

[h: x=input("NumDice|0|How many dice are you rolling?")]
[h: abort(x)]

[h: RegTotal=0]
[h: RegMax=0]

Regular dice: 
[for(i, 0, NumDice-1), CODE:
 {
  [NewRoll=d6]
  [h: RegTotal=RegTotal+NewRoll]
  [h: RegMax=if(NewRoll>RegMax,NewRoll,RegMax)]
 }
]

[h: WildResult=d6e]

<br>Wild die=[WildResult]
[h: FinalTally=if(WildResult==1, RegTotal-RegMax, RegTotal+WildResult)]
<br>Total=<b>[FinalTally]</b><br>

7 thoughts on “MapTool macro: Star Wars d6 / OpenD6 dice

  1. Great macro. I added a t: to avoid seeing all the rolls.
    One suggestion… sometimes a skill comes with either a +1 or +2 bonus applied, called in d6 SW a “pip”. 3 pips make a die, so you’ll never see a +3. Perhaps the macro can include a function to add a bonus to the roll?

  2. Actually, I think I got it! Check it out:

    [h: x=input(“NumDice|0|How many dice are you rolling?”)]
    [h: abort(x)]

    [h: RegTotal=0]
    [h: RegMax=0]

    Regular dice:
    [for(i, 0, NumDice-1), CODE:
    {
    [t:NewRoll=d6]
    [h: RegTotal=RegTotal+NewRoll]
    [h: RegMax=if(NewRoll>RegMax,NewRoll,RegMax)]
    }
    ]

    [h: WildResult=d6e]

    Wild die=[WildResult]
    [h: y=input(“NumDice|0|What’s your bonus?”)]

    [h: FinalTally=if(WildResult==1, RegTotal-RegMax+y, RegTotal+WildResult+y)]
    Total=[FinalTally]

    • Hmm, using my macro the roll is adding a +1 if I enter 0 as a bonus. Not understanding where I went wrong…. wonder if it’s adding a +1 as well if I enter a 1 or 2 as the bonus….

  3. Okay… I think I got it! Check it out… It asks for a bonus, and adds it to the final tally. Also in case of a 1 on the wild die, it keeps the bonus as part of the total after losing the highest roll along with the 1 of the wild die.

    [h: x=input(“NumDice|0|How many dice are you rolling?”)]
    [h: abort(x)]

    [h: RegTotal=0]
    [h: RegMax=0]

    Regular dice:
    [for(i, 0, NumDice-1), CODE:
    {
    [t:NewRoll=d6]
    [h: RegTotal=RegTotal+NewRoll]
    [h: RegMax=if(NewRoll>RegMax,NewRoll,RegMax)]
    }
    ]

    [h: WildResult=d6e]

    Wild die=[WildResult]

    [h: FinalTally=if(WildResult==1, RegTotal-RegMax, RegTotal+WildResult)]

    [h: FinalResult=(FinalTally+Bonus)]
    Total=[FinalResult]

  4. Very nice!

    Just a couple of suggestions: The aforementioned “pips” would be good to add (e.g. “3D+2” means “roll 3 six-sided dice and add 2 to the total”) — pips are always +0, +1, or +2 (e.g. 3D, 3D+1, or 3D+2, respectively).

    One other feature you should add: When you roll a 1 on the wild die, there are actually two possible outcomes (SWRPG 2nd edition, p.53):

    * “Penalty” — suggested 5/6 chance: You lose the wild die and the highest non-wild die from your total. (This is what you have it doing currently.)
    * “Complication” — suggested 1/6 chance: You don’t lose any dice from your total, but something unpleasant happens. If you’re successful on your roll, the intended effect occurs, but something else happens as well; for example, Lando flying the Millennium Falcon inside the 2nd Death Star gets a complication on a roll to avoid a collision, and even though he succeeds he knocks off the ship’s sensor dish. If you fail on your roll, something truly nasty happens; for example, Han Solo trying to sneak up on a scout trooper on Endor gets a complication *and* fails his sneak roll, so the GM says he steps on a branch so loudly that he startles himself, giving the not-surprised scout trooper initiative in the ensuing brawl.

    The rules point out that the penalty vs. complication thing doesn’t have to be automatic (they suggest a 1/6 chance of a complication as a guideline), but it would be nice to have this as an option. Thanks!

    • NewbieDM’s version of the macro in the comments handles the pips (a rule I didn’t know about when I wrote the macro – as I said, I’ve never played the game!).

      As for having a 1/6 chance of a complication instead of a penalty when the wild die is a 1, here’s the code for that alternative:

      [h: x=input(“NumDice|0|How many dice are you rolling?”)]
      [h: abort(x)]

      [h: RegTotal=0]
      [h: RegMax=0]

      Regular dice:
      [for(i, 0, NumDice-1), CODE:
      {
      [t:NewRoll=d6]
      [h: RegTotal=RegTotal+NewRoll]
      [h: RegMax=if(NewRoll>RegMax,NewRoll,RegMax)]
      }
      ]

      [h: WildResult=d6e]
      [h: WildResult=1]

      Wild die=[WildResult]

      [if(WildResult==1), CODE:
      {
      [if(d6==6), CODE:
      { – A complication occurs!
      [h: FinalTally=RegTotal+WildResult]}; {[h: FinalTally=RegTotal-RegMax]
      }
      ]
      };
      {[h: FinalTally=RegTotal+WildResult]
      }
      ]

      [h: FinalResult=(FinalTally+PipBonus)]

      Total=[FinalResult]

Leave a Reply