# Unit Property (Int)
Grammar — u prop (current|Current/Default)
Flags —Native
|Function
Returns a unit property.
# Arguments
unit
— Unitint
<preset::Unit_Property> — Propertybool
<preset::CurrentDefaultOption> — Current
Returns — int
native int UnitGetPropertyInt(
unit inUnit,
int inProp,
bool inCurrent,
);
# Related
Category: Unit / Properties
- Unit Type Of Unit —
string
<gamelink::Unit> — UnitGetType - Unit Tag —
int
— UnitGetTag - Unit Seed —
int
— UnitGetSeed - Unit Property Changes —
void
— TriggerAddEventUnitProperty - Triggering Unit Property —
int
<preset::Unit_Property> — EventUnitProperty - Triggering Unit Property Change (Integer) —
int
— EventUnitPropertyChangeInt - Triggering Unit Property Change (Real) —
fixed
— EventUnitPropertyChangeFixed - Set Unit Property —
void
— UnitSetPropertyFixed - Set Unit State —
void
— UnitSetState - Set Unit Seed —
void
— UnitSetSeed - Reset Unit Seed —
void
— UnitResetSeed - Make Unit Invulnerable —
void
— libNtve_gf_MakeUnitInvulnerable - Make Unit Uncommandable —
void
— libNtve_gf_MakeUnitUncommandable - Unit Property —
fixed
— UnitGetPropertyFixed - Unit Property (Int) —
int
— UnitGetPropertyInt - Unit Type Property —
fixed
— UnitTypeGetProperty - Unit Classification Check —
bool
— UnitTestState - Unit Type Classification Check —
bool
— UnitTypeTestFlag - Unit Type Attribute Check —
bool
— UnitTypeTestAttribute - Unit Targetable Check —
bool
— UnitTestPlane - Unit Is Invulnerable —
bool
— libNtve_gf_UnitIsInvulnerable - Unit Kills —
int
— libNtve_gf_UnitGetPropertyKills - Unit Resources —
int
— libNtve_gf_UnitGetPropertyResources - Unit Attachment Point —
point
— UnitGetAttachmentPoint - Name Of Unit Type —
text
— UnitTypeGetName - Gender Code Of Unit Type —
string
— UnitTypeGetGenderCode - Unit Type Cost —
int
— UnitTypeGetCost - Unit Type Is Affected By Upgrade —
bool
— UnitTypeIsAffectedByUpgrade - Reset Movement Speed —
void
— UnitResetSpeed - Unit Uses Mover —
bool
— UnitMoverExists - Unit Type Uses Mover —
bool
— libNtve_gf_UnitMoverExists - Unit Type From String —
string
<gamelink::Unit> — UnitTypeFromString - Set Unit Color —
void
— UnitSetTeamColorIndex - Set Unit Info Button - Ability Tooltip —
void
— libNtve_gf_SetUnitInfoButtonAbilityTooltip - Set Unit Info Button - Button Tooltip —
void
— libNtve_gf_SetUnitInfoButtonButtonTooltip - Set Unit Info Button - Item Tooltip —
void
— libNtve_gf_SetUnitInfoButtonItemTooltip - Reset Unit Info Button - Ability Tooltip —
void
— libNtve_gf_ResetUnitInfoButtonAbilityTooltip - Reset Unit Info Button - Button Tooltip —
void
— libNtve_gf_ResetUnitInfoButtonButtonTooltip - Reset Unit Info Button - Item Tooltip —
void
— libNtve_gf_ResetUnitInfoButtonItemTooltip - Set Unit Command Button Tooltip —
void
— UnitSetInfoButtonTooltip - Reset Unit Command Button Tooltip —
void
— UnitClearInfoButtonTooltip - Set Unit Highlight Cursor —
void
— UnitSetCursor - Set Unit Ping Cursor —
void
— UnitSetPingCursor - Set Unit Info —
void
— UnitSetInfoText - Set Unit Info Text —
void
— UnitSetInfoText2 - Set Unit Info Tip —
void
— UnitSetInfoTip - Set Unit Info SubTip —
void
— UnitSetInfoSubTip - Clear Unit Info —
void
— UnitClearInfoText - Set Unit Status Bar State (Deprecated) —
void
— UnitForceStatusBar - Show Unit Status Bar —
void
— UnitStatusBarOverride - Hide Unit Status Bar —
void
— UnitStatusBarClearOverride - Set Unit Scale —
void
— UnitSetScale - Set Unit Model Variation —
void
— libNtve_gf_UnitSetVariation - Change Unit Height —
void
— UnitSetHeight - Height Of Unit —
fixed
— UnitGetHeight - Change Unit Damage —
void
— libNtve_gf_ChangeUnitDamage - Add On Child —
unit
— UnitAddOnChild - Add On Parent —
unit
— UnitAddOnParent
# Examples
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:300
// Defend against threats, unless we're almost done destroying the obstruction
obsLife = UnitGetPropertyInt(obstruction, c_unitPropLifePercent, c_unitPropCurrent);
if (obsLife > 15) {
if (AIDefenseThreat(c_dtRealThreat, player, w)) {
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:102
friendlyCount = friendlyCount - 1;
friendlyVit = UnitGetPropertyInt(friendlyUnit, c_unitPropVitalityPercent, c_unitPropCurrent);
if (friendlyVit < 20) {
bestTargetUnit = enemyUnit;
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:121
if (bestPrio == 0) {
// no dangerous melee units found, split large ranged groups if we have extra energy
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 125) {
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 40) {
// not about to die and won't have 75 energy left
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:122
// no dangerous melee units found, split large ranged groups if we have extra energy
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 125) {
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 40) {
// not about to die and won't have 75 energy left
return false;
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:188
// Save at least 70 energy for other spells, unless we're about to die
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 170) {
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 25) {
return false;
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:189
// Save at least 70 energy for other spells, unless we're about to die
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 170) {
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 25) {
return false;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:481
// if too few enemies rely on probes and the mothershipcore itself to defend
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < c_CoreLowVitalityPercent) {
minEnemies = 2;
} else {
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:897
}
lowVitality = (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < c_HighTemplarLowVitPerc);
mark = AIMarker(aiUnit, c_MK_Feedback);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1200
return null; // no enemies
}
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 50) {
return null; // not low health & too few enemies
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1612
return null;
}
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > c_AICarrierLowVitalityPercent) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1654
return null;
}
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 90) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1101
if (AISuspectDetectionDanger(player, c_lateDetectionDangerTime)) {
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) < 150) {
return; // save for two comsats
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1341
missleOrd = AITacticalOrder(player, aiUnit, c_AB_SeekerMissile);
if (missleOrd) {
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) < minToCastAutoTurret(player)) {
return false;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1440
}
lowVitality = UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < c_RavenLowVitalityPercent;
if (CastAutoTurret(player, aiUnit, scanGroup, lowVitality)) {
AISetCooldown(aiUnit, c_hsMissileCooldown, sharedCoolDown);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:96
// Save at least 25 energy for spawn larva
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 50) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:583
if (!lowVitality) {
// Reserve 50 leftover mana for neural parasite
energy = UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent);
if (energy < MinToCastInfestedTerrans(player) && !lowVitality) {
return null;
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:708
}
lowVitality = (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < infestorLowVitalityPercent);
// neural parasite
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1026
}
lowVitality = (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < corruptorLowVitalityPercent);
if (lowVitality) {
minVitality = corruptionUrgentMinVitality;
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1318
if (UnitTypeTestAttribute(UnitGetType(unitToCheck), c_unitAttributeStructure) == true) {
// don't target structures without weapons or is a farm (providing food without a lot of health)
isFarm = (UnitGetPropertyInt(unitToCheck, c_unitPropSuppliesMade, c_unitPropCurrent) > 0) &&
(UnitGetPropertyInt(unitToCheck, c_unitPropLife, c_unitPropCurrent) <= 400);
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1319
// don't target structures without weapons or is a farm (providing food without a lot of health)
isFarm = (UnitGetPropertyInt(unitToCheck, c_unitPropSuppliesMade, c_unitPropCurrent) > 0) &&
(UnitGetPropertyInt(unitToCheck, c_unitPropLife, c_unitPropCurrent) <= 400);
if ( (UnitWeaponCount(unitToCheck) == 0) && (isFarm == false) ) {
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:103
friendlyCount = friendlyCount - 1;
friendlyVit = UnitGetPropertyInt(friendlyUnit, c_unitPropVitalityPercent, c_unitPropCurrent);
if (friendlyVit < 20) {
bestTargetUnit = enemyUnit;
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:123
// no dangerous melee units found, split large ranged groups if we have extra energy
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 125) {
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 40) {
// not about to die and won't have 75 energy left
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:124
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 125) {
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 40) {
// not about to die and won't have 75 energy left
return false;
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:506
// if too few enemies rely on probes and the mothershipcore itself to defend
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < c_CoreLowVitalityPercent) {
minEnemies = 2;
} else {
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:869
}
lowVitality = (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < c_HighTemplarLowVitPerc);
if (lowVitality) {
if (MergeToSurvive(player, aiUnit, scanGroup)) {
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1159
return null; // no enemies
}
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 50) {
return null; // not low health & too few enemies
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1601
return null;
}
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > c_AICarrierLowVitalityPercent) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1643
return null;
}
if (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) > 90) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1084
if (AISuspectDetectionDanger(player, 60)) {
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) < 150) {
return; // save for two comsats
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1313
missleOrd = AITacticalOrder(player, aiUnit, c_AB_SeekerMissile);
if (missleOrd) {
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) < minToCastAutoTurret(player)) {
return false;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1393
}
lowVitality = UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < c_RavenLowVitalityPercent;
if (CastAutoTurret(player, aiUnit, scanGroup, lowVitality)) {
return;
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:97
// Save at least 25 energy for spawn larva
if (UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent) <= 50) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:794
if (!lowVitality && AIAlliedCommandWeakerHumanDifficulty() >= c_campAdvanced) {
// Reserve 50 leftover mana for neural parasite
energy = UnitGetPropertyInt(aiUnit, c_unitPropEnergy, c_unitPropCurrent);
if (energy < MinToCastInfestedTerrans(player) && !lowVitality) {
return null;
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:921
}
lowVitality = (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < infestorLowVitalityPercent);
// neural parasite
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:1235
}
lowVitality = (UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent) < corruptorLowVitalityPercent);
if (lowVitality) {
minVitality = corruptionUrgentMinVitality;
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:480
return;
}
if(UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent)<=30){
hold=c_castRetreat;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:549
return;
}
if(UnitGetPropertyInt(aiUnit, c_unitPropVitalityPercent, c_unitPropCurrent)<=30){
hold=c_castRetreat;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicSystem.galaxy:727
lv_itUnit = UnitGroupUnitFromEnd(auto5AF0B447_g, auto5AF0B447_u);
if (lv_itUnit == null) { break; }
lv_itUnitLevel = UnitGetPropertyInt(lv_itUnit, c_unitPropLevel, c_unitPropCurrent);
if ((lv_itUnitLevel == 0)) {
lv_itUnitLevel = CatalogFieldValueGetAsInt(c_gameCatalogUnit, UnitGetType(lv_itUnit), "Level", lv_itPlayer);
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/Common_ai.galaxy:93
for(;ui<=uc;ui+=1){
u=UnitGroupUnit(mines,ui);
amount+=UnitGetPropertyInt(u, c_unitPropResources, c_unitPropCurrent);
}
}
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:389
// Defend against threats, unless we're almost done destroying the obstruction
obsLife = UnitGetPropertyInt(obstruction, c_unitPropLifePercent, c_unitPropCurrent);
if (GAw3_AIThreatedByNonHostilePlayer(player) && obsLife > 20) {
AIDefendWithWave(player, w);