FG Spreadshirt Swag
  1. #1

    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.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  2. #2
    JohnD's Avatar
    Join Date
    Mar 2012
    Location
    Johnstown ON
    Posts
    5,319
    Blog Entries
    1
    A 21 dex?!
    "I am a Canadian, free to speak without fear, free to worship in my own way, free to stand for what I think right, free to oppose what I believe wrong, or free to choose those who shall govern my country. This heritage of freedom I pledge to uphold for myself and all mankind."

    - John Diefenbaker

    RIP Canada, February 21, 2022

  3. #3

  4. #4
    I think it's an excellent idea.
    DM/GM Since 1985. Unity and Classic Ultimate License.

  5. #5
    Quote Originally Posted by JohnD View Post
    A 21 dex?!
    I was testing ranged attack bonuses
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

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
  •  
DICE PACKS BUNDLE

Log in

Log in