• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Knockback into 1 point [Hashtable]

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
HI all, I am making aspell called Black Hole : the spell create a black hole (^^)
than all ennemy get knockback to the black hole middle point, when units reach a certain point units get hide until the spell finish and explode . After the unit gets unhide & damaged and spell is end

my spell isnt finish yet : if i posted if was for the knockback : UNit doesnt stop in the middle they continu until the spell end. All picked unit Should KNockback to the Target Point and stay to it until the spell end

unless of knoackback aoe im doing the reverse of it but its doesnt work :/

here is my code : any suggestion regards the whole code is appreciated as long it's well explained, Plz remember im french so my english Failed lol , Tryng to getting better but its not all ........ Anyway

any idea how i can make the knockback to 1 point and keep unit on this point O_O


  • KnockbackAOE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tsukuyomi - Madara
    • Actions
      • -------- Just for configuration/readability --------
      • Set KnockBackTrig = (Triggering unit)
      • Set KnockBackPoint[2] = (Target point of ability being cast)
      • Set KB_AOE = 1000.00
      • -------- Distance unit is knocked back per second --------
      • -------- .03 is how often the units are moved, so we multiply the distance by .04 --------
      • Set KnockbackDistance = 25.00
      • -------- How long the unit is knocked back for --------
      • Set KB_AOE_SpellDuration = 5.00
      • -------- ------------ --------
      • -------- ------------ --------
      • Unit - Create 1 Dummy Mangekyou for (Owner of KnockBackTrig) at KnockBackPoint[2] facing Default building facing degrees
      • Set KnockbackDummyMangekyou = (Last created unit)
      • Set KnockBackPoint[1] = (Position of KnockbackDummyMangekyou)
      • Unit - Create 1 Dummy Black Hole for (Owner of KnockBackTrig) at KnockBackPoint[2] facing Default building facing degrees
      • Set KnockbackDummyHole = (Last created unit)
      • -------- ------------ --------
      • -------- ------------ --------
      • -------- Store the values --------
      • Set KnockbackGroup = (Units within KB_AOE of KnockBackPoint[2] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of KnockBackTrig)) Equal to True)))
      • Unit Group - Pick every unit in KnockbackGroup and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Set KnockBackPoint[3] = (Position of (Picked unit))
          • Set KnockbackAngle = (Angle from KnockBackPoint[3] to KnockBackPoint[2])
          • -------- - --------
          • Hashtable - Save Handle OfKnockBackPoint[2] as (Key loc2) of (Key (Picked unit)) in KBHashtable_AOE
          • Hashtable - Save Handle OfKnockBackTrig as (Key unit) of (Key (Picked unit)) in KBHashtable_AOE
          • Unit Group - Add (Picked unit) to KnockbackUnitsAOE
          • Hashtable - Save Handle OfKnockbackDummyMangekyou as (Key dummy) of (Key (Picked unit)) in KBHashtable_AOE
          • Hashtable - Save Handle OfKnockbackDummyHole as (Key dummy2) of (Key (Picked unit)) in KBHashtable_AOE
          • Hashtable - Save KB_AOE as (Key aoe) of (Key (Picked unit)) in KBHashtable_AOE
          • Hashtable - Save KnockbackDistance as (Key distance) of (Key (Picked unit)) in KBHashtable_AOE
          • Hashtable - Save KnockbackAngle as (Key angle) of (Key (Picked unit)) in KBHashtable_AOE
          • Hashtable - Save KB_AOE_SpellDuration as (Key time) of (Key (Picked unit)) in KBHashtable_AOE
          • -------- - --------
      • -------- - --------
      • Custom script: call RemoveLocation(udg_KnockBackPoint[2])
      • Custom script: call RemoveLocation(udg_KnockBackPoint[3])
      • Custom script: call RemoveLocation(udg_KnockBackPoint[1])
      • Custom script: call DestroyGroup(udg_KnockbackGroup)
      • -------- - --------
      • If ((Knockback loop <gen> is on) Equal to False) then do (Trigger - Turn on Knockback loop <gen>) else do (-------- do nothing comment,>.> 2 lazy --------)
  • Knockback loop
    • 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
          • (Number of units in KnockbackUnitsAOE) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in KnockbackUnitsAOE and do (Actions)
            • Loop - Actions
              • -------- Load all necessary variables stored in the Hashtable --------
              • Set KnockBackTrig = (Load (Key unit) of (Key (Picked unit)) in KBHashtable_AOE)
              • Set KnockbackDummyMangekyou = (Load (Key dummy) of (Key (Picked unit)) in KBHashtable_AOE)
              • Set KnockbackDummyHole = (Load (Key dummy2) of (Key (Picked unit)) in KBHashtable_AOE)
              • Set KnockbackDistance = (Load (Key distance) of (Key (Picked unit)) from KBHashtable_AOE)
              • Set KnockbackAngle = (Load (Key angle) of (Key (Picked unit)) from KBHashtable_AOE)
              • Set KB_AOE = (Load (Key aoe) of (Key (Picked unit)) from KBHashtable_AOE)
              • Set KB_AOE_SpellDuration = (Load (Key time) of (Key (Picked unit)) from KBHashtable_AOE)
              • Set KnockBackPoint[5] = (Load (Key loc2) of (Key (Picked unit)) in KBHashtable_AOE)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KB_AOE_SpellDuration Greater than 0.00
                • Then - Actions
                  • Set Position_Picked = (Position of (Picked unit))
                  • -------- Move the unit and update time remaining --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between Position_Picked and KnockBackPoint[5]) Greater than 10.00
                    • Then - Actions
                      • Unit - Move (Picked unit) instantly to (Position_Picked offset by KnockbackDistance towards KnockbackAngle degrees)
                      • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissile.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between Position_Picked and KnockBackPoint[5]) Less than or equal to 50.00
                        • Then - Actions
                          • Unit - Hide (Picked unit)
                        • Else - Actions
                  • Hashtable - Save (KB_AOE_SpellDuration - 0.04) as (Key time) of (Key (Picked unit)) in KBHashtable_AOE
                  • Custom script: call RemoveLocation(udg_Position_Picked)
                • Else - Actions
                  • Unit - Unpause (Picked unit)
                  • Unit - Unhide (Picked unit)
                  • Unit - Turn collision for (Picked unit) On
                  • -------- -------------- --------
                  • Set KnockBackPoint[4] = (Position of KnockbackDummyMangekyou)
                  • Unit - Create 1 Dummy_Map for (Owner of KnockBackTrig) at KnockBackPoint[4] facing Default building facing degrees
                  • -------- Bigger the dummy is Bigger the effect attach on him will be bigger as well --------
                  • Animation - Change (Last created unit)'s size to (200.00%, 200.00%, 200.00%) of its original size
                  • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                  • Special Effect - Create a special effect attached to the origin of (Last created unit) using NuclearExplosion.mdx
                  • Special Effect - Destroy (Last created special effect)
                  • -------- -------------- --------
                  • -------- Knockback is done, clean up --------
                  • Unit Group - Remove (Picked unit) from KnockbackUnitsAOE
                  • Unit - Remove KnockbackDummyMangekyou from the game
                  • Unit - Remove KnockbackDummyHole from the game
                  • Custom script: call RemoveLocation(udg_KnockBackPoint[4])
                  • Custom script: call RemoveLocation(udg_KnockBackPoint[5])
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in KBHashtable_AOE
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Can you post the map? Use debugging messages, Game - Display Message.

The knockback speed is 25, and you check whether the distance is less than 10 or not. The distance can jump from 12 to 13, never being under 10. So that 10 is too small number. Make it at least (knockback speed / 2) + 1.

  • (Distance between Position_Picked and KnockBackPoint[5]) Less than or equal to 50.00
^That will always be true if it goes to the else, no need for that.
 
Status
Not open for further replies.
Top