5E Character Create Playlist
  1. #1

    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
    How do I adjust the dice display to reflect what the code is actually doing?
    "Everything started as somebody's daydream." -- Larry Niven

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    23,628
    Blog Entries
    1
    You can experiment with

    Code:
    rMessage.dicedisplay = 0;
    which wont show the sum of the dice and you can do that all in the chat message.

    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...

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  3. #3
    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

  4. #4
    Quote Originally Posted by damned View Post
    You can experiment with

    Code:
    rMessage.dicedisplay = 0;
    which wont show the sum of the dice and you can do that all in the chat message.

    And I think FGU gives us another way but I cant think of an example to post...
    I couldn't get rMessage.dicedisplay to work, but that did lead me to rMessage.diemodifier and setting that to zero took care of it. Thanks.
    "Everything started as somebody's daydream." -- Larry Niven

  5. #5
    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)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in