• 🏆 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!

Need Help with a damage trigger

Status
Not open for further replies.
Level 4
Joined
Jan 19, 2010
Messages
73
Need Help with a damage trigger[Fixed]

Was making a spell trigger for my friends map and it worked well cept it won't damage enemies :(. I spent half an hour trying to fix it but I can't get the damage to work. It's probably just a small miss that I can't find.
If someone could point it out I would be really grateful.

  • Ice Spear
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Spear
    • Actions
      • -------- Saves the positions needed, to remove leaks. --------
      • Set tempPoint = (Target point of ability being cast)
      • Set caster_point = (Position of (Triggering unit))
      • -------- Now we get the angle and uses this to create lots of special effects. We also add units to the group later used for damage. --------
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • -------- Saves the position we are in of the novas. --------
          • Set ice_temp_point = (caster_point offset by (100.00 x (Real((Integer A)))) towards (Angle from caster_point to tempPoint) degrees)
          • Special Effect - Create a special effect at ice_temp_point using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- We create a unit group which we use to add units to the main group. Then we destroy that unit group. All to avoid leaks --------
          • Set tempGroup = (Units within 150.00 of ice_temp_point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matchi
          • Unit Group - Pick every unit in tempGroup and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to ice_group
          • Custom script: call DestroyGroup( udg_tempGroup )
      • -------- Get's The basic damage, then adds strenght in the damage action. --------
      • Set damage = 170
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Ice Spear for (Triggering unit)) Equal to 2
        • Then - Actions
          • Set damage = 240
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Ice Spear for (Triggering unit)) Equal to 3
            • Then - Actions
              • Set damage = 310
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Ice Spear for (Triggering unit)) Equal to 4
                • Then - Actions
                  • Set damage = 430
                • Else - Actions
      • Unit Group - Pick every unit in ice_group and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((Real(damage)) + ((Real((Strength of (Triggering unit) (Include bonuses)))) x 2.00)) damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup( udg_ice_group )
      • Custom script: call RemoveLocation( udg_tempPoint )
      • Custom script: call RemoveLocation( udg_caster_point )
      • Custom script: call RemoveLocation( udg_ice_temp_point )
Edit: The last thing that won't show on the conditions for tempgroup is if matching unit is alive equal to true.
 
Last edited:
Level 19
Joined
Feb 25, 2009
Messages
2,004
  • Set tempGroup = (Units within 150.00 of ice_temp_point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)
Move it outside the loop.

  • Custom script: call RemoveLocation( udg_ice_temp_point )
Place this inside the (Integer A) loop, otherwise you will have 5 point leaks.

Use a formula for the damage with levels like this:
  • Set damage = ((170) x (Level of (Ice Spear) for (Triggering Unit))
I don't see a reason to use 2 groups, just use the one at the end of the trigger.


  • Ice Spear
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Spear
    • Actions
      • Set CasterPos = (Position of (Triggering unit))
      • Set AbilityPos = (Target point of ability being cast)
      • Set Damage = (170.00 x (Real((Level of Ice Spear for (Triggering unit)))))
      • For each (Integer LoopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set LoopPos = (LoopPos offset by (100.00 x (Real(LoopInt))) towards (Angle from CasterPos to AbilityPos) degrees)
          • Special Effect - Create a special effect at LoopPos using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set IceGroup = (Units within 150.00 of LoopPos matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of (Trigger
          • Unit Group - Pick every unit in IceGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing Damage damage of attack type Spells and damage type Unknown
          • Custom script: call RemoveLocation (udg_LoopPos)
          • Custom script: call DestroyGroup (udg_IceGroup)
      • Custom script: call RemoveLocation (udg_CasterPos)
      • Custom script: call RemoveLocation (udg_AbilityPos)
 
First of all, you don't need to add the Picked unit to a new unit group. I would also like to see the full Matching, because it's cut on the trigger tag.

I'd do it like this:

  • Trigger1
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Frost Spear
  • Actions
    • Set Damage = ((70*(Real(Level of (Ability being cast)) for (Triggering unit)))) + 100)
    • Set Points[1] = (Position of (Triggering unit))
    • Set Points[2] = (Target point of ability being cast)
    • For each (IntegerA) from 1 to 6, do (Acitons)
      • Loop - Actions
        • Set Points[3] = (Points[1] offset by (100x(Real(IntegerA))) towards (Angle from Points[1] to Points[2])
        • Special Effect - Create a special effect at Points[3] using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
        • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation (udg_Points[3])
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 150.00 of Points[2] matching ((Matching unit) belongs to an enemy of (Owner of (Triggering unit)) and ((Matching unit) is alive) Equal to True) and (((Matching unit) is a structure) Equal to False) and (((Matching unit) is Magic Immune) Equal to False) and do (Actions)
      • Loop - Actions
        • Unit - Cause (Triggering unit) to damage (Picked unit) dealing Damage of attack type Spells and damage type Normal
    • Custom script: call RemoveLocation (udg_Points[1])
    • Custom script: call RemoveLocation (udg_Points[2])
 
Level 4
Joined
Jan 19, 2010
Messages
73
If I do that I can damage them several times. BUt fixed so that I just added units to the group without using a second group. It bugged cuz when you destroy a group you gotta set it to something before you add units to it. Therefore I could not damage units after first cast.
 
Status
Not open for further replies.
Top