-
April 16th, 2021, 15:48 #1
- Join Date
- Jul 2018
- Location
- St. Louis, MO
- Posts
- 25
Applying Modifier to Target Number Rather Than Dice Roll
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-.
skill_list.png
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.
modifier_stack.png
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.
success_roll.png
Here is the code I’m using for applying the modifier to the target number.
Code: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
"Everything started as somebody's daydream." -- Larry Niven
-
April 16th, 2021, 15:59 #2
You can experiment with
Code:rMessage.dicedisplay = 0;
there is also the onDiceTotal() function which allows you to set the value to something else.
[code]
function onDiceTotal( messagedata )
local sMyTotal = string.match(messagedata.text, "]%s(%d+)");
return true, tonumber(sMyTotal);
end
[code]
And I think FGU gives us another way but I cant think of an example to post...
-
April 16th, 2021, 16:17 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,557
I find it better to pass the target total as a separate value in the roll structure; or inject into the roll string and read it back out.
In that way, it never shows up in the roll expression or roll total.
Regards,
JPG
-
April 16th, 2021, 16:45 #4
- Join Date
- Jul 2018
- Location
- St. Louis, MO
- Posts
- 25
-
April 16th, 2021, 16:51 #5
- Join Date
- Jul 2018
- Location
- St. Louis, MO
- Posts
- 25
FYI, upon further testing, it seems that rMessage.dicedisplay only suppresses the total and not the formula or icons. So, the "3d8-2" above the dice was still showing.
"Everything started as somebody's daydream." -- Larry Niven
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks