# User Data (Upgrade)

Grammar — User Data (userType, instance, field, index)
FlagsNative | Function

Returns a value from user data for the given type, instance, and field. User data is defined in the Data module.

# Arguments

  • string<gamelink::User> — User Type
  • string<userinstance> — Instance
  • string<userfield> — Field
  • int — Index

Returns — string<gamelink::Upgrade>

native string UserDataGetUpgrade(
	string inType,
	string inInstance,
	string inField,
	int inIndex,
);

Category: User Data / Get Value

# Examples

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

        lv_techIndex = 1;
        for ( ; ( (autoB818D9AD_ai >= 0 && lv_techIndex <= autoB818D9AD_ae) || (autoB818D9AD_ai < 0 && lv_techIndex >= autoB818D9AD_ae) ) ; lv_techIndex += autoB818D9AD_ai ) {
            if ((UserDataGetUpgrade("SpearofAdunUpgrade", lv_indexUpgrade, "Upgrade", lv_techIndex) != null)) {
                libNtve_gf_SetUpgradeLevelForPlayer(libVoiC_gv_pCC_SoAPlayerSlot, UserDataGetUpgrade("SpearofAdunUpgrade", lv_indexUpgrade, "Upgrade", lv_techIndex), libVoiC_gf_PC_SoAUpgradeLevel(lv_indexUpgrade));
            }

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

        for ( ; ( (autoB818D9AD_ai >= 0 && lv_techIndex <= autoB818D9AD_ae) || (autoB818D9AD_ai < 0 && lv_techIndex >= autoB818D9AD_ae) ) ; lv_techIndex += autoB818D9AD_ai ) {
            if ((UserDataGetUpgrade("SpearofAdunUpgrade", lv_indexUpgrade, "Upgrade", lv_techIndex) != null)) {
                libNtve_gf_SetUpgradeLevelForPlayer(libVoiC_gv_pCC_SoAPlayerSlot, UserDataGetUpgrade("SpearofAdunUpgrade", lv_indexUpgrade, "Upgrade", lv_techIndex), libVoiC_gf_PC_SoAUpgradeLevel(lv_indexUpgrade));
            }

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

    lv_indexTech = 1;
    for ( ; ( (auto788D5897_ai >= 0 && lv_indexTech <= auto788D5897_ae) || (auto788D5897_ai < 0 && lv_indexTech >= auto788D5897_ae) ) ; lv_indexTech += auto788D5897_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_ability, "Upgrade", lv_indexTech) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(libVoiC_gv_pCC_SoAPlayerSlot, UserDataGetUpgrade("CampaignPerk", lp_ability, "Upgrade", lv_indexTech), lv_upgradeLevel);
        }

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

    for ( ; ( (auto788D5897_ai >= 0 && lv_indexTech <= auto788D5897_ae) || (auto788D5897_ai < 0 && lv_indexTech >= auto788D5897_ae) ) ; lv_indexTech += auto788D5897_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_ability, "Upgrade", lv_indexTech) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(libVoiC_gv_pCC_SoAPlayerSlot, UserDataGetUpgrade("CampaignPerk", lp_ability, "Upgrade", lv_indexTech), lv_upgradeLevel);
        }

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

    }
    else {
        return (TechTreeUpgradeCount(1, UserDataGetUpgrade("CampaignPerk", lp_ability, "Upgrade", 1), c_techCountQueuedOrBetter) == 1);
    }
}

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:2699

        }

        libNtve_gf_SetUpgradeLevelForPlayer(0, UserDataGetUpgrade("SpearofAdunUpgrade", libVCUI_gv_pU_SoAUpgrades[lv_auxiliaryIndex], "Upgrade", 1), libVCUI_gv_pU_SoAUpgradeLevels[lv_auxiliaryIndex]);
        TextExpressionSetToken("Param/Expression/lib_VCUI_F211695B", "TITLE", libVoiC_gf_PC_SoAUpgradeTitle(libVCUI_gv_pU_SoAUpgrades[lv_auxiliaryIndex]));
        TextExpressionSetToken("Param/Expression/lib_VCUI_F211695B", "DETAILS", libVCUI_gf_PU_SoAAuxiliaryDetail(libVCUI_gv_pU_SoAUpgrades[lv_auxiliaryIndex]));

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:2845

    auto9A8F3378_val = lp_upgrade;
    if (auto9A8F3378_val == "ShipStructureBuildUpgrade") {
        TextExpressionSetToken("Param/Expression/lib_VCUI_3BEC692E", "UPGRADE", IntToText((TechTreeUpgradeCount(0, UserDataGetUpgrade("SpearofAdunUpgrade", lp_upgrade, "Upgrade", 1), c_techCountQueuedOrBetter)*5)));
        return TextExpressionAssemble("Param/Expression/lib_VCUI_3BEC692E");
    }

