# Unit Gains Experience
Grammar — u gains experience
Flags —Native
|Event
This event fires when a unit gains experience. Use “Triggering Behavior” to get the behavior. Use “Triggering Experience Gained” to get the amount of experience. Use “Triggering Player” to get the owner of the unit that gained experience. Use “Triggering Unit” to get the unit that gained experience.
# Arguments
unitref
<unit> — Unit
Returns — void
native void TriggerAddEventUnitGainExperience(
trigger t,
unitref u,
);
# Event parameters
- Triggering Behavior — EventUnitBehavior
- Triggering Game User — EventGameUser
- Triggering Player — EventPlayer
- Triggering Unit — EventUnit
- Triggering Victim Unit — EventUnitVictimUnit
- Triggering Item Used — EventUnitItemUsed
- Triggering Effect Used — EventUnitEffectUsed
- Triggering Experience Gained — EventUnitXPDelta
# 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:13601
libGDHL_gt_HeroLostVikingsXPGain = TriggerCreate("libGDHL_gt_HeroLostVikingsXPGain_Func");
TriggerEnable(libGDHL_gt_HeroLostVikingsXPGain, false);
TriggerAddEventUnitGainExperience(libGDHL_gt_HeroLostVikingsXPGain, null);
}
mods/heromods/dva.stormmod — base.stormdata/LibHDVA.galaxy:1864
void libHDVA_gt_DEBUGDVaXPEqualizer_Init () {
libHDVA_gt_DEBUGDVaXPEqualizer = TriggerCreate("libHDVA_gt_DEBUGDVaXPEqualizer_Func");
TriggerAddEventUnitGainExperience(libHDVA_gt_DEBUGDVaXPEqualizer, null);
}