Hello. I have a passive ability that adds 1 strength to the unit that has it every time it has moved a certain distance (155/140/125/110 yards). To do this i set the variable Competitive_Spirit_Point equal to the position of the unit, then check if the distance between Competitive_Spirit_Point and Competitive_Spirit_Point_2 >= 155/140/125/110, and if it is, I add 1 strength to the unit, then set Competitive_Spirit_Point_2 = Competitive_Spirit_Point. So far so good. But when I try to remove the variable points in order to make the code not leak, it suddenly doesnt work. Here's the triggers:
This is for detecting when a unit learns the skill, so that I can add it to a Unit Group in order to access it later in another trigger.
)
So what actually happens when I try to remove the leaking points?
Strength gets added to the unit regardless of the distance it has moved from Competitive_Spirit_Point_2, that is, once every 0.03 seconds.
Note: I've tried putting the leak-removal line of code at every line in the trigger i could think of that I imagined would work, but it just doesn't. What am I doing wrong?
THANKS!
This is for detecting when a unit learns the skill, so that I can add it to a Unit Group in order to access it later in another trigger.
-
Competitive Spirit
-
Events
-
Unit - A unit Learns a skill
-
-
Conditions
-
((Triggering unit) has buff Competitive Spirit ) Equal to True
-
-
Actions
-
Set Competitive_Spirit_Unit = (Triggering unit)
-
Set Competitive_Spirit_Index = (Custom value of Competitive_Spirit_Unit)
-
Set Competitive_Spirit_Distance[Competitive_Spirit_Index] = (170.00 - (15.00 x (Real((Level of Competitive Spirit (Bartholomew) for Competitive_Spirit_Unit)))))
-
Set Competitive_Spirit_Point_2[Competitive_Spirit_Index] = (Position of Competitive_Spirit_Unit)
-
Unit Group - Add Competitive_Spirit_Unit to Competitive_Spirit_Group
-
Trigger - Turn on Competitive Spirit Loop <gen>
-
Trigger - Turn on Competitive Spirit Dummy Dies <gen>
-
-
-
Competitive Spirit Loop
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in Competitive_Spirit_Group and do (Actions)
-
Loop - Actions
-
Set Competitive_Spirit_Unit = (Picked unit)
-
Set Competitive_Spirit_Index = (Custom value of Competitive_Spirit_Unit)
-
Set Competitive_Spirit_Point = (Position of Competitive_Spirit_Unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Distance between Competitive_Spirit_Point and Competitive_Spirit_Point_2[Competitive_Spirit_Index]) Greater than Competitive_Spirit_Distance[Competitive_Spirit_Index]
-
-
Then - Actions
-
Special Effect - Create a special effect attached to the origin of Competitive_Spirit_Unit using Abilities\Spells\Human\Feedback\SpellBreakerAttack.mdl
-
Special Effect - Destroy (Last created special effect)
-
Set Competitive_Spirit_Point_2[Competitive_Spirit_Index] = (Position of Competitive_Spirit_Unit)
-
Hero - Modify Strength of Competitive_Spirit_Unit: Add 1
-
Unit - Create 1 Dummy 6 for (Owner of Competitive_Spirit_Unit) at Competitive_Spirit_Point facing Default building facing degrees
-
Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
-
Unit Group - Add (Last created unit) to Competitive_Spirit_Group_2
-
Set Competitive_Spirit_Unit_2[(Custom value of (Last created unit))] = Competitive_Spirit_Unit
-
-
Else - Actions
-
-
-
-
-
-
Competitive Spirit Dummy Dies
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
((Triggering unit) is in Competitive_Spirit_Group_2) Equal to True
-
-
Actions
-
Hero - Modify Strength of Competitive_Spirit_Unit_2[(Custom value of (Triggering unit))]: Subtract 1
-
-
So what actually happens when I try to remove the leaking points?
Strength gets added to the unit regardless of the distance it has moved from Competitive_Spirit_Point_2, that is, once every 0.03 seconds.
Note: I've tried putting the leak-removal line of code at every line in the trigger i could think of that I imagined would work, but it just doesn't. What am I doing wrong?
THANKS!