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

Hook like spell

Status
Not open for further replies.
Level 9
Joined
Jun 10, 2013
Messages
473
You can modify one of the many hook spells in the spell section. If you're requesting one then wrong forum.




Post what you've got and people can help.




Alright :), heres what I've got




  • Hook Events Unit - A unit Starts the effect of an ability
  • Conditions (Ability being cast) Equal to Power Hook
  • Actions -------- ----------------------- --------
  • -------- Index System --------
  • -------- ----------------------- --------
  • 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)
  • -------- ----------------------- --------
  • -------- Spell Settings --------
  • -------- ----------------------- --------
  • Set PH_Counter[PH_Index[2]] = 0
  • -------- ----------------------- --------
  • -------- Points for angle --------
  • Set PH_Cast_Point = (Position of (Triggering unit))
  • Set PH_Target_Point = (Target point of ability being cast)
  • -------- ----------------------- --------
  • -------- Caster --------
  • Set PH_Caster[PH_Index[2]] = (Triggering unit)
  • Unit - Pause PH_Caster[PH_Index[2]]
  • Unit - Add Invulnerable (Neutral) to PH_Caster[PH_Index[2]]
  • -------- ----------------------- --------
  • -------- Angle for hook --------
  • Set PH_Hook_Angle[PH_Index[2]] = (Angle from PH_Cast_Point to PH_Target_Point)
  • -------- ----------------------- --------
  • -------- Hook (Dummy) --------
  • 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)
  • -------- ----------------------- --------
  • -------- Things needed for spell to work fine --------
  • Set PH_Hooked_Is[PH_Index[2]] = False
  • Set PH_Hooked_Unit[PH_Index[2]] = No unit
  • Set PH_Effects[PH_Index[2]] = (Units of type Hook)
  • -------- ----------------------- --------
  • -------- Removing leaks --------
  • Custom script: call RemoveLocation(udg_PH_Near_Point)
  • Custom script: call RemoveLocation(udg_PH_Cast_Point)
  • Custom script: call RemoveLocation(udg_PH_Target_Point)
  • -------- ----------------------- --------
  • -------- Adjustable settings --------
  • -------- ----------------------- --------
  • -------- Damage and Hook Distance --------
  • Set PH_Damage = (100 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]]))
  • Set PH_Distance = (15 + (5 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]])))
  • -------- ----------------------- --------
  • -------- ----------------------- --------



  • 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 -------- ----------------------- --------
  • -------- Moving hook and creating effects --------
  • -------- ----------------------- --------
  • -------- Counter incrasing --------
  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] + 1)
  • -------- ----------------------- --------
  • -------- Set Locations and move Hook dummy --------
  • 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
  • Unit Group - Add (Last created unit) to PH_Effects[PH_Index[3]]
  • Hashtable - Save Handle Of(Last created unit) as PH_Counter[PH_Index[3]] of PH_Index[3] in PH_Table
  • -------- ----------------------- --------
  • -------- Hooking enemy unit --------
  • -------- ----------------------- --------
  • 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 (((Matching unit) belongs to an enemy of (Owner of PH_Caster[PH_Index[3]])) 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
  • 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
  • -------- ----------------------- --------
  • -------- Deal damage --------
  • 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]])
  • -------- Leaks Removed --------
  • -------- ----------------------- --------
  • -------- ----------------------- --------
  • -------- No unit hooked? --------
  • -------- ----------------------- --------
  • 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 -------- ----------------------- --------
  • -------- Moving Hook back --------
  • -------- ----------------------- --------
  • -------- Counter decrasing --------
  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] - 1)
  • -------- ----------------------- --------
  • -------- Setting locations to move Hook dummy and hooked unit --------
  • 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)
  • -------- ----------------------- --------
  • -------- Destroy effect of hook --------
  • 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]]
  • -------- ----------------------- --------
  • -------- Moving hooked unit --------
  • -------- ----------------------- --------
  • 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]])
  • -------- ----------------------- --------
  • -------- Leaks Removed --------
  • -------- ----------------------- --------
  • 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 -------- ----------------------- --------
  • -------- Removing hook and unpause caster --------
  • -------- ----------------------- --------
  • 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
  • Custom script: call DestroyGroup(udg_PH_Effects[udg_PH_Index[3]])
  • -------- ----------------------- --------
  • -------- Unpause Hooked unit --------
  • -------- ----------------------- --------
  • 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
  • -------- ----------------------- --------
  • -------- Spell Ending --------
  • -------- ----------------------- --------
  • 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



Now, currently it hooks the first target it encounter but, I want it to only hook the intended target. Any help would be greatly appreciated >:D
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
Now, currently it hooks the first target it encounter but, I want it to only hook the intended target. Any help would be greatly appreciated >:D

