# Wave Add Unit Priority

Grammar — Add unit unit to wave wave with priority priority|Prio
FlagsNative | Action

Adds a unit to a wave with a priority.

# Arguments

  • wave — Wave
  • unit — Unit
  • int — Priority

Returns — void

native void AIWaveAddUnitPriority(
	wave w,
	unit u,
	int prio,
);

Category: AI Advanced / Waves / Actions

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:324

    if (AIWaveUnitCount(attackWave) >= 4) {
        if (AIWaveDetectorCount(attackWave) == 0) {
            AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
            return;
        }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:331

    // next offer it to the defense wave
    if (AIWaveDetectorCount(defendWave) == 0) {
        AIWaveAddUnitPriority(defendWave, u, c_prioWavePeon);
        return;
    }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:345

    if (AIWaveUnitCount(attackWave) >= 4) {
        if (AIWaveDetectorCount(attackWave) < 2) {
            AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
            return;
        }

mods/liberty.sc2modbase.sc2data/TriggerLibs/Protoss/Protoss.galaxy:101

    //
    if (type == c_PU_WarpPrism) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/liberty.sc2modbase.sc2data/TriggerLibs/Terran/Terran.galaxy:136

        }

        AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
        return;
    }

mods/liberty.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:109

    //
    if (type == c_ZB_SpineCrawler || type == c_ZB_SporeCrawler) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/liberty.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:115

        drop = AIGetDropoffWithFewestGuards(player, c_ZU_Queen);
        if (drop == c_nullUnit) {
            AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        }
        else {

mods/liberty.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:120

            w = AIWaveCreate(AIWaveInfoCreate(), player, AIWaveTargetGatherDPoint(player, c_townMain));
            AIWaveSetType(w, c_waveStateGuardHome, AIWaveTargetGuardHomeUnit(drop));
            AIWaveAddUnitPriority(w, u, c_prioWavePeon);
            AIWaveSetDeleteWhenEmpty(w, true);
        }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:324

    if (AIWaveUnitCount(attackWave) >= 4) {
        if (AIWaveDetectorCount(attackWave) == 0) {
            AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
            return;
        }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:331

    // next offer it to the defense wave
    if (AIWaveDetectorCount(defendWave) == 0) {
        AIWaveAddUnitPriority(defendWave, u, c_prioWavePeon);
        return;
    }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:345

    if (AIWaveUnitCount(attackWave) >= 4) {
        if (AIWaveDetectorCount(attackWave) < 2) {
            AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
            return;
        }

mods/swarm.sc2modbase.sc2data/TriggerLibs/Protoss/Protoss.galaxy:110

    //
    if (type == c_PU_WarpPrism) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/swarm.sc2modbase.sc2data/TriggerLibs/Protoss/Protoss.galaxy:114

    }
    if (type == c_PU_MothershipCore) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/swarm.sc2modbase.sc2data/TriggerLibs/Terran/Terran.galaxy:142

        }

        AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
        return;
    }

mods/swarm.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:115

    //
    if (type == c_ZB_SpineCrawler || type == c_ZB_SporeCrawler) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/swarm.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:121

        drop = AIGetDropoffWithFewestGuards(player, c_ZU_Queen);
        if (drop == c_nullUnit) {
            AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        }
        else {

mods/swarm.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:126

            w = AIWaveCreate(AIWaveInfoCreate(), player, AIWaveTargetGatherDPoint(player, c_townMain));
            AIWaveSetType(w, c_waveStateGuardHome, AIWaveTargetGuardHomeUnit(drop));
            AIWaveAddUnitPriority(w, u, c_prioWavePeon);
            AIWaveSetDeleteWhenEmpty(w, true);
        }

mods/void.sc2modbase.sc2data/TriggerLibs/Protoss/Protoss.galaxy:119

    //
    if (type == c_PU_WarpPrism) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/void.sc2modbase.sc2data/TriggerLibs/Protoss/Protoss.galaxy:123

    }
    if (type == c_PU_MothershipCore) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/void.sc2modbase.sc2data/TriggerLibs/Terran/Terran.galaxy:148

        }

        AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
        return;
    }

mods/void.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:121

    //
    if (type == c_ZB_SpineCrawler || type == c_ZB_SporeCrawler) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }

mods/void.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:127

        drop = AIGetDropoffWithFewestGuards(player, c_ZU_Queen);
        if (drop == c_nullUnit) {
            AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        }
        else {

mods/void.sc2modbase.sc2data/TriggerLibs/Zerg/Zerg.galaxy:132

            w = AIWaveCreate(AIWaveInfoCreate(), player, AIWaveTargetGatherDPoint(player, c_townMain));
            AIWaveSetType(w, c_waveStateGuardHome, AIWaveTargetGuardHomeUnit(drop));
            AIWaveAddUnitPriority(w, u, c_prioWavePeon);
            AIWaveSetDeleteWhenEmpty(w, true);
        }

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeSC.galaxy:142

        }

        AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
        return;
    }

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/Orc/Orc.galaxy:652

    }
    if (type == ZEPPLIN) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }