# Unit Starts Attacking
Grammar — u starts attacking with weapon
Flags —Native
|Event
This event fires when a unit starts attacking. Use “Attacking Unit” or “Triggering Unit” to get the attacker. Use “Triggering Player” to get the owner of the attacker.
# Arguments
unitref
<unit> — Unitstring
<gamelink::Weapon> — Weapon
Returns — void
native void TriggerAddEventUnitStartedAttack2(
trigger t,
unitref u,
string inWeapon,
);
# Related
Category: Unit / Combat
- Get Unit Damage Dealt Time —
fixed
— UnitGetDamageDealtTime - Get Unit Damage Taken Time —
fixed
— UnitGetDamageTakenTime - Weapon Used In Attack —
string
<gamelink::Weapon> — EventUnitGetWeapon - Item Used In Attack —
unit
— EventUnitGetItem - Item Type Used In Attack —
string
<gamelink::Item> — EventUnitGetItemType - Unit Dies —
void
— TriggerAddEventUnitDied - Killing Unit —
unit
— libNtve_gf_KillingUnit - Killing Player —
int
— libNtve_gf_KillingPlayer - Triggering Death Type Check —
bool
— EventUnitDamageDeathCheck - Unit Is Being Removed —
void
— TriggerAddEventUnitRemoved - Unit Starts Attacking (Deprecated) —
void
— TriggerAddEventUnitStartedAttack - Unit Starts Attacking —
void
— TriggerAddEventUnitStartedAttack2 - Unit Is Attacked (Deprecated) —
void
— TriggerAddEventUnitAttacked - Unit Is Attacked —
void
— TriggerAddEventUnitAttacked2 - Attacking Unit —
unit
— EventUnitTarget - Unit Absorbs Damage —
void
— TriggerAddEventUnitDamageAbsorbed - Unit Takes Damage —
void
— TriggerAddEventUnitDamaged - Damaging Unit —
unit
— EventUnitDamageSourceUnit - Damaging Player —
int
— EventUnitDamageSourcePlayer - Damaging Effect —
string
<gamelink::Effect> — EventUnitDamageEffect - Triggering Damage Taken —
fixed
— EventUnitDamageAmount - Triggering Damage Attempted —
fixed
— EventUnitDamageAttempted - Triggering Damage Attempted Vitals —
fixed
— EventUnitDamageAttemptedVitals - Triggering Damage Absorbed —
fixed
— EventUnitDamageAbsorbed - Triggering Damage Behavior Shield —
fixed
— EventUnitDamageBehaviorShield - Triggering Vitals Leeched —
fixed
— EventUnitDamageVitalsLeeched - Triggering Unit Kill XP —
int
— EventUnitDamageKillXP - Damage Source Position —
point
— EventUnitDamageSourcePoint - Unit is Healed —
void
— TriggerAddEventUnitHealed - Healing Unit —
unit
— EventUnitHealLaunchUnit - Healing Player —
int
— EventUnitHealLaunchPlayer - Triggering Heal Vital Type —
int
<preset::UnitVitalType> — EventUnitHealVital - Triggering Heal Given —
fixed
— EventUnitHealAmount - Healing Effect —
string
<gamelink::Effect> — EventUnitHealEffect - Unit Spends Vital —
void
— TriggerAddEventUnitSpendVital - Triggering Spent Vital Type —
int
<preset::UnitVitalType> — EventUnitSpentVitalVital - Triggering Vital Spent —
fixed
— EventUnitSpentVitalAmount - Unit Acquires Target —
void
— TriggerAddEventUnitAcquiredTarget - Acquired Target —
unit
— libNtve_gf_AcquiredTarget - Unit Is Revived —
void
— TriggerAddEventUnitRevive - Triggering Victim Unit —
unit
— EventUnitVictimUnit - Triggering Item Used —
unit
— EventUnitItemUsed - Triggering Effect Used —
string
<gamelink::Effect> — EventUnitEffectUsed
# Examples
campaigns/swarm.sc2campaign — base.sc2maps/maps/campaign/voidprologue/voidprologue01.sc2map/MapScript.galaxy:2080
void gt_HybridStartsAttackingQ_Init () {
gt_HybridStartsAttackingQ = TriggerCreate("gt_HybridStartsAttackingQ_Func");
TriggerAddEventUnitStartedAttack2(gt_HybridStartsAttackingQ, UnitRefFromUnit(UnitFromId(1485)), null);
}
campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/voidprologue/voidprologue01.sc2map — MapScript.galaxy:2080
void gt_HybridStartsAttackingQ_Init () {
gt_HybridStartsAttackingQ = TriggerCreate("gt_HybridStartsAttackingQ_Func");
TriggerAddEventUnitStartedAttack2(gt_HybridStartsAttackingQ, UnitRefFromUnit(UnitFromId(1485)), null);
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/pmoebius01.sc2map/MapScript.galaxy:3083
void gt_ThorBark1Q_Init () {
gt_ThorBark1Q = TriggerCreate("gt_ThorBark1Q_Func");
TriggerAddEventUnitStartedAttack2(gt_ThorBark1Q, UnitRefFromUnit(UnitFromId(624)), null);
}
campaigns/void.sc2campaign — base.sc2maps/maps/campaign/void/pmoebius01.sc2map/MapScript.galaxy:3124
void gt_HybridTauntQ_Init () {
gt_HybridTauntQ = TriggerCreate("gt_HybridTauntQ_Func");
TriggerAddEventUnitStartedAttack2(gt_HybridTauntQ, UnitRefFromUnit(UnitFromId(481)), null);
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pmoebius01.sc2map — MapScript.galaxy:3083
void gt_ThorBark1Q_Init () {
gt_ThorBark1Q = TriggerCreate("gt_ThorBark1Q_Func");
TriggerAddEventUnitStartedAttack2(gt_ThorBark1Q, UnitRefFromUnit(UnitFromId(624)), null);
}
campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/pmoebius01.sc2map — MapScript.galaxy:3124
void gt_HybridTauntQ_Init () {
gt_HybridTauntQ = TriggerCreate("gt_HybridTauntQ_Func");
TriggerAddEventUnitStartedAttack2(gt_HybridTauntQ, UnitRefFromUnit(UnitFromId(481)), null);
}
mods/heromods/chromie.stormmod — base.stormdata/LibHCHR.galaxy:193
void libHCHR_gt_HeroChromieSandEchoBasicAttackAnimationBegins_Init () {
libHCHR_gt_HeroChromieSandEchoBasicAttackAnimationBegins = TriggerCreate("libHCHR_gt_HeroChromieSandEchoBasicAttackAnimationBegins_Func");
TriggerAddEventUnitStartedAttack2(libHCHR_gt_HeroChromieSandEchoBasicAttackAnimationBegins, null, "ChromieHeroWeapon");
}
mods/novastoryassets.sc2mod — base.sc2maps/maps/campaign/nova/nova01.sc2map/MapScript.galaxy:3756
void gt_TrooperFindsNovaQ_Init () {
gt_TrooperFindsNovaQ = TriggerCreate("gt_TrooperFindsNovaQ_Func");
TriggerAddEventUnitStartedAttack2(gt_TrooperFindsNovaQ, null, null);
}
mods/novastoryassets.sc2mod — base.sc2maps/maps/campaign/nova/nova01.sc2map/MapScript.galaxy:4393
gt_SnipeHallReaperFindsNovaQ = TriggerCreate("gt_SnipeHallReaperFindsNovaQ_Func");
TriggerEnable(gt_SnipeHallReaperFindsNovaQ, false);
TriggerAddEventUnitStartedAttack2(gt_SnipeHallReaperFindsNovaQ, null, null);
}
mods/novastoryassets.sc2mod — base3.sc2maps/maps/campaign/nova/nova07.sc2map/MapScript.galaxy:2867
void gt_DOMUnitsEngagingTargetTransmissionsQ_Init () {
gt_DOMUnitsEngagingTargetTransmissionsQ = TriggerCreate("gt_DOMUnitsEngagingTargetTransmissionsQ_Func");
TriggerAddEventUnitStartedAttack2(gt_DOMUnitsEngagingTargetTransmissionsQ, null, null);
}
mods/novastoryassets.sc2mod — base3.sc2maps/maps/campaign/nova/nova07.sc2map/MapScript.galaxy:4312
TriggerAddEventUnitAttacked2(gt_S1CombatInDefendRegionsController, null, null);
TriggerAddEventUnitDamaged(gt_S1CombatInDefendRegionsController, null, c_unitDamageTypeAny, c_unitDamageEither, null);
TriggerAddEventUnitStartedAttack2(gt_S1CombatInDefendRegionsController, null, null);
}
mods/novastoryassets.sc2mod — base3.sc2maps/maps/campaign/nova/nova07.sc2map/MapScript.galaxy:6249
TriggerAddEventUnitAttacked2(gt_S2CombatInDefendRegionsController, null, null);
TriggerAddEventUnitDamaged(gt_S2CombatInDefendRegionsController, null, c_unitDamageTypeAny, c_unitDamageEither, null);
TriggerAddEventUnitStartedAttack2(gt_S2CombatInDefendRegionsController, null, null);
}
mods/novastoryassets.sc2mod/base.sc2maps/maps/campaign/nova/nova01.sc2map — MapScript.galaxy:3756
void gt_TrooperFindsNovaQ_Init () {
gt_TrooperFindsNovaQ = TriggerCreate("gt_TrooperFindsNovaQ_Func");
TriggerAddEventUnitStartedAttack2(gt_TrooperFindsNovaQ, null, null);
}
mods/novastoryassets.sc2mod/base.sc2maps/maps/campaign/nova/nova01.sc2map — MapScript.galaxy:4393
gt_SnipeHallReaperFindsNovaQ = TriggerCreate("gt_SnipeHallReaperFindsNovaQ_Func");
TriggerEnable(gt_SnipeHallReaperFindsNovaQ, false);
TriggerAddEventUnitStartedAttack2(gt_SnipeHallReaperFindsNovaQ, null, null);
}
mods/novastoryassets.sc2mod/base3.sc2maps/maps/campaign/nova/nova07.sc2map — MapScript.galaxy:2867
void gt_DOMUnitsEngagingTargetTransmissionsQ_Init () {
gt_DOMUnitsEngagingTargetTransmissionsQ = TriggerCreate("gt_DOMUnitsEngagingTargetTransmissionsQ_Func");
TriggerAddEventUnitStartedAttack2(gt_DOMUnitsEngagingTargetTransmissionsQ, null, null);
}
mods/novastoryassets.sc2mod/base3.sc2maps/maps/campaign/nova/nova07.sc2map — MapScript.galaxy:4312
TriggerAddEventUnitAttacked2(gt_S1CombatInDefendRegionsController, null, null);
TriggerAddEventUnitDamaged(gt_S1CombatInDefendRegionsController, null, c_unitDamageTypeAny, c_unitDamageEither, null);
TriggerAddEventUnitStartedAttack2(gt_S1CombatInDefendRegionsController, null, null);
}
mods/novastoryassets.sc2mod/base3.sc2maps/maps/campaign/nova/nova07.sc2map — MapScript.galaxy:6249
TriggerAddEventUnitAttacked2(gt_S2CombatInDefendRegionsController, null, null);
TriggerAddEventUnitDamaged(gt_S2CombatInDefendRegionsController, null, c_unitDamageTypeAny, c_unitDamageEither, null);
TriggerAddEventUnitStartedAttack2(gt_S2CombatInDefendRegionsController, null, null);
}
mods/warcoop/warclassic.sc2mod — base.sc2data/TriggerLibs/WarClassic.galaxy:54
void GAw3_AddEventUnitStartedAttack2(trigger t,unit u,string weapon){
unitref ur=UnitRefFromUnit(u);
TriggerAddEventUnitStartedAttack2(t,ur,weapon);
}
void GAw3_AddEventUnitAbility(trigger t, unit u, abilcmd a, int stage, bool includeSharedAbils){