• 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.

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.
 
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
 
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