Ok I've created a meat hook that will track it's target if you've targetted a unit or just travel normally if you target the ground. What i want to do now is make it MUI but am pretty unsure on how to do this. It is entirely coded with GUI and would preferably like to keep it like that if possible as I wanted to make it into a hook for GUI coders to use. If it's too hard to make MUI in GUI i'm fine with it being in Jass but then it'll be for my own use (not vJass though please). Could somebody please help me with this.
Map and triggers attached.
Map and triggers attached.
Code:
Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to (==) Meat Hook [GUI]
Actions
Custom script: local location TempLoc = GetSpellTargetLoc()
Set Caster = (Triggering unit)
Set TargetUnit = (Target unit of ability being cast)
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TargetUnit Equal to (==) No unit
Then - Actions
Unit - Create 1 Dummy Target for (Owner of Caster) at (TempLoc) facing Default building facing (270.0) degrees
Set TargetUnit = (Last created unit)
Else - Actions
Set Angle = (Angle from (Position of Caster) to (Position of TargetUnit))
Set DistanceCoveredMax = (((Level of (Ability being cast) for Caster) x 1000) + 0)
Trigger - Turn on Create <gen>
Custom script: call RemoveLocation(TempLoc)
Code:
Create
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Custom script: local location TempLoc1 = GetUnitLoc(udg_Caster)
Custom script: local location TempLoc2 = GetUnitLoc(udg_Joint[1])
Custom script: local location TempLoc3 = GetUnitLoc(udg_TargetUnit)
Custom script: local location TempLoc4 = GetUnitLoc(udg_Joint[udg_NumberOfJoints])
Custom script: local location TempLoc5
Custom script: local location TempLoc6
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in PotentialTargets) Equal to (==) 0
Then - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DistanceCoveredCurrent Greater than or equal to (>=) DistanceCoveredMax
Then - Actions
Trigger - Turn on Retract <gen>
Trigger - Turn off Create <gen>
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
NumberOfJoints Equal to (==) 0
Then - Actions
Unit - Create 1 Joint for (Owner of Caster) at ((TempLoc1) offset by 80.00 towards Angle degrees) facing Angle degrees
Set DistanceCoveredCurrent = (DistanceCoveredCurrent + 80)
Set NumberOfJoints = (NumberOfJoints + 1)
Set Joint[NumberOfJoints] = (Last created unit)
Custom script: call RemoveLocation(TempLoc1)
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of TargetUnit) Equal to (==) Dummy Target
Then - Actions
Unit - Move Joint[1] instantly to ((TempLoc2) offset by 40.00 towards (Facing of Joint[1]) degrees), facing (Facing of Joint[1]) degrees
Set DistanceCoveredCurrent = (DistanceCoveredCurrent + 40)
Custom script: call RemoveLocation(TempLoc2)
Custom script: call RemoveLocation(TempLoc3)
Else - Actions
Unit - Move Joint[1] instantly to ((TempLoc2) offset by 40.00 towards (Angle from (TempLoc2) to (TempLoc3)) degrees), facing (Angle from (TempLoc2) to (TempLoc3)) degrees
Set DistanceCoveredCurrent = (DistanceCoveredCurrent + 40)
Custom script: call RemoveLocation(TempLoc2)
Custom script: call RemoveLocation(TempLoc3)
Unit - Create 1 Joint for (Owner of Caster) at ((TempLoc1) offset by 40.00 towards (Angle from (TempLoc1) to (TempLoc4)) degrees) facing (TempLoc4)
Custom script: call RemoveLocation(TempLoc1)
Custom script: call RemoveLocation(TempLoc4)
Set NumberOfJoints = (NumberOfJoints + 1)
Set Joint[NumberOfJoints] = (Last created unit)
Do Multiple ActionsFor each (Integer A) from 2 to NumberOfJoints, do (Actions)
Loop - Actions
Custom script: set TempLoc5 = GetUnitLoc(udg_Joint[GetForLoopIndexA()])
Custom script: set TempLoc6 = GetUnitLoc(udg_Joint[( GetForLoopIndexA() - 1 )])
Unit - Move Joint[(Integer A)] instantly to ((TempLoc5) offset by 40.00 towards (Angle from (TempLoc5) to (TempLoc6)) degrees), facing (TempLoc6)
Custom script: call RemoveLocation(TempLoc5)
Custom script: call RemoveLocation(TempLoc6)
Else - Actions
Set Snagged = True
Animation - Change Joint[1]'s animation speed to 0.00% of its original speed
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Target belongs to an ally of (Owner of Caster)) Equal to (==) True
Then - Actions
Else - Actions
Unit - Cause Caster to damage Target, dealing ((Real((Level of Meat Hook [GUI] for Caster))) x 100.00) damage of attack type Normal and damage type Normal
Special Effect - Create a special effect attached to the chest of Target using Objects\Spawnmodels\Human\HumanBlood\HeroBloodElfBlood.mdl
Special Effect - Destroy (Last created special effect)
Unit - Turn collision for Target Off
Trigger - Turn on Retract <gen>
Trigger - Turn off Create <gen>
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of TargetUnit) Equal to (==) Dummy Target
Then - Actions
Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Not equal to (!=) Caster))
Set Target = (First unit of group PotentialTargets)
Else - Actions
Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Equal to (==) TargetUnit))
Set Target = (First unit of group PotentialTargets)
Code:
Retract
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Custom script: local location TempLoc1 = GetUnitLoc(udg_Joint[1])
Custom script: local location TempLoc2 = GetUnitLoc(udg_Joint[2])
Custom script: local location TempLoc3 = GetUnitLoc(udg_Caster)
Custom script: local location TempLoc4 = GetUnitLoc(udg_Joint[udg_NumberOfJoints - 1])
Custom script: local location TempLoc5
Custom script: local location TempLoc6
Custom script: local location TempLoc7
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
NumberOfJoints Equal to (==) 0
Then - Actions
Set DistanceCoveredCurrent = 0
Set Snagged = False
Unit - Turn collision for Target On
Custom script: call DestroyGroup(udg_PotentialTargets)
Set Target = No unit
Trigger - Turn off Retract <gen>
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Snagged Equal to (==) True
Then - Actions
Else - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of TargetUnit) Equal to (==) Dummy Target
Then - Actions
Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Not equal to (!=) Caster))
Set Target = (First unit of group PotentialTargets)
Else - Actions
Set PotentialTargets = (Units within 120.00 of (Position of Joint[1]) matching ((Matching unit) Equal to (==) TargetUnit))
Set Target = (First unit of group PotentialTargets)
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
NumberOfJoints Greater than (>) 1
Then - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in PotentialTargets) Not equal to (!=) 0
Then - Actions
Set Snagged = True
Animation - Change Joint[1]'s animation speed to 0.00% of its original speed
Unit - Move Target instantly to ((TempLoc1) offset by 40.00 towards (Facing of Joint[1]) degrees), facing (Facing of Target) degrees
Custom script: call RemoveLocation(TempLoc1)
Else - Actions
Unit - Move Joint[1] instantly to (TempLoc2), facing Angle degrees
Custom script: call RemoveLocation(TempLoc1)
Custom script: call RemoveLocation(TempLoc2)
Else - Actions
Unit - Remove Joint[1] from the game
Unit - Move Joint[NumberOfJoints] instantly to ((TempLoc3) offset by 40.00 towards (Angle from (TempLoc3) to (TempLoc4)) degrees), facing (TempLoc4)
Custom script: call RemoveLocation(TempLoc3)
Custom script: call RemoveLocation(TempLoc4)
Do Multiple ActionsFor each (Integer A) from ((NumberOfJoints - 1) x -1) to -2, do (Actions)
Loop - Actions
Custom script: set TempLoc5 = GetUnitLoc(udg_Joint[(GetForLoopIndexA() *-1)])
Custom script: set TempLoc6 = GetUnitLoc(udg_Joint[( ( GetForLoopIndexA() * -1 ) + 1 )])
Custom script: set TempLoc7 = GetUnitLoc(udg_Joint[( ( GetForLoopIndexA() * -1 ) - 1 )])
Unit - Move Joint[((Integer A) x -1)] instantly to ((TempLoc6) offset by 40.00 towards (Angle from (TempLoc6) to (TempLoc5)) degrees), facing (TempLoc7)
Custom script: call RemoveLocation(TempLoc5)
Custom script: call RemoveLocation(TempLoc6)
Custom script: call RemoveLocation(TempLoc7)
Unit - Remove Joint[NumberOfJoints] from the game
Set NumberOfJoints = (NumberOfJoints - 1)