function CountPoliciesInBranch(iPlayer, policyBranchType)
local player = Players[iPlayer]
local count = 0
-- Loop through all policies
for row in GameInfo.Policies() do
-- Test if it's the correct branch
if row.PolicyBranchType == policyBranchType then
-- If so, test if the player has the policy
if player:HasPolicy(row.ID) then
count = count + 1
end
end
end
return count
end
print( CountPoliciesInBranch(0, "POLICY_BRANCH_LIBERTY") )