Hero System Dice Lib Update

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Hero System Dice Lib Update

Post by Jagged »

Hero System Dice Lib Update
The following is an update to the Dice Library Project specifically for Hero System and extends the existing functionality to allow for fractions of a die. Specifically resulting in either +1, or 1/2 as appropriate. It also allows for an optional d6-1 instead of a half.

If you are unfamiliar with the Hero System there are a number of occasions when you may wish to use fractions. A typical (or Normal) Hero System attack produces Stun and Body damage. The number of dice rolled to produce the Stun is calculated as a function of the strength of the attack divided by 5. Body is calculated by adding up the number of dice rolled and subtracting 1 for each number 1 rolled and adding 1 for each number 6 rolled.

The existing hero system chat macro covers the basics and typing "[10d6h] [10d6b]" into the chat window will prduce a valid result. However there are circumstances where the strength of an attack is does not end in either 5 or 0. A character with STR 18 would typically punch for 18/5 or 3.6 dice of stun. In this case values of 0.5 or more should result in a half die, so 3 and a half dice. Unfortunately in Hero System half dice have different rules for calculating body damage and this is not covered by the existing macro. For a half die you roll a d6 and use the table below:

Code: Select all

Roll Stun Body
 1  - 1  -  0
 2  - 1  -  0
 3  - 2  -  0
 4  - 2  -  1
 5  - 3  -  1
 6  - 3  -  1


This update modifies the existing Hero System macro so that you can enter decimal places for the number of dice and adds a couple of extra functions to handle killing attacks and the different way killing attacks deal with fractions. NOTE: It does not change any other existing dice functions so other game systems will be unaffected.

How to use:
The function is designed to used so that in macros you can simply divide the strength of an attack by 5 to get the number or dice to roll and the function will calculate the correct stun and body. For example typing

Code: Select all

[h:dice=Str/5][r: herostun(dice,6)] [r: herobody(dice,6)]
will produce a result for any value of Str.

Examples of Valid Syntax:
[r: herostun(7.6,6)] [r: herobody(7.6,6)]
[10d6h] [10d6b]
[9.2d6h] [9.2d6b]
[5.6d6h] [5.6d6b]
[d6h] [d6b]

Killing Attacks:
Killing attacks work slightly differently in that they divide the strength of the attack by 15 and fractional values may result in +1 or a half die. So 15 points gets you a 1d6 killing attack. 20 points would get you 1d6+1. 25 points 1.5d6 and 30 points 2d6. This produces the body damage, stun is calculated by a second roll of (unusally but not always) 1d6-1 and multiplying the body to get the stun. Stun is never less than body.

How to use:
The function is designed to used so that in macros you can simply divide the strength of an attack by 15 to get the number or dice to roll and the function will calculate the correct stun and body. For example typing

Code: Select all

[h:dice=Str/15][r: herokilling(dice,6)] [r: heromultiplier(1,6,-1)]
will produce a result for any value of Str.

Examples of Valid Syntax:
[r: herokilling(3,6)] [r: heromultiplier(1,6,-1)]
[r: herokilling(3,6,1)] [r: heromultiplier(1,6)]
[r: herokilling(2,6,-1)] [r: heromultiplier(1,6,1)]
[r: herokilling(3.2,6)] [r: heromultiplier(1,6,-1)]
[r: herokilling(3.6,6)] [r: heromultiplier(1,6,-1)]
[3d6hk] [1d6hm-1]
[1d6hk] [1d6hm+1]
[1.5d6hk] [d6hm]
[3.2d6hk] [1hm]
[3.66666d6hk] [3hm]

Killing Dice Option:
According to the offical Hero System rules a GM may allow their players to roll d6-1 instead of a hald die for killing attacks (minimum value 1). To enable this option I have added a "herokilling2" function that works exactly the same as the function above but will roll d6-1 instead of a half die should the need arise.

Examples of Valid Syntax:
[r: herokilling2(1.6,6)] [r: heromultiplier(1,6,-1)]
[1.6d6hk2] [1d6hm-1]

How to Install:
Unzip the file below and copy to your MapTool "lib" directory. Replace the existing DiceLib (probably dicelib-1.0.b18.jar) with the unzipped file and rename it to match the existing one (probably dicelib-1.0.b18.jar).
dicelib-1.0.b22.zip
(26.55 KiB) Downloaded 76 times


Source Code:
For those running their own builds or distributions I attach a patch file for the DiceLib Project. If you have any questions I am more than happy to answer any.
HeroSystemDiceLibPatch.zip
(2.43 KiB) Downloaded 52 times

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Hero System Dice Lib Update

Post by nolgroth »

Interesting. I wonder how I could get the values to automate based on getting a property and combining it with a specific damage class. I'll have to look into that.

EDIT: I see that the number of dice can be replaced with variable. Might I assume that the stun multiple would be too?

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Hero System Dice Lib Update

Post by Jagged »

Yes. All the values can be replaced by variables. Including the multiplier.

If you have a property that contains the Damage Class then dividing that by 3 should produce the correct result for the killing attack. For example:

[h: dice=DamageClass/3][r: herokilling(dice,6) +" "+heromultiplier(1,6,-1)]

Any issues please let me know :)

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Hero System Dice Lib Update

Post by nolgroth »

The only possible problem that I might encounter is getting potential players loaded up with the new Dice Lib stuff. :)

I'll do some more testing as I go along. I am about to gut some of the Campaign Properties (namely stats) and replace them with something that (I hope) will make it easier to do Aid/Drain. It is going to affect a lot of macros so I am probably going to break a the whole enchilada for a few days. During the macro rewrite, I will try to incorporate the new Dice Lib routines. If they all work (which I suspect that they do) then it will save me some file size by getting rid of the killing DC macro that I have.

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Hero System Dice Lib Update

