# Value Count Of User Data Field

Grammar — Value count of field for userType
FlagsNative | Function

Returns the total number of values associated with the given user data field. User types are defined within the Data module.

# Arguments

  • string<gamelink::User> — User Type
  • string<userfield> — Field

Returns — int

native int UserDataFieldValueCount(
	string inType,
	string inField,
);

Category: User Data / Basic

# Examples

campaigns/swarmstory.sc2campaignbase.sc2data/TriggerLibs/SwarmCampaignLib.galaxy:13256


    if ((libSwaC_gf_StoryMapPlanet(lp_mission) != libSwaC_gf_StoryMapPlanet(libSwaC_gf_CurrentMap()))) {
        auto7E532343_ae = UserDataFieldValueCount("Planets", "Travel Summary Origin");
        lv_index = 1;
        for ( ; ( (auto7E532343_ai >= 0 && lv_index <= auto7E532343_ae) || (auto7E532343_ai < 0 && lv_index >= auto7E532343_ae) ) ; lv_index += auto7E532343_ai ) {

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignLib.galaxy:4424

        lv_indexUpgrade = UserDataInstance("SpearofAdunUpgrade", auto42A758F1_ai);
        auto42A758F1_ai = auto42A758F1_ai+1;
        autoB818D9AD_ae = UserDataFieldValueCount("SpearofAdunUpgrade", "Upgrade");
        lv_techIndex = 1;
        for ( ; ( (autoB818D9AD_ai >= 0 && lv_techIndex <= autoB818D9AD_ae) || (autoB818D9AD_ai < 0 && lv_techIndex >= autoB818D9AD_ae) ) ; lv_techIndex += autoB818D9AD_ai ) {

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignLib.galaxy:5508

        lv_upgradeLevel = 0;
    }
    auto4087A5D1_ae = UserDataFieldValueCount("CampaignPerk", "AbilityCommand");
    lv_indexTech = 1;
    for ( ; ( (auto4087A5D1_ai >= 0 && lv_indexTech <= auto4087A5D1_ae) || (auto4087A5D1_ai < 0 && lv_indexTech >= auto4087A5D1_ae) ) ; lv_indexTech += auto4087A5D1_ai ) {

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignLib.galaxy:5516


    }
    auto788D5897_ae = UserDataFieldValueCount("CampaignPerk", "Upgrade");
    lv_indexTech = 1;
    for ( ; ( (auto788D5897_ai >= 0 && lv_indexTech <= auto788D5897_ae) || (auto788D5897_ai < 0 && lv_indexTech >= auto788D5897_ae) ) ; lv_indexTech += auto788D5897_ai ) {

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/UILib.galaxy:2344

    lv_list = libUIUI_gv_uIDebugPanel.lv_soundVOList;
    lv_index = 1;
    lv_maxCount = UserDataFieldValueCount("AnnouncerPackVOReplacementList", "SoundIDSuffixes");
    lv_soundID = "";
    lv_suffix = "";

mods/missionpacks/campaigncommon.sc2modbase.sc2data/LibComC.galaxy:2641

        lv_allowDisallow = false;
    }
    auto7A3CD7DC_ae = UserDataFieldValueCount("CampaignPerk", "Upgrade");
    auto7A3CD7DC_ai = 1;
    lv_upgradeIndex = 1;

mods/missionpacks/campaigncommon.sc2modbase.sc2data/LibComC.galaxy:2650


    }
    autoA574F886_ae = UserDataFieldValueCount("CampaignPerk", "AbilityCommand");
    autoA574F886_ai = 1;
    lv_commandIndex = 1;

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNCUI.galaxy:1771

                    lv_unitListIndex = 0;
                    auto5C4EAFD3_ai = 1;
                    auto5C4EAFD3_ae = UserDataFieldValueCount("CampaignTechItem", "UnitList")+1;
                    while (auto5C4EAFD3_ai < auto5C4EAFD3_ae) {    
                        lv_indexArmyUnit = UserDataGetGameLink("CampaignTechItem", lv_indexTechItem, "UnitList", auto5C4EAFD3_ai);

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNCUI.galaxy:2301

        lv_returnText = StringExternal("Param/Value/lib_NCUI_5CBA9BDD");
        autoA8BA21A8_ai = 1;
        autoA8BA21A8_ae = UserDataFieldValueCount("CampaignTechItem", "UnitList")+1;
        while (autoA8BA21A8_ai < autoA8BA21A8_ae) {    
            lv_indexArmyUnit = UserDataGetGameLink("CampaignTechItem", lv_techItem, "UnitList", autoA8BA21A8_ai);

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNovC.galaxy:1405

        lv_upgradeLevel = 0;
    }
    autoE0189707_ae = UserDataFieldValueCount("CampaignTechItem", "UnitList");
    autoE0189707_ai = 1;
    lv_unitIndex = 1;

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNovC.galaxy:1440

        lv_upgradeLevel = 0;
    }
    autoE05CED4F_ae = UserDataFieldValueCount("CampaignTechItem", "UnitList");
    autoE05CED4F_ai = 1;
    lv_unitIndex = 1;

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNovC.galaxy:1655

        autoB23C1D34_ai = autoB23C1D34_ai+1;
        if ((libNovC_gf_NC_ArmyTechItemStateCheck(lv_indexTechItem, libNovC_ge_NC_ArmyTechItemState_Unlocked) == true)) {
            auto28D2A37B_ae = UserDataFieldValueCount("CampaignTechItem", "IsNewList");
            auto28D2A37B_ai = 1;
            lv_unitIndex = 1;

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNovC.galaxy:1829

        lv_allowDisallow = false;
    }
    autoA038E9B9_ae = UserDataFieldValueCount("CampaignPerk", "Upgrade");
    autoA038E9B9_ai = 1;
    lv_upgradeIndex = 1;

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNovC.galaxy:1838


    }
    autoE0B1E26B_ae = UserDataFieldValueCount("CampaignPerk", "AbilityCommand");
    autoE0B1E26B_ai = 1;
    lv_abilityIndex = 1;

