PDA

View Full Version : DCC RPG Dice Tower Bug for Dice Swap Desktop Buttons



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

Moon Wizard
October 19th, 2019, 07:08
Your best bet is to add a lot of Debug.chat statements in all the various functions you have to see where the data is not as you expect.

The modifiers to rolls are added during the DiceTowerManager.onDrop() function before it gets forwarded to the GM machine for final rolling.

Regards,
JPG

leozelig
October 19th, 2019, 11:20
Thank you, Moon. I know you are busy with the FGU beta release so I really appreciate the reply.

I needed to modify the 'handleDiceTower' function in the 'desktop/scripts/manager_dicetower.lua' file. I did not realize that dice tower rolls use different roll data. While the 5E ruleset does not need to change this function for ADV/DIS, apparently my dice swap buttons do. It was an easy fix from there...

I will add this to the next update. I will probably wait until CoreRPG 3.3.9 is released so I can include any compatibility updates.