HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell leaks (help)

09-17-2010, 11:00 AM#1
shanghai
seems like on hive they dont know anything about leaks. So i need to ask the pros... I hope ur better with leaks here... I using leak tool. I suck at gui need how to lean how to fix triggers now. Im tried of asking nubs who try to edit the triggers then nothing hapening.

Here is the trigger:

Trigger:
Hook
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Meat Hook
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Index[1] Equal to 0
Collapse 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)
Set PH_Counter[PH_Index[2]] = 0
Set PH_Cast_Point = (Position of (Triggering unit))
Set PH_Target_Point = (Target point of ability being cast)
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
Set PH_Hook_Angle[PH_Index[2]] = (Angle from PH_Cast_Point to PH_Target_Point)
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)
Set PH_Hooked_Is[PH_Index[2]] = False
Set PH_Hooked_Unit[PH_Index[2]] = No unit
Custom script: call RemoveLocation(udg_PH_Near_Point)
Custom script: call RemoveLocation(udg_PH_Cast_Point)
Custom script: call RemoveLocation(udg_PH_Target_Point)
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]])))

leakchecker says

Scan Complete
Location leaks: 0
Special Effect leaks: 0
Lightning leaks: 0
Unit Group leaks: 0
Player Group leaks: 0

Variables
PH_Cast_Point : (Line: 16) Location - Removed: Yes
PH_Target_Point : (Line: 17) Location - Removed: Yes
PH_Near_Point : (Line: 22) Location - Removed: Yes
PH_Dummy[PH_Index[2]] : (Line: 24) Unit Group - Removed: No

Summary
Total Leaks: 0
Unremoved Variables: 1
Scan duration: 0 seconds
Total Lines Scanned: 32
Total Words Scanned: 195
Fixing Memory Leaks: http://world-editor-tutorials.thehel...php?view=27219

So what il do is adding

Custom script: call RemoveLocation(udg_PH_Dummy[PH_Index[2]]) ?

Also next trigger I can remove enemy buildings lol!

Trigger:
Hook Loop
Collapse Events
Time - Every 0.02 seconds of game time
Conditions
Collapse Actions
Collapse For each (Integer PH_Index[3]) from 1 to PH_Index[2], do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Counter[PH_Index[3]] Less than PH_Distance
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Hooked_Is[PH_Index[3]] Equal to False
Collapse Then - Actions
Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] + 1)
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
Custom script: set bj_wantDestroyGroup = true
Collapse 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)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) is Magic Immune) Equal to False
PH_Hooked_Is[PH_Index[3]] Equal to False
Collapse 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
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]])
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Counter[PH_Index[3]] Equal to PH_Distance
Collapse Then - Actions
Set PH_Hooked_Is[PH_Index[3]] = True
Unit - Unpause PH_Caster[PH_Index[3]]
Else - Actions
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Hooked_Is[PH_Index[3]] Equal to True
Collapse Then - Actions
Set PH_Counter[PH_Index[3]] = (PH_Counter[PH_Index[3]] - 1)
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)
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]]
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
Collapse 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]])
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Counter[PH_Index[3]] Equal to 0
Collapse Then - Actions
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
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Hooked_Unit[PH_Index[3]] Not equal to No unit
Collapse Then - Actions
Unit - Unpause PH_Hooked_Unit[PH_Index[3]]
Unit - Turn collision for PH_Hooked_Unit[PH_Index[3]] On
Else - Actions
Set PH_Index[1] = (PH_Index[1] - 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
PH_Index[1] Equal to 0
Collapse Then - Actions
Set PH_Index[2] = 0
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
Else - Actions

(Line: 24) (Word: 7) Unit Group Leak
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)
Unit Group - Pick every unit in ^Leak

Scan Complete
Location leaks: 0
Special Effect leaks: 0
Lightning leaks: 0
Unit Group leaks: 1
Player Group leaks: 0

Variables
PH_Dummy_Point[PH_Index[3]] : (Line: 17) Location - Removed: No
PH_Hook_Point[PH_Index[3]] : (Line: 18) Location - Removed: No
PH_Dummy_Point[PH_Index[3]] : (Line: 52) Location - Removed: No
PH_Hook_Point[PH_Index[3]] : (Line: 53) Location - Removed: No

Summary
Total Leaks: 1
Unremoved Variables: 4
Scan duration: 0 seconds
Total Lines Scanned: 92
Total Words Scanned: 565
Fixing Memory Leaks: http://world-editor-tutorials.thehel...php?view=27219

So Here How i make so the hook dont cant move buildings? LOL

its meat hook. Pls help me here guys + rep

It seems like the guys on this site have more experience im wrong?

Or the people on hive is just lazy at helping with triggers?
09-18-2010, 07:36 PM#2
DioD
gui leaks, take it easy.

arrays dont need any nullifications.