1. #1
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,612

    Party Sheet, Add all to Combat Tracker

    Valeriangamer came up with (I thought) a great idea of adding a button to add all the entries in the Party Sheet to the combat tracker. It's a simple thing so I did it for the AD&D ruleset. Diablobob then asked if he could get the same code for his project... so I'm placing it here for him and anyone else that wants to use it. This wouldn't be a bad thing to add to the CoreRPG version tho it'd need some tweaks.

    This is the XML entry, for the 2E and 5E ruleset that is in ps_main.xml.
    The anchor/position will need to be tweaked depending on your locations. For me this is the lower left corner on the main page of the party sheet.

    Code:
           <buttoncontrol name="addtocombattracker">
            <script>
              function onButtonPress()
                PartyManager2.addPartyToCombatTracker();
              end
            </script>
            <anchored to="leftanchor" height="30" width="35">
              <top />
              <left anchor="right" relation="relative" offset="15" />
            </anchored>
            <frame name="fielddark" offset="10,2,10,3" />
            <icon normal="button_ct" pressed="button_ct_down" />
            <tooltip textres="ps_label_addtocombattracker_tooltip" />
            <gmvisibleonly />
          </buttoncontrol>
    String entry needs to go where you keep them. <string name="ps_label_addtocombattracker_tooltip">Add party to combat tracker.</string>
    This is the code that does the work. For 2E and 5E ruleset this goes into manager_ps2.lua (I put it at the bottom).
    Code:
    -- return array of all party sheet member nodes
    function getPartySheetMembers()
      local aParty = {};
      for _,v in pairs(DB.getChildren("partysheet.partyinformation")) do
        local sClass, sRecord = DB.getValue(v, "link");
        if sClass == "charsheet" and sRecord then
          local nodePC = DB.findNode(sRecord);
          if nodePC then
            table.insert(aParty, nodePC );
          end
        end
      end
    
      return aParty;
    end
    
    -- add all party sheet members to combat tracker if they are not there already.
    function addPartyToCombatTracker()
      local bAdded = false;
      for _, nodePS in pairs(getPartySheetMembers()) do
        if not CombatManager.getCTFromNode(nodePS) then
          CombatManager.addPC(nodePS);
          bAdded = true;
        end
      end
      if bAdded then
        Interface.openWindow("combattracker_host", "combattracker");
      end
    end
    End result is clicking the button will add all entries in the Party Sheet to the CT if they do not already exist in the CT.

    In 2E it looks like this.

    Last edited by celestian; April 4th, 2020 at 05:03.
    ---
    Coding the Official AD&D Ruleset
    Documentation for AD&D 2E ruleset.
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)

  2. #2
    JohnD's Avatar
    Join Date
    Mar 2012
    Location
    Winnipeg Canada
    Posts
    4,669
    Blog Entries
    1
    A 21 dex?!
    DMing since February 1979. FGC & FGU Ultimate License holder.

    Currently GMing:
    * Yggsburgh and Castle Zagyg - Castles and Crusades Greyhawk (Monday | Friday)
    * ToEE - Castles and Crusades Greyhawk (Thursday)
    * AD&D Bandit Kingdoms (Friday)
    * AD&D (Saturday)

    Thanks for 8+ years of gaming via FG my friends (AD&D 2e / 3.5e / Rolemaster Classic / Castles & Crusades / Pathfinder / Savage Worlds / 5e).

    There/Their/They're are all different words and do not mean the same thing.

  3. #3
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    21,165
    Blog Entries
    1
    Quote Originally Posted by JohnD View Post
    A 21 dex?!
    Hes the GMs pet!

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  4. #4
    I think it's an excellent idea.
    DM Since 1985. Unity and Classic Ultimate License. Running a WoTR Pathfinder game in person and on Fantasy Grounds. Running a 2e AD&D game 1st and 3rd Friday nights of each month on Fantasy Grounds. Attempting to build modules for a GURPS game in the not so distant future.

  5. #5
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,612
    Quote Originally Posted by JohnD View Post
    A 21 dex?!
    I was testing ranged attack bonuses
    ---
    Coding the Official AD&D Ruleset
    Documentation for AD&D 2E ruleset.
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in