• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Trigger (lag)

Status
Not open for further replies.
Level 12
Joined
Jun 1, 2009
Messages
576
hi guys, this is trigger that i use in my map. I want to know what in this trigger couse so much lag and how to fix this:

  • Pick Cat
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Unit - Remove (Random unit from (Units owned by (Owner of (Sold unit)) of type Pick Cat)) from the game
      • Unit - Remove (Sold unit) from the game
      • Unit - Create 1 (Unit-type of (Sold unit)) for (Owner of (Sold unit)) at (Random point in Center <gen>) facing (Position of (Triggering unit))
      • Camera - Pan camera for (Owner of (Last created unit)) to (Position of (Last created unit)) over 0.00 seconds
      • Selection - Select (Last created unit) for (Owner of (Last created unit))
      • If (Add_Santa Equal to True) then do (Hero - Create |cffFF0000Santa Hat and give it to (Last created unit)) else do (Do nothing)
      • Game - Display to (All players) for 5.00 seconds the text: (Player_Colors[(Player number of (Owner of (Buying unit)))] + ((Name of (Owner of (Buying unit))) + (|r + ( |cffC0C0C0picked|r + (|cff8080FF + ((Proper name of (Sold unit)) + |r))))))
 
OF MY GARD. XD. Man it is rly laggy, I havent opened we for more than halgf year but so obvios that you have Location leaks, allso use variables, set variables for unit, set unit-variable = sold unit, player variable = owner of unit-variable, not sold unit, location variable to position of unit-variable, also delete locations after using them, i dont remember screeps but I think it was call removelocation(udg_nameofvariable).
 

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,296
Unit - Remove (Sold unit) from the game
Unit - Create 1 (Unit-type of (Sold unit)) for (Owner of (Sold unit)) at (Random point in Center <gen>) facing (Position of (Triggering unit))
Seeing how you just removed "Sold unit" it is illogical that "(Unit-type of (Sold unit))" will return anything meaningful. You need to either store the unit type in a local variable or remove the unit after create a new one.

If it is the first time the unit is being sold it may not be preloaded and will cause some frame drops due to a resource stall (where the game main thread is forced to stop execution and wait for I/O to finish).
 
Variables can be your best friend. ;)

As above was said remove your leaks

Leaks:
  • Unit - Remove (Random unit from (Units owned by (Owner of (Sold unit)) of type Pick Cat)) from the game
  • Unit - Create 1 (Unit-type of (Sold unit)) for (Owner of (Sold unit)) at (Random point in Center <gen>) facing (Position of (Triggering unit))
  • Camera - Pan camera for (Owner of (Last created unit)) to (Position of (Last created unit)) over 0.00 seconds
Also, is following line working well?
  • Game - Display to (All players) for 5.00 seconds the text: (Player_Colors[(Player number of (Owner of (Buying unit)))] + ((Name of (Owner of (Buying unit))) + (|r + ( |cffC0C0C0picked|r + (|cff8080FF + ((Proper name of (Sold unit)) + |r))))))
I'm just asking because you remove 'Sold unit' before out of game.
 
Status
Not open for further replies.
Top