[Trigger] Leaks & Needed Variables

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2015
Messages
165
I kind of need your help mapper community.
For my latest AOS Map, I created a Tavern Hero Pick system. I'm just getting used to the Editor again, and this was my best way of doing something like that.
This is how it should work:
The Hero is bought, the buying unit gets removed, and the hero gets moved to one of the 3 Spawns.
I copied pasted this 3 times by the way, for every Team once. I didn't find any Variables to make it all in once. If you have any guesses on that too, please tell me.
The "Playerhero" variable is for moving the heroes later on for stuff like Arena fights etc.
After picking the Hero, the Game is freezing 1 second for everyone. Any guess why? And any fix maybe? - I'm extremely noobish at the moment, so please help me out.

  • Taverns T1
    • Ereignisse
      • Einheit - A unit owned by Neutral passiv Verkauft eine Einheit
    • Bedingungen
      • (Unit-type of (Sold unit)) Ungleich RANDOM HERO
      • Or - Any (Conditions) are true
        • Bedingungen
          • (Owner of (Buying unit)) Gleich Spieler 1 (Rot)
          • (Owner of (Buying unit)) Gleich Spieler 2 (Blau)
          • (Owner of (Buying unit)) Gleich Spieler 3 (Blaugrau)
    • Aktionen
      • Set Buyer = (Buying unit)
      • Set Seller = (Sold unit)
      • Set Playerhero[(Player number of (Owner of (Sold unit)))] = (Sold unit)
      • Einheit - Kill Buyer
      • Einheit - Move Seller instantly to (Center of SpawnPoint lila Schloss <gen>)
      • Spiel - Display to (All players) the text: (Player + ((String((Player number of (Owner of Buyer)))) + ( has picked + (Name of Seller))))
      • Kamera - Pan camera for (Owner of Buyer) to (Center of SpawnPoint lila Schloss <gen>) over 0.00 seconds
      • Held - Create Recall [B] and give it to Seller
      • Held - Create Ankh der Reinkarnation and give it to Seller
 
Level 9
Joined
Apr 23, 2011
Messages
527
to make 1 trigger for all teams, remove the Or condition, add each player to a team playergroup and add this action:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Owner of Buyer) is in team1) Equal to True
    • Then - Actions
      • spawning actions here
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of Buyer) is in team2) Equal to True
        • Then - Actions
          • spawning actions here
        • Else - Actions
          • Continue this until you have an ITE for all teams
you also have two point leaks (moving seller to a point and panning camera for player to point)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,283
After picking the Hero, the Game is freezing 1 second for everyone. Any guess why? And any fix maybe? - I'm extremely noobish at the moment, so please help me out.
Resource stall? If a unit is not pre-loaded the game blocks until its assets and data are loaded.

Try placing the unit on the map somewhere so it loads at the same time the map loads. You can remove it immediately as the game starts as once it is loaded it remains loaded for the rest of the session. Do note that this does not eliminate the blocking the unit causes while loading, it just forces it to be done during the map load time (which is extended as a consequence).

If this does not help then maybe some other trigger is entering an infinite loop. If the loop is in the same thread then it will instantly hit the thread operation limit and crash the thread. Depending on what the loop does this could stall the game while it executes until the operation limit.

I copied pasted this 3 times by the way, for every Team once. I didn't find any Variables to make it all in once. If you have any guesses on that too, please tell me.
You need an array initialized at map initialization that maps player slot number to their start location. If you make this a location (point) array global variable then you can also solve some of the leaks at the same time (you only need 3 constant locations, one for each start point which you then map to the player slot).
 
Level 6
Joined
Apr 5, 2015
Messages
165
@Light,

Thanks for the quick and helping answer. I really appreciate it!

Alright so these are my leaks. The question is: Is there any Work-Around? Because i absolutely need the Unit and the Camera to do that.

Resource stall? If a unit is not pre-loaded the game blocks until its assets and data are loaded.

Try placing the unit on the map somewhere so it loads at the same time the map loads. You can remove it immediately as the game starts as once it is loaded it remains loaded for the rest of the session. Do note that this does not eliminate the blocking the unit causes while loading, it just forces it to be done during the map load time (which is extended as a consequence).

Thanks, i will absolutely try this out. - Editing in a few to say if it helped.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,283
Alright so these are my leaks. The question is: Is there any Work-Around? Because i absolutely need the Unit and the Camera to do that.
You could use constant locations which do not need removal and so do not leak. 1 location per team.

You could also just fix the leak like you do for all location leaks. This requires the use of custom script due to the lack of a GUI action for the RemoveLocation native.

The GUI for a location leak fix would look something like this.
  • Set RegLoc1 = (Center of SpawnPoint lila Schloss <gen>)
  • Einheit - Move Seller instantly to (RegLoc1)
  • Kamera - Pan camera for (Owner of Buyer) to (RegLoc1) over 0.00 seconds
  • Custom Script: call RemoveLocation(udg_RegLoc1)
The variable RegLoc1 can be used in other triggers to fix similar leaks.
 
Level 6
Joined
Apr 5, 2015
Messages
165
You could use constant locations which do not need removal and so do not leak. 1 location per team.

You could also just fix the leak like you do for all location leaks. This requires the use of custom script due to the lack of a GUI action for the RemoveLocation native.

The GUI for a location leak fix would look something like this.
  • Set RegLoc1 = (Center of SpawnPoint lila Schloss <gen>)
  • Einheit - Move Seller instantly to (RegLoc1)
  • Kamera - Pan camera for (Owner of Buyer) to (RegLoc1) over 0.00 seconds
  • Custom Script: call RemoveLocation(udg_RegLoc1)
The variable RegLoc1 can be used in other triggers to fix similar leaks.

I'm amazed. You pretty much fixed every problem that was there. Resource Stall was the answer for the Freeze, and I also fixed the leaks.
Thank you sir, and take my Reputation!

All problems Solved!
 
Status
Not open for further replies.
Top