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

Can anyone check my map for leaks?

Status
Not open for further replies.
Hello, this sounds more like a request, and so we
might maybe move it to the request section.

But before we go on - have you already looked at our tutorials about memory leaks?
Maybe you want to understand them and try it yourself, before you give it up.

I firtly would suggest to look at this: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

And if you want to learn more about leaks you can read this: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/memory-leaks-263410/
 
Level 12
Joined
Dec 11, 2014
Messages
662
Yup I even fixed some leaks after I started making the map and learned about those things, but in recent plays it gets really laggy and I really don't know anything that can be the cause. (I will take a look at it and post here if I am suspicious of some trigger)

You may move it to the request section.
 
Level 11
Joined
Jul 25, 2014
Messages
490
Leak tester

Found this to be quite useful, even though it's not official


EDIT:
Found this:
  • If (LifesTeam1 Greater than 0) then do (Leaderboard - Add Player 1 (Red) to leaderboard_lifes with label |cFFFF0202T|r|cFFEA... and value LifesTeam1) else do (Do nothing)
and several other lines with same construction.
|
Use the If/Then/Else block rather than using a single line of functions. Not only does it make it more convenient to use, it also doesn't force you to put "Do nothing" action. "Do Nothing" is useless and shouldn't be applied ANYWHERE.

Uh, you use a lot of Waits. Personally, they are okay, even though not approved in hive, but they have a lot of problems within themselves, I always look for a workaround:D

Lots of function calls could be done using variables (well most of them). If you use the same function call more than once(maybe twice) it is advised you store that into a variable. Example:


  • Actions
    • Floating Text - Create floating text that reads Choose your builder... above Race Market 0000 <gen> with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
    • Floating Text - Hide (Last created floating text) for (All players)
    • Floating Text - Show (Last created floating text) for Player Group - Player 1 (Red)
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the lifespan of (Last created floating text) to 30.00 seconds
->
  • Floating Text - Create floating text that reads Choose your builder... above Race Market 0000 <gen> with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
  • Set Your_FTextVariable = Last created floating text
  • Floating Text - Hide Your_FTextVariable for (All players)
  • Floating Text - Show Your_FTextVariable for Player Group - Player 1 (Red)
  • Floating Text - Change Your_FTextVariable: Disable permanence
  • Floating Text - Change the lifespan of Your_FTextVariable to 30.00 seconds


Other than that, you know how to clean major leaks and that's the important part. Good luck!
 
Level 12
Joined
Dec 11, 2014
Messages
662
Thanks a lot Meatmuffin.
I will replace those 1-liners with more-liners
Like this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Entered chat string) Equal to -day
      • (In-game time of day) Equal to 24.00
    • Then - Actions
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + set the time to day.)
      • Game - Set the time of day to 6.00
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to -night
          • (In-game time of day) Equal to 6.00
        • Then - Actions
          • Game - Set the time of day to 24.00
          • Game - Display to (All players) the text: ((Name of (Triggering player)) + set the time to night.)
        • Else - Actions
Also I will change that Floating text to use a variable(like you showed)
It would be really nice if you could say where else you found that it can be used. Thanks.
Edit: I will try to remove those waits (Use alternative ideas)
 
Level 11
Joined
Jul 25, 2014
Messages
490
...the Leak Tester doesn't work, it says the extension isn't w3x when CLEARLY IT IS...
I don't know, worked fine for me two times that I used it.

Yeah that one is how it should be and how it is generally done by map makers.