Post by nolgroth »

Note that the multiplier MUST have a value, even if it is 0. Otherwise it spits out a Java.nullPointerEexception blah blah blah error. Not a problem, but I was testing it. Note that I tried to break it with some pretty ridiculous numbers like 3000 killing dice. It worked. So chat commands seem to work flawlessly as long as one remembers that every option needs a value.

I'll work on replacing my current commands here tonight. Make sure it works as planned with variables and whatnot.

EDIT: Seems to work fine within the macros. I probably will not switch over, as my macros do not require the loading of the alternate Dice Lib. That is, unless maybe we can join forces and I can "bundle" the Dice Lib with the campaign framework?

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Hero System Dice Lib Update

Post by Jagged »

nolgroth wrote:Note that the multiplier MUST have a value, even if it is 0. Otherwise it spits out a Java.nullPointerEexception blah blah blah error. Not a problem, but I was testing it. Note that I tried to break it with some pretty ridiculous numbers like 3000 killing dice. It worked. So chat commands seem to work flawlessly as long as one remembers that every option needs a value.


Nobody likes null pointer errors :(. I think I have set the minimum number of parameters on the heromultiplier function to be 2, but maybe it should be 1? I will look into it.

nolgroth wrote:EDIT: Seems to work fine within the macros. I probably will not switch over, as my macros do not require the loading of the alternate Dice Lib. That is, unless maybe we can join forces and I can "bundle" the Dice Lib with the campaign framework?

I am more than happy for you to bundle the Dice Lib update with your framework. If I can help, let me know. Although if you do that I would recommend you keep your current version available for people that might be scared off by the update.
I was thinking that when 1.3 is finally finalised ;) I would put up a public download of the whole thing with my Dice Lib, just to make it easier for everyone.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Hero System Dice Lib Update

Post by Jagged »

nolgroth wrote:Note that the multiplier MUST have a value, even if it is 0. Otherwise it spits out a Java.nullPointerEexception blah blah blah error. Not a problem, but I was testing it. Note that I tried to break it with some pretty ridiculous numbers like 3000 killing dice. It worked. So chat commands seem to work flawlessly as long as one remembers that every option needs a value.


Not sure I can capture that without making code changes in areas I don't want to make code changes ;) Since I believe the error is getting thrown by the expression parser.

User avatar
nolgroth
Dragon
Posts: 441
Joined: Fri Sep 21, 2007 6:10 pm

Re: Hero System Dice Lib Update

Post by nolgroth »

Jagged wrote:
nolgroth wrote:Note that the multiplier MUST have a value, even if it is 0. Otherwise it spits out a Java.nullPointerEexception blah blah blah error. Not a problem, but I was testing it. Note that I tried to break it with some pretty ridiculous numbers like 3000 killing dice. It worked. So chat commands seem to work flawlessly as long as one remembers that every option needs a value.


Not sure I can capture that without making code changes in areas I don't want to make code changes ;) Since I believe the error is getting thrown by the expression parser.
I really don't think it is an issue. Just put a 0 in that last part of the expression. Boom. Fixed. Sometimes, you just can't automate the process completely.

Velocinox
Kobold
Posts: 21
Joined: Sun Jan 09, 2011 1:34 am

Re: Hero System Dice Lib Update

Post by Velocinox »

Thanks for the change Jagged.

I was wondering though if it would be possible to make it a simple mathematical flag instead of a separate function. As it stands now, if you run across an Xd6-1 situation you have to have a code type branched if to handle both cases (i.e...)

Code: Select all

[h, if(altDamRoll == true), code:
{
pre code
do something with herokilling2
post code
};{
pre code
do something with herokilling
post code
}]


While if it was a math flag such as if the incoming dice value was negative, handle before the code group, you could handle it before the damage code
(i.e...)

Code: Select all

[h, if(altDamRoll == true): damDice = damDice * -1]
pre code
do something with herokilling
post code


This really shouldn't run into any problems for the output since there will never be negative damage dice.

Sorry, not trying to be picky but it just seems more useful as a flag for the current function rather than separating them.

Thanks,
V

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Hero System Dice Lib Update

Post by Jagged »

Velocinox wrote:I was wondering though if it would be possible to make it a simple mathematical flag instead of a separate function.


How about an optional flag on the herokilling function?

So it would be herokilling(numberOfDice, sidesOfDice, additionOrSubtraction, useMinus1Flag)
That would mean you'd have to use 4 parameters but additionOrSubtraction would always be 0 and useMinus1Flag could be true or false.

Velocinox
Kobold
Posts: 21
Joined: Sun Jan 09, 2011 1:34 am

Re: Hero System Dice Lib Update

Post by Velocinox »

Jagged wrote:
Velocinox wrote:I was wondering though if it would be possible to make it a simple mathematical flag instead of a separate function.


How about an optional flag on the herokilling function?

So it would be herokilling(numberOfDice, sidesOfDice, additionOrSubtraction, useMinus1Flag)
That would mean you'd have to use 4 parameters but additionOrSubtraction would always be 0 and useMinus1Flag could be true or false.


Sounds great to me whatever works easiest for you to code. Thanks again.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Hero System Dice Lib Update

Post by Jagged »

Should be able to sort that out over the weekend.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Hero System Dice Lib Update

Post by Jagged »

Jagged wrote:Should be able to sort that out over the weekend.

Okay, maybe not "this" weekend! ;)

Post Reply

Return to “User Creations”