# Damage Unit (From Unit)
Grammar — Deal damage using effect on victim from attacker with bonus extra damage
Flags —Native
|Action
Deals damage targeting the specified victim, as if it was dealt by the specified attacker unit.
# Arguments
unit
— Attackerstring
<gamelink::Effect> — Effectunit
— Victimfixed
— Bonus
Returns — void
native void UnitDamage(
unit inAttacker,
string inEffect,
unit inVictim,
fixed inBonus,
);
# Related
Category: Environment / Effects
- Create Explosion At Point —
void
— libNtve_gf_CreateExplosionAtPoint - Create Effect At Point (From Player) —
void
— PlayerCreateEffectPoint - Create Effect On Unit (From Player) —
void
— PlayerCreateEffectUnit - Create Effect At Point (From Unit) —
void
— UnitCreateEffectPoint - Create Effect On Unit (From Unit) —
void
— UnitCreateEffectUnit - Damage Unit (From Unit) —
void
— UnitDamage - Player Can Create Effect At Point —
bool
— libNtve_gf_PlayerCanCreateEffectAtPoint - Player Can Create Effect On Unit —
bool
— libNtve_gf_PlayerCanCreateEffectOnUnit - Unit Can Create Effect At Point —
bool
— libNtve_gf_UnitCanCreateEffectAtPoint - Unit Can Create Effect On Unit —
bool
— libNtve_gf_UnitCanCreateEffectOnUnit - Destroy Effects —
void
— GameDestroyEffects - Effect Used —
void
— TriggerAddEventPlayerEffectUsed - Effect Used From Scope —
void
— TriggerAddEventPlayerEffectUsedFromScope - Triggering Effect Used —
string
<gamelink::Effect> — EventPlayerEffectUsed - Triggering Effect Point —
point
— EventPlayerEffectUsedPoint - Triggering Effect Unit —
unit
— EventPlayerEffectUsedUnit - Triggering Effect Item —
unit
— EventPlayerEffectUsedItem - Triggering Effect Impact Unit —
unit
— EventPlayerEffectUsedUnitImpact - Triggering Effect Launch Unit —
unit
— EventPlayerEffectUsedUnitLaunch - Triggering Effect Unit Owner —
int
— EventPlayerEffectUsedUnitOwner - Triggering Effect Unit Type —
string
<gamelink::Unit> — EventPlayerEffectUsedUnitType - Triggering Effect Item Type —
string
<gamelink::Unit> — EventPlayerEffectUsedItemType - Triggering Effect Amount (Integer) —
int
— EventPlayerEffectUsedAmountInt - Triggering Effect Amount (Real) —
fixed
— EventPlayerEffectUsedAmountFixed - Triggering Effect Source Behavior —
string
<gamelink::Behavior> — EventPlayerEffectUsedSourceBehavior - Triggering Effect Weapon —
string
<gamelink::Weapon> — EventPlayerEffectUsedWeapon - Triggering Effect Ability —
string
<gamelink::Abil> — EventPlayerEffectUsedAbil
# Examples
campaigns/swarm.sc2campaign — base.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.sc2map — MapScript.galaxy:1189
while (!UnitGroupLoopDone()) {
if ((UnitGetPropertyFixed(UnitGroupLoopCurrent(), c_unitPropLife, c_unitPropCurrent) <= gv_gasDamage_Terran)) {
UnitDamage(UnitGroupLoopCurrent(), "PoisonNovaDirectDamage", UnitGroupLoopCurrent(), 0.0);
}
else {
campaigns/void.sc2campaign — base.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.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);
mods/heroes.stormmod — base.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.stormmod — base.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.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.stormmod/base.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/heroesdata.stormmod — base.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.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:18100
}
else {
UnitDamage(lv_caster, "HeroGenericFakeHeroDuplicationDamage", lv_image, lv_damage);
}
return true;
mods/heromods/samuro.stormmod — base.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.stormmod — base.stormdata/LibHSAM.galaxy:1373
}
else {
UnitDamage(lv_caster, "HeroGenericFakeHeroDuplicationDamage", lv_image, lv_damage);
}
return true;
mods/novastoryassets.sc2mod — base3.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.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/starcoop/starcoop.sc2mod — base.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.sc2mod — base.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);
}