You would probably have to save the 'target unit of ability cast' or whatever it's called into a variable and then simply check if the hook ever comes into contact with the target as it extends. It's somewhat difficult to read your triggers without the indentations but under the "Hooking enemy unit" comment in the second trigger, you would replace the condition of the If-Then-Else statement with a new one checking if the target unit is in range of the hook.

This won't completely solve your problem as you would still need to find a way to make this MUI but it's a start.
 
Level 9
Joined
Jun 10, 2013
Messages
473
You would probably have to save the 'target unit of ability cast' or whatever it's called into a variable and then simply check if the hook ever comes into contact with the target as it extends. It's somewhat difficult to read your triggers without the indentations but under the "Hooking enemy unit" comment in the second trigger, you would replace the condition of the If-Then-Else statement with a new one checking if the target unit is in range of the hook.

This won't completely solve your problem as you would still need to find a way to make this MUI but it's a start.
Sorry, here's the proper indentations

  • Hook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Power Hook
    • Actions
      • -------- ----------------------- --------
      • -------- Index System --------
      • -------- ----------------------- --------
      • 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)
      • -------- ----------------------- --------
      • -------- Spell Settings --------
      • -------- ----------------------- --------
      • Set PH_Counter[PH_Index[2]] = 0
      • -------- ----------------------- --------
      • -------- Points for angle --------
      • Set PH_Cast_Point = (Position of (Triggering unit))
      • Set PH_Target_Point = (Target point of ability being cast)
      • -------- ----------------------- --------
      • -------- Caster --------
      • 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
      • -------- ----------------------- --------
      • -------- Angle for hook --------
      • Set PH_Hook_Angle[PH_Index[2]] = (Angle from PH_Cast_Point to PH_Target_Point)
      • -------- ----------------------- --------
      • -------- Hook (Dummy) --------
      • 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)
      • -------- ----------------------- --------
      • -------- Things needed for spell to work fine --------
      • Set PH_Hooked_Is[PH_Index[2]] = False
      • Set PH_Hooked_Unit[PH_Index[2]] = No unit
      • -------- ----------------------- --------
      • -------- Removing leaks --------
      • Custom script: call RemoveLocation(udg_PH_Near_Point)
      • Custom script: call RemoveLocation(udg_PH_Cast_Point)
      • Custom script: call RemoveLocation(udg_PH_Target_Point)
      • -------- ----------------------- --------
      • -------- Adjustable settings --------
      • -------- ----------------------- --------
      • -------- Damage and Hook Distance --------
      • Set PH_Damage = (100 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]]))
      • Set PH_Distance = (15 + (5 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]])))
      • -------- ----------------------- --------
      • -------- ----------------------- --------
  • 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
                  • -------- ----------------------- --------
                  • -------- Moving hook and creating effects --------
                  • -------- ----------------------- --------
                  • -------- Counter incrasing --------
                  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] + 1)
                  • -------- ----------------------- --------
                  • -------- Set Locations and move Hook dummy --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- Hooking enemy unit --------
                  • -------- ----------------------- --------
                  • 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 (((Matching unit) belongs to an enemy of (Owner of PH_Caster[PH_Index[3]])) 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
                          • 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
                          • -------- ----------------------- --------
                          • -------- Deal damage --------
                          • 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]])
                  • -------- Leaks Removed --------
                  • -------- ----------------------- --------
                  • -------- ----------------------- --------
                  • -------- No unit hooked? --------
                  • -------- ----------------------- --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- Moving Hook back --------
                  • -------- ----------------------- --------
                  • -------- Counter decrasing --------
                  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] - 1)
                  • -------- ----------------------- --------
                  • -------- Setting locations to move Hook dummy and hooked unit --------
                  • 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)
                  • -------- ----------------------- --------
                  • -------- Destroy effect of hook --------
                  • 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]]
                  • -------- ----------------------- --------
                  • -------- Moving hooked unit --------
                  • -------- ----------------------- --------
                  • 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]])
                  • -------- ----------------------- --------
                  • -------- Leaks Removed --------
                  • -------- ----------------------- --------
                • 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
                  • -------- ----------------------- --------
                  • -------- Removing hook and unpause caster --------
                  • -------- ----------------------- --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- Unpause Hooked unit --------
                  • -------- ----------------------- --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- Spell Ending --------
                  • -------- ----------------------- --------
                  • 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
 
Level 8
Joined
Jan 28, 2016
Messages
486
So I know this is late but I thought I'd better not leave this open ended.

