Skip to main content
GameDev.net gamedev.net
🔒 Locked

weight modifiers

Started by Vod Aug 30, 2007 at 7:54 PM 7 replies 2k views
Original Post
Vod
Vod
I think I may have misunderstood how to use the weight modifiers: Human 120 x (2d4) Dwarf 130 x (2d6) Elf 85 x (1d6) Gnome 40 x 1 I assumed that for the dwarf I would multiply the result of rolling 2 six sided dice by the base weight. This can't be right surely? That would mean a max possible modifier of 12 multiplied by 130. That's going to be one seriously obese dwarf. Similarly does the Gnome modifier 'x 1' mean that Gnomes always weigh exactly 40lbs? Can someone lend a hand here please :)
SiCrane
SiCrane
Ok. To calculate the height of a human you have

roll = 2d10;
height = 4'10" + roll

Now to calculate the weight

new_roll = 2d4
weight = 120lbs + roll * new_roll

It's the height roll reused for weight. Makes calculating height and weight in different functions difficult/annoying.
popcorn
popcorn
Quote:
Original post by SiCrane
It's the height roll reused for weight. Makes calculating height and weight in different functions difficult/annoying.


Ok so if did want to calculate height and weight in different functions what options do you have? How would you save the roll that you generated in the height function to be used in the weight function?
How about them apples?
SiCrane
SiCrane
Ok, one option is to, instead of storing height, storing the result of the height roll. Then you could implement height as a property that uses the race, sex and height roll to recalculate the height every time it's requested. Another option is to subtract the base height from the total height and then use that value to multiply against the new roll to calculate weight. Or you could save both the generate height and the height roll as member variables for your character class. It'd be a waste of space, but you could do it.

I'm sure there are other options; these are just off of the top of my head.
Vod
Vod
Let me just check I understand you...

If, say, I roll 2d10 and get the max possible value (ie. 20) that means I add 20 inches to 4'10" and end up with a height of 6'6".

Now I reuse that same roll of 20 to calculate the weight:
weight = 120lbs + [20] * new_roll

I assume you must mean: 120lbs + (roll * new_roll)?

Assuming I get the max possible value with the new_roll of 8:
weight = 120lbs + (20 * 8) = 280lbs [that's about 20st so that sounds right]

What about the Gnome modifier?
Male Base Height: 3'0"
Male Height Modifier: +2d4
Male Base Weight: 40
Male Weight Modifier: x 1 lb

Assuming max value again for roll does this mean: 40lbs + (8 * 1) = 48lbs?


Vod
Vod
Quote:
Original post by popcorn


Ok so if did want to calculate height and weight in different functions what options do you have? How would you save the roll that you generated in the height function to be used in the weight function?



I reckon I will have to pass the height modifier itself rather than the resultant height back from my height method, perform the height calculation using the height modifier and then pass the same height modifier into my weight method.





SiCrane
SiCrane
Quote:
Original post by Vod
I assume you must mean: 120lbs + (roll * new_roll)?

In C# * has a higher precedence than + so A + B * C would always mean A + (B * C). So yes, you seem to understand how to calculate weight now.
Emmanuel Deloget
Emmanuel Deloget
Quote:
Original post by SiCrane
Quote:
Original post by Vod
I assume you must mean: 120lbs + (roll * new_roll)?

In C# * has a higher precedence than + so A + B * C would always mean A + (B * C). So yes, you seem to understand how to calculate weight now.

Please note that this comment doesn't mean that it's be better to not use parenthesis. An explicit use of parenthesis makes the code easier to understand, and thus to debug later, and that's a good thing - especially if you don't have a huge programming background.

Best regards,
EnigmaticCoder
EnigmaticCoder
Quote:
Original post by Emmanuel Deloget
Quote:
Original post by SiCrane
Quote:
Original post by Vod
I assume you must mean: 120lbs + (roll * new_roll)?

In C# * has a higher precedence than + so A + B * C would always mean A + (B * C). So yes, you seem to understand how to calculate weight now.

Please note that this comment doesn't mean that it's be better to not use parenthesis. An explicit use of parenthesis makes the code easier to understand, and thus to debug later, and that's a good thing - especially if you don't have a huge programming background.

Best regards,


Good point, Emmanuel. Readability and style are universally important, regardless of language.
--------------------Enigmatic Coding

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.