• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] How to make meat hook faster?

Status
Not open for further replies.
Level 19
Joined
Feb 15, 2008
Messages
2,184
  • Hook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sumo Meat Hook 1 (TSM)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PH_Index[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on Hook Loop <gen>
        • Else - Actions
      • Set PH_Index[1] = (PH_Index[1] + 1)
      • Set PH_Index[2] = (PH_Index[2] + 1)
      • Set PH_Counter[PH_Index[2]] = 0
      • Set PH_Cast_Point = (Position of (Triggering unit))
      • Set PH_Target_Point = (Target point of ability being cast)
      • Set PH_Caster[PH_Index[2]] = (Triggering unit)
      • Unit - Pause PH_Caster[PH_Index[2]]
      • Animation - Play PH_Caster[PH_Index[2]]'s attack animation
      • Set PH_Hook_Angle[PH_Index[2]] = (Angle from PH_Cast_Point to PH_Target_Point)
      • Set PH_Near_Point = (PH_Cast_Point offset by 100.00 towards PH_Hook_Angle[PH_Index[2]] degrees)
      • Unit - Create 1 Hook for (Owner of PH_Caster[PH_Index[2]]) at PH_Near_Point facing Default building facing degrees
      • Set PH_Dummy[PH_Index[2]] = (Last created unit)
      • Set PH_Hooked_Is[PH_Index[2]] = False
      • Set PH_Hooked_Unit[PH_Index[2]] = No unit
      • Custom script: call RemoveLocation(udg_PH_Near_Point)
      • Custom script: call RemoveLocation(udg_PH_Cast_Point)
      • Custom script: call RemoveLocation(udg_PH_Target_Point)
      • Set PH_Damage = (100 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]]))
      • Set PH_Distance = (70 + (10 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]])))
