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

Phantom Hook[variation 2] v1.22

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: Deuterium
This is the second variation of my phantom hook,I upload it because of a request.Here is the description:

The warden shoots out a phantom hook that deals damage to the first unit it catches or disappear if there is no unit in range.Whenever it hits an enemy the enemy is teleported to the warden`s position.
Level 1-Hook has 500 range and deals 75 damage.
Level 2-Hook has 800 range and deals 150 damage.
Level 3-Hook has 1100 range and deals 225 damage.


The main changes are the hook visuality and the spell effects.
Here is the original spell:http://www.hiveworkshop.com/forums/spells-569/phantom-hook-143600/

Updates:
v1.1 Changed all the things deuterium mentioned,including the advice for the teleportation
v1.2 Fixed a major bug(I think)
v1.22 Fixed the unit group bug.

Keywords:
Phantom,Hook,v.2
Contents

Phantom Hook[variation 2] v1.22 (Map)

Reviews
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. IcemanBo: http://www.hiveworkshop.com/forums/spells-569/phantom-hook-variation-2-v1-22-a-143725/index2.html#post2638085 19:04, 20th Sep 2009 Deuterium: The spell is creative and...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: For long time as NeedsFix. Rejected.

IcemanBo: http://www.hiveworkshop.com/forums/spells-569/phantom-hook-variation-2-v1-22-a-143725/index2.html#post2638085
19:04, 20th Sep 2009
Deuterium:

The spell is creative and original. I'd advice anyone searching for such a spell to use this.
 
Level 7
Joined
Sep 8, 2009
Messages
90
Here it is-the second variation of the phantom hook.Spell requested by vercas.Again it can be controlled.If you find any bugs or problems,please tell me so I can fix them.
Hell gate-Actually where did you found the location leak?The hero and the unit are both moved to 1 point and I have cleaned the location leak on that point ?
 
Last edited:
Level 17
Joined
Mar 17, 2009
Messages
1,349
Well I skimmed and didn't see any leaks... but I might wrong.

Anyways, to the advice:
When the caster moves with the target, move the camera to the location of the triggering unit :) or leave an option to choose whether the importer wants the camera to move or not :)

Also, since it's a second variation of hook spell, well, instead of having it in a separate thread, insert it into the map with the original hook and update it :) it's easier to check one thread with two spells...
 
Level 7
Joined
Sep 8, 2009
Messages
90
Well many people told me to change the camera so maybe I`ll do that :)
Also the spell upload..well this one is requested so I thought it will be better to upload it but if this break the rules i`ll delete this spell and combine it with the other one.
Update:Added a camera action for the loop so the camera can move to the warden`s position.
Update 2:Added a documentation how to implement,and description on the more confusing actions.I`ll add a documentation on the other hook.
 
Last edited:
Level 17
Joined
Mar 17, 2009
Messages
1,349

Deuterium's Brief Review


1. Just to avoid certain possibilities of picking more than one unit and thus bugging the spell:
  • Unit Group - Pick every unit in PH_Group[PH_Index[3]] and do (Actions)
    • Loop - Actions
      • Set PH_Point4[PH_Index[3]] = (Position of PH_Hook[PH_Index[3]])
      • Set PH_Point5[PH_Index[3]] = (Position of (Picked unit))
      • Unit - Cause PH_Hook[PH_Index[3]] to damage (Picked unit), dealing ((Real((Level of Phantom Hook for PH_Caster[PH_Index[3]]))) x 75.00) damage of attack type Spells and damage type Normal
      • -------- The next action sets the teleporting range.Basically it`s calculation depends on the distance between the caster and the hook,and the angle is based on the hook`s facing/180 degrees --------
      • Set PH_Point6[PH_Index[3]] = (PH_Point4[PH_Index[3]] offset by ((Distance between PH_Point4[PH_Index[3]] and PH_Point1[PH_Index[3]]) x 2.00) towards (Angle from PH_Point4[PH_Index[3]] to PH_Point1[PH_Index[3]]) degrees)
      • Unit - Move PH_Hook[PH_Index[3]] instantly to PH_Point6[PH_Index[3]]
      • Unit - Add a 0.01 second Generic expiration timer to PH_Hook[PH_Index[3]]
      • Unit - Move (Picked unit) instantly to PH_Point6[PH_Index[3]]
      • Unit - Move PH_Caster[PH_Index[3]] instantly to PH_Point6[PH_Index[3]]
      • -------- The next 2 actions move the camera targets for the players that control the caster and the target to the teleporting position of the caster and the target --------
      • Camera - Pan camera for (Owner of (Picked unit)) to PH_Point6[PH_Index[3]] over 0.00 seconds
      • Camera - Pan camera for (Owner of PH_Caster[PH_Index[3]]) to PH_Point6[PH_Index[3]] over 0.00 seconds
      • Special Effect - Create a special effect at PH_Point6[PH_Index[3]] using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Lightning - Destroy PH_lighting[PH_Index[3]]
      • -------- If everything is done we remove 1 instance of the index. --------
      • Set PH_Index[1] = (PH_Index[1] - 1)
      • -------- The next action checks if there are no current instances of the spell.If it is 0 then we turn off the trigger. --------
      • 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
      • Custom script: call RemoveLocation(udg_PH_Point4[udg_PH_Index[3]])
      • Custom script: call RemoveLocation(udg_PH_Point5[udg_PH_Index[3]])
      • Custom script: call RemoveLocation(udg_PH_Point6[udg_PH_Index[3]])
Either use some way to get the closest unit (here's a spell which does that: Gloves of Reincarnation by hell_gate), or use a bit of Jass to pick only one of the units in the group:
  • -------- --------------------------------------------------------------------------------------------------------------- --------
  • -------- - Well, you need to replace all (Picked unit)'s to Firstofgroup_Variable, I didn't to that :P - --------
  • -------- --------------------------------------------------------------------------------------------------------------- --------
  • Set PH_Group[PH_Index[3]] = (Units within 60.00 of PH_Point4[PH_Index[3]] matching ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of PH_Hook[PH_Index[3]])) Equal to True)))
  • Custom script: set usg_Firstofgroup_Variable = FirstOfGroup(udg_PH_Group[udg_PH_Index[3]])
  • Custom script: if usg_Firstofgroup_Variable != null then
  • Set PH_Point4[PH_Index[3]] = (Position of PH_Hook[PH_Index[3]])
  • Set PH_Point5[PH_Index[3]] = (Position of (Picked unit))
  • Unit - Cause PH_Hook[PH_Index[3]] to damage (Picked unit), dealing ((Real((Level of Phantom Hook for PH_Caster[PH_Index[3]]))) x 75.00) damage of attack type Spells and damage type Normal
  • -------- The next action sets the teleporting range.Basically it`s calculation depends on the distance between the caster and the hook,and the angle is based on the hook`s facing/180 degrees --------
  • Set PH_Point6[PH_Index[3]] = (PH_Point4[PH_Index[3]] offset by ((Distance between PH_Point4[PH_Index[3]] and PH_Point1[PH_Index[3]]) x 2.00) towards (Angle from PH_Point4[PH_Index[3]] to PH_Point1[PH_Index[3]]) degrees)
  • Unit - Move PH_Hook[PH_Index[3]] instantly to PH_Point6[PH_Index[3]]
  • Unit - Add a 0.01 second Generic expiration timer to PH_Hook[PH_Index[3]]
  • Unit - Move (Picked unit) instantly to PH_Point6[PH_Index[3]]
  • Unit - Move PH_Caster[PH_Index[3]] instantly to PH_Point6[PH_Index[3]]
  • -------- The next 2 actions move the camera targets for the players that control the caster and the target to the teleporting position of the caster and the target --------
  • Camera - Pan camera for (Owner of (Picked unit)) to PH_Point6[PH_Index[3]] over 0.00 seconds
  • Camera - Pan camera for (Owner of PH_Caster[PH_Index[3]]) to PH_Point6[PH_Index[3]] over 0.00 seconds
  • Special Effect - Create a special effect at PH_Point6[PH_Index[3]] using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
  • Special Effect - Destroy (Last created special effect)
  • Lightning - Destroy PH_lighting[PH_Index[3]]
  • -------- If everything is done we remove 1 instance of the index. --------
  • Set PH_Index[1] = (PH_Index[1] - 1)
  • -------- The next action checks if there are no current instances of the spell.If it is 0 then we turn off the trigger. --------
  • 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
  • Custom script: call RemoveLocation(udg_PH_Point4[udg_PH_Index[3]])
  • Custom script: call RemoveLocation(udg_PH_Point5[udg_PH_Index[3]])
  • Custom script: call RemoveLocation(udg_PH_Point6[udg_PH_Index[3]])
  • Custom script: endif
  • -------- --------------------------------------------------------------------------------------------------------------- --------
  • -------- --------------------------------------------------------------------------------------------------------------- --------
  • -------- --------------------------------------------------------------------------------------------------------------- --------

2. Although I've got nothing against the indexing method you use, it seems to be against the rules. Use one of these:
Deuterium said:
Other manners of making spells MUI are found in the following tutorials:
[GUI] Dynamic Indexing Template by Hanky
Dynamic Values Storage by Kingz
Hashtables and MUI by wyrmlord
[GUI] Efficient Arrays - Multiinstanceabilty for Timers, Custom Values, and more by PurplePoot
I advice using the first (by Hanky).


3. Don't use the H as a hotkey. It's already used for the Hold Position button.



The three points I mentioned are minor problems, but the first should get fixed to avoid any chance of the spell bugging. Other than that, the spell is creative and original. I'd advice anyone searching for such a spell to use this.

A nice piece of advice would be just moving the target to the caster's position instead of moving both, that way you won't have to pan camera, and make the spell more useful in-game in my opinion.
 
Level 7
Joined
Sep 8, 2009
Messages
90
Changed everything even that from deuterium`s advice.Changing the indexing system was quite long though.
Edit:fixed the hook`s collision too so now it won`t miss if fired on a targeted enemy or enemies close to the warden.
Edit2:Ah I forgot to clear 1 leak now it`s fully leakless.
Edit3:I just noticed a major bug I`m currently working on fixing it.
 
