# Experience Level Of Unit

Grammar — Experience level of unit
FlagsNative | Function

Returns the experience value of a unit.

# Arguments

  • unit — Unit

Returns — int

native int UnitLevel(unit inUnit);

# Supported triggers

Category: Unit / Attributes And Experience

# Examples

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

        else {
            if ((UnitGetType(libSwaC_gv_zS_SwarmHeroUIUnit[lp_index]) == "SJHyperion")) {
                libNtve_gf_SetDialogItemText(libSwaC_gv_zS_SwarmHeroUIDialogLevelLabel[lp_index], IntToText(UnitLevel(libSwaC_gv_zS_SwarmHeroUIUnit[lp_index])), PlayerGroupAll());
            }

mods/heroes.stormmodbase.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorial01.stormmap/MapScript.galaxy:1483

    }

    lv_respawnDuration = libCore_gf_HeroDeathTime(libGame_gf_HeroKilledPlayer(), UnitLevel(libGame_gv_players[libGame_gf_HeroKilledPlayer()].lv_heroUnit));
    if ((lv_respawnDuration >= (lv_max_C - lv_add_C))) {
        libGame_gf_HeroDeathModifyRespawnTimer(libGame_gf_HeroKilledPlayer(), (lv_max_C - lv_respawnDuration));

mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorial01.stormmapMapScript.galaxy:1483

    }

    lv_respawnDuration = libCore_gf_HeroDeathTime(libGame_gf_HeroKilledPlayer(), UnitLevel(libGame_gv_players[libGame_gf_HeroKilledPlayer()].lv_heroUnit));
    if ((lv_respawnDuration >= (lv_max_C - lv_add_C))) {
        libGame_gf_HeroDeathModifyRespawnTimer(libGame_gf_HeroKilledPlayer(), (lv_max_C - lv_respawnDuration));

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:1763

    // Implementation
    lv_lVPlayer = UnitGetOwner(lp_viking);
    lv_heroLevel = UnitLevel(lp_viking);
    if ((lp_modify == false)) {
        UnitSetState(lv_heroUnit, c_unitStateStatusBar, false);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:5167

    }

    lv_multiplier = ((UnitLevel(libGame_gv_players[lv_abathurPlayer].lv_heroUnit) * 150.0) + 0.0);
    lv_lifeofTarget = UnitGetPropertyFixed(lv_target, c_unitPropLifeMax, c_unitPropNormal);
    PlayerSetSkin(lv_abathurPlayer, libGame_gv_players[UnitGetOwner(lv_target)].lv_skinData.lv_skinID);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:12258

    CatalogFieldValueSet(c_gameCatalogUnit, "HeroLeoric", "LifeRegenRate", lv_leoricPlayer, "0");
    CatalogFieldValueSet(c_gameCatalogActor, "HeroLeoric", "CustomUnitStatusFrame", EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster), "UnitStatus/HeroUnitStatusFrameAllGreyNoEnergyTemplate");
    lv_deathTimer = libCore_gf_HeroDeathTime(lv_leoricPlayer, UnitLevel(libGame_gv_players[lv_leoricPlayer].lv_heroUnit));
    libGame_gf_HeroDeathStartRespawnTimer(lv_leoricPlayer, lv_deathTimer);
    libNtve_gf_SendActorMessageToUnit(lv_leoric, "SetShowStatusBar 1");

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:17151

        libGame_gv_players[lv_deadPlayer].lv_cameraPlayerUnitGroupToFocusOn = libNtve_gf_ConvertUnitToUnitGroup(libGame_gv_players[lv_deadPlayer].lv_cameraDeadUnitCameraTarget);
        libGame_gf_HeroDeathUpdateUIElementsForDeath(true, true, true, lv_deadPlayer, lv_killingPlayer);
        lv_respawnTime = libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit));
    }
    else {

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


    // Implementation
    lv_playerLevel = UnitLevel(libGame_gv_players[lp_playerIndex].lv_heroUnit);
    lv_talentTierIndex = 1;
    lv_talentTierIndex = 1;

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

    StatEventSend(StatEventLastCreated());
    libGame_gf_SendEventHeroLevelUp(lv_player, lv_level);
    if ((libGame_gv_players[lv_player].lv_suppressLevelUpFXAndTeamXPTracking == false) && (libGame_gv_players[lv_player].lv_suppressLevelUpFXAndSounds == false) && (UnitLevel(lp_hero) > 1)) {
        auto0D9AE8AF_g = libGame_gv_players[lv_player].lv_heroUnitGroup;
        auto0D9AE8AF_u = UnitGroupCount(auto0D9AE8AF_g, c_unitCountAll);

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

    // Implementation
    lv_heroIndex = libGame_gv_players[lp_player].lv_heroIndex;
    lv_playerLevel = UnitLevel(libGame_gv_players[lp_player].lv_heroUnit);
    lv_itChoice = 1;
    for ( ; ( (auto50211B8D_ai >= 0 && lv_itChoice <= auto50211B8D_ae) || (auto50211B8D_ai < 0 && lv_itChoice >= auto50211B8D_ae) ) ; lv_itChoice += auto50211B8D_ai ) {

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

    libGame_gf_CameraUpdateCameraForPlayer(lv_deadPlayer);
    libGame_gf_SendEventHeroKilled(lv_killingPlayer, lv_deadUnit);
    libGame_gf_HeroDeathStartRespawnTimer(lv_deadPlayer, libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit)));
    libGame_gf_HeroDeathUpdateUIElementsForDeath(true, true, true, lv_deadPlayer, lv_killingPlayer);
    libGame_gf_HeroDeathEnableDisableDeadSoundStateForPlayer(true, lv_deadPlayer);

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

    }

    lv_respawnDuration = FixedToInt(libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(lv_deadUnit)));
    if ((PlayerHasTalent(lv_deadPlayer, "DiabloMasteryDyingBreathApocalypse") == true)) {
        UnitCreateEffectUnit(lv_deadUnit, "DiabloApocalypseEnumerateTrackedUnits", lv_deadUnit);

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

    }
    else {
        lv_respawnTime = libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit));
    }
    libGame_gf_HeroDeathStartRespawnTimer(lv_deadPlayer, lv_respawnTime);

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

    libGame_gf_SendEventHeroKilled(lv_killingPlayer, lv_deadUnit);
    UnitBehaviorAdd(lv_deadUnit, "Dead", lv_deadUnit, 1);
    lv_currentDeathTime = libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(lv_deadUnit));
    lv_spiritOfRedemptionBuffDuration = CatalogFieldValueGetAsFixed(c_gameCatalogBehavior, "SpiritOfRedemptionSpiritFormBuff", "Duration", 0);
    CatalogFieldValueSetFixed(c_gameCatalogBehavior, "SpiritOfRedemptionSpiritFormBuff", "Duration", lv_deadPlayer, MinF((lv_currentDeathTime - lv_spiritOfRedemptionLowDeathTimeAdjustment_C), lv_spiritOfRedemptionBuffDuration));

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

    }
    else {
        libGame_gf_HeroDeathStartRespawnTimer(lv_deadPlayer, libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit)));
    }
    return true;

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

    libGame_gf_CameraPanCameraForPlayerAndUpdateMapBoundsIfNecessary(lv_deadPlayer, UnitGetPosition(lv_deadUnit), 0.25, -1, 0.0, false);
    libGame_gf_SendEventHeroEntersSpecialDeathState(lv_deadUnit);
    libGame_gf_HeroDeathStartRespawnTimer(lv_deadPlayer, libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit)));
    return true;
}

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


    // Implementation
    lv_levelOfAwardPlayer = UnitLevel(libGame_gv_players[lp_awardPlayer].lv_heroUnit);
    lv_deadUnitOwner = UnitGetOwner(lp_deadUnit);
    if ((lv_deadUnitOwner > libCore_gv_bALMaxEnginePlayerCount)) {

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

    }

    lv_levelOfDeadPlayer = UnitLevel(libGame_gv_players[lv_deadUnitOwner].lv_heroUnit);
    return (lv_levelOfDeadPlayer - lv_levelOfAwardPlayer);
}

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

    // Implementation
    lv_heroUnit = libGame_gv_players[UnitGetOwner(lp_deadUnit)].lv_heroUnit;
    lv_levelOfDeadPlayer = UnitLevel(lv_heroUnit);
    lv_baseXP = (libCore_gv_data_XP_HeroValuePerLevel_C * IntToFixed((lv_levelOfDeadPlayer + libCore_gv_data_XP_HeroLevelModifier_C)));
    lv_valueCoefficient = libCore_gf_DataXPGetValueCoefficientForUnit(lp_deadUnit);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/StartingExperienceLib.galaxy:1750


    // Implementation
    lv_playerLevel = UnitLevel(libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_heroUnit);
    if ((lv_playerLevel >= libGame_gv_players[libStEx_gv_pLAYER_01_USER].lv_talents_TierLevels[lp_tier].lv_level) && (GetTalentTierEnabled(lp_tier) == true)) {
        return true;

mods/heromods/chogall.stormmodbase.stormdata/LibHCHO.galaxy:2146

    libGame_gf_SendEventHeroKilled(lv_killingPlayer, lv_deadUnit);
    libGame_gf_CameraPanCameraForPlayerAndUpdateMapBoundsIfNecessary(lv_deadPlayer, UnitGetPosition(lv_deadUnit), 0.25, -1, 0.0, false);
    libGame_gf_HeroDeathStartRespawnTimer(lv_deadPlayer, libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit)));
    libGame_gf_HeroDeathUpdateUIElementsForDeath(true, true, true, lv_deadPlayer, lv_killingPlayer);
    libAIAI_gf_AITeamDelegateModifyHeroStatusTokensforTeam(libAIAI_ge_AITeamDelegateAddRemoveLaneValue_Remove, libGame_gv_players[lv_deadPlayer].lv_aIHeroDelegateTokenValue, libGame_gf_TeamNumberOfPlayer(lv_deadPlayer), libAIAI_ge_AITeamDelegateLivingDeadHeroStatusUpdates_HeroAlive);

