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

Trigger Lags (Random Hero)

Status
Not open for further replies.
Level 3
Joined
Aug 15, 2007
Messages
67
When a user selects a random hero this trigger runs and all players in the game experience a minor 2 second game freeze. Any thoughts on what could cause this delay?

  • random hero
    • Events
      • Unit - A unit enters safezone <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Random Hero
    • Actions
      • Set RandomInteger = (Random integer number between 1 and herocount)
      • Unit - Remove (Triggering unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 1 (Red)
              • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
              • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
              • (Owner of (Triggering unit)) Equal to Player 7 (Green)
              • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Set Location = (Center of northherospawn <gen>)
          • Camera - Pan camera for (Owner of (Triggering unit)) to Location over 0.00 seconds
          • Unit - Create 1 randomhero[RandomInteger] for (Owner of (Triggering unit)) at Location facing Default building facing degrees
          • Unit Group - Add (Last created unit) to heros
          • Game - Display to (All players) for 8.00 seconds the text: ((playercolour[(Player number of (Owner of (Triggering unit)))] + ((Name of (Owner of (Triggering unit))) + |r)) + has chosen a Random Hero and recieved an extra 200 gold!)
          • Player - Add 200 to (Owner of (Triggering unit)) Current gold
          • Custom script: call RemoveLocation(udg_Location)
        • Else - Actions
          • Set Location = (Center of southherospawn <gen>)
          • Camera - Pan camera for (Owner of (Triggering unit)) to Location over 0.00 seconds
          • Unit - Create 1 randomhero[RandomInteger] for (Owner of (Triggering unit)) at Location facing Default building facing degrees
          • Unit Group - Add (Last created unit) to heros
          • Game - Display to (All players) for 8.00 seconds the text: ((playercolour[(Player number of (Owner of (Triggering unit)))] + ((Name of (Owner of (Triggering unit))) + |r)) + has chosen a Random Hero and recieved an extra 200 gold!)
          • Player - Add 200 to (Owner of (Triggering unit)) Current gold
          • Custom script: call RemoveLocation(udg_Location)
      • Set RandomInteger = 0
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
My guess is that the unit is loaded for the first time, which usually lags the game a bit.
Try placing all the heroes you choose beforehand into the map and test it again. It doesn't matter who the owner of this pre-placed heroes is, just that the unit is loaded upon map initialization.
 
Status
Not open for further replies.
Top