5E Character Create Playlist
Page 10 of 12 First ... 89101112 Last
  1. #91
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    By all means go in your own direction.
    Already by the time I decided to stop there are things I would have done differently - particularly with skills

    Also bear in mind - I have never played the game so your perspective will be different to mine.

    All of those changes sound legitimate so keep on going.

  2. #92
    Quote Originally Posted by damned View Post
    By all means go in your own direction.
    Already by the time I decided to stop there are things I would have done differently - particularly with skills

    Also bear in mind - I have never played the game so your perspective will be different to mine.

    All of those changes sound legitimate so keep on going.
    Will do, thanks! I haven’t played either actually - just reading the core Rulebook cover to cover now, and working on the ruleset as I go. But- I really want to run this game (in Fantasy Grounds of course!)

    Anyway, I haven’t got to skills yet. Looking forward to tackling that next, probably, if not items/equipment first.

  3. #93
    So I actually did get some code working that handles Exploding dice on 10 (adding result) and on 1 (subtracting result) using a custom result handler for skill checks. It colors the additional d10 red or green, and only explodes once.

    I am going to implement it for all skills and allow for just rolling on an ability as well, and implement it there too. (As well as auto adding penalties due to armor on relevant skills/abilities.). I can provide a code snippet for any trying to do this too, if interested.

    Edit: Here's a screenshot of my WIP (still need to do weapons and all here too, but think I am going to implement skills and item templates first to do that properly.)
    Screen Shot 2022-03-19 at 2.33.12 PM.png. (Ignore the bugged "Crit failure" for rolls that were normal... fixed that already lol).
    Last edited by seansps; March 19th, 2022 at 19:35.

  4. #94

  5. #95
    Quote Originally Posted by damned View Post
    Well done! Looking good. I would love to see your code.
    Thanks! Certainly!

    In campaign/scripts/manager_cpred.lua: (You can ignore the `customPerformAction` for now, I am going to use that later to calculate hits based on the range of the target to the actor, and each item will have it's own DV table in the template, is the plan.) The code for `resolveAbility` was heavily borrowed from an old thread, so I am not sure if I need the second result check here. But just in case... for now, it's there.

    Code:
    function onInit()
    	GameSystem.actions= {
    		["dice"] = { bUseModStack = "true" },
    		["table"] = { },
    		["effect"] = {sIcon = "action_effect", sTargeting = "all" },
    		["deathsave"] = {sIcon = "action_effect", sTargeting = "none" },
    		["initiative"] = {sIcon = "action_effect", sTargeting = "none" },
    		["ability"] = {sIcon = "action_effect", sTargeting = "none" },
    	};
    	
    	ActionsManager.registerResultHandler("deathsave", resolveDeathSave);
    	ActionsManager.registerResultHandler("initiative", resolveInitiative);
    	ActionsManager.registerResultHandler("ability", resolveAbility);
    	
    	performAction = ActionsManager.performAction;
           ActionsManager.performAction = customPerformAction;
    end
    
    function resolveAbility(rSource, rTarget, rRoll)
    	local nDiceRoll = 0;
    
    	Debug.console(rRoll);
    	Debug.console(rRoll.aDice[0]);
    	
    	local firstResult = 0;
    	local secondResult = 0;
    	local isCrit = false;
    	local isCritFail = false;
    	local dicetable = rRoll.aDice;
    	local reroll = false;
    	local total = {};
    	
    	-- TODO Cleanup, remove second result?
    	if dicetable then
    		for n = 1, table.maxn(dicetable) do
    			if dicetable[n].type == "d10" then
    				if firstResult > 0 and dicetable[n].result > secondResult then
    					secondResult = dicetable[n].result;
    					total[2] = dicetable[n];
    				elseif dicetable[n].result > firstResult then
    					firstResult = dicetable[n].result;
    					total[1] = dicetable[n];
    				end
    			end
    		end
    	end
    	
    	if firstResult == 10 or secondResult == 10 then
    		isCrit = true;
    		local dieRoll = math.random(1,10);
    		local explode = {};
    		explode.type = "g10";
    		explode.result = dieRoll;
    		table.insert(total, explode);
    		-- Show the roll a d10
    		local dice = {};
    		table.insert(dice, "d10");
    		Comm.throwDice("explode", dice, 0, "explode");
    		-- Insert into actual result
    		table.insert(rRoll.aDice, explode);
    	elseif firstResult == 1 then
    		isCritFail = true;
    		local dieRoll = math.random(1,10);
    		local explode = {};
    		explode.type = "r10";
    		explode.result = dieRoll;
    		table.insert(total, explode);
    		-- Show the roll a d10
    		local dice = {};
    		table.insert(dice, "d10");
    		Comm.throwDice("explode", dice, 0, "explode");
    		-- Insert into actual result
    		explode.result = dieRoll * -1;
    		table.insert(rRoll.aDice, explode);
    	end
    	
    	-- TODO deduct penalties if needed?
    	
    	local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
    	local playerName = ActorManager.getDisplayName(rSource);
    	rMessage.text = "[".. rRoll.sDesc .. "]";
    	if isCrit then
    		rMessage.text = "[".. rRoll.sDesc .. "][CRIT SUCCESS]";
    	elseif isCritFail then
    		rMessage.text = "[".. rRoll.sDesc .. "][CRIT FAILURE]";
    	end
    
    	Comm.deliverChatMessage(rMessage);
    end
    Then in the code for each ability (change the value for `local nStat`and `sDesc` accordingly`... I'm also going to be doing it this way basically for each skill too, on the next tab):
    Code:
    function onInit()
    	local w = addBitmapWidget("field_rollable");
    	w.setPosition("bottomleft", 4, -6);
    	setHoverCursor("hand");
    end
    
    function action(draginfo)
    	local nodeWin = window.getDatabaseNode();
    	local rActor = ActorManager.resolveActor(nodeWin);
    	local nStat = nodeWin.getChild("int_current").getValue();
    	
    	rRoll = { 
    		sType = "ability",
    		sDesc = "INT",
    		aDice = {expr = "1d10" }, 
    		nMod = nStat,
    		nTarget = nil
    	};
    	
    	ActionsManager.performAction(draginfo, rActor, rRoll);
    end
    
    function onDragStart(button, x, y, draginfo)
    	action(draginfo);
    	return true;
    end
    
    function onDoubleClick(x, y)
    	action();
    	return true;
    end

  6. #96

  7. #97
    Quote Originally Posted by damned View Post
    Nicely done!
    Thanks! I’ll definitely do some refactoring/cleanup once I address all my TODOs lol.

  8. #98
    Quote Originally Posted by seansps View Post
    Thanks! Certainly!

    In campaign/scripts/manager_cpred.lua: (You can ignore the `customPerformAction` for now, I am going to use that later to calculate hits based on the range of the target to the actor, and each item will have it's own DV table in the template, is the plan.) The code for `resolveAbility` was heavily borrowed from an old thread, so I am not sure if I need the second result check here. But just in case... for now, it's there.
    Hi Seansps, your code for adding the exploding die has helped me tremendously with my issue of only exploding if both dice are max value. Thanks.

    I have noticed that most of the time the rolled extra die on the screen does not match the number shown in the chat window. See attached file. Have you found a way to get around this?

    I have checked the standard RSW exploding die (with 2d6e) and this appears to be okay.

    Any advice would be greatly appreciated.
    Attached Images Attached Images

  9. #99
    Quote Originally Posted by Brotherkelly View Post
    Hi Seansps, your code for adding the exploding die has helped me tremendously with my issue of only exploding if both dice are max value. Thanks.

    I have noticed that most of the time the rolled extra die on the screen does not match the number shown in the chat window. See attached file. Have you found a way to get around this?

    I have checked the standard RSW exploding die (with 2d6e) and this appears to be okay.

    Any advice would be greatly appreciated.
    Hi! Glad to be of help. As for the visual not matching... yes... I have noticed that as well. Unfortunately, right now I am just using the `throwDice` command as a visual to go with the "exploding" dice and have not been able to figure out how to replace the result with what I randomly generated that before. I can keep poking around there and see if there is a way. I could just be using this function wrong or might need to do call `ActionsManager.buildThrow` first with the right values.

    Until then, short of having it do another `performAction` and then a separate handler for that, I haven't figured that part out! But, you might be able to use the "1d10e#1" notation, which rolls a d10 and explodes only once on 10. This was fixed with a recent release of FG. And I believe "1d10l#1" does the negative-explode low. This didn't work for me here because I have to be able to do both (and that notation didn't seem to allow for both!)

  10. #100
    Thanks for your thoughts on what to look at. I will see if I can work out how to use the ActionsManager.buildThrow function.

    The exploding dice function built in doesn't work for me as I need the roll to explode only if both dice roll a 6.

    I am hoping someone will be able to suggest how I can read the value of the rolled dice and add it rather than generate a random number and hope the dice throw shows the same result.

Thread Information

Users Browsing this Thread

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

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