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

[Trigger] Hashtable - Spell Not Working

Status
Not open for further replies.
Level 2
Joined
Apr 21, 2010
Messages
9
Im having trouble getting the knockback for this trigger to work. any help would be greatly Apreciated.

  • Untitled Trigger 005
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Clash
    • Actions
      • Set KBAngle = (Angle from (Position of (Casting unit)) to (Position of (Target unit of ability being cast)))
      • Set KBDistance = (400.00 x 0.04)
      • Set RemainingTime = 40
      • Hashtable - Save KBDistance as 0 of (Key (Target unit of ability being cast)) in (Last created hashtable)
      • Hashtable - Save KBAngle as 1 of (Key (Target unit of ability being cast)) in (Last created hashtable)
      • Hashtable - Save RemainingTime as 2 of (Key (Target unit of ability being cast)) in (Last created hashtable)
      • Unit Group - Add (Target unit of issued order) to KBUnits
  • Untitled Trigger 006
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KBUnits and do (Actions)
        • Loop - Actions
          • Set KBDistance = (Load 0 of (Key (Target unit of ability being cast)) from (Last created hashtable))
          • Set KBAngle = (Load 1 of (Key (Target unit of ability being cast)) from (Last created hashtable))
          • Set RemainingTime = (Load 2 of (Key (Target unit of ability being cast)) from (Last created hashtable))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RemainingTime Greater than 0
            • Then - Actions
              • Unit - Move (Target unit of ability being cast) instantly to ((Position of (Target unit of ability being cast)) offset by KBAngle towards KBDistance degrees)
              • Hashtable - Save (RemainingTime - 4) as 2 of (Key (Target unit of ability being cast)) in (Last created hashtable)
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Load 0 of (Key (Target unit of ability being cast)) in (Last created hashtable))) in (Last created hashtable)
              • Hashtable - Clear all child hashtables of child (Key (Load 1 of (Key (Target unit of ability being cast)) in (Last created hashtable))) in (Last created hashtable)
              • Hashtable - Clear all child hashtables of child (Key (Load 2 of (Key (Target unit of ability being cast)) in (Last created hashtable))) in (Last created hashtable)
              • Unit Group - Remove all units of KBUnits from KBUnits
 
This is how it should be:
  • Zero
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
  • One
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Clash
      • ((Target unit of ability being cast) is in KBGroup) Equal to False
    • Actions
      • Set Points[1] = (Position of (Triggering unit))
      • Set Points[2] = (Position of (Target unit of ability being cast))
      • Hashtable - Save 40 as (Key time) of (Key (Target unit of ability being cast)) in Hashtable
      • Hashtable - Save (Angle from Points[1] to Points[2]) as (Key angle) of (Key (Target unit of ability being cast)) in Hashtable
      • Unit Group - Add (Target unit of ability being cast) to KBGroup
      • Custom script: call RemoveLocation (udg_Points[1])
      • Custom script: call RemoveLocation (udg_Points[2])
      • Trigger - Turn on Two <gen>
  • Two
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KBGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in KBGroup and do (Actions)
            • Loop - Actions
              • Set Time = (Load (Key time) of (Key (Picked unit)) from Hashtable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Time Not equal to 0
                • Then - Actions
                  • Hashtable - Save (Time - 4) as (Key time) of (Key (Picked unit)) in Hashtable
                  • Set Points[3] = (Position of (Picked unit))
                  • Set Points[4] = (Points[3] offset by 15.00 towards (Load (Key angle) of (Key (Picked unit)) from Hashtable) degrees)
                  • Unit - Move (Picked unit) instantly to Points[4]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 100) Less than or equal to 35
                    • Then - Actions
                      • Special Effect - Create a special effect at Points[4] using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Custom script: call RemoveLocation (udg_Points[3])
                  • Custom script: call RemoveLocation (udg_Points[4])
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from KBGroup
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
And here is a test map: View attachment Clash.w3x
 
Status
Not open for further replies.
Top