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

[Trigger] does this spell leak? and how to fix?

Status
Not open for further replies.
Level 19
Joined
Feb 15, 2008
Messages
2,184
does this spell leak? and how to fix? [solved]

Just wondering if this spell leaks. and how do i fix it?

And also what does it means the distance 20 + 10?

  • Set PH_Distance = (20 + (10 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]])))

  • Hook Table
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set PH_Table = (Last created hashtable)
  • Hook
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Meat Hook Advanced
    • 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 = (250 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]]))
      • Set PH_Distance = (20 + (10 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 100.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
 
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
It does not look like it leaks but it uses the old indexing method.
That means that it can hit the op-limit or the array limit and break the spell.

This is the distance...
Set PH_Distance = (20 + (10 x (Level of (Ability being cast) for PH_Caster[PH_Index[2]])))

You should really read the whole thing before asking questions.

this does (20 + ( 10 * level)) so if it is level one it does ( 20 + ( 10 * 1)) = 30
Level 2 does. ( 20 + ( 10 * 2)) = 40
and so on.
 
Level 19
Joined
Feb 15, 2008
Messages
2,184
i testing this psyco hook its not working :/

  • PsychoHookStraightCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Straight Psycho Hook
    • Actions
      • -------- Array slots are limited to 8192 --------
      • -------- We use a maximum of 100 dummys per cast --------
      • -------- So this spell shouldn't be casted more often then 80 times (lag would stop people from doing this anyway...) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PHMax Less than 80
        • Then - Actions
          • Set loc = (Position of (Triggering unit))
          • Set loc2 = (Target point of ability being cast)
          • -------- Increases the total ammount of hooks by one --------
          • Set PHMax = (PHMax + 1)
          • -------- Sets the variables which are necessary --------
          • Set PHCaster[PHMax] = (Triggering unit)
          • -------- Shall the hook return yet? No --------
          • Set PHReturn[PHMax] = False
          • -------- How far did the hook travel yet? 0 --------
          • Set PHDistance[(PHMax x 2)] = 0.00
          • -------- How far shall it go? 1000 + 1000 per level --------
          • Set PHDistance[((PHMax x 2) + 1)] = (((Real((Level of Empower Weapon for (Triggering unit)))) x 1000.00) + 200.00)
          • -------- How fast will the hook travel forward? --------
          • Set PHSpeed[(PHMax x 2)] = 40.00
          • -------- And how fast back to the caster? --------
          • Set PHSpeed[((PHMax x 2) + 1)] = 45.00
          • -------- Straight or with an angle? --------
          • -------- Setting the angle to less then 0 will make the hook go straight like the normal dota hook --------
          • Set PHAngle[PHMax] = 1.00
          • -------- This is the head of the hook --------
          • Unit - Create 1 PsychoHookDummy for (Owner of (Triggering unit)) at loc facing loc2
          • -------- It shall look a little different --------
          • Animation - Change (Last created unit)'s size to (250.00%, 250.00%, 250.00%) of its original size
          • Set PHSegment[(PHMax x 100)] = (Last created unit)
          • -------- We created one segment already (the first one) --------
          • Set PHSegmentMax[PHMax] = 1
          • -------- Creates a dummy to check if a destrutible is a tree --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • harvester Not equal to No unit
              • (harvester is alive) Equal to True
            • Then - Actions
            • Else - Actions
              • -------- You need a unit which is able to harvest --------
              • -------- Anything else does not matter --------
              • Unit - Create 1 Peasant for Neutral Passive at loc facing Default building facing degrees
              • Set harvester = (Last created unit)
              • Unit - Make harvester Invulnerable
              • Unit - Hide (Last created unit)
          • -------- Runs the main trigger to deal with the movement and so on --------
          • Trigger - Turn on PsychoHookLoop <gen>
          • -------- Removes leaks --------
          • Custom script: call RemoveLocation( udg_loc )
          • Custom script: call RemoveLocation( udg_loc2 )
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: This Spell may not ...
  • PsychoHookLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Declaration of some local variables so there is no need to waste space for global ones --------
      • Custom script: local real a = 0
      • Custom script: local unit u = null
      • Custom script: local unit u2 = null
      • -------- This trigger will be turned of if there is nothing to do --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PHMax Less than 1
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • For each (Integer i) from 1 to PHMax, do (Actions)
            • Loop - Actions
              • Custom script: set udg_PHDistance[udg_i*2] = udg_PHDistance[udg_i*2] + udg_PHSpeed[udg_i*2]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PHCaster[i] Not equal to No unit
                  • (PHCaster[i] is alive) Equal to True
                  • Or - Any (Conditions) are true
                    • Conditions
                      • PHDistance[(i x 2)] Less than PHDistance[((i x 2) + 1)]
                      • PHReturn[i] Equal to True
                  • ((Playable map area) contains PHSegment[(i x 100)]) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PHReturn[i] Equal to False
                    • Then - Actions
                      • -------- Moves the first one --------
                      • Custom script: set u = udg_PHSegment[udg_i*100]
                      • -------- "a" is the direction the first hook will travel along --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • PHAngle[i] Greater than or equal to 0.00
                        • Then - Actions
                          • Custom script: set a = GetUnitFacing( udg_PHCaster[udg_i] ) + udg_PHAngle[udg_i]
                        • Else - Actions
                          • Custom script: set a = GetUnitFacing( udg_PHSegment[udg_i*100] )
                      • -------- This makes the first unit face where it's going --------
                      • Custom script: call SetUnitFacing( u, a )
                      • -------- This is called polar projection (it's the same as "point with polar offset" but with coordinates) --------
                      • -------- The position of the first unit will be set to its position + (Cos for x and Sin for y of its facing angle) * speed --------
                      • Custom script: call SetUnitX( u, GetUnitX( u ) + Cos( a * bj_DEGTORAD ) * udg_PHSpeed[udg_i*2] )
                      • Custom script: call SetUnitY( u, GetUnitY( u ) + Sin( a * bj_DEGTORAD ) * udg_PHSpeed[udg_i*2] )
                      • Set loc = (Position of PHSegment[(i x 100)])
                      • -------- Tree Killer Function --------
                      • Destructible - Pick every destructible within 180.00 of loc and do (Actions)
                        • Loop - Actions
                          • -------- If the tree is not dead already --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked destructible) is alive) Equal to True
                            • Then - Actions
                              • -------- Moves the harvest dummy to the position of the picked destructable --------
                              • Custom script: call SetUnitX(udg_harvester, GetWidgetX(GetEnumDestructable() ))
                              • Custom script: call SetUnitY(udg_harvester, GetWidgetY(GetEnumDestructable() ))
                              • -------- Orders the dummy to try to harvest the picked destructable --------
                              • Unit - Order harvester to Harvest (Picked destructible)
                              • -------- If the dummy is able to harvest the picked destructable it must be a tree --------
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Current order of harvester) Equal to (Order(harvest))
                                • Then - Actions
                                  • -------- Create some special effect --------
                                  • Set loc2 = (Position of (Picked destructible))
                                  • Special Effect - Create a special effect at loc2 using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
                                  • Special Effect - Destroy (Last created special effect)
                                  • Custom script: call RemoveLocation( udg_loc2 )
                                  • -------- Kill the Tree --------
                                  • Destructible - Kill (Picked destructible)
                                • Else - Actions
                              • -------- Stops the dummy from going to the next tree after the previous one was killed --------
                              • Unit - Order harvester to Stop
                            • Else - Actions
                      • -------- Checks if a unit is within range --------
                      • -------- The unit has to be: --------
                      • -------- -non flying --------
                      • -------- -not be a target yet --------
                      • -------- -not be a target yet --------
                      • -------- -not to be a structure --------
                      • -------- -alive --------
                      • -------- -hostile --------
                      • Set TempArrayGroup[i] = (Units within 180.00 of loc matching ((((Matching unit) is A flying unit) Equal to False) and ((((((Matching unit) is in PHTargetGroup) Equal to False) and (((Matching unit) is A structure) Equal to False)) and (((Matching unit) is alive) Equal to True)) and
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (TempArrayGroup[i] is empty) Equal to False
                        • Then - Actions
                          • Set PHTarget[i] = (Random unit from TempArrayGroup[i])
                          • Unit Group - Add PHTarget[i] to PHTargetGroup
                          • Set PHDistance[((i x 2) + 1)] = 0.00
                          • Set PHReturn[i] = True
                          • -------- Set Damage here (Preset: 100 + 100 per level) --------
                          • Unit - Cause PHCaster[i] to damage PHTarget[i], dealing (((Real((Level of Empower Weapon for PHCaster[i]))) x 100.00) + 100.00) damage of attack type Spells and damage type Normal
                          • -------- Impact Effect --------
                          • Special Effect - Create a special effect attached to the chest of PHTarget[i] using Abilities\Spells\Undead\OrbOfDeath\OrbOfDeathMissile.mdl
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                      • Custom script: call DestroyGroup( udg_TempArrayGroup[udg_i] )
                      • Custom script: call RemoveLocation( udg_loc )
                      • -------- Change distance between segments here (Preset: 75 ) --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • PHSegmentMax[i] Less than 101
                          • PHSegmentMax[i] Less than or equal to ((Integer(PHDistance[(i x 2)])) / 75)
                        • Then - Actions
                          • Set loc = (Position of PHCaster[i])
                          • Set loc2 = (Position of PHSegment[((i x 100) + (PHSegmentMax[i] - 1))])
                          • -------- Other hook dummys are created --------
                          • Unit - Create 1 PsychoHookDummy for (Owner of PHCaster[i]) at loc facing loc2
                          • Custom script: call RemoveLocation( udg_loc )
                          • Custom script: call RemoveLocation( udg_loc2 )
                          • Set PHSegment[((i x 100) + PHSegmentMax[i])] = (Last created unit)
                          • Set PHSegmentMax[i] = (PHSegmentMax[i] + 1)
                        • Else - Actions
                      • -------- Other hook dummys are moved --------
                      • Custom script: set u2 = udg_PHSegment[udg_i*100]
                      • For each (Integer i2) from 1 to PHSegmentMax[i], do (Actions)
                        • Loop - Actions
                          • Custom script: set u = udg_PHSegment[ udg_i * 100 + udg_i2 ]
                          • -------- This calculates the angle between a segment and the segment behind it --------
                          • Custom script: set a = Atan2( GetUnitY(u2) - GetUnitY(u), GetUnitX(u2) - GetUnitX(u) )
                          • Custom script: call SetUnitX( u, GetUnitX(u) + Cos(a) * udg_PHSpeed[udg_i*2] )
                          • Custom script: call SetUnitY( u, GetUnitY(u) + Sin(a) * udg_PHSpeed[udg_i*2] )
                          • -------- bj_RADTODEG is used to change radiants to degrees --------
                          • Custom script: call SetUnitFacing( u, a *bj_RADTODEG )
                          • Custom script: set u2 = u
                    • Else - Actions
                      • -------- Same the other way round --------
                      • Custom script: set u2 = udg_PHCaster[udg_i]
                      • Set loc = (Position of PHCaster[i])
                      • For each (Integer i2) from 1 to PHSegmentMax[i], do (Actions)
                        • Loop - Actions
                          • Custom script: set u = udg_PHSegment[ udg_i * 100 + ( udg_PHSegmentMax[udg_i] - udg_i2 ) ]
                          • Custom script: set a = Atan2( GetUnitY(u2) - GetUnitY(u), GetUnitX(u2) - GetUnitX(u) )
                          • Custom script: call SetUnitX( u, GetUnitX(u) + Cos(a) * udg_PHSpeed[udg_i*2+1] )
                          • Custom script: call SetUnitY( u, GetUnitY(u) + Sin(a) * udg_PHSpeed[udg_i*2+1] )
                          • Custom script: if udg_PHCaster[udg_i] != u2 then
                          • Custom script: call SetUnitFacing(u2, a*bj_RADTODEG+180)
                          • Custom script: endif
                          • Custom script: set u2 = u
                          • -------- Checks if the distance ^ 2 between the target and the caster is very small --------
                          • Custom script: if 25000>Pow(GetUnitX(u2)-GetUnitX(udg_PHCaster[udg_i]), 2)+Pow(GetUnitY(u2)-GetUnitY(udg_PHCaster[udg_i]), 2)then
                          • -------- Hides the segment --------
                          • Custom script: call ShowUnit(u2,false)
                          • Custom script: endif
                      • Custom script: call RemoveLocation( udg_loc )
                      • -------- Target is moved to the first/last hook (however you'd like to call it now) --------
                      • Custom script: set u = udg_PHTarget[udg_i]
                      • Custom script: set u2 = udg_PHSegment[udg_i*100]
                      • Custom script: call SetUnitX( u, GetUnitX( u2 ) )
                      • Custom script: call SetUnitY( u, GetUnitY( u2 ) )
                      • Set loc = (Position of PHTarget[i])
                      • -------- Killing trees again --------
                      • Destructible - Pick every destructible within 180.00 of loc and do (Actions)
                        • Loop - Actions
                          • -------- If the tree is not dead already --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked destructible) is alive) Equal to True
                            • Then - Actions
                              • -------- Moves the harvest dummy to the position of the picked destructable --------
                              • Custom script: call SetUnitX(udg_harvester, GetWidgetX(GetEnumDestructable() ))
                              • Custom script: call SetUnitY(udg_harvester, GetWidgetY(GetEnumDestructable() ))
                              • -------- Orders the dummy to try to harvest the picked destructable --------
                              • Unit - Order harvester to Harvest (Picked destructible)
                              • -------- If the dummy is able to harvest the picked destructable it must be a tree --------
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Current order of harvester) Equal to (Order(harvest))
                                • Then - Actions
                                  • -------- Create some special effect --------
                                  • Set loc2 = (Position of (Picked destructible))
                                  • Special Effect - Create a special effect at loc2 using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
                                  • Special Effect - Destroy (Last created special effect)
                                  • Custom script: call RemoveLocation( udg_loc2 )
                                  • -------- Kill the Tree --------
                                  • Destructible - Kill (Picked destructible)
                                • Else - Actions
                              • -------- Stops the dummy from going to the next tree after the previous one was killed --------
                              • Unit - Order harvester to Stop
                            • Else - Actions
                      • -------- Stop if the target vanishes or reached the caster --------
                      • Set loc2 = (Position of PHCaster[i])
                      • -------- Delete the "IsAlive?-Thing" to make this skill pull dead units --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (PHTarget[i] is alive) Equal to True
                          • PHTarget[i] Not equal to No unit
                          • (Distance between loc and loc2) Greater than 64.00
                        • Then - Actions
                        • Else - Actions
                          • Set PHReturn[i] = False
                      • Custom script: call RemoveLocation( udg_loc )
                      • Custom script: call RemoveLocation( udg_loc2 )
                • Else - Actions
                  • -------- Clean up and sort array slots --------
                  • For each (Integer i2) from 0 to 99, do (Actions)
                    • Loop - Actions
                      • Unit - Unhide PHSegment[((i x 100) + i2)]
                      • Unit - Kill PHSegment[((i x 100) + i2)]
                      • Set PHSegment[((i x 100) + i2)] = PHSegment[((PHMax x 100) + i2)]
                      • -------- So it won't waste space until the slots are used again --------
                      • -------- Usually I don't do that but for such an ammount of units it seems appropriate --------
                      • Set PHSegment[((PHMax x 100) + i2)] = No unit
                  • Unit Group - Remove PHTarget[i] from PHTargetGroup
                  • Set PHCaster[i] = PHCaster[PHMax]
                  • Set PHTarget[i] = PHTarget[PHMax]
                  • Set PHDistance[(i x 2)] = PHDistance[(PHMax x 2)]
                  • Set PHDistance[((i x 2) + 1)] = PHDistance[((PHMax x 2) + 1)]
                  • Set PHSpeed[(i x 2)] = PHSpeed[(PHMax x 2)]
                  • Set PHSpeed[((i x 2) + 1)] = PHSpeed[((PHMax x 2) + 1)]
                  • Set PHAngle[i] = PHAngle[PHMax]
                  • Set PHReturn[i] = PHReturn[PHMax]
                  • Set PHSegmentMax[i] = PHSegmentMax[PHMax]
                  • Set PHMax = (PHMax - 1)
                  • Set i = (i - 1)
      • -------- Clean leaks --------
      • Custom script: set u = null
      • Custom script: set u2 = null

also i dont want it to kill trees etc. how do i change this and its only 1 dummy for some reason?
 
Last edited:
Level 19
Joined
Mar 18, 2012
Messages
1,716
Remove two blocks of code. They are commented as Tree Killer Function within the loop. Once on extend and the other while retracting.

It doesn't use only 1 dummy. The unit you are refering to is probably the harvester. That unit can be deleted aswell if you don't want to kill trees.

The spell works for me.

Again can you tell me what was wrong with the two hooks I suggested first. Didn't you manage to import them?
I'm asking because they are both far superior in so many aspects than the one you posted here.
 
Level 19
Joined
Feb 15, 2008
Messages
2,184
its 1 dummy in the map. and i removed this 2 blocks of code still doesent work.

and why is there.

Unit - Cause PHCaster to damage PHTarget, dealing (((Real((Level of Psycho Hook for PHCaster))) x 250.00) + 200.00) damage of attack type Spells and damage type Normal

when im gona use the straight one?

Again can you tell me what was wrong with the two hooks I suggested first. Didn't you manage to import them?
I'm asking because they are both far superior in so many aspects than the one you posted here.

the psyco hook is problem. i dont get it working. when casting the hook i see a blade thrown in 128 range and then disapair or something like that. And about your hook. I dont wan vjass. jass is ok. its only reason. because i dont wana open map with vjass editor.

now i see the hook but only blade in the hook. also it doesent get back to the caster?
 
Last edited:
Status
Not open for further replies.
Top