DICE PACKS BUNDLE
  1. #1

    A Question about combat tracker

    Is there a way to start with the lowest number in combat tracker first.

    Count up rather than count down.


    1 goes first, then 2, then 3 and so on. Just reverse the standard order in the combat tracker.
    GM Ultimate license FGC and FGU

    Running The DemonPlague Characters at level 11 in 50th session.

    Playing a Survival DND game in FGU

    Running a Mutants and Masterminds game in FGU

    Playing a Mutants and Masterminds game in FGU

    Playing a Homebrew Campaign against the Dragon kings in FGU

    Running a game of Fallout 2d20

    StarFinder or Star Trek 2D20 next on list If Children of Atom doesn't come out soon.

  2. #2
    You would need to customize the combat tracker within the ruleset to sort ascending, instead of descending. (Unless the ruleset already works that way) It would require an extension to modify the tracker code for sorting.

    Regards,
    JPG

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,491
    You'll have to define a custom sort function for the combat tracker - which uses the CombatManager package.

    Look in CoreRPG -> Scripts -> manager_combat.lua The onSortCompare function is executed to order the entries in the combat tracker. There is the ability to define a custom sort function called fCustomSort to override the default sorting.

    The custom sort function is set in the scripts\manager_combat2.lua script - with the CombatManager.setCustomSort(CombatManager.sortfunc Standard); command.

    You could so something similar, by creating a custom sort function in manager_combat2.lua that reverses the init comparison. Something like this:

    Code:
    -- 
    -- Please see the license.html file included with this distribution for 
    -- attribution and copyright information.
    --
    
    function onInit()
    	-- Changed custom sort function to use ascending function listed below.
    	CombatManager.setCustomSort(CombatManager.sortfuncAscending);
    	CombatManager.setCustomCombatReset(resetInit);
    end
    
    --
    -- ACTIONS
    --
    
    function resetInit()
    	for _, vChild in pairs(DB.getChildren(CombatManager.CT_LIST)) do
    		DB.setValue(vChild, "initresult", "number", 0);
    	end
    end
    
    -- New ascending function.
    function sortfuncAscending(node1, node2)
    	local bHost = User.isHost();
    	local sOptCTSI = OptionsManager.getOption("CTSI");
    	
    	local sFaction1 = DB.getValue(node1, "friendfoe", "");
    	local sFaction2 = DB.getValue(node2, "friendfoe", "");
    	
    	local bShowInit1 = bHost or ((sOptCTSI == "friend") and (sFaction1 == "friend")) or (sOptCTSI == "on");
    	local bShowInit2 = bHost or ((sOptCTSI == "friend") and (sFaction2 == "friend")) or (sOptCTSI == "on");
    	
    	if bShowInit1 ~= bShowInit2 then
    		if bShowInit1 then
    			return true;
    		elseif bShowInit2 then
    			return false;
    		end
    	else
    		if bShowInit1 then
    			local nValue1 = DB.getValue(node1, "initresult", 0);
    			local nValue2 = DB.getValue(node2, "initresult", 0);
    			if nValue1 ~= nValue2 then
    				-- This is the only change - reversed this comparison.
    				return nValue1 < nValue2;
    			end
    		else
    			if sFaction1 ~= sFaction2 then
    				if sFaction1 == "friend" then
    					return true;
    				elseif sFaction2 == "friend" then
    					return false;
    				end
    			end
    		end
    	end
    	
    	local sValue1 = DB.getValue(node1, "name", "");
    	local sValue2 = DB.getValue(node2, "name", "");
    	if sValue1 ~= sValue2 then
    		return sValue1 < sValue2;
    	end
    
    	return node1.getNodeName() < node2.getNodeName();
    end
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  4. #4
    great thanks. I hadn't seen any rulesets that went ascending instead of descending. That looks doable.
    GM Ultimate license FGC and FGU

    Running The DemonPlague Characters at level 11 in 50th session.

    Playing a Survival DND game in FGU

    Running a Mutants and Masterminds game in FGU

    Playing a Mutants and Masterminds game in FGU

    Playing a Homebrew Campaign against the Dragon kings in FGU

    Running a game of Fallout 2d20

    StarFinder or Star Trek 2D20 next on list If Children of Atom doesn't come out soon.

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
  •  
FG Spreadshirt Swag

Log in

Log in