• 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.

Charge ability needs to be fixed.

Level 15
Joined
Jul 19, 2007
Messages
856
I have a triggered ability in my map named "Rush" and I found it from an old spellpack and when using it, the Hero charges to the target enemy unit, dealing damage and stunning it. But there is a problem if the target enemy unit uses a "Blink" spell when this "Rush" ability is casted, the hero will not stop charge and moves around uncontrollable all the time! Please can someone fix this problem?

  • RushCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Rush
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to (Player((Integer A)))
            • Then - Actions
              • Set VariableSet RH_Target[(Integer A)] = (Target unit of ability being cast)
              • Set VariableSet RH_TargetPos[(Integer A)] = (Position of RH_Target[(Integer A)])
              • Set VariableSet RH_Caster[(Integer A)] = (Triggering unit)
              • Set VariableSet RH_CasterPos[(Integer A)] = (Position of RH_Caster[(Integer A)])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between RH_CasterPos[(Integer A)] and RH_TargetPos[(Integer A)]) Less than 500.00
                • Then - Actions
                  • Game - Display to (Player group((Owner of RH_Caster[(Integer A)]))) the text: |cffff0000Target to...
                  • Unit - Remove Rush buff from RH_Target[(Integer A)]
                  • Set VariableSet RH_Caster[(Integer A)] = No unit
                  • Set VariableSet RH_Target[(Integer A)] = No unit
                  • Custom script: call RemoveLocation(udg_RH_CasterPos[bj_forLoopAIndex])
                  • Custom script: call RemoveLocation(udg_RH_TargetPos[bj_forLoopAIndex])
                  • Skip remaining actions
                • Else - Actions
              • Set VariableSet RH_Level[(Integer A)] = (Level of Rush for RH_Caster[(Integer A)])
              • Unit - Turn collision for RH_Caster[(Integer A)] Off.
              • Animation - Change RH_Caster[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 80.00% transparency
              • Unit - Make RH_Caster[(Integer A)] face RH_Target[(Integer A)] over 0.00 seconds
              • Set VariableSet RH_MoveAngle[(Integer A)] = (Facing of RH_Caster[(Integer A)])
              • Set VariableSet RH_Rushing[(Integer A)] = True
            • Else - Actions
  • RushMove
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RH_Rushing[(Integer A)] Equal to True
            • Then - Actions
              • Set VariableSet RH_PrevPos[(Integer A)] = (Position of RH_Caster[(Integer A)])
              • Set VariableSet RH_MovePoint[(Integer A)] = (RH_PrevPos[(Integer A)] offset by 10.00 towards RH_MoveAngle[(Integer A)] degrees.)
              • Unit - Move RH_Caster[(Integer A)] instantly to RH_MovePoint[(Integer A)]
              • Unit - Make RH_Caster[(Integer A)] face RH_Target[(Integer A)] over 0.00 seconds
              • Set VariableSet RH_MoveAngle[(Integer A)] = (Facing of RH_Caster[(Integer A)])
              • Special Effect - Create a special effect at RH_MovePoint[(Integer A)] using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_RH_PrevPos[bj_forLoopAIndex])
              • Custom script: call RemoveLocation(udg_RH_MovePoint[bj_forLoopAIndex])
            • Else - Actions
  • RushDis
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (RH_Target[(Integer A)] has buff Rush ) Equal to True
            • Then - Actions
              • Unit - Cause RH_Caster[(Integer A)] to damage RH_Target[(Integer A)], dealing ((Real(RH_Level[(Integer A)])) x 90.00) damage of attack type Spells and damage type Normal
              • Animation - Change RH_Caster[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Animation - Play RH_Caster[(Integer A)]'s attack animation
              • Unit - Turn collision for RH_Caster[(Integer A)] On.
              • Set VariableSet RH_Rushing[(Integer A)] = False
              • Set VariableSet RH_Caster[(Integer A)] = No unit
              • Set VariableSet RH_Target[(Integer A)] = No unit
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,875
This spell is poorly designed. You should avoid using (Integer A) and you shouldn't use a For Loop with a static range like that. The max player count is now 24 so that's not even going to work for half of the players. Use a Unit Group and Unit Indexing to allow for any number of casters without any limitations. It also looks like this relies on some kind of Buff that I can only guess is coming from Acid Bomb or something like that. This Buff is not guaranteed to be applied so there's a chance that a Unit can be stuck "rushing" forever.

Anyway, all you have to do is add a Distance check in the RushMove trigger:
  • If (Distance between RH_PrevPos[(Integer A)] and RH_MovePoint[(Integer A)]) Greater than 800.00
    • Then - Actions
Change 800.00 to a value that works well.

Then if they're too far away from one another set Rushing to False:
  • Set VariableSet RH_Rushing[(Integer A)] = False
Then you can add a check to see if RH_Target(Integer A)] is Dead. So if it's too far away OR dead then set Rushing = False.

Edit:
Attached a version that uses Unit Indexing and I added some nice changes to it.
 

Attachments

  • Rush New 1.w3m
    26.7 KB · Views: 2
Last edited:
Top