I edited the triggers (changes in bold) which should make it so that only the target unit of the hook is a valid target. I'm not sure about the indexing of the target unit but I assume it could be set up the same way as the triggering unit. Also I changed the periodic timeout from 0.02 to 0.03 as anything less than that is redundant.

  • Hook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Power Hook
    • Actions
      • -------- ----------------------- --------
      • -------- Index System --------
      • -------- ----------------------- --------
      • 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)
      • -------- ----------------------- --------
      • -------- Spell Settings --------
      • -------- ----------------------- --------
      • Set PH_Counter[PH_Index[2]] = 0
      • -------- ----------------------- --------
      • -------- Points for angle --------
      • Set PH_Cast_Point = (Position of (Triggering unit))
      • Set PH_Target_Point = (Target point of ability being cast)
      • -------- ----------------------- --------
      • -------- Caster --------
      • 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
      • -------- ----------------------- --------
      • -------- ADDED TARGET UNIT ARRAY --------
      • -------- Target --------
      • Set PH_Target[PH_Index[2]] = (Target unit of ability being cast)
      • -------- ----------------------- --------
      • -------- Angle for hook --------
      • Set PH_Hook_Angle[PH_Index[2]] = (Angle from PH_Cast_Point to PH_Target_Point)
      • -------- ----------------------- --------
      • -------- Hook (Dummy) --------
      • 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)
      • -------- ----------------------- --------
      • -------- Things needed for spell to work fine --------
      • Set PH_Hooked_Is[PH_Index[2]] = False
      • Set PH_Hooked_Unit[PH_Index[2]] = No unit
      • -------- ----------------------- --------
      • -------- Removing leaks --------
      • Custom script: call RemoveLocation(udg_PH_Near_Point)
      • Custom script: call RemoveLocation(udg_PH_Cast_Point)
      • Custom script: call RemoveLocation(udg_PH_Target_Point)
      • -------- ----------------------- --------
      • -------- Adjustable settings --------
      • -------- ----------------------- --------
      • -------- Damage and Hook Distance --------
      • Set PH_Damage = (100 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]]))
      • Set PH_Distance = (15 + (5 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]])))
      • -------- ----------------------- --------
      • -------- ----------------------- --------
  • Hook Loop
    • Events
      • Time - Every 0.03 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
                  • -------- ----------------------- --------
                  • -------- Moving hook and creating effects --------
                  • -------- ----------------------- --------
                  • -------- Counter increasing --------
                  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] + 1)
                  • -------- ----------------------- --------
                  • -------- Set Locations and move Hook dummy --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- RESTRUCTURED GROUP TO AVOID boolexpr --------
                  • -------- AND TO ONLY HOOK THE TARGETED UNIT --------
                  • -------- Hooking enemy unit --------
                  • -------- ----------------------- --------
                  • Custom script: set bj_wantDestroyGroup = true
                  • [B]Unit Group - Pick every unit in (Units within 64.00 of PH_Hook_Point[PH_Index[3]]) and do (Actions)[/B]
                    • 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
                          • PH_Hooked_Is[PH_Index[3]] Equal to False
                          • ((Picked unit) is alive) Equal to True
                          • (Picked unit) Equal to PH_Target[PH_Index[3]]
                          • ((Picked unit) belongs to an enemy of (Owner of PH_Caster[PH_Index[3]])) Equal to True[
                        • 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
                          • -------- ----------------------- --------
                          • -------- Deal damage --------
                          • 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]])
                  • -------- Leaks Removed --------
                  • -------- ----------------------- --------
                  • -------- ----------------------- --------
                  • -------- No unit hooked? --------
                  • -------- ----------------------- --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- Moving Hook back --------
                  • -------- ----------------------- --------
                  • -------- Counter decrasing --------
                  • Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] - 1)
                  • -------- ----------------------- --------
                  • -------- Setting locations to move Hook dummy and hooked unit --------
                  • 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)
                  • -------- ----------------------- --------
                  • -------- Destroy effect of hook --------
                  • 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]]
                  • -------- ----------------------- --------
                  • -------- Moving hooked unit --------
                  • -------- ----------------------- --------
                  • 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]])
                  • -------- ----------------------- --------
                  • -------- Leaks Removed --------
                  • -------- ----------------------- --------
                • 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
                  • -------- ----------------------- --------
                  • -------- Removing hook and unpause caster --------
                  • -------- ----------------------- --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- Unpause Hooked unit --------
                  • -------- ----------------------- --------
                  • 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
                  • -------- ----------------------- --------
                  • -------- Spell Ending --------
                  • -------- ----------------------- --------
                  • 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 8
Joined
Jan 28, 2016
Messages
486
You'd think so but you still need those checks to make sure the unit is alive and such when the hook reaches it. Which reminds me...

@sarumanthecursed I didn't explicitly say this in my previous posts but you need to change the ability of your hook to one that has unit targeting otherwise this won't.
 
Level 9
Joined
Jun 10, 2013
Messages
473
You'd think so but you still need those checks to make sure the unit is alive and such when the hook reaches it. Which reminds me...

@sarumanthecursed I didn't explicitly say this in my previous posts but you need to change the ability of your hook to one that has unit targeting otherwise this won't.
Yeah I figured that, and thanks again!
 
Status
Not open for further replies.
Top