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

Short freeze when buying unit

Status
Not open for further replies.
  • SOLD PALA
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Paladin
    • Actions
      • Unit - Move (Sold unit) instantly to ((Center of Alli Spawn <gen>) offset by (Random real number between 0.00 and 100.00) towards 90.00 degrees)
      • Set Paladin = (Sold unit)
      • Unit Group - Add (Sold unit) to FOR_Leavers[(Player number of (Owner of (Sold unit)))]
      • Set sold_ALLY = (sold_ALLY - 1)
      • Player - Limit training of Archmage to 0 for (Owner of Paladin)
      • Player - Limit training of Mountain King to 0 for (Owner of Paladin)
      • Player - Limit training of Blood Mage to 0 for (Owner of Paladin)
      • Player - Limit training of Ranger to 0 for (Owner of Paladin)
      • Player - Limit training of Wizard to 0 for (Owner of Paladin)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of Paladin to 0 for (Picked player)
      • Trigger - Turn on camera of pala <gen>
Do you think something must be edited here? When I buy a unit there follows a short freeze befroe the bought unit spawns.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Objects have to be inited, which puts some stress on the game depending on the amount of their comitted object modifications. You can preload them, reduce the modifications or convert them to slk. Latter is badly supported by the editor and comes with other issues, which is why it's not recommended for simple mapmaking.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
The solution is what WaterKnight has said.

You can find info on preloading in my tutorial Things a GUIer should know. There should also be a link at bottom of tutorial for a tutorial on preloading to get more in depth.

As DysfunctionaI said you leak.
More specifically this leaks two locations.
  • ((Center of Alli Spawn <gen>) offset by (Random real number between 0.00 and 100.00) towards 90.00 degrees)
You leak a player group also.

Also anything used twice or more should be stored in a variable.
Example store (Owner of Paladin) to a variable and use the temp player variable. It will speed things up and make it easier for editing later.
 
There's leaks there, but that's not what's causing the lag. You might need to post "camera of pala".

Edit: oh yeah, try placing a random Paladin somewhere so the map loads it on init, then try again (to see if the problem is related to loading the Paladin stuffs).

The cameras, my friend, do not cause any lag, they are not the problem, but Ok I will show you how simple is the camera of paal
  • camera of pala
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Camera - Lock camera target for (Owner of Paladin) to Paladin, offset by (0.00, 0.00) using Default rotation
Objects have to be inited, which puts some stress on the game depending on the amount of their comitted object modifications. You can preload them, reduce the modifications or convert them to slk. Latter is badly supported by the editor and comes with other issues, which is why it's not recommended for simple mapmaking.
So, waterknight you arte saying that I should initilize the heroes? How, when a variables cannot be a unit-type? that's why I defien them on (sold unit)?
Example store (Owner of Paladin) to a variable and use the temp player variable. It will speed things up and make it easier for editing later.
Edit: you say I should store owner of paladin? then I should store this owner to the chosen player? How do I do this? The players depend on the unit :O
 
Level 13
Joined
Dec 21, 2010
Messages
541
I have encountered this problem..the lag is caused by loading their abilities when you bought them.... Just create those heroes owned by player passive at map initialization then remove them afterwards...or just make a dummy then add the abilities to that dummy then remove the dummy..



@deathismyfriend...
How many spells can you give to a dummy? can you store more than 5?
 
Status
Not open for further replies.
Top