SECOND TRIGGER

  • Hook Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer PH_Index[3]) from 1 to PH_Index[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PH_Counter[PH_Index[3]] Less than PH_Distance
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PH_Hooked_Is[PH_Index[3]] Equal to False
                • Then - Actions
                  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] + 1)
                  • Set PH_Dummy_Point[PH_Index[3]] = (Position of PH_Dummy[PH_Index[3]])
                  • Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by 30.00 towards PH_Hook_Angle[PH_Index[3]] degrees)
                  • Unit - Move PH_Dummy[PH_Index[3]] instantly to PH_Hook_Point[PH_Index[3]]
                  • Unit - Create 1 Effect for (Owner of PH_Caster[PH_Index[3]]) at PH_Dummy_Point[PH_Index[3]] facing PH_Hook_Angle[PH_Index[3]] degrees
                  • Unit - Turn collision for (Last created unit) Off
                  • Hashtable - Save Handle Of(Last created unit) as PH_Counter[PH_Index[3]] of PH_Index[3] in PH_Table
                  • Custom script: set bj_wantDestroyGroup = true
                  • Unit Group - Pick every unit in (Units within 64.00 of PH_Hook_Point[PH_Index[3]] matching (((Matching unit) is alive) Equal to True)) and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has buff Invulnerable) Equal to False
                          • (Level of Invulnerable (Neutral) for (Picked unit)) Equal to 0
                          • (Owner of (Picked unit)) Not equal to Neutral Hostile
                          • (Owner of (Picked unit)) Not equal to Neutral Victim
                          • (Owner of (Picked unit)) Not equal to Neutral Extra
                          • (Owner of (Picked unit)) Not equal to Neutral Passive
                          • ((Picked unit) is Magic Immune) Equal to False
                          • ((Picked unit) is A structure) Equal to False
                          • PH_Hooked_Is[PH_Index[3]] Equal to False
                        • Then - Actions
                          • Set PH_Hooked_Unit[PH_Index[3]] = (Picked unit)
                          • Set PH_Hooked_Is[PH_Index[3]] = True
                          • Unit - Pause (Picked unit)
                          • Unit - Turn collision for (Picked unit) Off
                          • Unit - Cause PH_Caster[PH_Index[3]] to damage (Picked unit), dealing (Real(PH_Damage)) damage of attack type Spells and damage type Lightning
                        • Else - Actions
                  • Custom script: call RemoveLocation(udg_PH_Dummy_Point[udg_PH_Index[3]])
                  • Custom script: call RemoveLocation(udg_PH_Hook_Point[udg_PH_Index[3]])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PH_Counter[PH_Index[3]] Equal to PH_Distance
                    • Then - Actions
                      • Set PH_Hooked_Is[PH_Index[3]] = True
                      • Unit - Unpause PH_Caster[PH_Index[3]]
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PH_Hooked_Is[PH_Index[3]] Equal to True
                • Then - Actions
                  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] - 1)
                  • Set PH_Dummy_Point[PH_Index[3]] = (Position of PH_Dummy[PH_Index[3]])
                  • Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by 30.00 towards (PH_Hook_Angle[PH_Index[3]] - 180.00) degrees)
                  • Set PH_Effect = (Load (PH_Counter[PH_Index[3]] + 1) of PH_Index[3] in PH_Table)
                  • Unit - Kill PH_Effect
                  • Unit - Remove PH_Effect from the game
                  • Unit - Move PH_Dummy[PH_Index[3]] instantly to PH_Hook_Point[PH_Index[3]]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
                    • Then - Actions
                      • Unit - Move PH_Hooked_Unit[PH_Index[3]] instantly to PH_Dummy_Point[PH_Index[3]]
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_PH_Dummy_Point[udg_PH_Index[3]])
                  • Custom script: call RemoveLocation(udg_PH_Hook_Point[udg_PH_Index[3]])
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PH_Counter[PH_Index[3]] Equal to 0
                • Then - Actions
                  • Unit - Kill PH_Dummy[PH_Index[3]]
                  • Unit - Remove PH_Dummy[PH_Index[3]] from the game
                  • Unit - Unpause PH_Caster[PH_Index[3]]
                  • Animation - Reset PH_Caster[PH_Index[3]]'s animation
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
                    • Then - Actions
                      • Unit - Unpause PH_Hooked_Unit[PH_Index[3]]
                      • Unit - Turn collision for PH_Hooked_Unit[PH_Index[3]] On
                    • Else - Actions
                  • Set PH_Index[1] = (PH_Index[1] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PH_Index[1] Equal to 0
                    • Then - Actions
                      • Set PH_Index[2] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
I touched all nothing helps just the first one in loop. But then it dont make unit go whole way to the hero.
 
Level 4
Joined
Oct 9, 2009
Messages
50
Faster, as in, how fast you want it to drag the unit to you?

You already have the trigger activating every .02 seconds, if that is still too slow, change the "Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by 30.00" parts to a slightly bigger number, like 35/40/45.

If I'm reading everything right, that should help. Don't make the number too big, or else it will start looking like the unit is teleporting, not being dragged.
 
Level 8
Joined
Oct 31, 2010
Messages
238
EDIT:
You forgot to change the hooking back PH_Hook_Point offset from 30 to 45/60...
Look at this: (I highlighted the parts you require to change - red & green)
Code:
Hook Loop
    Events
        Time - Every 0.02 seconds of game time
    Conditions
    Actions
        For each (Integer PH_Index[3]) from 1 to PH_Index[2], do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        PH_Counter[PH_Index[3]] Less than PH_Distance
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                PH_Hooked_Is[PH_Index[3]] Equal to False
                            Then - Actions
                                Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] + 1)
                                Set PH_Dummy_Point[PH_Index[3]] = (Position of PH_Dummy[PH_Index[3]])
                                [COLOR="Lime"]Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by [COLOR="Red"]45.00[/COLOR] towards PH_Hook_Angle[PH_Index[3]] degrees)[/COLOR]
                                Unit - Move PH_Dummy[PH_Index[3]] instantly to PH_Hook_Point[PH_Index[3]]
                                Unit - Create 1 Effect for (Owner of PH_Caster[PH_Index[3]]) at PH_Dummy_Point[PH_Index[3]] facing PH_Hook_Angle[PH_Index[3]] degrees
                                Unit - Turn collision for (Last created unit) Off
                                Hashtable - Save Handle Of(Last created unit) as PH_Counter[PH_Index[3]] of PH_Index[3] in PH_Table
                                Custom script:   set bj_wantDestroyGroup = true
                                Unit Group - Pick every unit in (Units within 64.00 of PH_Hook_Point[PH_Index[3]] matching (((Matching unit) is alive) Equal to True)) and do (Actions)
                                    Loop - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                ((Picked unit) is Magic Immune) Equal to False
                                                ((Picked unit) is A structure) Equal to False
                                                PH_Hooked_Is[PH_Index[3]] Equal to False
                                            Then - Actions
                                                Set PH_Hooked_Unit[PH_Index[3]] = (Picked unit)
                                                Set PH_Hooked_Is[PH_Index[3]] = True
                                                Unit - Pause (Picked unit)
                                                Unit - Turn collision for (Picked unit) Off
                                                Unit - Cause PH_Caster[PH_Index[3]] to damage (Picked unit), dealing (Real(PH_Damage)) damage of attack type Spells and damage type Lightning
                                            Else - Actions
                                Custom script:   call RemoveLocation(udg_PH_Dummy_Point[udg_PH_Index[3]])
                                Custom script:   call RemoveLocation(udg_PH_Hook_Point[udg_PH_Index[3]])
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Counter[PH_Index[3]] Equal to PH_Distance
                                    Then - Actions
                                        Set PH_Hooked_Is[PH_Index[3]] = True
                                        Unit - Unpause PH_Caster[PH_Index[3]]
                                    Else - Actions
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                PH_Hooked_Is[PH_Index[3]] Equal to True
                            Then - Actions
                                Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] - 1)
                                Set PH_Dummy_Point[PH_Index[3]] = (Position of PH_Dummy[PH_Index[3]])
                               [COLOR="Lime"] Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by [COLOR="Red"]45.00[/COLOR] towards (PH_Hook_Angle[PH_Index[3]] - 180.00) degrees)[/COLOR]
                                Set PH_Effect = (Load (PH_Counter[PH_Index[3]] + 1) of PH_Index[3] in PH_Table)
                                Unit - Kill PH_Effect
                                Unit - Remove PH_Effect from the game
                                Unit - Move PH_Dummy[PH_Index[3]] instantly to PH_Hook_Point[PH_Index[3]]
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
                                    Then - Actions
                                        Unit - Move PH_Hooked_Unit[PH_Index[3]] instantly to PH_Dummy_Point[PH_Index[3]]
                                    Else - Actions
                                Custom script:   call RemoveLocation(udg_PH_Dummy_Point[udg_PH_Index[3]])
                                Custom script:   call RemoveLocation(udg_PH_Hook_Point[udg_PH_Index[3]])
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                PH_Counter[PH_Index[3]] Equal to 0
                            Then - Actions
                                Unit - Kill PH_Dummy[PH_Index[3]]
                                Unit - Remove PH_Dummy[PH_Index[3]] from the game
                                Unit - Unpause PH_Caster[PH_Index[3]]
                                Animation - Reset PH_Caster[PH_Index[3]]'s animation
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
                                    Then - Actions
                                        Unit - Unpause PH_Hooked_Unit[PH_Index[3]]
                                        Unit - Turn collision for PH_Hooked_Unit[PH_Index[3]] On
                                    Else - Actions
                                Set PH_Index[1] = (PH_Index[1] - 1)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Index[1] Equal to 0
                                    Then - Actions
                                        Set PH_Index[2] = 0
                                        Trigger - Turn off (This trigger)
                                    Else - Actions
                            Else - Actions
                    Else - Actions

