PDA

View Full Version : Help accesing modifier stack before rolling dice



vPumpkinG
January 27th, 2020, 17:47
Hello, i'm trying to access the value of the modifier stack just before the throwing dice animation happens.

I have this script:

function getRoll(rActor, sAbilityStat, vCantidadDados)
local rRoll = {};
local dMod = 0;
--I need the value of the stack here as a number, say, dMod = -2
local dados = d6s(vCantidadDados + dMod );
rRoll.sType = "ability";
rRoll.aDice = dados;
rRoll.nMod = 0;
rRoll.sDesc = StringManager.capitalize(sAbilityStat);
rRoll.sDesc = rRoll.sDesc .. ": ";

return rRoll;
end

The idea is to pass the modifier to the function that populates aDice so it can increase/decrease the amount of dice to throw.
What'd be the best way to do this?

Thanks in advance.

damned
January 27th, 2020, 21:42
Welcome vPumpkinG

something like this:
ModifierStack.addSlot(desc, value);

superteddy57
January 27th, 2020, 21:48
Download and unpack my Shadowrun 5E extension for MoreCore. This adds dice to the dice pool from the modifier stack.

https://fantasygrounds.com/forums/showthread.php?48066-Shadowrun-5e-(MoreCore-Extension)

Trenloe
January 27th, 2020, 23:04
Have a look at the functions available in the CoreRPG ruleset (which is used by most rulesets) desktop\scripts\modifierstack.lua file. This is the ModifierStack global script package and the functions can be called with ModifierStack.<function name>...

For example: ModifierStack.getSum() returns the total in the modifier stack.

vPumpkinG
January 27th, 2020, 23:14
Thank you both, that was very helpful and it's working now.