# Enable/Disable Experience Gain For Unit
Grammar — enable|Enable/Disable behavior experience gain for unit
Flags —Native
|Action
Enables or disables experience gain for the specified unit.
# Arguments
unit
— Unitstring
<gamelink::Behavior> — Behaviorbool
<preset::Enable_Disable_Option> — Enable
Returns — void
native void UnitXPGainEnable(
unit inUnit,
string inBehavior,
bool inEnable,
);
# 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/StartingExperienceLib.galaxy:1290
for ( ; ( (autoA8B89EDC_ai >= 0 && lv_indexPlayer <= autoA8B89EDC_ae) || (autoA8B89EDC_ai < 0 && lv_indexPlayer >= autoA8B89EDC_ae) ) ; lv_indexPlayer += autoA8B89EDC_ai ) {
if ((libGame_gv_players[lv_indexPlayer].lv_heroUnit != null)) {
UnitXPGainEnable(libGame_gv_players[lv_indexPlayer].lv_heroUnit, null, true);
}