# Unit XP Get Current XP
Grammar — The current xp in veterancyBehavior for unit
Flags —Native
|Function
Returns the current xp of a unit
# Arguments
unit
— Unitstring
<gamelink::Behavior> — Veterancy Behavior
Returns — fixed
native fixed UnitXPGetCurrentXP(
unit inUnit,
string inVeterancyBehavior,
);
# Related
Category: Unit / Attributes And Experience
- Unit Gains Experience —
void
— TriggerAddEventUnitGainExperience - Unit Gains Experience Level —
void
— TriggerAddEventUnitGainLevel - Unit XP Get Current XP —
fixed
— UnitXPGetCurrentXP - Unit XP Add XP —
void
— UnitXPAddXP - Unit XP Set Current XP —
void
— UnitXPSetCurrentXP - Unit XP Get XP For Level —
int
— UnitXPGetXPForLevel - Unit XP Set XP For Level —
void
— UnitXPSetXPForLevel - Unit XP Get Current Level —
int
— UnitXPGetCurrentLevel - Unit XP Set Current Level —
void
— UnitXPSetCurrentLevel - Unit XP Get Num Levels —
int
— UnitXPGetNumLevels - Triggering Experience Gained —
fixed
— EventUnitXPDelta - Unit Attribute Change —
void
— TriggerAddEventUnitAttributeChange - Triggering Attribute Points —
int
— EventUnitAttributePoints - Total Experience Of Unit —
fixed
— UnitXPTotal - Experience Level Of Unit —
int
— UnitLevel - Enable/Disable Experience Gain For Unit —
void
— UnitXPGainEnable
# Examples
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2095
lv_deadHeroWholeLevel = UnitXPGetCurrentLevel(libGame_gv_players[UnitGetOwner(lp_deadHero)].lv_heroUnit, "HeroDummyVeterancy");
lv_experienceLevelBaseXP = libCore_gf_GetTotalXPForLevel(lv_deadHeroWholeLevel);
lv_experienceLevelTotalXP = UnitXPGetCurrentXP(libGame_gv_players[UnitGetOwner(lp_deadHero)].lv_heroUnit, "HeroDummyVeterancy");
lv_experienceLevelBase1XP = (lv_deadHeroWholeLevel + 1);
lv_xPMath = (libCore_gf_GetTotalXPForLevel(lv_experienceLevelBase1XP) - lv_experienceLevelBaseXP);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2111
lv_playerHeroWholeLevel = UnitXPGetCurrentLevel(libGame_gv_players[UnitGetOwner(lp_playerHero)].lv_heroUnit, "HeroDummyVeterancy");
lv_experienceLevelBaseXP = libCore_gf_GetTotalXPForLevel(lv_playerHeroWholeLevel);
lv_experienceLevelTotalXP = UnitXPGetCurrentXP(libGame_gv_players[UnitGetOwner(lp_playerHero)].lv_heroUnit, "HeroDummyVeterancy");
lv_experienceLevelBase1XP = (lv_playerHeroWholeLevel + 1);
lv_xPMath = (libCore_gf_GetTotalXPForLevel(lv_experienceLevelBase1XP) - lv_experienceLevelBaseXP);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/MapMechanicsLib.galaxy:1758
PlayerGroupAdd(lv_creditGroup, UnitGetOwner(lv_itUnit));
}
lv_grantedXP = UnitXPGetCurrentXP(libMapM_gv_jungleCreepCamps[lp_camp].lv_campOwnershipFlagUnit, null);
lv_grantedXP += libMapM_gv_dataJungleCampDefenderData[(libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType)].lv_xPAwardForCapture;
auto6FC0000D_g = lv_creditGroup;