# Unit Starts Attacking

Grammaru starts attacking with weapon
FlagsNative | 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> — Unit
  • string<gamelink::Weapon> — Weapon

Returns — void

native void TriggerAddEventUnitStartedAttack2(
	trigger t,
	unitref u,
	string inWeapon,
);

Category: Unit / Combat

# Examples

campaigns/swarm.sc2campaignbase.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.sc2mapMapScript.galaxy:2080

void gt_HybridStartsAttackingQ_Init () {
    gt_HybridStartsAttackingQ = TriggerCreate("gt_HybridStartsAttackingQ_Func");
    TriggerAddEventUnitStartedAttack2(gt_HybridStartsAttackingQ, UnitRefFromUnit(UnitFromId(1485)), null);
}

campaigns/void.sc2campaignbase.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.sc2campaignbase.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.sc2mapMapScript.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.sc2mapMapScript.galaxy:3124

void gt_HybridTauntQ_Init () {
    gt_HybridTauntQ = TriggerCreate("gt_HybridTauntQ_Func");
    TriggerAddEventUnitStartedAttack2(gt_HybridTauntQ, UnitRefFromUnit(UnitFromId(481)), null);
}

mods/heromods/chromie.stormmodbase.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.sc2modbase.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.sc2modbase.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.sc2modbase3.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.sc2modbase3.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.sc2modbase3.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.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.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.sc2mapMapScript.galaxy:6249

    TriggerAddEventUnitAttacked2(gt_S2CombatInDefendRegionsController, null, null);
    TriggerAddEventUnitDamaged(gt_S2CombatInDefendRegionsController, null, c_unitDamageTypeAny, c_unitDamageEither, null);
    TriggerAddEventUnitStartedAttack2(gt_S2CombatInDefendRegionsController, null, null);
}

mods/warcoop/warclassic.sc2modbase.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){