# Wave Add Unit
Grammar — Add unit unit to wave wave
Flags —Native
|Action
Adds a unit to a wave.
# Arguments
wave
— Waveunit
— Unit
Returns — void
native void AIWaveAddUnit(wave w, unit u);
# 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:257
void AIMergeUnit (int player, unit u, wave w) {
wave merge = AIWaveCreate(AIWaveInfoCreate(), player, AIGetGatherLocation(player, c_townMain));
AIWaveAddUnit(merge, u);
AIWaveSetType(merge, c_waveStateMerge, AIWaveTargetMerge(w));
}
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMU.galaxy:2123
Wait(0.5, c_timeAI);
AISetUnitScriptControlled(lp_aIUnit, false);
AIWaveAddUnit(lv_wave, lp_aIUnit);
return ;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:257
void AIMergeUnit (int player, unit u, wave w) {
wave merge = AIWaveCreate(AIWaveInfoCreate(), player, AIGetGatherLocation(player, c_townMain));
AIWaveAddUnit(merge, u);
AIWaveSetType(merge, c_waveStateMerge, AIWaveTargetMerge(w));
}
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:2896
if (auto36E4A908_var == null) { break; }
AISetUnitScriptControlled(auto36E4A908_var, false);
AIWaveAddUnit(lv_enemywave, auto36E4A908_var);
}
AIWaveSetType(lv_enemywave, c_waveAttack, lp_attackTarget);
mods/warcoop/warcoopdata.sc2mod — base.sc2data/TriggerLibs/WarCoopData.galaxy:4029
}
AIWaveAddUnit(lv_attackwave, EventUnitCreatedUnit());
return true;
}