# Total Experience Of Unit
Grammar — Total experience of unit
Flags —Native
|Function
Returns the total experience a unit possesses.
# Arguments
unit
— Unit
Returns — fixed
native fixed UnitXPTotal(unit inUnit);
# Supported triggers
- Unit Dies — TriggerAddEventUnitDied
# 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/GameDataHelperLib.galaxy:18041
UISetSelectionTypeEnabled(PlayerGroupSingle(lv_ownerOfCreatedUnit), c_localSelectionTypeWorldPanelHero, false);
UnitSetFacing(lv_createdUnit, UnitGetFacing(lv_creatingUnit), 0.0);
UnitSetPropertyFixed(lv_createdUnit, c_unitPropXP, UnitXPTotal(lv_creatingUnit));
UnitSetPropertyFixed(lv_createdUnit, c_unitPropLifeMax, UnitGetPropertyFixed(lv_creatingUnit, c_unitPropLifeMax, c_unitPropCurrent));
UnitSetPropertyFixed(lv_createdUnit, c_unitPropLife, UnitGetPropertyFixed(lv_creatingUnit, c_unitPropLife, c_unitPropCurrent));
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4685
for ( ; lv_iterPlayer <= auto1BAA646D_ae ; lv_iterPlayer += 1 ) {
if ((UnitIsValid(libGame_gv_players[lv_iterPlayer].lv_heroUnit) == true)) {
if ((UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit) > lv_highestXP)) {
lv_highestXP = UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4686
if ((UnitIsValid(libGame_gv_players[lv_iterPlayer].lv_heroUnit) == true)) {
if ((UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit) > lv_highestXP)) {
lv_highestXP = UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4743
}
lv_lowestXP = UnitXPTotal(libGame_gv_players[1].lv_heroUnit);
auto5C858753_ae = libCore_gv_bALMaxPlayers;
lv_iterPlayer = 1;
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4748
for ( ; lv_iterPlayer <= auto5C858753_ae ; lv_iterPlayer += 1 ) {
if ((UnitIsValid(libGame_gv_players[lv_iterPlayer].lv_heroUnit) == true)) {
if ((UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit) >= lv_highestXP)) {
lv_highestXP = UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit);
lv_highestXPUnit = libGame_gv_players[lv_iterPlayer].lv_heroUnit;
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4749
if ((UnitIsValid(libGame_gv_players[lv_iterPlayer].lv_heroUnit) == true)) {
if ((UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit) >= lv_highestXP)) {
lv_highestXP = UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit);
lv_highestXPUnit = libGame_gv_players[lv_iterPlayer].lv_heroUnit;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4753
}
if ((UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit) <= lv_lowestXP)) {
lv_lowestXP = UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit);
lv_lowestXPUnit = libGame_gv_players[lv_iterPlayer].lv_heroUnit;
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4754
if ((UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit) <= lv_lowestXP)) {
lv_lowestXP = UnitXPTotal(libGame_gv_players[lv_iterPlayer].lv_heroUnit);
lv_lowestXPUnit = libGame_gv_players[lv_iterPlayer].lv_heroUnit;
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4767
else {
libSprt_gv_dEBUGXPBoostEnable = true;
if ((UnitXPTotal(lv_highestXPUnit) > UnitXPTotal(lv_lowestXPUnit))) {
libSprt_gv_dEBUGXPBoostTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(lv_lowestXPUnit));
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:4767
else {
libSprt_gv_dEBUGXPBoostEnable = true;
if ((UnitXPTotal(lv_highestXPUnit) > UnitXPTotal(lv_lowestXPUnit))) {
libSprt_gv_dEBUGXPBoostTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(lv_lowestXPUnit));
}
mods/heromods/dva.stormmod — base.stormdata/LibHDVA.galaxy:1851
lv_dVaMech = EventUnit();
lv_dVaPilot = UnitCargo(lv_dVaMech, 1);
lv_mechXP = UnitXPTotal(lv_dVaMech);
lv_pilotXP = UnitXPTotal(lv_dVaPilot);
if ((lv_mechXP > lv_pilotXP)) {
mods/heromods/dva.stormmod — base.stormdata/LibHDVA.galaxy:1852
lv_dVaPilot = UnitCargo(lv_dVaMech, 1);
lv_mechXP = UnitXPTotal(lv_dVaMech);
lv_pilotXP = UnitXPTotal(lv_dVaPilot);
if ((lv_mechXP > lv_pilotXP)) {
UnitXPAddXP(lv_dVaPilot, null, EventUnitXPDelta());