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

[Trigger] Reveal map on losing all units

Status
Not open for further replies.
Level 2
Joined
Feb 23, 2016
Messages
7
Hello all. I'm a real piece of noob when it comes to World Editor triggers. I am currently giving a melee map some additional settings and heroes for a LAN party so the next few weeks I expect to have a few questions.

I already have issues with the basic stuff. I'm trying to create a trigger that will reveal the map to a player when he controls no more units and buildings.

The below hasn't worked yet.

QeSdGzg.png


Are any of the Events the best way of handling this trigger? I'm planning just to use the "A unit dies" Event but it depends on how well Warcraft III handles many unit deaths at once (as the max pop is 300 per person). I expect it's not too bad.

Thanks :vw_love:
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
I don't think you need to check it every 10 seconds unless a player can lose units other than dying. From the looks of it, you are going to create a seperate trigger for every single player, which is not the best approach. I'd recommend using maybe a Unit Indexer that let's you add and or remove entering/leaving units from the map into their Group[Player number of Owner of (unit)]. That way, you only have to check how many units are in the group instead of having to enumerate over the entire map. If you stick with the latter strategy, your map might have noticable lag everytime a unit dies considering that each player will have 300 units each.
 
Level 14
Joined
Nov 30, 2013
Messages
926
If you stick with the latter strategy, your map might have noticable lag everytime a unit dies considering that each player will have 300 units each.

I think it would be easy if you shorten it into "Leaks".

Anyway to Skadrel, Leaks is a big deal in any mapmaking.
This can cause quite a potential lag due because of a remaining unused variables being operated.
If you want to best avoid this kind of leak, use this.
  • Melee Initialization
    • Events
      • Unit - A unit owned by Player 3 (Teal) Dies
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units owned by Player 3 (Teal))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of TempGroup are dead) Equal to True
        • Then - Actions
          • -------- Do whatever you want here. --------
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
This can able to remove the Unit-Group leak after being used.

If you want to learn more what will leak, go to this link.
 
Level 14
Joined
Nov 30, 2013
Messages
926
I wasn't referring to leaks causing a spike in lag everytime this trigger ran. I was referring to the fact that the trigger has to enumerate over the entire map which can contain well over 300 units. That's going to be extremely taxing.

I see, I'mma agree to that.
Well picking over than 300 units can cause a lag but picking a unit which belong to what player won't lag it.
But if the player has that amount of that units, yes, it can lag but also can cause some movement delay when everytime you ordered them to move.
 
Level 2
Joined
Feb 23, 2016
Messages
7
Thank you so much for continuing critique even after my solution was made available. I seriously appreciate it. I have made a lot of unnecessary triggers I think, beside this, because I don't know the ins and outs of the editor triggers (also, have to say, the trigger search function is way too limited).

Should I use the trigger proposed by bear_369 instead?
 
Status
Not open for further replies.
Top