• 🏆 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] How do i make this countdown with no leaks?

Status
Not open for further replies.
Level 19
Joined
Feb 15, 2008
Messages
2,184
How do i make this countdown with no leaks? [SOLVED]

  • Countdown
  • Countdown
    • Events
    • Conditions
    • Actions
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 3 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 2 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 1 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Floating Text - Create floating text that reads FIGHT! at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Unit - Unpause all units
      • Custom script: call RemoveLocation(udg_Temp_Location)
      • Custom script: call RemoveLocation(udg_Temp_Location_2)
Some how when playing the game gets slowed down. And its because of this crap countdown trigger. How can i make it leakless with no bugs?
 
Last edited:
Level 13
Joined
Mar 24, 2013
Messages
1,105
You are leaking locations

For the first three since you're just using 1 location, just

set temploc = center of arena
create floating text at temploc
call RemoveLocation(udg_temploc)

For the last one since you want to offset it from the center.
You need to remove 2 points

set temploc = center of arena
set temploc2 = temploc offset by x towards x

create floating text at temploc2

call RemoveLocation(udg_temploc)
call RemoveLocation(udg_temploc2)
 
Level 19
Joined
Feb 15, 2008
Messages
2,184
  • Countdown
    • Events
    • Conditions
    • Actions
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 3 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 2 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 1 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Floating Text - Create floating text that reads FIGHT! at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Unit - Unpause all units
      • Custom script: call RemoveLocation(udg_Temp_Location)
      • Custom script: call RemoveLocation(udg_Temp_Location_2)
Do this trigger still leaks?

is it better or is it just same shit?
 
Level 13
Joined
Dec 21, 2010
Messages
541
  • Countdown
    • Events
    • Conditions
    • Actions
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 3 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 2 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 1 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Floating Text - Create floating text that reads FIGHT! at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Unit - Unpause all units
      • Custom script: call RemoveLocation(udg_Temp_Location)
      • Custom script: call RemoveLocation(udg_Temp_Location_2)
Do this trigger still leaks?

is it better or is it just same shit?


Ok... let me clear this to you.. that's why professionals are very strict with using waits..
You see every time you create a variable for the location you need to destroy it immediately before using waits like for ex:
  • Wait
    • Actions
      • Set Point = (Center of Arena <ge>)
      • -------- Do watever u want with the point just make sure u destroy it immediately-----
      • Custom script: call RemoveLocation(udg_Point)
      • Wait 1.00 seconds
      • Set Point = (Center of Arena <ge>)
      • -------- Do watever u want with the point just make sure u destroy it immediately-----
      • Custom script: call RemoveLocation(udg_Point)
      • Wait 1.00 seconds
      • Set Point = (Center of Arena <ge>)
      • -------- Do watever u want with the point just make sure u destroy it immediately-----
      • Custom script: call RemoveLocation(udg_Point)
      • Wait 1.00 seconds
      • Set Point = (Center of Arena <ge>)
      • -------- Do watever u want with the point just make sure u destroy it immediately-----
      • Custom script: call RemoveLocation(udg_Point)
      • Wait 1.00 seconds
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Ok... let me clear this to you.. that's why professionals are very strict with using waits..
You see every time you create a variable for the location you need to destroy it immediately before using waits

This is not true

You only need to remove location before you overwrite it. As long as you can guarantee that during wait another trigger will not try to overwrite the variable, you can remove it even after the wait

edit: in your example you pretty much uselessly remove the location and then create it again after wait several times
You dont need to destroy nor to create it multiple times, just clear it at the end
 
Level 13
Joined
Dec 21, 2010
Messages
541
This is not true

You only need to remove location before you overwrite it. As long as you can guarantee that during wait another trigger will not try to overwrite the variable, you can remove it even after the wait

edit: in your example you pretty much uselessly remove the location and then create it again after wait several times
You dont need to destroy nor to create it multiple times, just clear it at the end

Ohhh.... but why did IcemanBo said that
Also RemoveLocation before each wait. You only remove them once, after last actions.

this means that he's wrong??
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
what he said is not right per se, but he most likely said before wait, because right after wait he assigns it again

yet, there is still no need to remove and reassign them, as he uses the same X Y coordinate again and again
 
Level 13
Joined
Dec 21, 2010
Messages
541
but shanghai did was

  • ?
    • Actions
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 3 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 2 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Set Temp_Location = (Temp_Location offset by 0.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads 1 at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Wait 1.00 seconds
      • Set Temp_Location = (Center of Arena <gen>)
      • Floating Text - Create floating text that reads FIGHT! at Temp_Location with Z offset 20.00, using font size 30.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Unit - Unpause all units
      • Custom script: call RemoveLocation(udg_Temp_Location)
      • Custom script: call RemoveLocation(udg_Temp_Location_2)
He created the point over and over again without destroying them before each wait..
So your saying that you just create points in the 1st line of the trigger then its ok if you use wait wait wait .... then destroy it at the last line of the trigger.. << am I right?
 
Status
Not open for further replies.
Top