• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Why do this leak?

Status
Not open for further replies.
Level 15
Joined
Jul 19, 2007
Messages
855
This is a trigger of a "Charge" ability which should make the hero charge in to the target enemy unit which damages it and knocks it back and all other enemy units in a line, like Shockwave. The knockback works like it should but the damage it does it bugged. It is meant to do 65/130/195/260 damage but sometimes, units takes damage multiple times or tripple times and more which kills them in one hit and my friend who fixed this can't see what's wrong! Please can anyone figure out? Here is the triggers for the "Charge" ability.

  • Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Set SS_CountInteger = (SS_CountInteger + 1)
      • Set SS_CountIntegerArray = (SS_CountIntegerArray + 1)
      • Set SS_Caster[SS_CountIntegerArray] = (Triggering unit)
      • Set SS_boolean[SS_CountIntegerArray] = True
      • Set SS_Location2[SS_CountIntegerArray] = (Position of (Triggering unit))
      • Set SS_Location3[SS_CountIntegerArray] = (Target point of ability being cast)
      • Set SS_angle[SS_CountIntegerArray] = (Angle from SS_Location2[SS_CountIntegerArray] to SS_Location3[SS_CountIntegerArray])
      • Set SS_Bdestroytrees[SS_CountIntegerArray] = True
      • Unit - Turn collision for SS_Caster[SS_CountIntegerArray] Off
      • Unit - Hide SS_Caster[SS_CountIntegerArray]
      • Custom script: call RemoveLocation(udg_SS_Location2[udg_SS_CountIntegerArray])
      • Custom script: call RemoveLocation(udg_SS_Location3[udg_SS_CountIntegerArray])
      • Trigger - Turn on Run <gen>
  • Run
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to SS_CountIntegerArray, do (Actions)
        • Loop - Actions
          • Set SS_Location2[(Integer A)] = (Position of SS_Caster[(Integer A)])
          • Set SS_Location4[(Integer A)] = (SS_Location2[(Integer A)] offset by 80.00 towards SS_angle[(Integer A)] degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_boolean[(Integer A)] Equal to True
            • Then - Actions
              • Set SS_UnitCount[(Integer A)] = (SS_UnitCount[(Integer A)] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SS_UnitCount[(Integer A)] Equal to ((Level of Charge for SS_Caster[(Integer A)]) x 5)
                • Then - Actions
                  • Set SS_boolean[(Integer A)] = False
                  • Set SS_UnitCount[(Integer A)] = 0
                  • Set SS_CountInteger = (SS_CountInteger - 1)
                  • Set SS_angle[(Integer A)] = 0.00
                  • Unit - Unhide SS_Caster[(Integer A)]
                  • Special Effect - Create a special effect attached to the chest of SS_Caster[(Integer A)] using Abilities\Spells\Human\Invisibility\InvisibilityTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Selection - Select SS_Caster[(Integer A)] for (Owner of SS_Caster[(Integer A)])
                  • Unit - Turn collision for SS_Caster[(Integer A)] On
                  • Custom script: set udg_SS_Caster[bj_forLoopAIndex] = null
                • Else - Actions
                  • Set SS_UnitGroup = (Units within 79.00 of SS_Location4[(Integer A)] matching ((((Matching unit) belongs to an enemy of (Owner of SS_Caster[(Integer A)])) Equal to True) and (((Matching unit) is A structure) Not equal to True)))
                  • Unit Group - Pick every unit in SS_UnitGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Cause SS_Caster[(Integer A)] to damage (Picked unit), dealing ((Real((Level of Charge for SS_Caster[(Integer A)]))) x 65.00) damage of attack type Hero and damage type Normal
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Move (Picked unit) instantly to SS_Location4[(Integer A)]
                  • Custom script: call DestroyGroup(udg_SS_UnitGroup)
                  • Unit Group - Pick every unit in (Units within SS_angle[(Integer A)] of SS_Location4[(Integer A)] matching (((Matching unit) belongs to an enemy of (Owner of SS_Caster[(Integer A)])) Equal to True)) and do (Actions)
                    • Loop - Actions
                      • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 50.00 towards (Facing of SS_Caster[(Integer A)]) degrees)
                      • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
                  • Unit - Create 1 TimeChargeDummy for (Owner of SS_Caster[(Integer A)]) at SS_Location4[(Integer A)] facing SS_angle[(Integer A)] degrees
                  • Animation - Change (Last created unit)'s animation speed to 200.00% of its original speed
                  • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 70.00% transparency
                  • Special Effect - Create a special effect at SS_Location4[(Integer A)] using Abilities\Weapons\Bolt\BoltImpact.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Move SS_Caster[(Integer A)] instantly to SS_Location4[(Integer A)]
                  • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
                  • Selection - Select (Last created unit) for (Owner of SS_Caster[(Integer A)])
            • Else - Actions
          • Custom script: call RemoveLocation(udg_SS_Location2[bj_forLoopAIndex])
          • Animation - Play (Last created unit)'s walk animation
          • Custom script: call RemoveLocation(udg_SS_Location4[bj_forLoopAIndex])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_CountInteger Equal to 0
        • Then - Actions
          • Set SS_CountIntegerArray = SS_CountInteger
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Die
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to TimeChargeDummy
    • Actions
      • Unit - Remove (Triggering unit) from the game
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Maybe it's because you pick units withing 79 of SS_Location4[(Integer A)]. The units might get picked several times. You could use a boolean, set it false at the beginning and set it to true when it has been damaged once. Check the boolean when units are supposed to be damaged.

  • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 50.00 towards...
^Two leaks there.

  • Unit Group - Pick every unit in (Units within SS_angle[(Integer A)] of SS_Location4[(Integer A)] matching (((Matching unit) belongs to an enemy of...
^One leak here.
 
Level 15
Joined
Jul 19, 2007
Messages
855
Maybe it's because you pick units withing 79 of SS_Location4[(Integer A)]. The units might get picked several times. You could use a boolean, set it false at the beginning and set it to true when it has been damaged once. Check the boolean when units are supposed to be damaged.

  • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 50.00 towards...
^Two leaks there.

  • Unit Group - Pick every unit in (Units within SS_angle[(Integer A)] of SS_Location4[(Integer A)] matching (((Matching unit) belongs to an enemy of...
^One leak here.
Could u please fix it to me? It's just getting bugged when I'll try and I suck at triggering and my friend is buzy.. Ty anyway for finding the leaks.
 
Status
Not open for further replies.
Top