[General] Hook System Topic using GUI

Level 7
Joined
Oct 6, 2022
Messages
172
Hello everyone, i would like to open this Hook Topic for those who want to ask of how would a certain hook would work in GUI trigger.
A knowledge about hook - basically Hook is a one of the skill of a certain hero name pudge from dota1 that catches a single unit using his hook and drags it into his position.
(Video for more information):

Credits to "TheBaltazarTV"

but in this topic like i said, i would like to open this Hook Topic for those who want to ask of how would a certain Hook would work in GUI trigger. which it would be a various types of what people would want/like to know.




Now for the start, i would like to go and ask first.

How to do an AoE hook(Blizzard is base ability) that creates 5 hooks(+1 per level) at the center of the target point drags the 5 units(+1 per level) from 500 AoE range into the center of the target point?





that's all for me.
 
Last edited:
Level 25
Joined
Mar 29, 2020
Messages
1,465
this seems like a decent GUI hook system :


once you have the hook part set up you just need a dummy to cast it from the middle of the AOE at the units in range
 
Level 7
Joined
Oct 6, 2022
Messages
172
I was able to make my own single hook when i was offline yesterday, but for some reason it didn't work when i make it multiple hooks in my first attempt.

i tried to do it again as for my second attempt but different however, it seems it doesn't work either. i would like to stick with the second attempt since to avoid many triggers i'm creating for the sake of this one. so here's the trigger of my 2nd attempt. please help me with this guys

  • DeadM Hook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to []DeadMaster[] Hook
    • Actions
      • Set DeadM_Hook_Unit[1] = (Casting unit)
      • Set DeadM_Point[1] = (Target point of ability being cast)
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set DeadM_Point[2] = (DeadM_Point[1] offset by 70.00 towards (Real(((Integer A) x 70))) degrees)
          • Unit - Create 1 Meat Hook for (Owner of DeadM_Hook_Unit[1]) at DeadM_Point[2] facing ((Real((Integer A))) x 70.00) degrees
          • Set DeadM_Hook_Unit[2] = (Last created unit)
          • Unit Group - Add DeadM_Unit[2] to DeadM_UnitGroup[1]
      • Set DeadM_Hook_Count = 0
      • Set DeadM_Hook_Distance = 0.00
      • Set DeadM_Hook_Distance_Max = 1000.00
      • Trigger - Turn on DeadM Hook Loop <gen>
  • DeadM Hook Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DeadM_UnitGroup[1] and do (Actions)
        • Loop - Actions
          • Set DeadM_Hook_Unit[3] = (Picked unit)
          • For each (Integer A) from 1 to DeadM_Hook_Count, do (Actions)
            • Loop - Actions
              • Unit - Move DeadM_Hook_Chain[(Integer A)] instantly to ((Position of DeadM_Hook_Chain[(Integer A)]) offset by 50.00 towards (Angle from (Position of DeadM_Hook_Chain[(Integer A)]) to (Position of DeadM_Hook_Unit[1])) degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DeadM_Hook_Distance Less than DeadM_Hook_Distance_Max
            • Then - Actions
              • Set DeadM_Hook_Distance = (DeadM_Hook_Distance + 50.00)
              • Set DeadM_Hook_Count = (DeadM_Hook_Count + 1)
              • Unit - Create 1 Meat Hook for (Owner of DeadM_Hook_Unit[1]) at (Position of DeadM_Hook_Unit[3]) facing (Facing of DeadM_Hook_Unit[3]) degrees
              • Set DeadM_Hook_Chain[DeadM_Hook_Count] = (Last created unit)
              • Unit - Move DeadM_Hook_Unit[3] instantly to ((Position of DeadM_Hook_Unit[3]) offset by 50.00 towards (Facing of DeadM_Hook_Unit[3]) degrees)
              • Unit Group - Pick every unit in (Random 1 units from (Units within 175.00 of (Position of DeadM_Hook_Unit[3]))) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A structure) Equal to False
                      • ((Picked unit) is dead) Equal to False
                      • (Picked unit) Not equal to DeadM_Hook_Unit[1]
                      • (Unit-type of (Picked unit)) Not equal to Majin Saber
                      • ((Picked unit) is in DeadM_UnitGroup[1]) Equal to False
                    • Then - Actions
                      • Set DeadM_Hook_Unit[4] = (Picked unit)
                      • Set DeadM_Hook_Distance = DeadM_Hook_Distance_Max
                    • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeadM_Hook_Distance Greater than or equal to DeadM_Hook_Distance_Max
                • Then - Actions
                  • Special Effect - Create a special effect at (Position of DeadM_Hook_Unit[3]) using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Move DeadM_Hook_Unit[3] instantly to (Position of DeadM_Hook_Chain[DeadM_Hook_Count])
                  • Unit - Move DeadM_Hook_Unit[4] instantly to (Position of DeadM_Hook_Unit[3])
                  • Unit - Remove DeadM_Hook_Chain[DeadM_Hook_Count] from the game
                  • Set DeadM_Hook_Count = (DeadM_Hook_Count - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between (Position of DeadM_Hook_Unit[1]) and (Position of DeadM_Hook_Unit[3])) Less than or equal to 200.00
                    • Then - Actions
                      • For each (Integer A) from 1 to DeadM_Hook_Count, do (Actions)
                        • Loop - Actions
                          • Unit - Remove DeadM_Hook_Chain[(Integer A)] from the game
                      • Set DeadM_Hook_Count = 0
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeadM_Hook_Count Equal to 0
                    • Then - Actions
                      • Unit Group - Pick every unit in DeadM_UnitGroup[1] and do (Actions)
                        • Loop - Actions
                          • Unit - Remove DeadM_Hook_Unit[3] from the game
                          • Set DeadM_Hook_Unit[3] = No unit
                      • Set DeadM_Hook_Unit[1] = No unit
                      • Set DeadM_Hook_Unit[4] = No unit
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
 
