# Wave Add Unit

Grammar — Add unit unit to wave wave
FlagsNative | Action

Adds a unit to a wave.

# Arguments

  • wave — Wave
  • unit — Unit

Returns — void

native void AIWaveAddUnit(wave w, unit u);

Category: AI Advanced / Waves / Actions

# Examples

mods/core.sc2modbase.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.sc2modbase.sc2data/LibCOMU.galaxy:2123

            Wait(0.5, c_timeAI);
            AISetUnitScriptControlled(lp_aIUnit, false);
            AIWaveAddUnit(lv_wave, lp_aIUnit);
            return ;
        }

mods/starcoop/starcoop.sc2modbase.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.sc2modbase.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.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:4029

    }

    AIWaveAddUnit(lv_attackwave, EventUnitCreatedUnit());
    return true;
}