PDA

View Full Version : Need direction to add Roll Modifier in output



mixologee
September 19th, 2021, 04:27
So I am trying to get a roll to show the modifier that happens based on the roll and the ability used during the role. Here is my handler code and a screenshot of what FG shows. The value is calculated and added to the CT correctly, but not showing in the roll itself. Thanks in advance.



function InitHandler(rSource, rTarget, rRoll)

local rMessage = ActionsManager.createActionMessage(rSource, rRoll);

if (rSource) then

local sPCNodeName = ActorManager.getCreatureNodeName(rSource);
local sInfo = DB.getChild(sPCNodeName, "init_cb").getValue();
local nAbility = 0;

if sInfo == "Prowess" then
nAbility = tonumber(DB.getChild(sPCNodeName, "prowess").getValue());
elseif sInfo == "Coordination" then
nAbility = tonumber(DB.getChild(sPCNodeName, "coordination").getValue());
elseif sInfo == "Strength" then
nAbility = tonumber(DB.getChild(sPCNodeName, "strength").getValue());
elseif sInfo == "Intellect" then
nAbility = tonumber(DB.getChild(sPCNodeName, "intellect").getValue());
elseif sInfo == "Awareness" then
nAbility = tonumber(DB.getChild(sPCNodeName, "awareness").getValue());
elseif sInfo == "Willpower" then
nAbility = tonumber(DB.getChild(sPCNodeName, "willpower").getValue());
end

rRoll.nMod = nAbility;

local nTotal = ActionsManager.total(rRoll);
rCreature = DB.findNode(rSource.sCTNode);
rCreature.getChild("initresult").setValue(nTotal);
rMessage.text = rMessage.text .. "[Initiative : " .. sInfo .. "]";
end

Comm.deliverChatMessage(rMessage);

end


49187

DCrumb
September 19th, 2021, 09:19
I would try to create the action message after you have adjusted rRoll. Since rMessage was already created at the start of your function, it will only have what rRoll was when created, not when you have changed it for the ability modifier.

mixologee
September 19th, 2021, 16:11
TY. That got me what I needed.