Level 5
Joined
May 12, 2008
Messages
80
It seems you are using global variables in a way that they overwrite each other.
For example DeadM_Hook_Distance increases by 50 for each unit in DeadM_UnitGroup[1]. So, as you create 5 hooks, its increased by 250 for each iteration of the loop trigger.

I'll try to set up an example trigger and post it tomorrow.

However, i'd like to ask you a few questions:

1: You don't want the hooked units to get dragged to your caster but to the center of the blizzard spell?

2: Is there only a single unit at any time, that can use the ability or might there be multiple units, that use the ability at the same time? In other words, do you know about MUI and is it relevant?
 
Level 7
Joined
Oct 6, 2022
Messages
172
Hello, sorry for the late reply.

You can drag the triggering unit, it is for the purpose of using it as an escape.
Single unit for each hook, only the triggering unit can use it.
 
Level 5
Joined
May 12, 2008
Messages
80
Test map is attached. Not 100% sure if this is what you wanted but it is what i understood from post #1.
Keep in mind that I have no experience with hooks and eventual pitfalls. Taking a close look at Cheshires suggestion and examining the triggers might be a good learning experience.

Also this will break as soon as you have multiple units casting the ability at the same time or if the cooldown is shorter than the duration of the ability.
In this case, redesign with hashtables or unit indexer for example.

  • DeadM Hook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hook
    • Actions
      • Set MeatHook = Meat Hook
      • Set DeadM_Hook_Distance_Max = 1000.00
      • Set DeadM_Hook_Distance_Gap[1] = 70.00
      • Set DeadM_Hook_Distance_Gap[2] = 50.00
      • Set DeadM_UnitGroup[2] = (Units in Kein Gebiet)
      • Set DeadM_Hook_Caster = (Casting unit)
      • Set DeadM_Point_Target = (Target point of ability being cast)
      • Set DeadM_Level = ((Level of Hook for DeadM_Hook_Caster) + 4)
      • Set DeadM_Hooks_Per_Chain = ((Integer(((DeadM_Hook_Distance_Max - DeadM_Hook_Distance_Gap[1]) / DeadM_Hook_Distance_Gap[2]))) + 1)
      • For each (Integer A) from 1 to DeadM_Level, do (Actions)
        • Loop - Actions
          • Set DeadM_Hook_Count[(Integer A)] = 0
          • Set DeadM_Facing[(Integer A)] = ((360.00 / (Real(DeadM_Level))) x (Real((Integer A))))
          • Set DeadM_Point[(Integer A)] = (DeadM_Point_Target offset by DeadM_Hook_Distance_Gap[1] towards DeadM_Facing[(Integer A)] degrees)
          • Set DeadM_Forward[(Integer A)] = True
      • Trigger - Turn on DeadM Hook Loop <gen>
  • DeadM Hook Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set DeadM_Hook_Count[0] = 0
      • For each (Integer B) from 1 to DeadM_Level, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • DeadM_Hook_Target[(Integer B)] Ungleich Keine Einheit
                  • DeadM_Hook_Count[(Integer B)] Größer gleich DeadM_Hooks_Per_Chain
            • Then - Actions
              • Set DeadM_Forward[(Integer B)] = False
            • Else - Actions
          • Set DeadM_Point[0] = (DeadM_Point[(Integer B)] offset by (DeadM_Hook_Distance_Gap[2] x (Real(DeadM_Hook_Count[(Integer B)]))) towards DeadM_Facing[(Integer B)] degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DeadM_Forward[(Integer B)] Gleich True
            • Then - Actions
              • Unit - Create 1 MeatHook for (Owner of DeadM_Hook_Caster) at DeadM_Point[0] facing DeadM_Facing[(Integer B)] degrees
              • Set DeadM_Hook_Chain[((((Integer B) - 1) x DeadM_Hooks_Per_Chain) + DeadM_Hook_Count[(Integer B)])] = (Last created unit)
              • Set DeadM_UnitGroup[1] = (Units within 175.00 of DeadM_Point[0] matching ((((((Matching unit) is Ein Gebäude) Gleich False) and (((Matching unit) is alive) Gleich True)) and ((Matching unit) Ungleich DeadM_Hook_Caster)) and ((((Matching unit) is in DeadM_UnitGroup[2]) Gleich False)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in DeadM_UnitGroup[1]) Größer als 0
                • Then - Actions
                  • Set DeadM_Hook_Target[(Integer B)] = (Random unit from DeadM_UnitGroup[1])
                  • Unit Group - Add DeadM_Hook_Target[(Integer B)] to DeadM_UnitGroup[2]
                • Else - Actions
              • Set DeadM_Hook_Count[(Integer B)] = (DeadM_Hook_Count[(Integer B)] + 1)
              • Set DeadM_Hook_Count[0] = 1
              • Custom script: call DestroyGroup(udg_DeadM_UnitGroup[1])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeadM_Hook_Count[(Integer B)] Größer als 0
                • Then - Actions
                  • Set DeadM_Hook_Count[(Integer B)] = (DeadM_Hook_Count[(Integer B)] - 1)
                  • Unit - Remove DeadM_Hook_Chain[((((Integer B) - 1) x DeadM_Hooks_Per_Chain) + DeadM_Hook_Count[(Integer B)])] from the game
                  • Unit - Move DeadM_Hook_Target[(Integer B)] instantly to DeadM_Point[0], facing (DeadM_Facing[(Integer B)] - 180.00) degrees
                  • Set DeadM_Hook_Count[0] = 1
                • Else - Actions
                  • Set DeadM_Hook_Target[(Integer B)] = Keine Einheit
                  • Custom script: call RemoveLocation(udg_DeadM_Point[GetForLoopIndexB()])
          • Custom script: call RemoveLocation(udg_DeadM_Point[0])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeadM_Hook_Count[0] Gleich 0
        • Then - Actions
          • Custom script: call RemoveLocation(udg_DeadM_Point_Target)
          • Custom script: call DestroyGroup(udg_DeadM_UnitGroup[2])
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

Attachments

  • Hook Test.w3x
    29.2 KB · Views: 5
Top