campaigns/voidstory.sc2campaignbase.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:2849

    }
    else if (auto9A8F3378_val == "ShipShieldUpgrades") {
        TextExpressionSetToken("Param/Expression/lib_VCUI_667BE8C1", "UPGRADE", IntToText((TechTreeUpgradeCount(0, UserDataGetUpgrade("SpearofAdunUpgrade", lp_upgrade, "Upgrade", 1), c_techCountQueuedOrBetter)*5)));
        return TextExpressionAssemble("Param/Expression/lib_VCUI_667BE8C1");
    }

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

    lv_upgradeIndex = 1;
    for ( ; ( (auto7A3CD7DC_ai >= 0 && lv_upgradeIndex <= auto7A3CD7DC_ae) || (auto7A3CD7DC_ai <= 0 && lv_upgradeIndex >= auto7A3CD7DC_ae) ) ; lv_upgradeIndex += auto7A3CD7DC_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex), lv_upgradeLevel);
        }

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

    for ( ; ( (auto7A3CD7DC_ai >= 0 && lv_upgradeIndex <= auto7A3CD7DC_ae) || (auto7A3CD7DC_ai <= 0 && lv_upgradeIndex >= auto7A3CD7DC_ae) ) ; lv_upgradeIndex += auto7A3CD7DC_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex), lv_upgradeLevel);
        }

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

