PDA

View Full Version : Removing modifier from dice results



ShakyLuigi
July 2nd, 2022, 10:32
I am working on a Warhammer 4th edt ruleset, and I need to remove the modifier from the dice total in the white box when rolling dice.

Basically in WH you add a modifer to your skill, not the dice roll. So I've edited the rollOutcome() so the chat results are correct.
But the modifier is still shown in the white box with the dice roll. I would like to just have ONLY the die result in the white box.

Is it possible to code the modifier away from the die roll result?

I am using the Ruleset Wizard and made a script for the roll. Could I just add another function to this script?

damned
July 2nd, 2022, 14:37
I am working on a Warhammer 4th edt ruleset, and I need to remove the modifier from the dice total in the white box when rolling dice.

Basically in WH you add a modifer to your skill, not the dice roll. So I've edited the rollOutcome() so the chat results are correct.
But the modifier is still shown in the white box with the dice roll. I would like to just have ONLY the die result in the white box.

Is it possible to code the modifier away from the die roll result?

I am using the Ruleset Wizard and made a script for the roll. Could I just add another function to this script?

Something like:



function onBeforeDiceRoll()
DiceRollString ="1d20";
end

ShakyLuigi
July 2nd, 2022, 17:39
I tried just adding that code in the beginning of the script, but that didn't seem to work. Probably just put it in the wrong place.
I'll explain a bit more in detail what I am doing.

I have instructed the numberfield to run skillroll.SkillHandler when rolling dice.


function SkillHandler(rSource, rTarget, rRoll)

local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
--local adv = DB.getValue(ActorManager.getCreatureNode(rSource), "advantage_field", 0);
local mod = rRoll.nMod
local nTarget = rRoll.skill+mod
local nTotal = ActionsManager.total(rRoll)-mod;

rMessage.text = rMessage.text;

rMessage.text = rMessage.text .. ": " .. "[".. nTarget .."]" .. " vs. [" .. nTotal .. "]" .. "\n"
.."Outcome: " .. rollOutcome(nTotal, nTarget, adv);

if rTarget then
rMessage.text = rMessage.text .. " vs " .. rTarget.sName;
end

Comm.deliverChatMessage(rMessage);

end

This just controls what is shown in the chat, except for the white field with the dice roll.
What I would like is that the field I marked in red, in the picture below, is not there.
And the result on the right most place should be equal to the die result.
Is this even possible?

53397

LordEntrails
July 2nd, 2022, 22:06
I bet if you go back and look at rRoll, you will find it is a function that adds in the modifier. Sk either you need to overwrite that where it is defined, or don't use it and just use the diceRollString like damned suggested.

Note, on my p hone so can't open up the rulesets to check, and just getting into doing myself so I could well be wrong. But that's what I would look at.

damned
July 3rd, 2022, 01:35
My specific code was showing the absolute bare minimum for a onBeforeDiceRoll() it was unlikely to be exactly what you want.
In this case I think you should approach it differently.

In your NumberField set Use Modifier Stack to False
Set Re3set Modifier Stack to False

in your Roll use something like:


local nMod = ModifierStack.getSum();
ModifierStack.reset();

This should not grab the Modifier Stack in your roll but grab it in processing and then you can use nMod in your calculations.

ShakyLuigi
July 3rd, 2022, 11:08
Thanks damned. That worked perfectly! Just need to fix up the script for the results, but that's the easy part.

This forum is helping me immensly with this project. So just a general thanks to everyone here!

damned
July 3rd, 2022, 11:15
Keep plugging away it it!