Make sure you use the same variable after you create each floating text and use it in the next following lines, until you create the next text.
{Create text -> Store it into a variable -> Use it in the following lines -> Create another text -> Store it into the same variable (overriding it, since you won't use it again) -> Use it in.....}

Waits are convenient, but if you want to polish your map completely, then yeah, look for workarounds.

As for other things, I'll check them and edit the post if I find some other radical multiple function calls that can be done using variables.

Oh and there are also leftovers of variables, remove them if you have no intention of using them :p
 
Level 12
Joined
Dec 11, 2014
Messages
662
I fixed the leak tester (I was putting in a shortcut -_-'')
Already fixed some leaks thanks to it ,it really is useful :D
Edit: Removed unused variables.
Wow, I am surprised how many mistakes the map had, crazy. I am so grateful for this site :D
 
Level 11
Joined
Jul 25, 2014
Messages
490
EDIT:
Storing
When you send creeps (in the category TeamXSendsCreeps), store entering unit and last created unit
into variables at the start of the trigger and use them throughout your execution.

Same thing applies to Movement T1 (Although you can skip "Move1T1/2/3/4" triggers, these ones only have one line)

Also the same to "WorkerLeavesRegion" category triggers.

In the "Spy" trigger, do the same just with a player variable.

Aaaand same thing applies to "PlayerLeave" category, store triggering player within a player variable (same as above).

Same thing to Zombie Revive (SpecialCreep ctg.), store triggering unit and last created unit.
--
I think you get where I'm going. If you use function calls more than once (like Triggering Unit), it's best if you store them into a variable. They don't need cleaning as well.

Trigger structure
That's the thing what is bothering me the most. You have multiple triggers for each/player team, when you could merge them all using variable arrays and if then else blocks. I didn't look into the trigger cores, but I can certainly verify that. As for your current multiple triggers, you can leave them be (or rework them, but it will not be easy on you :D). It shall be a note for the future.

If I'm understanding you correctly, you want to improve your editing even though everything works flawlessly in-game. These changes won't improve the enjoyability of the game, it will improve your editing skills for the future, for better, faster and more efficient coding. If that's the case, then be my guest and do your best! (rhymes, hue)


Wanted to edit the post, but yeah, might not get noticed:D

I fixed the leak tester (I was putting in a shortcut -_-'')
You what mate.
 
Level 12
Joined
Dec 11, 2014
Messages
662
Type: timer
CreateTimer [Blizzard.j:605]

I have 2 of them in these 2 triggers:
  • Countdown Timer - Create a timer window for LevelTimer with title First income in ...
  • Set TimerWindVar = (Last created timer window)
  • Countdown Timer - Start LevelTimer as a One-shot timer that will expire in 25.00 seconds
  • Countdown Timer - Show TimerWindVar
When the above one expires.
  • Countdown Timer - Destroy TimerWindVar
  • Countdown Timer - Create a timer window for LevelTimer with title Next income in:
  • Set TimerWindVar = (Last created timer window)
  • Countdown Timer - Show TimerWindVar
  • Countdown Timer - Start LevelTimer as a One-shot timer that will expire in TimerVar seconds
Also this
Type: trigger
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
CreateTrigger [Blizzard.j:5310]
Type: trigger
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
CreateTrigger [Blizzard.j:5316]
Type: triggeraction
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
TriggerAddAction [Blizzard.j:5318]
Type: trigger
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
CreateTrigger [Blizzard.j:5321]
Type: triggeraction
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
TriggerAddAction [Blizzard.j:5323]
Type: trigger
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
CreateTrigger [Blizzard.j:5326]
Type: triggeraction
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
TriggerAddAction [Blizzard.j:5328]
Type: trigger
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
CreateTrigger [Blizzard.j:5331]
Type: triggeraction
Trig_KickBlue_Actions [war3map.j:2932]
CustomDefeatBJ [war3map.j:2921]
CustomDefeatDialogBJ [Blizzard.j:5359]
TriggerAddAction [Blizzard.j:5333]

I will soon upload a new test version for you to check out.

EDIT: NEW TEST VERSION
 
Level 12
Joined
Dec 11, 2014
Messages
662
@Meatmuffin
Here is the FloatTxt & T1Sends

  • FloatTxt
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- 1 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0000 <gen> with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 1 (Red)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
      • -------- 2 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0001 <gen> with Z offset 0.00, using font size 8.00, color (0.00%, 0.00%, 100.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 2 (Blue)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
      • -------- 3 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0005 <gen> with Z offset 0.00, using font size 8.00, color (0.00%, 50.00%, 50.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 3 (Teal)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
      • -------- 4 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0008 <gen> with Z offset 0.00, using font size 8.00, color (50.00%, 0.00%, 50.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 4 (Purple)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
      • -------- 5 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0011 <gen> with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 5 (Yellow)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
      • -------- 6 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0016 <gen> with Z offset 0.00, using font size 8.00, color (100.00%, 50.00%, 0.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 6 (Orange)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
      • -------- 7 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0020 <gen> with Z offset 0.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 7 (Green)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
      • -------- 8 --------
      • Floating Text - Create floating text that reads Choose your builder... above Race Market 0017 <gen> with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 100.00%), and 0.00% transparency
      • Set FloatTxtVar = (Last created floating text)
      • Floating Text - Hide FloatTxtVar for (All players)
      • Floating Text - Show FloatTxtVar for Player Group - Player 8 (Pink)
      • Floating Text - Change FloatTxtVar: Disable permanence
      • Floating Text - Change the lifespan of FloatTxtVar to 30.00 seconds
  • T1Sends
    • Events
      • Unit - A unit enters Spawn Team1 <gen>
    • Conditions
      • ((Entering unit) is A peon-type unit) Equal to False
      • ((Entering unit) is A structure) Equal to False
    • Actions
      • Set UnitVar = (Entering unit)
      • Set Income[(Player number of (Owner of UnitVar))] = (Income[(Player number of (Owner of UnitVar))] + (Point-value of UnitVar))
      • Player - Set (Owner of UnitVar) Current lumber to Income[(Player number of (Owner of UnitVar))]
      • -------- Creep for Team 2 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam2 Greater than 0
          • ((Player 3 (Teal) slot status) Equal to Is playing) or ((Player 4 (Purple) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of UnitVar) for Player 10 (Light Blue) at CheckpointsAll[5] facing 225.00 degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of UnitVar))
          • Unit Group - Add (Last created unit) to UnitGroupVarArray[6]
        • Else - Actions
      • -------- Creep for Team 3 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam3 Greater than 0
          • ((Player 5 (Yellow) slot status) Equal to Is playing) or ((Player 6 (Orange) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of UnitVar) for Player 11 (Dark Green) at CheckpointsAll[9] facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of PlayerVar)
          • Unit Group - Add (Last created unit) to UnitGroupVarArray[10]
        • Else - Actions
      • -------- Creep for Team 4 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam4 Greater than 0
          • ((Player 7 (Green) slot status) Equal to Is playing) or ((Player 8 (Pink) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of UnitVar) for Player 12 (Brown) at CheckpointsAll[13] facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of UnitVar))
          • Unit Group - Add (Last created unit) to UnitGroupVarArray[14]
        • Else - Actions
      • -------- Remove original Unit --------
      • Unit - Remove UnitVar from the game
Are they good? Do I have to, in the 2nd trigger, put "Last created unit" also in a variable?

@IcemanBo
Here are both triggers that use timers.

  • Start
    • Events
    • Conditions
      • Endgame Equal to False
    • Actions
      • Quest - Create a Required quest titled Version 5.4 with the description |cFF01B7D6V|r|cFF06..., using icon path ReplaceableTextures\CommandButtons\BTNScrollOfTownPortal.blp
      • Quest - Create a Required quest titled Version 5.3 with the description |cFF01B7D6V|r|cFF06..., using icon path ReplaceableTextures\CommandButtons\BTNScrollOfTownPortal.blp
      • Quest - Create a Required quest titled Version 5.2 with the description |cFF01B7D6V|r|cFF06..., using icon path ReplaceableTextures\CommandButtons\BTNScrollOfTownPortal.blp
      • Quest - Create a Required quest titled Version 5.1 with the description |cFF01B7D6V|r|cFF06..., using icon path ReplaceableTextures\CommandButtons\BTNScrollOfTownPortal.blp
      • Quest - Create a Required quest titled Version 5.0 with the description |cFF01B7D6V|r|cFF06..., using icon path ReplaceableTextures\CommandButtons\BTNScrollOfTownPortal.blp
      • Quest - Create a Required quest titled Version 4.0 - 4.5 with the description - Fixed typos - Ne..., using icon path ReplaceableTextures\CommandButtons\BTNScrollOfProtection.blp
      • Quest - Create a Required quest titled Versions 3.0 - 3.3 with the description - Fixed teleport's ..., using icon path ReplaceableTextures\CommandButtons\BTNScrollUber.blp
      • Quest - Create a Required quest titled Versions 2.0 - 2.7 with the description - Interface changes..., using icon path ReplaceableTextures\CommandButtons\BTNBansheeMaster.blp
      • Quest - Create a Required quest titled Versions 1.0 - 1.5 with the description - Creeps can now pa..., using icon path ReplaceableTextures\CommandButtons\BTNSnazzyScroll.blp
      • Quest - Create a Optional quest titled Credits with the description Thanks to Carnifex ..., using icon path ReplaceableTextures\CommandButtons\BTNTomeRed.blp
      • Quest - Create a Optional quest titled Commands with the description Commands for everyo..., using icon path ReplaceableTextures\CommandButtons\BTNSpellBookBLS.blp
      • Quest - Create a Optional quest titled Gameplay with the description |cFF00FF40Simple|r ..., using icon path ReplaceableTextures\WorldEditUI\Editor-Force.blp
      • Countdown Timer - Create a timer window for LevelTimer with title First income in ...
      • Set TimerWindVar = (Last created timer window)
      • Countdown Timer - Start LevelTimer as a One-shot timer that will expire in 25.00 seconds
      • Countdown Timer - Show TimerWindVar
      • Trigger - Run Leaderbrds <gen> (ignoring conditions)
      • Sound - Stop (Last played sound) Immediately
      • Sound - Play ArrangedTeamInvitation <gen>
  • NxtIncm
    • Events
      • Time - LevelTimer expires
    • Conditions
      • Endgame Equal to False
    • Actions
      • Sound - Play Hint <gen>
      • -------- Setup Timer --------
      • Countdown Timer - Destroy TimerWindVar
      • Countdown Timer - Create a timer window for LevelTimer with title Next income in:
      • Set TimerWindVar = (Last created timer window)
      • Countdown Timer - Show TimerWindVar
      • Countdown Timer - Start LevelTimer as a One-shot timer that will expire in TimerVar seconds
You can ignore everything else and look at the timer functions. As I see there isn't anything I could do. Am I wrong?
 
Status
Not open for further replies.
Top