Last edited:
Level 17
Joined
Mar 17, 2009
Messages
1,349
Well, v1.2 would have a rare bug however:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in PH_Group[PH_Temp]) Equal to 1
    • Then - Actions
      • Set PH_Point3 = (Position of PH_Hook[PH_Temp])
      • Set PH_Point6 = (Position of (Picked unit))
      • Unit - Cause PH_Hook[PH_Temp] to damage (Picked unit), dealing ((Real((Level of Phantom Hook for PH_Caster[PH_Temp]))) x 75.00) damage of attack type Spells and damage type Normal
      • Unit - Add a 0.01 second Generic expiration timer to PH_Hook[PH_Temp]
      • Unit - Move (Picked unit) instantly to PH_Point1
      • Special Effect - Create a special effect at PH_Point1 using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Lightning - Destroy PH_lighting[PH_Temp]
      • -------- If everything is done we remove 1 instance of the index. --------
      • Set PH_Integer[PH_Loop] = PH_Integer[PH_IntegerSize]
      • Set PH_Integer[PH_IntegerSize] = PH_Temp
      • Set PH_IntegerSize = (PH_IntegerSize - 1)
      • Set PH_Loop = (PH_Loop - 1)
      • Custom script: call RemoveLocation(udg_PH_Point3)
      • Custom script: call RemoveLocation(udg_PH_Point6)
    • Else - Actions
