PDA

View Full Version : Only some exploding dice in a single roll



chillybilly
May 17th, 2019, 16:29
In the RPG, Arcanis, you roll two "Action" dice (2d10) and an "Attribute" die (can be anywhere from d4 to d12). The Attribute die can explode but the Action dice cannot.

After chatting with Damned, I tweaked the manager_custom_explode lua file in the Morecore ruleset and added the two (highlighted) lines. It gets me exploding dice for d4, d6, d8 and d12 but (obviously) not for d10. Still, I'm happy with the result being the feeble coder that I am. Yet, I have to ask, is there a solution that gets me across the goal line and, somehow, explodes that third d10 when your Attribute die happens to be a d10? Anyone know?

27357


In case my attachment doesn't work, here is the relevant (twaked) section of the lua file.
for i , v in ipairs (aSavedDice) do
Debug.console("onLanded: last dice ", i, v);
if v.exploded then
w = aDice[k];
k = k + 1; -- move on to next die for next time around
v.result = v.result + w.result;
if w.result == 10 then <-----------------These are the two lines I added
v.exploded = false; <-----------------These are the two lines I added
elseif w.result == getDieMax(w.type) then
aRerollDice[j] = w.type;
j = j + 1;
v.exploded = true;
else
v.exploded = false;

end
end
end

chillybilly
May 17th, 2019, 23:23
and the answer was:

for i , v in ipairs (aSavedDice) do
Debug.console("onLanded: last dice ", i, v);
if v.exploded then
w = aDice[k];
if getDieMax(w.type) == 10 then diecounter = diecounter+1;
end
k = k + 1; -- move on to next die for next time around
v.result = v.result + w.result;
if w.result == getDieMax(w.type) and (diecounter == 3 or getDieMax(w.type) ~= 10) then
aRerollDice[j] = w.type;
j = j + 1;
v.exploded = true;
else
v.exploded = false;
end
end
end

damned
May 18th, 2019, 04:57
hi chillybilly

good work

w.result is the result of that particular individual dice roll so you want to exclude (or include) based on the number of sides of the dice.

also you want to do this in a separate script - create one called manager_custom_arcanis.lua for example

chillybilly
May 18th, 2019, 12:46
Thank you! The entire ruleset/extension is taking nice shape mostly thanks to your Open Legend extension (and of course, Morecore). When I get it truly functional, I'll share it in case anyone is interested in Arcanis (the non-5E one).