DICE PACKS BUNDLE
  1. #1

    Need direction to add Roll Modifier in output

    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.

    Code:
    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
    visual.jpg

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

  3. #3
    TY. That got me what I needed.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in