# Unit Behavior

Grammarunit behavior index
FlagsNative | Function

Returns the behavior at the specified index on the specified unit.

# Arguments

  • unit — Unit
  • int — Index

Returns — string<gamelink::Behavior>

native string UnitBehaviorGet(unit inUnit, int inIndex);

Category: Behavior / Basic

# Examples

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:11730

        lv_itBehavior = 1;
        for ( ; lv_itBehavior <= auto70A8A24D_ae ; lv_itBehavior += 1 ) {
            if ((UnitBehaviorHasCategoryFlag(UnitBehaviorGet(lv_itHeroUnit, lv_itBehavior), c_behaviorCategoryQuest) == true)) {
                lv_removedBehavior = UnitBehaviorGet(lv_itHeroUnit, lv_itBehavior);
                UnitBehaviorRemove(lv_itHeroUnit, lv_removedBehavior, 1);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:11731

        for ( ; lv_itBehavior <= auto70A8A24D_ae ; lv_itBehavior += 1 ) {
            if ((UnitBehaviorHasCategoryFlag(UnitBehaviorGet(lv_itHeroUnit, lv_itBehavior), c_behaviorCategoryQuest) == true)) {
                lv_removedBehavior = UnitBehaviorGet(lv_itHeroUnit, lv_itBehavior);
                UnitBehaviorRemove(lv_itHeroUnit, lv_removedBehavior, 1);
                UnitBehaviorAdd(lv_itHeroUnit, lv_removedBehavior, lv_itHeroUnit, 1);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/HeroesLib.galaxy:2953

    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);
        if ((CatalogFieldValueGetAsInt(c_gameCatalogBehavior, lv_behavior, "BehaviorFlags[" + IntToString(0) + "]", c_playerAny) != 1)) {
            lv_behaviorsToBeRemovedCount += 1;

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/SupportLib.galaxy:1711

        lv_itBehavior = 1;
        for ( ; ( (auto4FF55E2E_ai >= 0 && lv_itBehavior <= auto4FF55E2E_ae) || (auto4FF55E2E_ai < 0 && lv_itBehavior >= auto4FF55E2E_ae) ) ; lv_itBehavior += auto4FF55E2E_ai ) {
            lv_tokenBehavior = UnitBehaviorGet(lv_itSelectedUnit, lv_itBehavior);
            if ((CatalogFieldValueGet(c_gameCatalogBehavior, lv_tokenBehavior, "BehaviorCategories[" + IntToString(c_behaviorCategoryQuest) + "]", lp_player) == "1") && (lv_tokenBehavior != "AlarakSadismToken")) {
                lv_tokensToAdd = lp_count;

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/LibCOMI.galaxy:3536

    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);
        if ((CatalogFieldValueGetAsInt(c_gameCatalogBehavior, lv_b, "BehaviorCategories[" + IntToString(c_unitBehaviorFlagFast) + "]", c_playerAny) == 1)) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1666

        lv_behaviorIndex = 1;
        for ( ; ( (auto85BE7A0C_ai >= 0 && lv_behaviorIndex <= auto85BE7A0C_ae) || (auto85BE7A0C_ai < 0 && lv_behaviorIndex >= auto85BE7A0C_ae) ) ; lv_behaviorIndex += auto85BE7A0C_ai ) {
            if (((UnitBehaviorGet(lp_killer, lv_behaviorIndex) == "") || (CatalogEntryScope(c_gameCatalogBehavior, UnitBehaviorGet(lp_killer, lv_behaviorIndex)) != "CBehaviorBuff"))) {
                continue;
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1666

        lv_behaviorIndex = 1;
        for ( ; ( (auto85BE7A0C_ai >= 0 && lv_behaviorIndex <= auto85BE7A0C_ae) || (auto85BE7A0C_ai < 0 && lv_behaviorIndex >= auto85BE7A0C_ae) ) ; lv_behaviorIndex += auto85BE7A0C_ai ) {
            if (((UnitBehaviorGet(lp_killer, lv_behaviorIndex) == "") || (CatalogEntryScope(c_gameCatalogBehavior, UnitBehaviorGet(lp_killer, lv_behaviorIndex)) != "CBehaviorBuff"))) {
                continue;
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1670

            }

            lv_creditor = CatalogFieldValueGet(c_gameCatalogBehavior, UnitBehaviorGet(lp_killer, lv_behaviorIndex), "KillCredit.Value", c_playerAny);
            if ((lv_creditor != "Unknown")) {
                auto09043CCB_val = lv_creditor;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1690

                else {
                }
                lv_actualKiller = UnitBehaviorEffectUnit(lp_killer, UnitBehaviorGet(lp_killer, lv_behaviorIndex), lv_creditorEffectUnit, 0);
                break;
            }

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:494

    lv_i = 1;
    for ( ; ( (autoCFB9FEA6_ai >= 0 && lv_i <= autoCFB9FEA6_ae) || (autoCFB9FEA6_ai < 0 && lv_i >= autoCFB9FEA6_ae) ) ; lv_i += autoCFB9FEA6_ai ) {
        lv_itBuff = UnitBehaviorGet(lv_caster, lv_i);
        lv_itStack = UnitBehaviorCount(lv_caster, lv_itBuff);
        lv_itStackExist = UnitBehaviorCount(lv_target, lv_itBuff);

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:502

    lv_i = 1;
    for ( ; ( (auto8D9AF44D_ai >= 0 && lv_i <= auto8D9AF44D_ae) || (auto8D9AF44D_ai < 0 && lv_i >= auto8D9AF44D_ae) ) ; lv_i += auto8D9AF44D_ai ) {
        lv_itBuff = UnitBehaviorGet(lv_caster, lv_i);
        if ((CatalogEntryScope(c_gameCatalogBehavior, lv_itBuff) == "CBehaviorAttribute")) {
            lv_itStack = UnitGetAttributePoint(lp_source, lv_itBuff, true);

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")) {

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicSystem.galaxy:1350

    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")) {
            lv_ug = UnitGetTrackedUnitGroup(lv_u, lv_itBehavior);