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
-



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
-

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:
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.