# Number Of Behaviors On Unit
Grammar — Number of behaviors on unit
Flags —Native
|Function
Returns the number of behaviors on a unit.
# Arguments
unit
— Unit
Returns — int
native int UnitBehaviorCountAll(unit inUnit);
# Related
Category: Behavior / Basic
- Remove Behaviors By Category —
void
— UnitBehaviorRemoveCategory - Remove Behavior (Player) —
void
— UnitBehaviorRemovePlayer - Remove Behavior —
void
— UnitBehaviorRemove - Add Behavior (Player) —
void
— UnitBehaviorAddPlayer - Add Behavior —
void
— UnitBehaviorAdd - Set Behavior Count —
void
— libNtve_gf_SetBehaviorCount - Number Of Behaviors On Unit —
int
— UnitBehaviorCountAll - Unit Behavior —
string
<gamelink::Behavior> — UnitBehaviorGet - Unit Has Behavior —
bool
— UnitHasBehavior2 - Unit Has Behavior (Enabled) —
bool
— UnitHasBehavior - Unit Behavior Enabled —
bool
— UnitBehaviorEnabled - Stack Count Of Behavior On Unit —
int
— UnitBehaviorCount - Behavior Has Flag —
bool
— UnitBehaviorHasFlag - Transfer Behavior —
void
— UnitBehaviorTransfer - Set Unit Behavior Duration —
void
— UnitBehaviorSetDuration - Set Unit Behavior Duration Remaining —
void
— UnitBehaviorSetDurationRemaining - Duration Remaining Of Behavior On Unit —
fixed
— UnitBehaviorDuration - Duration Of Behavior On Unit —
fixed
— UnitBehaviorDurationTotal - Set Unit Behavior Spawn Count —
void
— UnitBehaviorSpawn - Unit Behavior Effect Player —
int
— UnitBehaviorEffectPlayer - Unit Behavior Effect Unit —
unit
— UnitBehaviorEffectUnit - Set Unit Behavior User Data —
void
— UnitBehaviorEffectTreeSetUserData - User Data Of Behavior On Unit —
fixed
— UnitBehaviorEffectTreeUserData - User Data Of Behavior On Unit Exists —
bool
— UnitBehaviorEffectTreeUserDataExists - Unit Behavior Changes —
void
— TriggerAddEventUnitBehaviorChange - Unit Behavior Changes From Category —
void
— TriggerAddEventUnitBehaviorChangeFromCategory - Triggering Behavior —
string
<gamelink::Behavior> — EventUnitBehavior - Triggering Behavior Change —
int
<preset::BehaviorChange> — EventUnitBehaviorChange - Unit Behavior Damage Modify Remaining —
fixed
— UnitBehaviorDamageModifyRemaining - Unit Behavior Damage Modify Limit —
fixed
— UnitBehaviorDamageModifyLimit - For Each Behavior On Unit — macro
# Examples
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameLib.galaxy:11727
lv_itHeroUnit = UnitGroupUnitFromEnd(auto9DEBA187_g, auto9DEBA187_u);
if (lv_itHeroUnit == null) { break; }
auto70A8A24D_ae = UnitBehaviorCountAll(lv_itHeroUnit);
lv_itBehavior = 1;
for ( ; lv_itBehavior <= auto70A8A24D_ae ; lv_itBehavior += 1 ) {
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/HeroesLib.galaxy:2951
// Implementation
lv_itBehavior = UnitBehaviorCountAll(lp_targetUnit);
for ( ; ( (auto6DC7FEE5_ai >= 0 && lv_itBehavior <= auto6DC7FEE5_ae) || (auto6DC7FEE5_ai < 0 && lv_itBehavior >= auto6DC7FEE5_ae) ) ; lv_itBehavior += auto6DC7FEE5_ai ) {
lv_behavior = UnitBehaviorGet(lp_targetUnit, lv_itBehavior);
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/SupportLib.galaxy:1708
lv_itSelectedUnit = UnitGroupUnitFromEnd(auto3DF71D7D_g, auto3DF71D7D_u);
if (lv_itSelectedUnit == null) { break; }
auto4FF55E2E_ae = UnitBehaviorCountAll(lv_itSelectedUnit);
lv_itBehavior = 1;
for ( ; ( (auto4FF55E2E_ai >= 0 && lv_itBehavior <= auto4FF55E2E_ae) || (auto4FF55E2E_ai < 0 && lv_itBehavior >= auto4FF55E2E_ae) ) ; lv_itBehavior += auto4FF55E2E_ai ) {
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:3535
autoE98657EB_u = lp_parent;
autoE98657EB_i = 1;
for ( ; autoE98657EB_i <= UnitBehaviorCountAll(autoE98657EB_u) ; autoE98657EB_i += BoolToInt(lv_b == UnitBehaviorGet(autoE98657EB_u, autoE98657EB_i)) ) {
lv_b = UnitBehaviorGet(autoE98657EB_u, autoE98657EB_i);
lv_bstackcount = UnitBehaviorCount(lp_parent, lv_b);
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:1663
}
else {
auto85BE7A0C_ae = UnitBehaviorCountAll(lp_killer);
lv_behaviorIndex = 1;
for ( ; ( (auto85BE7A0C_ai >= 0 && lv_behaviorIndex <= auto85BE7A0C_ae) || (auto85BE7A0C_ai < 0 && lv_behaviorIndex >= auto85BE7A0C_ae) ) ; lv_behaviorIndex += auto85BE7A0C_ai ) {
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicSystem.galaxy:490
UnitLearnAbilAddLevel(lp_target, "War3_LearnHero", lv_i, lv_itLearnedLevel);
}
lv_c = UnitBehaviorCountAll(lv_caster);
autoCFB9FEA6_ae = lv_c;
lv_i = 1;
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicSystem.galaxy:1349
auto37CC6DB9_u = lv_u;
auto37CC6DB9_i = 1;
for ( ; auto37CC6DB9_i <= UnitBehaviorCountAll(auto37CC6DB9_u) ; auto37CC6DB9_i += BoolToInt(lv_itBehavior == UnitBehaviorGet(auto37CC6DB9_u, auto37CC6DB9_i)) ) {
lv_itBehavior = UnitBehaviorGet(auto37CC6DB9_u, auto37CC6DB9_i);
if ((CatalogEntryScope(c_gameCatalogBehavior, lv_itBehavior) == "CBehaviorUnitTracker")) {