I recommend doing this:


Code:
Hook
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Sumo Meat Hook 1 (TSM)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                PH_Index[1] Equal to 0
            Then - Actions
                Trigger - Turn on Hook Loop <gen>
            Else - Actions
[COLOR="Red"]        -- // ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== --
        [COLOR="Lime"]Set PH_Hook_Offset = 45.00[/COLOR]
        -- // ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== --[/COLOR]
        Set PH_Index[1] = (PH_Index[1] + 1)
        Set PH_Index[2] = (PH_Index[2] + 1)
        Set PH_Counter[PH_Index[2]] = 0
        Set PH_Cast_Point = (Position of (Triggering unit))
        Set PH_Target_Point = (Target point of ability being cast)
        Set PH_Caster[PH_Index[2]] = (Triggering unit)
        Unit - Pause PH_Caster[PH_Index[2]]
        Animation - Play PH_Caster[PH_Index[2]]'s attack animation
        Set PH_Hook_Angle[PH_Index[2]] = (Angle from PH_Cast_Point to PH_Target_Point)
        Set PH_Near_Point = (PH_Cast_Point offset by 100.00 towards PH_Hook_Angle[PH_Index[2]] degrees)
        Unit - Create 1 Hook for (Owner of PH_Caster[PH_Index[2]]) at PH_Near_Point facing Default building facing degrees
        Set PH_Dummy[PH_Index[2]] = (Last created unit)
        Set PH_Hooked_Is[PH_Index[2]] = False
        Set PH_Hooked_Unit[PH_Index[2]] = No unit
        Custom script:   call RemoveLocation(udg_PH_Near_Point)
        Custom script:   call RemoveLocation(udg_PH_Cast_Point)
        Custom script:   call RemoveLocation(udg_PH_Target_Point)
        Set PH_Damage = (100 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]]))
        Set PH_Distance = (70 + (10 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]])))