Let's say there are two units in range :p nothing would happen...

This could be a quick solution to your way:
  • Unit Group - Pick every unit in PH_Group[PH_Temp] and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in PH_Group[PH_Temp]) Equal to 1
        • Then - Actions
          • Set PH_Point3 = (Position of PH_Hook[PH_Temp])
          • Set PH_Point6 = (Position of (Picked unit))
          • Unit - Cause PH_Hook[PH_Temp] to damage (Picked unit), dealing ((Real((Level of Phantom Hook for PH_Caster[PH_Temp]))) x 75.00) damage of attack type Spells and damage type Normal
          • Unit - Add a 0.01 second Generic expiration timer to PH_Hook[PH_Temp]
          • Unit - Move (Picked unit) instantly to PH_Point1
          • Special Effect - Create a special effect at PH_Point1 using Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Lightning - Destroy PH_lighting[PH_Temp]
          • -------- If everything is done we remove 1 instance of the index. --------
          • Set PH_Integer[PH_Loop] = PH_Integer[PH_IntegerSize]
          • Set PH_Integer[PH_IntegerSize] = PH_Temp
          • Set PH_IntegerSize = (PH_IntegerSize - 1)
          • Set PH_Loop = (PH_Loop - 1)
          • Custom script: call RemoveLocation(udg_PH_Point3)
          • Custom script: call RemoveLocation(udg_PH_Point6)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in PH_Group[PH_Temp]) Greater than 1
            • Then - Actions
              • Unit Group - Remove (Picked unit) from PH_Group[PH_Temp]
            • Else - Actions
What will happen here is that if it's more then one, it'll keep on removing units until it's only one, and then run the action ;)

Although there are more efficient ways to do this, it's really no big deal.


EDIT:
You could also use booleans for this. Use an indexed boolean. Set it to true at spell initialization.
Inside the group loop, use if/then/else checking for the condition if the boolean is true.
Inside the "then" run the actions and make sure to set the boolean to false.

That way, it'll run only for the first unit picked.

Both ways should work just fine...
 
Top