PDA

View Full Version : Exploding dice



Arion
May 30th, 2014, 09:18
Valarian was kind enough to do a few modifications for me based on the OpenD6 ruleset for a game i am writing. It is working well, but i may need to tweak some rules, specifically the result of 1 on the wild dice. Normally this 1 would be subtracted from the total, another dice would be rolled and that also subtracted, and the highest remaining dice also subtracted.

I am not, and never i think will be a programmer, but i am keen to learn bits. I have pasted the code below that i assume refers to the exploding dice rules from chat_chat.lua

I someone able to explain in fairly simple terms how the script handles the exploding dice. I know that it will force another dice roll on a 1 or a 6, and then add or subtract results. But how, for example, would i get it to simply report a result of half of the total rather than rolling and subtracting extra dice on a 1?


https://www.arion-games.com/code.jpg

Valarian
May 30th, 2014, 10:57
The code checks the first die in the die list (dicetable[1]). If it is a 1 (the first section of code), then it looks for the highest die result in the list and reduces the total rolled by that die value (dicetable[delindex].result) and also by the 1 rolled on the Wild Die. No additional dice are rolled on a result of 1. The highest rolled value is removed (the mechanic used in Star Wars 2nd Edition). If the first die in the list rolled a 6, then another die is rolled and the result added. If that die is a 6, then another die is rolled ... and so on.

To get half of the result total on teh event of teh Wild Die showing a 1, all you'd need to do would be to replace the code in the "dicetable[1].result == 1" section. Under where it adds the "Critical Failure" note to the display, add a line : total = total / 2;

Then remove the remaining lines to the elseif that checks whether the Wild Die result is 6.

Arion
May 30th, 2014, 11:36
Ah ha...fantastic! I am beginning to see how this works. I am doing some more playtesting next week and will have a go at modifying this.

Essentially this coding business is all about grammar and lexicon - knowing what words to use and in what structure!

Arion
May 30th, 2014, 11:49
I tried making a variant and that worked! I feel like i am a programmer now...:D

Valarian
May 30th, 2014, 12:06
Essentially this coding business is all about grammar and lexicon - knowing what words to use and in what structure!
Pretty much. I'm no good with spoken languages though :)