mods/missionpacks/novacampaign.sc2modbase.sc2data/LibNovC.galaxy:1984


    // Implementation
    auto118F1C02_ae = UserDataFieldValueCount("CampaignPerk", "Upgrade");
    auto118F1C02_ai = 1;
    lv_upgradeIndex = 1;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:2552

    }

    auto4387DFC8_ae = UserDataFieldValueCount("CoopAICommanderTiers", "PhaseUnits");
    lv_unitTierIter = 1;
    for ( ; ( (auto4387DFC8_ai >= 0 && lv_unitTierIter <= auto4387DFC8_ae) || (auto4387DFC8_ai < 0 && lv_unitTierIter >= auto4387DFC8_ae) ) ; lv_unitTierIter += auto4387DFC8_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:2561

    }
    lv_indexUnitType = 1;
    auto45C59D69_ae = UserDataFieldValueCount("CoopAICommanderTiers", "PhaseUnits");
    lv_unitTypeIter = 1;
    for ( ; ( (auto45C59D69_ai >= 0 && lv_unitTypeIter <= auto45C59D69_ae) || (auto45C59D69_ai < 0 && lv_unitTypeIter >= auto45C59D69_ae) ) ; lv_unitTypeIter += auto45C59D69_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:2929

    }

    auto4A308EFB_ae = UserDataFieldValueCount("CoopAICommanderTiers", "PhaseUnits");
    lv_unitTierIter = 1;
    for ( ; ( (auto4A308EFB_ai >= 0 && lv_unitTierIter <= auto4A308EFB_ae) || (auto4A308EFB_ai < 0 && lv_unitTierIter >= auto4A308EFB_ae) ) ; lv_unitTierIter += auto4A308EFB_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:2938

    }
    lv_indexUnitType = 1;
    autoA609CF0B_ae = UserDataFieldValueCount("CoopAICommanderTiers", "PhaseUnits");
    lv_unitTypeIter = 1;
    for ( ; ( (autoA609CF0B_ai >= 0 && lv_unitTypeIter <= autoA609CF0B_ae) || (autoA609CF0B_ai < 0 && lv_unitTypeIter >= autoA609CF0B_ae) ) ; lv_unitTypeIter += autoA609CF0B_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:3095

    libCOMI_gv_cM_CoopAIPlayer_NextStockUpdate[lp_player] = (GameGetMissionTime() + 5.0);
    AIClearStock(lp_player);
    auto47D233A5_ae = UserDataFieldValueCount("CoopAICommanders", "StartingTech");
    lv_startingTechStockIter = 1;
    for ( ; ( (auto47D233A5_ai >= 0 && lv_startingTechStockIter <= auto47D233A5_ae) || (auto47D233A5_ai < 0 && lv_startingTechStockIter >= auto47D233A5_ae) ) ; lv_startingTechStockIter += auto47D233A5_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:3182

    TechTreeUpgradeAddLevel(lp_player, "CoopAIReaperCost", 1);
    TechTreeUpgradeAddLevel(lp_player, "CoopAIMutaliskCost", 1);
    autoBC0EE9F6_ae = UserDataFieldValueCount("CoopAICommanders", "StartingTech");
    lv_unitCreateIter = 1;
    for ( ; ( (autoBC0EE9F6_ai >= 0 && lv_unitCreateIter <= autoBC0EE9F6_ae) || (autoBC0EE9F6_ai < 0 && lv_unitCreateIter >= autoBC0EE9F6_ae) ) ; lv_unitCreateIter += autoBC0EE9F6_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:3268

        lv_time = libCOMI_gv_cM_CoopAI_CachedUpgradeData[lp_player].lv_time[lv_upgradeIter];
        if ((lv_time >= 0.0) && (lv_time < GameGetMissionTime()) && (TechTreeUpgradeCount(lp_player, lv_upgrade, c_techCountQueuedOrBetter) == 0)) {
            auto3A3C35EB_ae = UserDataFieldValueCount("CoopAIUpgrade", "ExclusiveToCommander");
            lv_exclusiveCommanderIter = 1;
            for ( ; ( (auto3A3C35EB_ai >= 0 && lv_exclusiveCommanderIter <= auto3A3C35EB_ae) || (auto3A3C35EB_ai < 0 && lv_exclusiveCommanderIter >= auto3A3C35EB_ae) ) ; lv_exclusiveCommanderIter += auto3A3C35EB_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:6274

    lv_targetunitsupply = UnitTypeGetProperty(lp_unitType, c_unitPropSuppliesUsed);
    lv_numberofdevolutiontiers = UserDataInstanceCount("DevolutionTiers");
    lv_numberofunittypespertier = UserDataFieldValueCount("DevolutionTiers", "UnitsToDevolveInto");

    // Implementation

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:6318

    // Variable Initialization
    lv_numberofdevolutiontiers = UserDataInstanceCount("DevolutionTiers");
    lv_numberofunittypespertier = UserDataFieldValueCount("DevolutionTiers", "UnitsToDevolveInto");
    lv_oldunitrace = (CatalogFieldValueGet(c_gameCatalogUnit, lp_oldUnitType, "Race", c_playerAny));

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:19828

                auto9B486C0C_field = "Affected Units";
                auto9B486C0C_i = 1;
                for ( ; auto9B486C0C_i <= UserDataFieldValueCount(auto9B486C0C_userType,auto9B486C0C_field) ; auto9B486C0C_i += 1 ) {
                    lv_unitType = UserDataGetGameLink(auto9B486C0C_userType,auto9B486C0C_instance,auto9B486C0C_field, auto9B486C0C_i);
                    if ((CatalogEntryIsValid(c_gameCatalogUnit, lv_unitType) == true)) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1062

    }

    autoFFFE3F17_ae = UserDataFieldValueCount("PlayerPrestige", "DisableAbil");
    lv_index = 1;
    for ( ; ( (autoFFFE3F17_ai >= 0 && lv_index <= autoFFFE3F17_ae) || (autoFFFE3F17_ai < 0 && lv_index >= autoFFFE3F17_ae) ) ; lv_index += autoFFFE3F17_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1067

        TechTreeAbilityAllow(lp_player, UserDataGetAbilCmd("PlayerPrestige", lp_prestige, "DisableAbil", lv_index), false);
    }
    auto2AF6D99E_ae = UserDataFieldValueCount("PlayerPrestige", "EnableAbil");
    lv_index = 1;
    for ( ; ( (auto2AF6D99E_ai >= 0 && lv_index <= auto2AF6D99E_ae) || (auto2AF6D99E_ai < 0 && lv_index >= auto2AF6D99E_ae) ) ; lv_index += auto2AF6D99E_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1072

        TechTreeAbilityAllow(lp_player, UserDataGetAbilCmd("PlayerPrestige", lp_prestige, "EnableAbil", lv_index), true);
    }
    auto8173B652_ae = UserDataFieldValueCount("PlayerPrestige", "SuppressUpgrade");
    lv_index = 1;
    for ( ; ( (auto8173B652_ai >= 0 && lv_index <= auto8173B652_ae) || (auto8173B652_ai < 0 && lv_index >= auto8173B652_ae) ) ; lv_index += auto8173B652_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1077

        libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetGameLink("PlayerPrestige", lp_prestige, "SuppressUpgrade", lv_index), 0);
    }
    autoEDDDFDDA_ae = UserDataFieldValueCount("PlayerPrestige", "SuppressUpgradeShared");
    lv_index = 1;
    for ( ; ( (autoEDDDFDDA_ai >= 0 && lv_index <= autoEDDDFDDA_ae) || (autoEDDDFDDA_ai < 0 && lv_index >= autoEDDDFDDA_ae) ) ; lv_index += autoEDDDFDDA_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1088

        }
    }
    autoA8942F1B_ae = UserDataFieldValueCount("PlayerPrestige", "DisableUnit");
    lv_index = 1;
    for ( ; ( (autoA8942F1B_ai >= 0 && lv_index <= autoA8942F1B_ae) || (autoA8942F1B_ai < 0 && lv_index >= autoA8942F1B_ae) ) ; lv_index += autoA8942F1B_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1093

        TechTreeUnitAllow(lp_player, UserDataGetUnit("PlayerPrestige", lp_prestige, "DisableUnit", lv_index), false);
    }
    autoAF2781D7_ae = UserDataFieldValueCount("PlayerPrestige", "UpgradeSupplements");
    lv_index = 1;
    for ( ; ( (autoAF2781D7_ai >= 0 && lv_index <= autoAF2781D7_ae) || (autoAF2781D7_ai < 0 && lv_index >= autoAF2781D7_ae) ) ; lv_index += autoAF2781D7_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1108

    }

    auto232467FB_ae = UserDataFieldValueCount("PlayerPrestige", "SecondaryUpgradesSelf");
    lv_index = 1;
    for ( ; ( (auto232467FB_ai >= 0 && lv_index <= auto232467FB_ae) || (auto232467FB_ai < 0 && lv_index >= auto232467FB_ae) ) ; lv_index += auto232467FB_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1113

        libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetGameLink("PlayerPrestige", lp_prestige, "SecondaryUpgradesSelf", lv_index), 1);
    }
    autoF8F85F68_ae = UserDataFieldValueCount("PlayerPrestige", "SecondaryUpgradesShared");
    lv_index = 1;
    for ( ; ( (autoF8F85F68_ai >= 0 && lv_index <= autoF8F85F68_ae) || (autoF8F85F68_ai < 0 && lv_index >= autoF8F85F68_ae) ) ; lv_index += autoF8F85F68_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1124

        }
    }
    autoE6A4272A_ae = UserDataFieldValueCount("PlayerPrestige", "PlayerResponses");
    lv_index = 1;
    for ( ; ( (autoE6A4272A_ai >= 0 && lv_index <= autoE6A4272A_ae) || (autoE6A4272A_ai < 0 && lv_index >= autoE6A4272A_ae) ) ; lv_index += autoE6A4272A_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOOC.galaxy:1660


    // Implementation
    auto0D63B996_ae = UserDataFieldValueCount(lp_userType, "Commander");
    lv_index = 1;
    for ( ; ( (auto0D63B996_ai >= 0 && lv_index <= auto0D63B996_ae) || (auto0D63B996_ai < 0 && lv_index >= auto0D63B996_ae) ) ; lv_index += auto0D63B996_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:6967

        }
        lv_selectedChallenge = libCOUI_gv_cU_CommanderMutatorChallengeList[(DialogControlGetSelectedItem(libCOUI_gv_cU_CommanderMutatorChallengePulldown, EventPlayer())-1)];
        auto2F8A2574_ae = UserDataFieldValueCount("MutatorChallenges", "Mutators");
        lv_challengeMutatorIndex = 1;
        for ( ; ( (auto2F8A2574_ai >= 0 && lv_challengeMutatorIndex <= auto2F8A2574_ae) || (auto2F8A2574_ai < 0 && lv_challengeMutatorIndex >= auto2F8A2574_ae) ) ; lv_challengeMutatorIndex += auto2F8A2574_ai ) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:9331

        auto100DBF9A_field = "Equipment";
        auto100DBF9A_i = 1;
        for ( ; auto100DBF9A_i <= UserDataFieldValueCount(auto100DBF9A_userType,auto100DBF9A_field) ; auto100DBF9A_i += 1 ) {
            lv_equipment = UserDataGetUpgrade(auto100DBF9A_userType,auto100DBF9A_instance,auto100DBF9A_field, auto100DBF9A_i);
            if ((lv_equipment == libNtve_gf_TriggeringProgressUpgrade())) {

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:2714


    // Implementation
    auto7AF0E6AE_ae = UserDataFieldValueCount("LegionWaves", "UnitTypes");
    lv_waveunitindex = 1;
    for ( ; ( (auto7AF0E6AE_ai >= 0 && lv_waveunitindex <= auto7AF0E6AE_ae) || (auto7AF0E6AE_ai < 0 && lv_waveunitindex >= auto7AF0E6AE_ae) ) ; lv_waveunitindex += auto7AF0E6AE_ai ) {

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:2725

    }
    lv_targetwaveweight = RandomInt(1, lv_totalwaveweight);
    auto73BD3D6C_ae = UserDataFieldValueCount("LegionWaves", "UnitTypes");
    lv_waveunitindex = 1;
    for ( ; ( (auto73BD3D6C_ai >= 0 && lv_waveunitindex <= auto73BD3D6C_ae) || (auto73BD3D6C_ai < 0 && lv_waveunitindex >= auto73BD3D6C_ae) ) ; lv_waveunitindex += auto73BD3D6C_ai ) {