# Damage Unit (From Unit)

Grammar — Deal damage using effect on victim from attacker with bonus extra damage
FlagsNative | Action

Deals damage targeting the specified victim, as if it was dealt by the specified attacker unit.

# Arguments

  • unit — Attacker
  • string<gamelink::Effect> — Effect
  • unit — Victim
  • fixed — Bonus

Returns — void

native void UnitDamage(
	unit inAttacker,
	string inEffect,
	unit inVictim,
	fixed inBonus,
);

Category: Environment / Effects

# Examples

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/evolution/zevolutionultralisk.sc2map/MapScript.galaxy:1189

    while (!UnitGroupLoopDone()) {
        if ((UnitGetPropertyFixed(UnitGroupLoopCurrent(), c_unitPropLife, c_unitPropCurrent) <= gv_gasDamage_Terran)) {
            UnitDamage(UnitGroupLoopCurrent(), "PoisonNovaDirectDamage", UnitGroupLoopCurrent(), 0.0);
        }
        else {

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/evolution/zevolutionultralisk.sc2mapMapScript.galaxy:1189

    while (!UnitGroupLoopDone()) {
        if ((UnitGetPropertyFixed(UnitGroupLoopCurrent(), c_unitPropLife, c_unitPropCurrent) <= gv_gasDamage_Terran)) {
            UnitDamage(UnitGroupLoopCurrent(), "PoisonNovaDirectDamage", UnitGroupLoopCurrent(), 0.0);
        }
        else {

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/paiur01.sc2map/MapScript.galaxy:6459

        autoC38DB271_var = UnitGroupUnitFromEnd(autoC38DB271_g, autoC38DB271_u);
        if (autoC38DB271_var == null) { break; }
        UnitDamage(gv_introMothership, "PurifierPlanetCrackerDamage", autoC38DB271_var, 500.0);
    }
    CameraShake(gv_pLAYER_01_USER, "Heavy", "Earthquake", 0.0, 1.0, 3.0);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/paiur01.sc2mapMapScript.galaxy:6459

        autoC38DB271_var = UnitGroupUnitFromEnd(autoC38DB271_g, autoC38DB271_u);
        if (autoC38DB271_var == null) { break; }
        UnitDamage(gv_introMothership, "PurifierPlanetCrackerDamage", autoC38DB271_var, 500.0);
    }
    CameraShake(gv_pLAYER_01_USER, "Heavy", "Earthquake", 0.0, 1.0, 3.0);

mods/heroes.stormmodbase.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmap/MapScript.galaxy:1914

    libStEx_gf_MoveUnit(libStEx_gv_hERO_PlayerUnit, PointFromId(1120), false);
    libStEx_gf_MoveUnit(libStEx_gv_hERO_EnemyGreymane, PointFromId(17), false);
    UnitDamage(libStEx_gv_hERO_PlayerUnit, "CleaveDamage", libStEx_gv_hERO_EnemyGreymane, 2000.0);
    Wait(5.0, c_timeGame);
    libStEx_gf_MoveUnit(libStEx_gv_hERO_PlayerUnit, PointFromId(276870261), false);

mods/heroes.stormmodbase.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmap/MapScript.galaxy:1918

    libStEx_gf_MoveUnit(libStEx_gv_hERO_PlayerUnit, PointFromId(276870261), false);
    libStEx_gf_MoveUnit(libStEx_gv_hERO_EnemyNazeebo, PointFromId(729), false);
    UnitDamage(libStEx_gv_hERO_PlayerUnit, "CleaveDamage", libStEx_gv_hERO_EnemyNazeebo, 2000.0);
    Wait(5.0, c_timeGame);
    PlayerGroupAdd(lv_orderPlayerGroup, libStEx_gv_pLAYER_01_USER);

mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmapMapScript.galaxy:1914

    libStEx_gf_MoveUnit(libStEx_gv_hERO_PlayerUnit, PointFromId(1120), false);
    libStEx_gf_MoveUnit(libStEx_gv_hERO_EnemyGreymane, PointFromId(17), false);
    UnitDamage(libStEx_gv_hERO_PlayerUnit, "CleaveDamage", libStEx_gv_hERO_EnemyGreymane, 2000.0);
    Wait(5.0, c_timeGame);
    libStEx_gf_MoveUnit(libStEx_gv_hERO_PlayerUnit, PointFromId(276870261), false);

mods/heroes.stormmod/base.stormmaps/maps/heroes/singleplayermaps/startingexperience/tutorialveteran.stormmapMapScript.galaxy:1918

    libStEx_gf_MoveUnit(libStEx_gv_hERO_PlayerUnit, PointFromId(276870261), false);
    libStEx_gf_MoveUnit(libStEx_gv_hERO_EnemyNazeebo, PointFromId(729), false);
    UnitDamage(libStEx_gv_hERO_PlayerUnit, "CleaveDamage", libStEx_gv_hERO_EnemyNazeebo, 2000.0);
    Wait(5.0, c_timeGame);
    PlayerGroupAdd(lv_orderPlayerGroup, libStEx_gv_pLAYER_01_USER);

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:18097


    if ((UnitIsValid(libGame_gv_teams[libGame_gf_EnemyTeamNumberOfPlayer(lv_imageOwner)].lv_core) == true)) {
        UnitDamage(libGame_gv_teams[libGame_gf_EnemyTeamNumberOfPlayer(lv_imageOwner)].lv_core, "HeroGenericFakeHeroDuplicationDamage", lv_image, lv_damage);
    }
    else {

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:18100

    }
    else {
        UnitDamage(lv_caster, "HeroGenericFakeHeroDuplicationDamage", lv_image, lv_damage);
    }
    return true;

mods/heromods/samuro.stormmodbase.stormdata/LibHSAM.galaxy:1370


    if ((UnitIsValid(libGame_gv_teams[libGame_gf_EnemyTeamNumberOfPlayer(lv_imageOwner)].lv_core) == true)) {
        UnitDamage(libGame_gv_teams[libGame_gf_EnemyTeamNumberOfPlayer(lv_imageOwner)].lv_core, "HeroGenericFakeHeroDuplicationDamage", lv_image, lv_damage);
    }
    else {

mods/heromods/samuro.stormmodbase.stormdata/LibHSAM.galaxy:1373

    }
    else {
        UnitDamage(lv_caster, "HeroGenericFakeHeroDuplicationDamage", lv_image, lv_damage);
    }
    return true;

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

        UnitSetOwner(UnitLastCreated(), 0, false);
        UnitSetPropertyFixed(UnitLastCreated(), c_unitPropLifePercent, 5.0);
        UnitDamage(UnitLastCreated(), "GuassRifle", UnitLastCreated(), 5.0);
        libNtve_gf_ChangeUnitDamage(UnitLastCreated(), libNtve_ge_UnitDamageTakenDealt_Damage_Take, libNtve_ge_UnitDamageChangeOption_No);
        UnitGroupAdd(gv_cinematicTempUnits, UnitLastCreated());

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

        UnitSetOwner(UnitLastCreated(), 0, false);
        UnitSetPropertyFixed(UnitLastCreated(), c_unitPropLifePercent, 5.0);
        UnitDamage(UnitLastCreated(), "GuassRifle", UnitLastCreated(), 5.0);
        libNtve_gf_ChangeUnitDamage(UnitLastCreated(), libNtve_ge_UnitDamageTakenDealt_Damage_Take, libNtve_ge_UnitDamageChangeOption_No);
        UnitGroupAdd(gv_cinematicTempUnits, UnitLastCreated());

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

            auto0317252B_var = UnitGroupUnitFromEnd(auto0317252B_g, auto0317252B_u);
            if (auto0317252B_var == null) { break; }
            UnitDamage(lp_damagedUnit, "DiffusionDummyImpact", auto0317252B_var, (lv_bouncedDamageAmount / lv_bounceTargetsUnitCount));
        }
        if ((UnitGetPropertyFixed(lp_damagedUnit, c_unitPropShieldsMax, c_unitPropCurrent) != 0.0)) {

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

    UnitGroupAdd(libCOMU_gv_cT_TempDamageReflectUnits, lp_damagingUnit);
    UnitSetCustomValue(lp_damagingUnit, libCOMU_gv_cTC_TempDamageCustomIndex, (UnitGetCustomValue(lp_damagingUnit, libCOMU_gv_cTC_TempDamageCustomIndex) + lp_damageAmount));
    UnitDamage(lp_damagingUnit, "MutatorTempDamageReflect", lp_damagingUnit, lp_damageAmount);
}