Netzilla
April 16th, 2021, 15:48
I’m working on a ruleset for Champions / the Hero System, which uses a 3d6 roll under mechanic. Modifiers are typically applied to the target number rather than the die roll, which keeps beneficial modifiers positive and harmful modifiers negative. So, my sample character here has the Deduction skill at a base of 14-.
45791
Let’s say he’s working on a difficult issue and has a -2 modifier, making the target number 12-. So, I apply that modifier to the modifier stack manually.
45792
Now, when I make the die roll, my ruleset does the calculation properly, but the dice display still shows the -2 applying to the die roll, which is confusing to the players and just doesn’t look nice.
45793
Here is the code I’m using for applying the modifier to the target number.
function onSuccessRoll(rSource, rTarget, rRoll)
local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
if (rRoll.nTarget) then
local nTargetValue = tonumber(rRoll.nTarget) or 0;
if (rRoll.nMod) then
nTargetValue = nTargetValue + tonumber(rRoll.nMod);
rRoll.nMod = 0;
end
local nTotal = ActionsManager.total(rRoll);
local nDiff = nTargetValue - nTotal;
rMessage.text = rMessage.text .. " (" .. nTargetValue .. "-) Rolled " .. nTotal;
if (nTotal <= nTargetValue) then
rMessage.text = rMessage.text .. "\n[SUCCESS]";
else
rMessage.text = rMessage.text .. "\n[FAILURE]";
end
rMessage.text = rMessage.text .. " by " .. math.abs(nDiff);
end
rMessage.secret = CombatManagerChamps.isCTHidden(rSource);
Comm.deliverChatMessage(rMessage);
end
How do I adjust the dice display to reflect what the code is actually doing?
45791
Let’s say he’s working on a difficult issue and has a -2 modifier, making the target number 12-. So, I apply that modifier to the modifier stack manually.
45792
Now, when I make the die roll, my ruleset does the calculation properly, but the dice display still shows the -2 applying to the die roll, which is confusing to the players and just doesn’t look nice.
45793
Here is the code I’m using for applying the modifier to the target number.
function onSuccessRoll(rSource, rTarget, rRoll)
local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
if (rRoll.nTarget) then
local nTargetValue = tonumber(rRoll.nTarget) or 0;
if (rRoll.nMod) then
nTargetValue = nTargetValue + tonumber(rRoll.nMod);
rRoll.nMod = 0;
end
local nTotal = ActionsManager.total(rRoll);
local nDiff = nTargetValue - nTotal;
rMessage.text = rMessage.text .. " (" .. nTargetValue .. "-) Rolled " .. nTotal;
if (nTotal <= nTargetValue) then
rMessage.text = rMessage.text .. "\n[SUCCESS]";
else
rMessage.text = rMessage.text .. "\n[FAILURE]";
end
rMessage.text = rMessage.text .. " by " .. math.abs(nDiff);
end
rMessage.secret = CombatManagerChamps.isCTHidden(rSource);
Comm.deliverChatMessage(rMessage);
end
How do I adjust the dice display to reflect what the code is actually doing?