Belizan
July 22nd, 2007, 08:35
So, I've been looking at making an L5R ruleset. For those not familiar, L5R involves a system where in you roll a bunch of d10, where each d10 has the possibility (potentially) to "explode" or open end up on a 10. The total of each die is important, however, because at the end of the roll, you pick so many of the highest of the dice you rolled. This is called x keep y. As in, roll 5 keep 3, abbreviated #k#, or xky and 5k3 to follow the previous examples.
Therein, Joshuha has a code sample that implements exploding dice of a kind...
local dicetable = {};
-- dicetable = draginfo.getDieList();
-- local size = table.maxn(dicetable)
-- for i= 1,size do
-- if (dicetable[i].type == "d10" and dicetable[i].result == 10) then
-- local explodetable = {};
-- table.insert(explodetable, "d10");
-- throwDice("dice", explodetable, 0, "Exploded");
-- end
-- end
But, I don't think this will work very well, because it will roll the extra d10, but they will be orphaned from the die which "sponsored" the extra die roll in the first place. Or something like this--
3D10: 10, 5, 10, 4, 10, 2.
Or actually more like...
3D10: 10, 5, 10
Exploded: 4
Exploded: 10
Exploded: 2
Instead, I'm looking for something that will produce results more like--
3D10: 10+4, 5, 10+10+2.
Which makes room for later more saavy implementation to automatically manage the "keep" part, etc. (There are other roll mechanics as well, but if I can solve this problem, the others should be no trouble).
I had been thinking to do this via a CustomDie type with something like...
<customdie name="Exploding d10">
<model>d10</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
if result == 10 then
local dice = {};
table.insert(dice, "Exploding d10");
result += throwDice("dice", dice, 0, "Exploding");
return result;
end
</script>
</customdie>
Only.. this has lots of problems :)...
throwDice doesn't return a value
I'm not sure I can pass in custom die types that way
It looks as though it's going to asynchronously roll another die on the window triggering a separate chat entry. Which is to say, in other words, it's not going to help at all :(.
I've really just begun starting to wade into the ruleset files, but this is the key first step for me, and I was hoping someone might have some advice on how I could get this working?
Therein, Joshuha has a code sample that implements exploding dice of a kind...
local dicetable = {};
-- dicetable = draginfo.getDieList();
-- local size = table.maxn(dicetable)
-- for i= 1,size do
-- if (dicetable[i].type == "d10" and dicetable[i].result == 10) then
-- local explodetable = {};
-- table.insert(explodetable, "d10");
-- throwDice("dice", explodetable, 0, "Exploded");
-- end
-- end
But, I don't think this will work very well, because it will roll the extra d10, but they will be orphaned from the die which "sponsored" the extra die roll in the first place. Or something like this--
3D10: 10, 5, 10, 4, 10, 2.
Or actually more like...
3D10: 10, 5, 10
Exploded: 4
Exploded: 10
Exploded: 2
Instead, I'm looking for something that will produce results more like--
3D10: 10+4, 5, 10+10+2.
Which makes room for later more saavy implementation to automatically manage the "keep" part, etc. (There are other roll mechanics as well, but if I can solve this problem, the others should be no trouble).
I had been thinking to do this via a CustomDie type with something like...
<customdie name="Exploding d10">
<model>d10</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
if result == 10 then
local dice = {};
table.insert(dice, "Exploding d10");
result += throwDice("dice", dice, 0, "Exploding");
return result;
end
</script>
</customdie>
Only.. this has lots of problems :)...
throwDice doesn't return a value
I'm not sure I can pass in custom die types that way
It looks as though it's going to asynchronously roll another die on the window triggering a separate chat entry. Which is to say, in other words, it's not going to help at all :(.
I've really just begun starting to wade into the ruleset files, but this is the key first step for me, and I was hoping someone might have some advice on how I could get this working?