# Order Is Valid

Grammarorder is valid for unit
FlagsNative | Function

Returns true if the order is valid for the specified unit.

# Arguments

  • unit — Unit
  • order — Order

Returns — bool

native bool UnitOrderIsValid(unit inUnit, order inOrder);

Category: Order / Order Properties

# Examples

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:19

    if (UnitCheckAbilCmdState(aiUnit, repaircmd, c_cmdStateIsAutoCast) == true) {
        ord = OrderSetAutoCast(repaircmd, false);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker,  c_castHold);
            return;

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:46

    int numActualThreatsInBarrage = 0;

    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:115

    bool enemyInBarrage = false;

    if (!UnitOrderIsValid(aiUnit, cancelOrd)) {
        return;
    }

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:174


    ord = AICreateOrder(player, c_AB_SpiderMine, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:234

    //
    ord = AICreateOrder(player, c_AB_LokiYamato, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:347


    ord = AICreateOrder(player, c_AB_QoBImplosion, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:357

    
        OrderSetTargetUnit(ord, unitToCheck);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker, c_castHold);
            return true;    

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:371


    ord = AICreateOrder(player, c_AB_QoBOmegaStorm, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:390


    OrderSetTargetPoint(ord, loc);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:428

    //
    ord = AICreateOrder(player, c_AB_BioPlasmidDischarge, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:471

    lp_candidates = AIGetFilterGroup(lv_snipeFilter, lp_candidates);
    lv_snipeOrder = OrderTargetingUnit(AbilityCommand("Snipe", 0), UnitGroupUnit(lp_candidates, 1));
    if ((UnitOrderIsValid(lp_ghost, lv_snipeOrder) == true)) {
        AICast(lp_ghost, lv_snipeOrder, lv_snipeMarker, false);
    }

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:471

    lp_candidates = AIGetFilterGroup(lv_snipeFilter, lp_candidates);
    lv_snipeOrder = OrderTargetingUnit(AbilityCommand("Snipe", 0), UnitGroupUnit(lp_candidates, 1));
    if ((UnitOrderIsValid(lp_ghost, lv_snipeOrder) == true)) {
        AICast(lp_ghost, lv_snipeOrder, lv_snipeMarker, false);
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:19

    if (UnitCheckAbilCmdState(aiUnit, repaircmd, c_cmdStateIsAutoCast) == true) {
        ord = OrderSetAutoCast(repaircmd, false);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker,  c_castHold);
            return;

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:46

    int numActualThreatsInBarrage = 0;

    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:115

    bool enemyInBarrage = false;

    if (!UnitOrderIsValid(aiUnit, cancelOrd)) {
        return;
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:174


    ord = AICreateOrder(player, c_AB_SpiderMine, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:234

    //
    ord = AICreateOrder(player, c_AB_LokiYamato, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:347


    ord = AICreateOrder(player, c_AB_QoBImplosion, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:357

    
        OrderSetTargetUnit(ord, unitToCheck);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker, c_castHold);
            return true;    

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:371


    ord = AICreateOrder(player, c_AB_QoBOmegaStorm, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:390


    OrderSetTargetPoint(ord, loc);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:428

    //
    ord = AICreateOrder(player, c_AB_BioPlasmidDischarge, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

campaigns/void.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:19

    if (UnitCheckAbilCmdState(aiUnit, repaircmd, c_cmdStateIsAutoCast) == true) {
        ord = OrderSetAutoCast(repaircmd, false);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker,  c_castHold);
            return;

campaigns/void.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:174


    ord = AICreateOrder(player, c_AB_SpiderMine, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

campaigns/void.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:837


    ord = AICreateOrder(player, c_AB_QueenMPEnsnare, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

campaigns/void.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:867


    OrderSetTargetPoint(ord, loc);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:227

//--------------------------------------------------------------------------------------------------
bool AICastStandard (unit aiUnit, order ord, marker mark, bool retreat) {
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:313

order AITacticalOrder (int player, unit aiUnit, string abilLink) {
    order ord = AICreateOrder(player, abilLink, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:324

order AITacticalOrderIndex (int player, unit aiUnit, string abilLink, int abilIndex) {
    order ord = AICreateOrder(player, abilLink, abilIndex);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:44

    // Do not proceed if the order is invalid for some reason
    ord = AICreateOrder(player, c_AB_ForceField, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:159


    OrderSetTargetPoint(ord, forceFieldTarget);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:195


    ord = AICreateOrder(player, c_AB_Hallucinate_VoidRay, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:206

    if (AINearbyUnits(player, c_PU_Colossus, here, 10, 1)) {
        ord = AICreateOrder(player, c_AB_Hallucinate_Colossus, 0);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker, c_castHold);
            return true;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:213

    if (AINearbyUnits(player, c_PU_Archon, here, 10, 1)) {
        ord = AICreateOrder(player, c_AB_Hallucinate_Archon, 0);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker, c_castHold);
            return true;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:223

        if (onGround > 1) {
            ord = AICreateOrder(player, c_AB_Hallucinate_Immortal, 0);
            if (UnitOrderIsValid(aiUnit, ord)) {
                AICast(aiUnit, ord, c_noMarker, c_castHold);
                return true;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:231


    ord = AICreateOrder(player, c_AB_Hallucinate_Stalker, 0);
    if (UnitOrderIsValid(aiUnit, ord)) {
        AICast(aiUnit, ord, c_noMarker, c_castHold);
        return true;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:251


    ord = AICreateOrder(player, c_AB_GuardianShield, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:476


    ord = AICreateOrder(player, c_AB_CorePhotonOvercharge, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:501

        
        OrderSetTargetUnit(ord, unitToCheck);
        if (!UnitOrderIsValid(aiUnit, ord)) {
            continue;
        }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:39


    ord = AICreateOrder(player, c_AB_250mmStrikeCannons, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:111


    ord = AICreateOrder(player, c_AB_Bombardment, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:151

    int loop = 0;

    if (!UnitOrderIsValid(aiUnit, cancelOrd)) {
        return;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:207


    ord = AICreateOrder(player, c_AB_Snipe, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    } 

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:262


    ord = AICreateOrder(player, c_AB_SteadyTargeting, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:371

    //
    ord = AICreateOrder(player, c_AB_KD8Charge, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:389

    //
    OrderSetTargetUnit(ord, target);
    if (UnitOrderIsValid(aiUnit, ord)) {
        return ord;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:450

    //
    ord = AICreateOrder(player, c_AB_Yamato, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:491

    //  See if this spell can be cast at all.
    ord = AICreateOrder(player, c_AB_TacticalJump, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:526

    
    OrderSetTargetPoint(ord, targetPoint);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:23


    ord = AICreateOrder(player, c_AB_Transfusion, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:59


    ord = AICreateOrder(player, c_AB_SpawnMutantLarva, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:101


    ord = AICreateOrder(player, c_AB_QueenBuild, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:112


    OrderSetTargetPlacement(ord, p, aiUnit, c_ZB_CreepTumor);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:165

    
    ord = AICreateOrder(player, c_AB_CreepTumorBuild, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:176


    OrderSetTargetPlacement(ord, p, aiUnit, c_ZB_CreepTumor);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:212


    ord = AICreateOrder(player, c_AB_ViperBlindingCloud, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:237


    OrderSetTargetPoint(ord, loc);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:254


    ord = AICreateOrder(player, c_AB_ViperAbduct, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:304


    ord = AICreateOrder(player, c_AB_ParasiticBomb, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

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

    }

    if ((UnitOrderIsValid(lv_heroUnit, lv_order) == false) && (lv_cmd != null)) {
        return true;
    }

mods/novastoryassets.sc2modbase2.sc2maps/maps/campaign/nova/nova04.sc2map/MapScript.galaxy:1072

            for ( ; ( (auto10F83F74_ai >= 0 && lv_y <= auto10F83F74_ae) || (auto10F83F74_ai < 0 && lv_y >= auto10F83F74_ae) ) ; lv_y += auto10F83F74_ai ) {
                lv_crawlerCheckPoint = Point((PointGetX(lv_roundedCrawlerLocation) + lv_x), (PointGetY(lv_roundedCrawlerLocation) + lv_y));
                if ((UnitOrderIsValid(lp_sporeCrawler, OrderTargetingPoint(AbilityCommand("SporeCrawlerRoot", 0), lv_crawlerCheckPoint)) == true)) {
                    if ((lv_closestValidCrawlerLocation == null)) {
                        lv_closestValidCrawlerLocation = lv_crawlerCheckPoint;

mods/novastoryassets.sc2modbase3.sc2maps/maps/campaign/nova/nova09.sc2map/MapScript.galaxy:1105


    // Implementation
    if ((UnitOrderIsValid(lp_ghostAcademy, Order(AbilityCommand("ArmSiloWithNuke", 0))) == true)) {
        libNtve_gf_AICast(lp_ghostAcademy, Order(AbilityCommand("ArmSiloWithNuke", 0)));
    }

mods/novastoryassets.sc2mod/base2.sc2maps/maps/campaign/nova/nova04.sc2mapMapScript.galaxy:1072

            for ( ; ( (auto10F83F74_ai >= 0 && lv_y <= auto10F83F74_ae) || (auto10F83F74_ai < 0 && lv_y >= auto10F83F74_ae) ) ; lv_y += auto10F83F74_ai ) {
                lv_crawlerCheckPoint = Point((PointGetX(lv_roundedCrawlerLocation) + lv_x), (PointGetY(lv_roundedCrawlerLocation) + lv_y));
                if ((UnitOrderIsValid(lp_sporeCrawler, OrderTargetingPoint(AbilityCommand("SporeCrawlerRoot", 0), lv_crawlerCheckPoint)) == true)) {
                    if ((lv_closestValidCrawlerLocation == null)) {
                        lv_closestValidCrawlerLocation = lv_crawlerCheckPoint;

mods/novastoryassets.sc2mod/base3.sc2maps/maps/campaign/nova/nova09.sc2mapMapScript.galaxy:1105


    // Implementation
    if ((UnitOrderIsValid(lp_ghostAcademy, Order(AbilityCommand("ArmSiloWithNuke", 0))) == true)) {
        libNtve_gf_AICast(lp_ghostAcademy, Order(AbilityCommand("ArmSiloWithNuke", 0)));
    }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:3588

    for ( ; ( (auto8C1B49B3_ai >= 0 && lv_i <= auto8C1B49B3_ae) || (auto8C1B49B3_ai < 0 && lv_i >= auto8C1B49B3_ae) ) ; lv_i += auto8C1B49B3_ai ) {
        lv_order = Order(AbilityCommand(lp_learnAbility, lv_i));
        if ((UnitOrderIsValid(lp_hero, lv_order) == true)) {
            return true;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:14029

        }

        if (!((UnitOrderIsValid(lv_caster, OrderSetAutoCast(AbilityCommand("ObserverTargetLock", 0), true)) == false))) {
            return false;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:14076

        }

        if (!((UnitOrderIsValid(lv_caster, OrderSetAutoCast(AbilityCommand("RavenTargetLock", 0), true)) == false))) {
            return false;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:14250

        lv_i = 1;
        for ( ; ( (autoD4B71CE1_ai >= 0 && lv_i <= autoD4B71CE1_ae) || (autoD4B71CE1_ai < 0 && lv_i >= autoD4B71CE1_ae) ) ; lv_i += autoD4B71CE1_ai ) {
            if ((UnitOrderIsValid(lv_u, lv_order) == true)) {
                UnitIssueOrder(lv_u, lv_order, c_orderQueueAddToEnd);
            }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:14353

    UnitCreate(1, libCOMI_gv_supplicantWarpTrainCreatorUnitLink, c_unitCreateIgnorePlacement, lv_player, lv_p, 270.0);
    lv_actualCreator = UnitLastCreated();
    if ((UnitOrderIsValid(lv_actualCreator, lv_order1) == false) && (UnitOrderIsValid(lv_actualCreator, lv_order2) == false)) {
        UnitAbilityAddChargeUsed(lv_warpGate, libCOMI_gv_warpGateTrainAbility, "WarpGateTrain", -1.0);
        UnitRemove(lv_actualCreator);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:14353

    UnitCreate(1, libCOMI_gv_supplicantWarpTrainCreatorUnitLink, c_unitCreateIgnorePlacement, lv_player, lv_p, 270.0);
    lv_actualCreator = UnitLastCreated();
    if ((UnitOrderIsValid(lv_actualCreator, lv_order1) == false) && (UnitOrderIsValid(lv_actualCreator, lv_order2) == false)) {
        UnitAbilityAddChargeUsed(lv_warpGate, libCOMI_gv_warpGateTrainAbility, "WarpGateTrain", -1.0);
        UnitRemove(lv_actualCreator);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:24114

        lv_cmd = TechTreeUnitProducedAbilCmd(lv_ut, lv_i);
        lv_order = Order(lv_cmd);
        if ((UnitOrderIsValid(lv_sCV, lv_order) == false)) {
            continue;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:24121

        OrderSetFlag(lv_order, c_cmdSmartClick, true);
        OrderSetFlag(lv_order, c_cmdQueued, lv_isQueuedOrder);
        if ((UnitOrderIsValid(lv_sCV, lv_order) == true)) {
            UnitIssueOrder(lv_sCV, lv_order, c_orderQueueReplace);
            return true;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:24185

        lv_cmd = TechTreeUnitProducedAbilCmd(lv_ut, lv_i);
        lv_order = Order(lv_cmd);
        if ((UnitOrderIsValid(lv_sCV, lv_order) == false)) {
            continue;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMI.galaxy:24191

        lv_order = OrderTargetingUnit(lv_cmd, lv_target);
        OrderSetFlag(lv_order, c_cmdSmartClick, true);
        if ((UnitOrderIsValid(lv_sCV, lv_order) == true)) {
            UnitIssueOrder(lv_sCV, lv_order, c_orderQueueAddToFront);
            return true;

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


    // Implementation
    if (((UnitGroupCount(lp_nearByUnits, c_unitCountAlive) <= 0) || (UnitOrderIsValid(lp_aIUnit, Order(AbilityCommand("MutatorAmonTychusTossGrenade", 0))) == false) || (UnitAbilityGetCooldown(lp_aIUnit, "MutatorAmonTychusTossGrenade", "Abil/MutatorAmonTychusTossGrenade") > 0.0) || (UnitOrderHasAbil(lp_aIUnit, "MutatorAmonTychusTossGrenade") == true))) {
        return ;
    }

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

    AISetFilterBits(lv_enemyNearbyFilter, UnitFilter((1 << c_targetFilterVisible), 0, (1 << c_targetFilterAir) | (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile) | (1 << c_targetFilterBuried), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterHallucination - 32)) | (1 << (c_targetFilterInvulnerable - 32))));
    lv_enemyUnitsNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    if (((UnitGroupCount(lv_enemyUnitsNearby, c_unitCountAlive) <= 0) || (UnitOrderIsValid(lp_aIUnit, Order(AbilityCommand("MutatorAmonRaynorSnipe", 0))) == false) || (UnitAbilityGetCooldown(lp_aIUnit, "MutatorAmonRaynorSnipe", "Abil/MutatorAmonRaynorSnipe") > 0.0) || (UnitOrderHasAbil(lp_aIUnit, "MutatorAmonRaynorSnipe") == true))) {
        return ;
    }

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

                    lv_commandIndex = 0;
                    for ( ; ( (auto0A9E56CE_ai >= 0 && lv_commandIndex <= auto0A9E56CE_ae) || (auto0A9E56CE_ai < 0 && lv_commandIndex >= auto0A9E56CE_ae) ) ; lv_commandIndex += auto0A9E56CE_ai ) {
                        if ((AbilityCommand(lv_structureAbility, lv_commandIndex) != null) && (UnitCheckAbilCmdState(lv_indexStructure, AbilityCommand(lv_structureAbility, lv_commandIndex), c_cmdStateDisabled) == false) && (UnitCheckAbilCmdState(lv_indexStructure, AbilityCommand(lv_structureAbility, lv_commandIndex), c_cmdStateHidden) == false) && (UnitOrderIsValid(lv_indexStructure, Order(AbilityCommand(lv_structureAbility, lv_commandIndex))) == true)) {
                            lv_commandCount += 1;
                        }

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

                    lv_commandIndex = 0;
                    for ( ; ( (autoE331E288_ai >= 0 && lv_commandIndex <= autoE331E288_ae) || (autoE331E288_ai < 0 && lv_commandIndex >= autoE331E288_ae) ) ; lv_commandIndex += autoE331E288_ai ) {
                        if ((AbilityCommand(lv_structureAbility, lv_commandIndex) != null) && (UnitCheckAbilCmdState(lv_indexStructure, AbilityCommand(lv_structureAbility, lv_commandIndex), c_cmdStateDisabled) == false) && (UnitCheckAbilCmdState(lv_indexStructure, AbilityCommand(lv_structureAbility, lv_commandIndex), c_cmdStateHidden) == false) && (UnitOrderIsValid(lv_indexStructure, Order(AbilityCommand(lv_structureAbility, lv_commandIndex))) == true)) {
                            lv_commandCount -= 1;
                            if ((lv_commandCount == 0)) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:52

	
	OrderSetTargetPoint(ord, loc);
	if (!UnitOrderIsValid(aiUnit,ord)) {
		return null;
	}

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:70

	
	ord = AICreateOrder(player, c_AB_DefilerDarkSwarm, 0);
	if (!UnitOrderIsValid(aiUnit, ord)) {
		return null;
	}

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:98


    OrderSetTargetPoint(ord, loc);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:163


    ord = AICreateOrder(player, c_AB_QueenClassicParasite, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:213


    ord = AICreateOrder(player, c_AB_QueenMPEnsnare, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:243


    OrderSetTargetPoint(ord, loc);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:264


    ord = AICreateOrder(player, c_AB_QueenMPSpawnBroodlings, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:369

    if (UnitCheckAbilCmdState(aiUnit, repaircmd, c_cmdStateIsAutoCast) == true) {
        ord = OrderSetAutoCast(repaircmd, false);
        if (UnitOrderIsValid(aiUnit, ord)) {
            AICast(aiUnit, ord, c_noMarker,  c_castHold);
            return;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:396

    int numActualThreatsInBarrage = 0;
	
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:465

    bool enemyInBarrage = false;

    if (!UnitOrderIsValid(aiUnit, cancelOrd)) {
        return;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:227

//--------------------------------------------------------------------------------------------------
bool AICastStandard (unit aiUnit, order ord, marker mark, bool retreat) {
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:313

order AITacticalOrder (int player, unit aiUnit, string abilLink) {
    order ord = AICreateOrder(player, abilLink, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:324

order AITacticalOrderIndex (int player, unit aiUnit, string abilLink, int abilIndex) {
    order ord = AICreateOrder(player, abilLink, abilIndex);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:45

    // Do not proceed if the order is invalid for some reason
    ord = AICreateOrder(player, c_AB_ForceField, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:161


    OrderSetTargetPoint(ord, forceFieldTarget);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:253


    ord = AICreateOrder(player, c_AB_GuardianShield, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return false;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:477


    ord = AICreateOrder(player, c_AB_CorePhotonOvercharge, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:494

        
        OrderSetTargetUnit(ord, unitToCheck);
        if (!UnitOrderIsValid(aiUnit, ord)) {
            continue;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:539

    // Do not proceed if the order is invalid for some reason
    ord = AICreateOrder(player, c_AB_TimeWarp, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:567


    OrderSetTargetPoint(ord, targetPoint);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:589

    //  See if this spell can be cast at all.
    ord = AICreateOrder(player, c_AB_CoreMassRecall, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:619

    
    OrderSetTargetUnit(ord, targetUnit);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;
    }