# Number Of Behaviors On Unit

Grammar — Number of behaviors on unit
FlagsNative | Function

Returns the number of behaviors on a unit.

# Arguments

  • unit — Unit

Returns — int

native int UnitBehaviorCountAll(unit inUnit);

Category: Behavior / Basic

# Examples

mods/heroesdata.stormmodbase.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.stormmodbase.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.stormmodbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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")) {