• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Would this trigger cause lag?

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2013
Messages
154
  • ZombieSpawnsSpawn
    • Events
      • Time - Every (Random real number between 2.00 and 4.00) seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Zombie for Player 12 (Brown) at (Center of SpawnZombieSpawner[(Random integer number between 1 and AmountOfZombieSpawners)]) facing Default building facing degrees
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Distance between (Position of (Last created unit)) and (Position of PlayerUnit[(Integer A)])) Greater than Distance
            • Then - Actions
              • Unit - Remove (Last created unit) from the game
              • Trigger - Run (This trigger) (ignoring conditions)
            • Else - Actions
      • Unit Group - Add (Last created unit) to ALLZombies
      • AI - Ignore (Last created unit)'s guard position
      • Unit - Order (Last created unit) to Attack-Move To (Position of PlayerUnit[(Random integer number between 1 and 4)])
I'm mostly worried about the distance check part. It checks if the place where the zombie spawned is atleast 6000 meters from the nearest hero unit, and if it isn't it kills the zombie and spawns it at another random location, hopefully near the hero. Would this trigger cause lag if the zombie somehow spawned like 5 times in a row at a distance too far away from a hero?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,232
Time - Every (Random real number between 2.00 and 4.00) seconds of game time
This might not do what you think it does. At map initialization it will roll a random real between 2 and 4 and then periodically every that period run the trigger. For example if it rolled 2.50 it would then have a period of exactly 2.50 seconds for the rest of the game. You might want to use a timer instead that each tick you restart with a random timeout of 2.00 to 4.00.

As KILLCIDE mentioned, it leaks a lot of location object. These can degrade game performance over time.
 
Status
Not open for further replies.
Top