leozelig
October 13th, 2019, 17:46
I am having a little trouble working out a fix for a DCC RPG ruleset bug involving the dice tower. The ruleset has desktop buttons similar to ADV/DIS for the 5E ruleset, only the DCC buttons increase/decrease the primary die rolled instead of adding a second d20. If you press the +1D button and roll a d8, the dice roll will change to a d10. If this is rolled in the dice tower, the die does not change, but the rRoll data DOES appear to change the die appropriately.
Clearly, I am missing something about how dice tower rolls work. Any help is appreciated. I posted the "dice swap" script files for a basic die roll from the desktop...
scripts/manager_action_general.lua
function onInit()
ActionsManager.registerModHandler("dice", modRoll);
end
function modRoll(rSource, rTarget, rRoll)
if #(rRoll.aDice) == 1 then
ActionsManager2.encodeDiceSwap(rRoll);
end
end
scripts/manager_actions2.lua
function encodeDiceSwap(rRoll)
if ModifierStack.getModifierKey("PLUS1D") then
rRoll.aDice[1] = GameSystem.increaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [+1D]";
end
if ModifierStack.getModifierKey("PLUS2D") then
rRoll.aDice[1] = GameSystem.increaseActionDie(rRoll.aDice[1]);
rRoll.aDice[1] = GameSystem.increaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [+2D]";
end
if ModifierStack.getModifierKey("MINUS1D") then
rRoll.aDice[1] = GameSystem.decreaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [-1D]";
end
if ModifierStack.getModifierKey("MINUS2D") then
rRoll.aDice[1] = GameSystem.decreaseActionDie(rRoll.aDice[1]);
rRoll.aDice[1] = GameSystem.decreaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [-2D]";
end
end
Clearly, I am missing something about how dice tower rolls work. Any help is appreciated. I posted the "dice swap" script files for a basic die roll from the desktop...
scripts/manager_action_general.lua
function onInit()
ActionsManager.registerModHandler("dice", modRoll);
end
function modRoll(rSource, rTarget, rRoll)
if #(rRoll.aDice) == 1 then
ActionsManager2.encodeDiceSwap(rRoll);
end
end
scripts/manager_actions2.lua
function encodeDiceSwap(rRoll)
if ModifierStack.getModifierKey("PLUS1D") then
rRoll.aDice[1] = GameSystem.increaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [+1D]";
end
if ModifierStack.getModifierKey("PLUS2D") then
rRoll.aDice[1] = GameSystem.increaseActionDie(rRoll.aDice[1]);
rRoll.aDice[1] = GameSystem.increaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [+2D]";
end
if ModifierStack.getModifierKey("MINUS1D") then
rRoll.aDice[1] = GameSystem.decreaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [-1D]";
end
if ModifierStack.getModifierKey("MINUS2D") then
rRoll.aDice[1] = GameSystem.decreaseActionDie(rRoll.aDice[1]);
rRoll.aDice[1] = GameSystem.decreaseActionDie(rRoll.aDice[1]);
rRoll.sDesc = rRoll.sDesc .. " [-2D]";
end
end