# Unit Tag

Grammar — Unit tag of u
FlagsNative | Function

A unit’s tag is a unique integer associated with that unit. The tag will never change and will never be associated with a different unit.

# Arguments

  • unit — Unit

Returns — int

native int UnitGetTag(unit inUnit);

Category: Unit / Properties

# Examples

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:464

    // Automatic Variable Declarations
    // Implementation
    return DataTableGetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))));
}

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:470

    // Automatic Variable Declarations
    // Implementation
    return DataTableGetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(lp_shuttle))));
}

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:731

    // Automatic Variable Declarations
    // Implementation
    DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
    DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
    DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:732

    // Implementation
    DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
    DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
    DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);
}

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:733

    DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
    DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
    DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);
}

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:2336

        }

        if (!((DataTableGetDialog(true, ("Shuttle_" + IntToString(UnitGetTag(EventUnitTargetUnit())))) == c_invalidDialogId))) {
            return false;
        }

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition02.sc2map/MapScript.galaxy:2362

    lv_warpAwayProgressBar = DialogControlLastCreated();
    DialogSetVisible(lv_warpAwayBar, PlayerGroupAll(), true);
    DataTableSetDialog(true, ("Shuttle_" + IntToString(UnitGetTag(EventUnitTargetUnit()))), lv_warpAwayBar);
    while ((UnitIsAlive(EventUnitTargetUnit()) == true)) {
        DialogSetPositionRelativeToUnit(lv_warpAwayBar, EventUnitTargetUnit(), "Ref_Center", -100, -90);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2mapMapScript.galaxy:464

    // Automatic Variable Declarations
    // Implementation
    return DataTableGetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))));
}

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2mapMapScript.galaxy:470

    // Automatic Variable Declarations
    // Implementation
    return DataTableGetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(lp_shuttle))));
}

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2mapMapScript.galaxy:731

    // Automatic Variable Declarations
    // Implementation
    DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
    DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
    DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2mapMapScript.galaxy:732

    // Implementation
    DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
    DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
    DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);
}

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2mapMapScript.galaxy:733

    DataTableSetUnitGroup(true, ("EscortShuttles_" + IntToString(UnitGetTag(lp_escort))), lp_shuttles);
    DataTableSetUnit(true, ("EscortShuttle_" + IntToString(UnitGetTag(lp_escort))), UnitGroupUnit(lp_shuttles, 1));
    DataTableSetUnitGroup(true, ("ShuttleEscorts_" + IntToString(UnitGetTag(UnitGroupUnit(lp_shuttles, 1)))), lp_allEscorts);
}

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2mapMapScript.galaxy:2336

        }

        if (!((DataTableGetDialog(true, ("Shuttle_" + IntToString(UnitGetTag(EventUnitTargetUnit())))) == c_invalidDialogId))) {
            return false;
        }

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition02.sc2mapMapScript.galaxy:2362

    lv_warpAwayProgressBar = DialogControlLastCreated();
    DialogSetVisible(lv_warpAwayBar, PlayerGroupAll(), true);
    DataTableSetDialog(true, ("Shuttle_" + IntToString(UnitGetTag(EventUnitTargetUnit()))), lv_warpAwayBar);
    while ((UnitIsAlive(EventUnitTargetUnit()) == true)) {
        DialogSetPositionRelativeToUnit(lv_warpAwayBar, EventUnitTargetUnit(), "Ref_Center", -100, -90);

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


    // Implementation
    if ((DataTableGetDialog(true, ("ProgressBar_" + IntToString((libVCUI_ge_PU_ProgressBarUnit_DialogTypesOld_ProgressBar_Dialog)) + "_" + IntToString(UnitGetTag(lp_unit)))) != c_invalidDialogId)) {
        TriggerDebugOutput(1, StringExternal("Param/Value/lib_VCUI_FB61F536"), true);
        libVCUI_gf_DestroyProgressBarUnitOld(lp_unit);

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:20097

        for ( ; ( (auto06675179_ai >= 0 && lv_structureIndex <= auto06675179_ae) || (auto06675179_ai < 0 && lv_structureIndex >= auto06675179_ae) ) ; lv_structureIndex += auto06675179_ai ) {
            if ((UnitGetType(libGame_gv_townTownData[lv_townIndex].lv_structureUnits[lv_structureIndex]) != "KingsCore")) {
                DataTableSetFixed(true, ("%BuildingScalingLifePercent%" + IntToString(UnitGetTag(libGame_gv_townTownData[lv_townIndex].lv_structureUnits[lv_structureIndex]))), UnitGetPropertyFixed(libGame_gv_townTownData[lv_townIndex].lv_structureUnits[lv_structureIndex], c_unitPropLifePercent, c_unitPropCurrent));
            }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:20114

        if (auto2636383B_var == null) { break; }
        if ((UnitGetType(auto2636383B_var) != "KingsCore")) {
            UnitSetPropertyFixed(auto2636383B_var, c_unitPropLifePercent, DataTableGetFixed(true, ("%BuildingScalingLifePercent%" + IntToString(UnitGetTag(auto2636383B_var)))));
        }

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/HeroesLib.galaxy:3312

    else {
    }
    lv_name = (lv_name + IntToString(UnitGetTag(lp_unit)) + "_" + IntToString(lp_index));
    return lv_name;
}

mods/heroesmapmods/battlegroundmapmods/alteracpass.stormmodbase.stormdata/LibMMAP.galaxy:2653

    UnitBehaviorAdd(lv_defenderUnit, "DebugWatchedFlagDefender", lv_defenderUnit, 1);
    TextExpressionSetToken("Param/Expression/lib_MMAP_46214EA8", "A", UnitGetName(lv_defenderUnit));
    TextExpressionSetToken("Param/Expression/lib_MMAP_46214EA8", "B", IntToText(UnitGetTag(lv_defenderUnit)));
    TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_MMAP_46214EA8"), true);
    return true;

mods/heroesmapmods/battlegroundmapmods/hauntedmines.stormmodbase.stormdata/LibMHtM.galaxy:255

    // Automatic Variable Declarations
    // Implementation
    return ((UnitGetType(lp_unit)) + "+" + IntToString(UnitGetTag(lp_unit)) + " Forwarded Order");
}

mods/missionpacks/campaigncommon.sc2modbase.sc2data/LibCMUI.galaxy:352

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

mods/missionpacks/campaigncommon.sc2modbase.sc2data/LibCMUI.galaxy:382

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

                lv_changedValue = (lv_oldValue*libCOMI_gv_c_TychusSpecialistTrainingAuraCooldownFactor/100);
                CatalogFieldValueModify(c_gameCatalogAbil, lv_itActive, lv_pathCooldown, lv_p, FixedToString(lv_changedValue, c_fixedPrecisionAny), c_upgradeOperationSubtract);
                DataTableSetFixed(true, ("TychusSpecialistTrainingAura_" + IntToString(UnitGetTag(lv_u)) + "_CooldownTimeChange"), lv_changedValue);
                lv_oldValue = libNtve_gf_CatalogFieldValueGetAsReal(c_gameCatalogAbil, lv_itActive, lv_pathCharge, lv_p);
                lv_changedValue = (lv_oldValue*libCOMI_gv_c_TychusSpecialistTrainingAuraCooldownFactor/100);

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

                lv_changedValue = (lv_oldValue*libCOMI_gv_c_TychusSpecialistTrainingAuraCooldownFactor/100);
                CatalogFieldValueModify(c_gameCatalogAbil, lv_itActive, lv_pathCharge, lv_p, FixedToString(lv_changedValue, c_fixedPrecisionAny), c_upgradeOperationSubtract);
                DataTableSetFixed(true, ("TychusSpecialistTrainingAura_" + IntToString(UnitGetTag(lv_u)) + "_ChargeTimeChange"), lv_changedValue);
            }

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

    lv_u = EventUnit();
    lv_uT = UnitGetType(lv_u);
    lv_changedValueCooldown = DataTableGetFixed(true, ("TychusSpecialistTrainingAura_" + IntToString(UnitGetTag(lv_u)) + "_CooldownTimeChange"));
    lv_changedValueCharge = DataTableGetFixed(true, ("TychusSpecialistTrainingAura_" + IntToString(UnitGetTag(lv_u)) + "_ChargeTimeChange"));
    lv_p = UnitGetOwner(lv_u);

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

    lv_uT = UnitGetType(lv_u);
    lv_changedValueCooldown = DataTableGetFixed(true, ("TychusSpecialistTrainingAura_" + IntToString(UnitGetTag(lv_u)) + "_CooldownTimeChange"));
    lv_changedValueCharge = DataTableGetFixed(true, ("TychusSpecialistTrainingAura_" + IntToString(UnitGetTag(lv_u)) + "_ChargeTimeChange"));
    lv_p = UnitGetOwner(lv_u);
    lv_pathCooldown = "Cost[0].Cooldown.TimeUse";

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2776

        UnitGroupAddUnitGroup(lv_attackUnits, UnitLastCreatedGroup());
    }
    DataTableSetUnitGroup(true, ("CT_GiftAtk_" + IntToString(UnitGetTag(lp_gift))), lv_attackUnits);
    AISetGroupScriptControlled(lv_attackUnits, false);
    auto399DB06C_g = lv_attackUnits;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2830


    // Implementation
    lv_attackingForce = DataTableGetUnitGroup(true, ("CT_GiftAtk_" + IntToString(UnitGetTag(lp_gift))));
    if ((libCOMU_gf_CT_GiftState(lp_gift) == libCOMU_ge_CT_GiftState_CT_GiftStatePlayer)) {
        libCOMU_gv_cT_GiftAmonPower += 1;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:6643

            lv_resourceAmount = libNtve_gf_UnitGetPropertyResources(lv_indexResource, c_unitPropCurrent);
            if ((UnitHasBehavior2(lv_indexResource, "MineralFieldMinerals") == true)) {
                DataTableSetString(true, ("CT_ResType_" + IntToString(UnitGetTag(lv_indexResource))), ("MineralFieldMinerals"));
                UnitBehaviorRemove(lv_indexResource, "MineralFieldMinerals", 1);
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:6647

            }
            else if ((UnitHasBehavior2(lv_indexResource, "MineralFieldMinerals750") == true)) {
                DataTableSetString(true, ("CT_ResType_" + IntToString(UnitGetTag(lv_indexResource))), ("MineralFieldMinerals750"));
                UnitBehaviorRemove(lv_indexResource, "MineralFieldMinerals750", 1);
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:6651

            }
            else if ((UnitHasBehavior2(lv_indexResource, "HighYieldMineralFieldMinerals") == true)) {
                DataTableSetString(true, ("CT_ResType_" + IntToString(UnitGetTag(lv_indexResource))), ("HighYieldMineralFieldMinerals"));
                UnitBehaviorRemove(lv_indexResource, "HighYieldMineralFieldMinerals", 1);
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:6655

            }
            else if ((UnitHasBehavior2(lv_indexResource, "HighYieldMineralFieldMinerals750") == true)) {
                DataTableSetString(true, ("CT_ResType_" + IntToString(UnitGetTag(lv_indexResource))), ("HighYieldMineralFieldMinerals750"));
                UnitBehaviorRemove(lv_indexResource, "HighYieldMineralFieldMinerals750", 1);
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:6659

            }
            else if ((UnitHasBehavior2(lv_indexResource, "MineralFieldMineralsNoRemove") == true)) {
                DataTableSetString(true, ("CT_ResType_" + IntToString(UnitGetTag(lv_indexResource))), ("MineralFieldMineralsNoRemove"));
                UnitBehaviorRemove(lv_indexResource, "MineralFieldMineralsNoRemove", 1);
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:9032

            lv_resourceAmount = libNtve_gf_UnitGetPropertyResources(lv_indexResource, c_unitPropCurrent);
            UnitBehaviorRemove(lv_indexResource, "MutatorMineralsLowYield", 1);
            UnitBehaviorAddPlayer(lv_indexResource, (DataTableGetString(true, ("CT_ResType_" + IntToString(UnitGetTag(lv_indexResource))))), 0, 1);
            libNtve_gf_SendActorMessageToUnit(lv_indexResource, "Signal MutatorNormalYield");
            UnitSetPropertyFixed(lv_indexResource, c_unitPropResources, lv_resourceAmount);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:13502

            lv_indexGift = UnitGroupUnitFromEnd(auto63BC9A0B_g, auto63BC9A0B_u);
            if (lv_indexGift == null) { break; }
            lv_attackingForce = DataTableGetUnitGroup(true, ("CT_GiftAtk_" + IntToString(UnitGetTag(lv_indexGift))));
            if ((lv_attackingForce != null)) {
                AISetGroupScriptControlled(lv_attackingForce, false);

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


    // Implementation
    if ((DataTableGetDialog(true, ("ProgressBar_" + IntToString((libCOUI_ge_CU_ProgressBarUnit_DialogTypesOld_ProgressBar_Dialog)) + "_" + IntToString(UnitGetTag(lp_unit)))) != c_invalidDialogId)) {
        TriggerDebugOutput(1, StringExternal("Param/Value/lib_COUI_FB61F536"), true);
        libCOUI_gf_DestroyProgressBarUnitOld(lp_unit);

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

    // Implementation
    lv_name = "ProgressBar_ValueShow_";
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

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

    // Implementation
    lv_isWideBar = "ProgressBar_IsWideBar_";
    lv_isWideBar = (lv_isWideBar + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_isWideBar;
}

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

    else {
    }
    lv_name = (lv_name + "_" + IntToString(UnitGetTag(lp_unit)));
    return lv_name;
}

mods/swarm.sc2modbase.sc2data/TriggerLibs/SwarmLib.galaxy:145

    else {
    }
    lv_name = (lv_name + IntToString(UnitGetTag(lp_unit)) + "_" + IntToString(lp_index));
    return lv_name;
}