Code:
Hook Loop
    Events
        Time - Every 0.02 seconds of game time
    Conditions
    Actions
        For each (Integer PH_Index[3]) from 1 to PH_Index[2], do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        PH_Counter[PH_Index[3]] Less than PH_Distance
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                PH_Hooked_Is[PH_Index[3]] Equal to False
                            Then - Actions
                                Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] + 1)
                                Set PH_Dummy_Point[PH_Index[3]] = (Position of PH_Dummy[PH_Index[3]])
                                [COLOR="Lime"]Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by [COLOR="Red"]PH_Hook_Offset[/COLOR] towards PH_Hook_Angle[PH_Index[3]] degrees)[/COLOR]
                                Unit - Move PH_Dummy[PH_Index[3]] instantly to PH_Hook_Point[PH_Index[3]]
                                Unit - Create 1 Effect for (Owner of PH_Caster[PH_Index[3]]) at PH_Dummy_Point[PH_Index[3]] facing PH_Hook_Angle[PH_Index[3]] degrees
                                Unit - Turn collision for (Last created unit) Off
                                Hashtable - Save Handle Of(Last created unit) as PH_Counter[PH_Index[3]] of PH_Index[3] in PH_Table
                                Custom script:   set bj_wantDestroyGroup = true
                                Unit Group - Pick every unit in (Units within 64.00 of PH_Hook_Point[PH_Index[3]] matching (((Matching unit) is alive) Equal to True)) and do (Actions)
                                    Loop - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                ((Picked unit) is Magic Immune) Equal to False
                                                ((Picked unit) is A structure) Equal to False
                                                PH_Hooked_Is[PH_Index[3]] Equal to False
                                            Then - Actions
                                                Set PH_Hooked_Unit[PH_Index[3]] = (Picked unit)
                                                Set PH_Hooked_Is[PH_Index[3]] = True
                                                Unit - Pause (Picked unit)
                                                Unit - Turn collision for (Picked unit) Off
                                                Unit - Cause PH_Caster[PH_Index[3]] to damage (Picked unit), dealing (Real(PH_Damage)) damage of attack type Spells and damage type Lightning
                                            Else - Actions
                                Custom script:   call RemoveLocation(udg_PH_Dummy_Point[udg_PH_Index[3]])
                                Custom script:   call RemoveLocation(udg_PH_Hook_Point[udg_PH_Index[3]])
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Counter[PH_Index[3]] Equal to PH_Distance
                                    Then - Actions
                                        Set PH_Hooked_Is[PH_Index[3]] = True
                                        Unit - Unpause PH_Caster[PH_Index[3]]
                                    Else - Actions
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                PH_Hooked_Is[PH_Index[3]] Equal to True
                            Then - Actions
                                Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] - 1)
                                Set PH_Dummy_Point[PH_Index[3]] = (Position of PH_Dummy[PH_Index[3]])
                               [COLOR="Lime"] Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by [COLOR="Red"]PH_Hook_Offset[/COLOR] towards (PH_Hook_Angle[PH_Index[3]] - 180.00) degrees)[/COLOR]
                                Set PH_Effect = (Load (PH_Counter[PH_Index[3]] + 1) of PH_Index[3] in PH_Table)
                                Unit - Kill PH_Effect
                                Unit - Remove PH_Effect from the game
                                Unit - Move PH_Dummy[PH_Index[3]] instantly to PH_Hook_Point[PH_Index[3]]
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
                                    Then - Actions
                                        Unit - Move PH_Hooked_Unit[PH_Index[3]] instantly to PH_Dummy_Point[PH_Index[3]]
                                    Else - Actions
                                Custom script:   call RemoveLocation(udg_PH_Dummy_Point[udg_PH_Index[3]])
                                Custom script:   call RemoveLocation(udg_PH_Hook_Point[udg_PH_Index[3]])
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                PH_Counter[PH_Index[3]] Equal to 0
                            Then - Actions
                                Unit - Kill PH_Dummy[PH_Index[3]]
                                Unit - Remove PH_Dummy[PH_Index[3]] from the game
                                Unit - Unpause PH_Caster[PH_Index[3]]
                                Animation - Reset PH_Caster[PH_Index[3]]'s animation
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
                                    Then - Actions
                                        Unit - Unpause PH_Hooked_Unit[PH_Index[3]]
                                        Unit - Turn collision for PH_Hooked_Unit[PH_Index[3]] On
                                    Else - Actions
                                Set PH_Index[1] = (PH_Index[1] - 1)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PH_Index[1] Equal to 0
                                    Then - Actions
                                        Set PH_Index[2] = 0
                                        Trigger - Turn off (This trigger)
                                    Else - Actions
                            Else - Actions
                    Else - Actions
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
0.02 is the fastest, I'd say in an Event...
Although minimum should be 0.03s per Event...
Try change this:
  • Set PH_Hook_Point[PH_Index[3]] = (PH_Dummy_Point[PH_Index[3]] offset by 30.00 towards PH_Hook_Angle[PH_Index[3]] degrees)
Make from 30.00 to 50.00 or any above than that
It'll make your hook moves faster ahead
 
Status
Not open for further replies.
Top