• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Help with damage trigger

Status
Not open for further replies.
Im having trouble with a trigger.

What i want is when you press an ability it the unit deals damage, in line with its facing angle, to enemy units.

I dont want to have to select a target though, like shockwave or something.

I have tried something like this but it does not work (also it does not incorporate facing angle and what not):

  • strike air
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Strike air
    • Actions
      • Player Group - Pick every player in (All enemies of Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units owned by (Matching player)) and do (Actions)
            • Loop - Actions
              • Unit - Cause Player1Unit to damage (Picked unit), dealing 500.00 damage of attack type Normal and damage type Normal
 
Your right, line damage is tricky. But, I made a trigger that can do it.
  • Line Damage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Set TempLocA = (Position of (Casting unit))
      • Set TempLocC = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to (Casting unit))))) and do (Actions)
        • Loop - Actions
          • Set TempLocB = (Position of (Picked unit))
          • Set TempRealA = (Distance between TempLocA and TempLocB)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Region centered at (TempLocA offset by TempRealA towards (Angle from TempLocA to TempLocC) degrees) with size (50.00, 50.00)) contains (Picked unit)) Equal to True
            • Then - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect at TempLocB using Objects\Spawnmodels\Human\FragmentationShards\FragBoomSpawn.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempLocB)
          • Custom script: set udg_TempRealA = 0
      • Custom script: call RemoveLocation(udg_TempLocA)
      • Custom script: call RemoveLocation(udg_TempLocC)
If you have any questions just ask.
 
  • Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Owner of (Casting unit)) Equal to Player 1 (Red)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Attack (Z)
        • Then - Actions
          • Set Casting_Unit_Loc[(Player number of (Owner of (Casting unit)))] = ((Position of (Casting unit)) offset by 100.00 towards (Facing of (Casting unit)) degrees)
          • Set Hit_Group[(Player number of (Owner of (Casting unit)))] = (Units within 100.00 of Casting_Unit_Loc[(Player number of (Owner of (Casting unit)))] matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True))
          • Unit Group - Pick every unit in Hit_Group[(Player number of (Owner of (Casting unit)))] and do (Unit - Cause (Casting unit) to damage (Picked unit), dealing (100.00 + ((Real((Strength of (Casting unit) (Include bonuses)))) x 2.50)) damage of attack type Spells and damage type Normal)
          • Unit Group - Pick every unit in Hit_Group[(Player number of (Owner of (Casting unit)))] and do (Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl)
          • Custom script: call DestroyGroup( udg_Hit_Group[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] )
          • Custom script: call RemoveLocation( udg_Casting_Unit_Loc[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] )
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Do nothing
the problem is that is only for one player, this is how i make it MUI, i just changet a player..
 
hmmm... it doesn't seem to work for me.

unless i leaked?

  • strike air2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to StrikeAir2
    • Actions
      • Set TempLocA = (Position of (Casting unit))
      • Set TempLocC = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to (Casting unit))))) and do (Actions)
        • Loop - Actions
          • Set TempLocB = (Position of (Picked unit))
          • Set TempRealA = (Distance between TempLocA and TempLocB)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Region centered at (TempLocA offset by TempRealA towards (Angle from TempLocA to TempLocC) degrees) with size (50.00, 50.00)) contains (Picked unit)) Equal to True
            • Then - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing 100.00 damage of attack type Normal and damage type Normal
            • Else - Actions
              • Custom script: call RemoveLocation(udg_TempLocB)
              • Custom script: set udg_TempRealA = 0
              • Custom script: call RemoveLocation(udg_TempLocA)
              • Custom script: call RemoveLocation(udg_TempLocC)
 
still no luck

X/

  • strike air2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to StrikeAir2
    • Actions
      • Set TempLocA = (Position of (Casting unit))
      • Set TempLocC = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to (Casting unit))))) and do (Actions)
        • Loop - Actions
          • Set TempRealA = (Distance between TempLocA and TempLocB)
          • Set TempLocB = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Region centered at (TempLocA offset by TempRealA towards (Angle from TempLocA to TempLocC) degrees) with size (50.00, 50.00)) contains (Picked unit)) Equal to True
            • Then - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing 100.00 damage of attack type Normal and damage type Normal
            • Else - Actions
          • Custom script: set udg_TempRealA = 0
          • Custom script: call RemoveLocation(udg_TempLocB)
          • Custom script: call RemoveLocation(udg_TempLocA)
          • Custom script: call RemoveLocation(udg_TempLocC)
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
You should set TempLocB = (Position of (Picked unit)) before TempRealA so no one have to stand on you because at the moment the distance is 0.
The region size is a bit small i think.
And you don't need to set TempRealA = 0 at the end.

This should work, but it still leaks though.
  • strike air2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to StrikeAir2
    • Actions
      • Set TempLocA = (Position of (Casting unit))
      • Set TempLocC = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to (Casting unit))))) and do (Actions)
        • Loop - Actions
          • Set TempLocB = (Position of (Picked unit))
          • Set TempRealA = (Distance between TempLocA and TempLocB)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Region centered at (TempLocA offset by TempRealA towards (Angle from TempLocA to TempLocC) degrees) with size (150.00, 150.00)) contains (Picked unit)) Equal to True
              • Then - Actions
                • Unit - Cause (Casting unit) to damage (Picked unit), dealing 100.00 damage of attack type Normal and damage type Normal
              • Else - Actions
          • Custom script: call RemoveLocation(udg_TempLocB)
        • Custom script: call RemoveLocation(udg_TempLocC)
        • Custom script: call RemoveLocation(udg_TempLocA)
 
Last edited:
Status
Not open for further replies.
Top