string libNovC_gf_NC_ArmyTechItemUpgradeFromIndex (string lp_techItem, int lp_upgradeIndex) {
    // Implementation
    return UserDataGetUpgrade("CampaignTechItem", lp_techItem, "UpgradeList", lp_upgradeIndex);
}

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

    lv_upgradeIndex = 1;
    for ( ; ( (autoA038E9B9_ai >= 0 && lv_upgradeIndex <= autoA038E9B9_ae) || (autoA038E9B9_ai <= 0 && lv_upgradeIndex >= autoA038E9B9_ae) ) ; lv_upgradeIndex += autoA038E9B9_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_equipment, "Upgrade", lv_upgradeIndex) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(libNovC_gv_nCC_NovaPlayerSlot, UserDataGetUpgrade("CampaignPerk", lp_equipment, "Upgrade", lv_upgradeIndex), lv_upgradeLevel);
        }

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

    for ( ; ( (autoA038E9B9_ai >= 0 && lv_upgradeIndex <= autoA038E9B9_ae) || (autoA038E9B9_ai <= 0 && lv_upgradeIndex >= autoA038E9B9_ae) ) ; lv_upgradeIndex += autoA038E9B9_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_equipment, "Upgrade", lv_upgradeIndex) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(libNovC_gv_nCC_NovaPlayerSlot, UserDataGetUpgrade("CampaignPerk", lp_equipment, "Upgrade", lv_upgradeIndex), lv_upgradeLevel);
        }

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

    lv_upgradeIndex = 1;
    for ( ; ( (auto118F1C02_ai >= 0 && lv_upgradeIndex <= auto118F1C02_ae) || (auto118F1C02_ai <= 0 && lv_upgradeIndex >= auto118F1C02_ae) ) ; lv_upgradeIndex += auto118F1C02_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex) != null) && (TechTreeUpgradeCount(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex), c_techCountCompleteOnly) >= 1)) {
            return true;
        }

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

    lv_upgradeIndex = 1;
    for ( ; ( (auto118F1C02_ai >= 0 && lv_upgradeIndex <= auto118F1C02_ae) || (auto118F1C02_ai <= 0 && lv_upgradeIndex >= auto118F1C02_ae) ) ; lv_upgradeIndex += auto118F1C02_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex) != null) && (TechTreeUpgradeCount(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_upgradeIndex), c_techCountCompleteOnly) >= 1)) {
            return true;
        }

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

    lv_upgradeIter = 1;
    for ( ; ( (auto93DD5DF8_ai >= 0 && lv_upgradeIter <= auto93DD5DF8_ae) || (auto93DD5DF8_ai < 0 && lv_upgradeIter >= auto93DD5DF8_ae) ) ; lv_upgradeIter += auto93DD5DF8_ai ) {
        libCOMI_gv_cM_CoopAI_CachedUpgradeData[lp_player].lv_upgrade[lv_upgradeIter] = UserDataGetUpgrade("CoopAIUpgrade", UserDataInstance("CoopAIUpgrade", lv_upgradeIter), "Upgrade", 1);
        libCOMI_gv_cM_CoopAI_CachedUpgradeData[lp_player].lv_time[lv_upgradeIter] = UserDataGetFixed("CoopAIUpgrade", UserDataInstance("CoopAIUpgrade", lv_upgradeIter), "TimePerDifficult", lp_difficulty);
    }

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

    for ( ; auto5BDC1380_i <= UserDataInstanceCount(auto5BDC1380_userType) ; auto5BDC1380_i += 1 ) {
        lv_herorevivesoundinstance = UserDataInstance(auto5BDC1380_userType, auto5BDC1380_i);
        if ((UserDataGetUnit("HeroReviveSounds", lv_herorevivesoundinstance, "HeroUnit", 1) == UnitGetType(lv_herounit)) && ((UserDataGetUpgrade("HeroReviveSounds", lv_herorevivesoundinstance, "RequiredUpgrade", 1) == null) || (TechTreeUpgradeCount(lv_owner, UserDataGetUpgrade("HeroReviveSounds", lv_herorevivesoundinstance, "RequiredUpgrade", 1), c_techCountCompleteOnly) > 0))) {
            libCOMI_gf_CM_HeroReviveQueue_PlaySound(SoundLink(UserDataGetSound("HeroReviveSounds", lv_herorevivesoundinstance, "HeroSound", 1), c_soundIndexAny), UserDataGetFixed("HeroReviveSounds", lv_herorevivesoundinstance, "HeroSoundDelay", 1), libCOOC_gf_CommanderPlayers());
            break;

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

    for ( ; auto5BDC1380_i <= UserDataInstanceCount(auto5BDC1380_userType) ; auto5BDC1380_i += 1 ) {
        lv_herorevivesoundinstance = UserDataInstance(auto5BDC1380_userType, auto5BDC1380_i);
        if ((UserDataGetUnit("HeroReviveSounds", lv_herorevivesoundinstance, "HeroUnit", 1) == UnitGetType(lv_herounit)) && ((UserDataGetUpgrade("HeroReviveSounds", lv_herorevivesoundinstance, "RequiredUpgrade", 1) == null) || (TechTreeUpgradeCount(lv_owner, UserDataGetUpgrade("HeroReviveSounds", lv_herorevivesoundinstance, "RequiredUpgrade", 1), c_techCountCompleteOnly) > 0))) {
            libCOMI_gf_CM_HeroReviveQueue_PlaySound(SoundLink(UserDataGetSound("HeroReviveSounds", lv_herorevivesoundinstance, "HeroSound", 1), c_soundIndexAny), UserDataGetFixed("HeroReviveSounds", lv_herorevivesoundinstance, "HeroSoundDelay", 1), libCOOC_gf_CommanderPlayers());
            break;

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

    // Automatic Variable Declarations
    // Implementation
    return UserDataGetUpgrade("MasteryUpgrades", lp_masteryUpgrade, "Upgrade", 1);
}

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

    lv_indexTech = 1;
    for ( ; ( (autoC7DFFF31_ai >= 0 && lv_indexTech <= autoC7DFFF31_ae) || (autoC7DFFF31_ai < 0 && lv_indexTech >= autoC7DFFF31_ae) ) ; lv_indexTech += autoC7DFFF31_ai ) {
        if ((UserDataGetUpgrade("PlayerCommanders", lv_playerCommander, "DefaultUpgrades", lv_indexTech) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("PlayerCommanders", lv_playerCommander, "DefaultUpgrades", lv_indexTech), 1);
        }

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

    for ( ; ( (autoC7DFFF31_ai >= 0 && lv_indexTech <= autoC7DFFF31_ae) || (autoC7DFFF31_ai < 0 && lv_indexTech >= autoC7DFFF31_ae) ) ; lv_indexTech += autoC7DFFF31_ai ) {
        if ((UserDataGetUpgrade("PlayerCommanders", lv_playerCommander, "DefaultUpgrades", lv_indexTech) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("PlayerCommanders", lv_playerCommander, "DefaultUpgrades", lv_indexTech), 1);
        }

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

    lv_indexTech = 1;
    for ( ; ( (auto788D5897_ai >= 0 && lv_indexTech <= auto788D5897_ae) || (auto788D5897_ai < 0 && lv_indexTech >= auto788D5897_ae) ) ; lv_indexTech += auto788D5897_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_indexTech) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_indexTech), lv_upgradeLevel);
            if ((libCOOC_gv_cC_DebugTechSuperSpam == true)) {

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

    for ( ; ( (auto788D5897_ai >= 0 && lv_indexTech <= auto788D5897_ae) || (auto788D5897_ai < 0 && lv_indexTech >= auto788D5897_ae) ) ; lv_indexTech += auto788D5897_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_indexTech) != null)) {
            libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_indexTech), lv_upgradeLevel);
            if ((libCOOC_gv_cC_DebugTechSuperSpam == true)) {
                TextExpressionSetToken("Param/Expression/lib_COOC_5DED9532", "A", StringToText((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_indexTech))));

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

            libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_indexTech), lv_upgradeLevel);
            if ((libCOOC_gv_cC_DebugTechSuperSpam == true)) {
                TextExpressionSetToken("Param/Expression/lib_COOC_5DED9532", "A", StringToText((UserDataGetUpgrade("CampaignPerk", lp_perk, "Upgrade", lv_indexTech))));
                TextExpressionSetToken("Param/Expression/lib_COOC_5DED9532", "B", IntToText(lv_upgradeLevel));
                TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COOC_5DED9532"), true);

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

    lv_indexTech = 1;
    for ( ; ( (autoBE1AED9F_ai >= 0 && lv_indexTech <= autoBE1AED9F_ae) || (autoBE1AED9F_ai < 0 && lv_indexTech >= autoBE1AED9F_ae) ) ; lv_indexTech += autoBE1AED9F_ai ) {
        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "UpgradeOff", lv_indexTech) != null)) {
            if ((lp_enableDisable == true)) {
                libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "UpgradeOff", lv_indexTech), 0);

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

        if ((UserDataGetUpgrade("CampaignPerk", lp_perk, "UpgradeOff", lv_indexTech) != null)) {
            if ((lp_enableDisable == true)) {
                libNtve_gf_SetUpgradeLevelForPlayer(lp_player, UserDataGetUpgrade("CampaignPerk", lp_perk, "UpgradeOff", lv_indexTech), 0);
            }

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


            if ((libCOOC_gv_cC_DebugTechSuperSpam == true)) {
                TextExpressionSetToken("Param/Expression/lib_COOC_B56724DE", "A", StringToText((UserDataGetUpgrade("CampaignPerk", lp_perk, "UpgradeOff", lv_indexTech))));
                TextExpressionSetToken("Param/Expression/lib_COOC_B56724DE", "B", IntToText(lv_upgradeLevel));
                TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_COOC_B56724DE"), true);

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

        lv_indexSharedUpgrade = UserDataInstance("SharedUpgrades", auto8FFB0F01_ai);
        auto8FFB0F01_ai = auto8FFB0F01_ai+1;
        if ((UserDataGetUpgrade("SharedUpgrades", lv_indexSharedUpgrade, "Upgrade", 1) != null)) {
            libCOOC_gf_CC_SharedUpgradesCheckAndApply(UserDataGetUpgrade("SharedUpgrades", lv_indexSharedUpgrade, "Upgrade", 1));
        }

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

        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())) {
                UserDataSetInt("CoopTechTychusSquad", lv_squadinstance, "EquipCount", 1, (UserDataGetInt("CoopTechTychusSquad", lv_squadinstance, "EquipCount", 1) + 1));