mods/heromods/guldan.stormmodbase.stormdata/LibHGUL.galaxy:387

    UnitBehaviorAdd(lv_deadUnit, "GuldanDarkBargainDuration", lv_deadUnit, 1);
    UnitBehaviorSetDuration(lv_deadUnit, "GuldanDarkBargainDuration", 15.0);
    lv_respawnTime = libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit));
    lv_respawnTime = (lv_respawnTime + 15.0);
    libGame_gf_HeroDeathStartRespawnTimer(lv_deadPlayer, lv_respawnTime);

mods/heromods/malthael.stormmodbase.stormdata/LibHMTH.galaxy:447

    UnitBehaviorRemove(lv_unit, "MalthaelNoOneCanStopDeathActivated", 1);
    UnitBehaviorAdd(lv_unit, "MalthaelNoOneCanStopDeathTracker", lv_unit, 1);
    libGame_gf_HeroDeathUpdateRespawnTimer(lv_player, (lv_malthaelRespawnTimer * libCore_gf_HeroDeathTime(lv_player, UnitLevel(libGame_gv_players[lv_player].lv_heroUnit))));
    return true;
}

mods/warcoop/warclassic.sc2modbase.sc2data/TriggerLibs/WarClassic.galaxy:1068

    lv_prop = UnitGetName(lv_u);
    lv_name = StringExternal(("Name/" + (lv_uT)));
    lv_level = UnitLevel(lv_u);
    TextExpressionSetToken("Param/Expression/lib_GAw3_EE11EABC", "Prop", TextWithColor(lv_prop, lv_color));
    TextExpressionSetToken("Param/Expression/lib_GAw3_EE11EABC", "Name", lv_name);

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:56

//--------------------------------------------------------------------------------------------------
int GAw3_UnitCREval(unit u){
    return UserDataGetInt("UnitBalance",UnitGetType(u), "Level", 1)+UnitLevel(u);
}
static bool MatchingFunc(){

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:27


int GAw3_AIUnitCREval(unit u){
    return UserDataGetInt("UnitBalance",UnitGetType(u), "Level", 1)+UnitLevel(u);
}