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

Repel v0.02

This is quite a simple, but I think quite useful as well.

When activated, knockbacks all enemies away, not allowing to enemies to get too close to you.
This spell is based on Wind Walk, so it won't interrupt current action while cast.

  • Repel Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Repel
    • Actions
      • -------- Sets the Caster --------
      • Set Caster = (Triggering unit)
      • -------- Creates a location for Dummy Unit spawning --------
      • Set Points[1] = (Position of Caster)
      • -------- Saves the AoE at which enemies are detected to knockback --------
      • Set Real[1] = (100.00 + (100.00 x (Real((Level of Repel for Caster)))))
      • -------- Creates a dummy unit and Stores caster and Detection Range --------
      • Unit - Create 1 Dummy Unit for (Owner of Caster) at Points[1] facing Default building facing degrees
      • Hashtable - Save Real[1] as 0 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Handle OfCaster as 1 of (Key (Last created unit)) in Hashtable
      • -------- Checks if there is any instance of this spell in effect --------
      • -------- If not, turns the Effect trigger on --------
      • If ((DummyGroup is empty) Equal to True) then do (Trigger - Turn on Repel Effect <gen>) else do (Do nothing)
      • -------- Adds dummy unit to Dummy Units' group --------
      • Unit Group - Add (Last created unit) to DummyGroup
      • -------- Clears Leak --------
      • Custom script: call RemoveLocation(udg_Points[1])
  • Repel Effect
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Every 0.03 seconds of the game --------
      • Unit Group - Pick every unit in DummyGroup and do (Actions)
        • Loop - Actions
          • -------- Loads the Knockback detection range and Caster --------
          • Set Real[1] = (Load 0 of (Key (Picked unit)) from Hashtable)
          • Set Caster = (Load 1 of (Key (Picked unit)) in Hashtable)
          • -------- Creates a location for knockbacking offset --------
          • Set Points[1] = (Position of Caster)
          • -------- Finds all enemies to knockback --------
          • -------- NOTE 1 : Finds all visible organic enemies that are not magic immune --------
          • Set Enemies = (Units within Real[1] of Points[1] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Mechanical) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching unit) is dead) Not equal to
          • -------- Does knockbacking --------
          • Unit Group - Pick every unit in Enemies and do (Actions)
            • Loop - Actions
              • -------- Finds Enemy's location and a place at which it will be knockbacked --------
              • Set Points[2] = (Position of (Picked unit))
              • Set Points[3] = (Points[2] offset by 45.00 towards (Angle from Points[1] to Points[2]) degrees)
              • -------- Moves (Knockbacks) the enemy --------
              • Unit - Move (Picked unit) instantly to Points[3]
              • -------- Creates an Rocky explosion on target --------
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
              • -------- Clears leaks --------
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_Points[2])
              • Custom script: call RemoveLocation(udg_Points[3])
          • -------- NOTE 2 : This spell is based on Windwalk, so it won't interupt current action --------
          • -------- NOTE 3 : You don't get invisible because the transition time is much longer than duration --------
          • -------- NOTE 4 : Repel IS dispellable --------
          • -------- If the caster isn't alive or the Buff of the Repel is gone... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Caster is alive) Equal to True
              • (Caster has buff Repel ) Equal to True
            • Then - Actions
            • Else - Actions
              • -------- Rids the Hashtable of the unnecessary information stored inside the dummy unit --------
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
              • -------- Removes Dummy unit for Dummy Group --------
              • Unit Group - Remove (Picked unit) from DummyGroup
              • -------- Removes Dummy unit from Game --------
              • Unit - Remove (Picked unit) from the game
          • -------- Clears the Leaks --------
          • Custom script: call RemoveLocation(udg_Points[1])
          • Custom script: call DestroyGroup(udg_Enemies)
      • -------- Checks if there is any instance of this spell left after loop --------
      • -------- If not, turns this trigger off --------
      • If ((DummyGroup is empty) Equal to True) then do (Trigger - Turn off (This trigger)) else do (Do nothing)

v0.01 - First uploaded
v0.02 - Fixed the leak, Instant Knockback is no more.


Keywords:
Repel, enemies, knockback, untouchable, range, distance, aoe, buff, windwalk, base
Contents

Repel v0.02 (Map)

Reviews
11:11, 10th Jun 2010 TriggerHappy: Leakless & MUI.

Moderator

M

Moderator

11:11, 10th Jun 2010
TriggerHappy:

Leakless & MUI.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Review:

Repel

This spell has been done many times over, and perhaps with a little better quality than this.

- You could name your variables a little better, as this spell would be pretty difficult to simply do a copy+paste. The user would probably have to rename all of your variables and fix the references for them in all of your triggers. Try to keep your names unique to the spell, in this case you could give them a "Repel_" prefix or something.

- There is no need to create a dummy unit. It is just as easy to add the casting unit to the unit-group because there is nothing that the dummy unit is necessary for.

- The location "Points[1]" leaks in your "Repel Cast" trigger.

- I won't say this is a "problem" per se, but in "Repel Effect" trigger you have the following line:

  • Set Points[3] = (Points[1] offset by (Real[1] + 100.00) towards (Angle from Points[1] to Points[2]) degrees)
The variable "Real[1]" refers to the radius in which enemy units are enumerated, though you "shouldn't" be instantly moving affected units to the maximum extent of the radius of the spell. Also, you should multiple "100" by 0.03 so that they are moved 100 range every second instead of being pushed back over 4000 distance per second.

Also you shouldn't be using the position of the caster when knocking the affected units backwards, instead you should be using their position ("Points[2]"). This will require another location, so don't forget to clean that either.

- There are too many effects displayed on the affected units, it poorly represents the effects of the spell.

Anachron said:
Can't work since you are not inside an enumeration.

In the version I downloaded it isn't. The change-log is blank, so I'm assuming he hasn't changed anything. Look closer?

I see you use the dummy-unit to have a unique handle ID that you can reference for each instance of the spell.
 
Last edited:
Top