Charge ability for Knight

Nathan0093

New Member
Reaction score
4
Hey all. I'm trying to make a Charge ability for a Knight unit. When a point is targeted with this ability, the Knight will move toward that point damaging everything that he ran through. His collision will be off while he is moving. Does anyone know how to best trigger this ability? The charge effect is basically immolation. That is what I used to deal the damage while moving. Suggestions? I also cant seem to find a way to check if the Knight is done charging or not.

Code:
Untitled Trigger 001
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to (==) Charge (Run)
    Actions
        Unit - Turn collision for (Triggering unit) Off
        Set TempPoint = (Position of (Triggering unit))
        Unit - Order (Triggering unit) to Move To (Target point of ability being cast)
        Unit - Add Charge Effect (Neutral Hostile 1) to (Triggering unit)
        Wait until (((X of TempPoint) Equal to (==) (X of (Target point of ability being cast))) and ((Y of TempPoint) Equal to (==) (Y of (Target point of ability being cast)))), checking every 0.50 seconds
        Unit - Remove Charge Effect (Neutral Hostile 1) from (Triggering unit)
        Unit - Turn collision for (Triggering unit) On
        Custom script:   call RemoveLocation(udg_TempPoint)
 

Summoned

New Member
Reaction score
51
The Slide tutorial in the sub-forum is extremely helpful for this. You don't need any spell other than the original charge spell.

Edit: So basically something like this...

WARNING: Doing this in GUI means you need 1 set of variables for each knight you expect to be in the game, or an array of each variable type.

Make sure the second trigger is set to Initially Off.

Variables: Caster (unit), Casterpoint (point), Targetpoint (point), MoveToPoint (point), Angle (real) and AnyUnitGroup (unit group)

Trigger:
  • Charge1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Set Caster = (Triggering unit)
      • Set Targetpoint = (Target point of ability being cast)
      • Unit - Pause Caster
      • Unit - Turn collision for Caster Off
      • Trigger - Turn on Charge2 <gen>


Trigger:
  • Charge2
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set Casterpoint = (Position of Caster)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Casterpoint and Targetpoint) Greater than or equal to 40.00
          • (Caster is alive) Equal to True
        • Then - Actions
          • -------- Damaging Enemies for 100 damage per second --------
          • Set AnyUnitGroup = (Units within 200.00 of Casterpoint)
          • Unit Group - Pick every unit in AnyUnitGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is an enemy of (Owner of Caster)) Equal to True
                • Then - Actions
                  • Unit - Cause Caster to damage (Picked unit), dealing 5.00 damage of attack type Hero and damage type Normal
                • Else - Actions
                  • Do nothing
          • Custom script: call DestroyGroup(udg_AnyUnitGroup)
          • -------- Moving the unit toward the location --------
          • Set Angle = (Angle from Casterpoint to Targetpoint)
          • Set MoveToPoint = (Casterpoint offset by 50.00 towards Angle degrees)
          • Unit - Move Caster instantly to MoveToPoint
          • Custom script: call RemoveLocation(udg_Casterpoint)
          • Custom script: call RemoveLocation(udg_MoveToPoint)
        • Else - Actions
          • -------- Caster is either dead or you've reached the destination, turns trigger off --------
          • Unit - Unpause Caster
          • Unit - Turn collision for Caster On
          • Custom script: set udg_Caster = null
          • Custom script: call RemoveLocation(udg_MoveToPoint)
          • Custom script: call RemoveLocation(udg_Casterpoint)
          • Custom script: call RemoveLocation(udg_Targetpoint)
          • Trigger - Turn off (This trigger)
 

Nexor

...
Reaction score
74
you could trigger the movement too with a periodic trigger. I've made a charging trigger for my knight, it does actually the same thing except the damage all units. If you want I can post it but it's in JASS, so configuration things will be a bit harder than in GUI
 

Nathan0093

New Member
Reaction score
4
Summoned: Thanks, man. This is just what I needed. Theres one more thing I wanna do though, and that is to make the Knight appears as though he's moving and not dragged to the target point. I tried adding Play Unit Animation - move, but that didnt work. Help again? Also as far as MUI is concerned I'm gonna see what I can do about that.
 

Squirel

New Member
Reaction score
13
Your original trigger would get what you wanted done, but your wait function is wrong. Your TempPoint is never changing, so it will never be equal to the point that the ability is being cast at. You need the casting unit to be in a range of the location of the target of the ability being cast.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top