# Wave Add Unit Priority
Grammar — Add unit unit to wave wave with priority priority|Prio
Flags —Native
|Action
Adds a unit to a wave with a priority.
# Arguments
wave
— Waveunit
— Unitint
— Priority
Returns — void
native void AIWaveAddUnitPriority(
wave w,
unit u,
int prio,
);
# Related
Category: AI Advanced / Waves / Actions
- Wave Add Info —
void
— AIWaveInfoAdd - Wave Info Attack —
int
— AIWaveInfoAttack - Wave Info Suicide —
int
— AIWaveInfoSuicide - Wave Add Unit —
void
— AIWaveAddUnit - Wave Add Unit Priority —
void
— AIWaveAddUnitPriority - Wave Remove Unit —
void
— AIWaveRemoveUnit - Wave Set Type —
void
— AIWaveSetType - Wave Delete —
void
— AIWaveDelete - Wave Target Add Waypoint —
void
— AIWaveTargetAddWaypoint - Wave Target Clear Waypoints —
void
— AIWaveTargetClearWaypoints - Wave Set —
void
— AIWaveSet - Wave Merge —
void
— AIWaveMerge
# Examples
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:324
if (AIWaveUnitCount(attackWave) >= 4) {
if (AIWaveDetectorCount(attackWave) == 0) {
AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
return;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:331
// next offer it to the defense wave
if (AIWaveDetectorCount(defendWave) == 0) {
AIWaveAddUnitPriority(defendWave, u, c_prioWavePeon);
return;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:345
if (AIWaveUnitCount(attackWave) >= 4) {
if (AIWaveDetectorCount(attackWave) < 2) {
AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
return;
}
mods/liberty.sc2mod — base.sc2data/TriggerLibs/Protoss/Protoss.galaxy:101
//
if (type == c_PU_WarpPrism) {
AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
return;
}
mods/liberty.sc2mod — base.sc2data/TriggerLibs/Terran/Terran.galaxy:136
}
AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
return;
}
mods/liberty.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:324
if (AIWaveUnitCount(attackWave) >= 4) {
if (AIWaveDetectorCount(attackWave) == 0) {
AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
return;
}
mods/starcoop/starcoop.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:345
if (AIWaveUnitCount(attackWave) >= 4) {
if (AIWaveDetectorCount(attackWave) < 2) {
AIWaveAddUnitPriority(attackWave, u, c_prioWavePeon);
return;
}
mods/swarm.sc2mod — base.sc2data/TriggerLibs/Protoss/Protoss.galaxy:110
//
if (type == c_PU_WarpPrism) {
AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
return;
}
mods/swarm.sc2mod — base.sc2data/TriggerLibs/Protoss/Protoss.galaxy:114
}
if (type == c_PU_MothershipCore) {
AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
return;
}
mods/swarm.sc2mod — base.sc2data/TriggerLibs/Terran/Terran.galaxy:142
}
AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
return;
}
mods/swarm.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/Protoss/Protoss.galaxy:119
//
if (type == c_PU_WarpPrism) {
AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
return;
}
mods/void.sc2mod — base.sc2data/TriggerLibs/Protoss/Protoss.galaxy:123
}
if (type == c_PU_MothershipCore) {
AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
return;
}
mods/void.sc2mod — base.sc2data/TriggerLibs/Terran/Terran.galaxy:148
}
AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
return;
}
mods/void.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/MeleeSC.galaxy:142
}
AIWaveAddUnitPriority(AIWaveGet(player, c_waveMain), u, c_prioWavePeon);
return;
}
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/Orc/Orc.galaxy:652
}
if (type == ZEPPLIN) {
AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
return;
}