# Massive Lag Spike?

#### Karzama

Level 13
So for my hero map I have added in computers and such and tested having all 8 computers playing and me being an observer and when the timer expired and they were "picking" their heroes I got a massive lag spike. I've tried putting in a single computer and there's a bit there too. Also a lil bit when I pick one myself.

• AI Pick Hero
• Events
• Conditions
• Actions
• Player Group - Pick every player in AIPlayerGroup and do (Actions)
• Loop - Actions
• Set AITempPlayer = (Picked player)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• PlayerHero[(Player number of AITempPlayer)] Equal to No unit
• Then - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• AITempPlayer Equal to Player 1 (Red)
• AITempPlayer Equal to Player 2 (Blue)
• AITempPlayer Equal to Player 3 (Teal)
• AITempPlayer Equal to Player 4 (Purple)
• Then - Actions
• Set TempPoint = (Random point in NorthHeroSpawn <gen>)
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• AITempPlayer Equal to Player 5 (Yellow)
• AITempPlayer Equal to Player 6 (Orange)
• AITempPlayer Equal to Player 7 (Green)
• AITempPlayer Equal to Player 8 (Pink)
• Then - Actions
• Set TempPoint = (Random point in SouthHeroSpawn <gen>)
• Else - Actions
• Set AIRandomInt = (Random integer number between 2 and 9)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 1
• HeroUsed[1] Equal to False
• Then - Actions
• Unit - Create 1 Blood Elf Champion for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Blood Elf Champion from all marketplaces
• Hero - Learn skill for (Last created unit): Sword of Leaders
• Unit Group - Add (Last created unit) to HeroStr
• Set HeroUsed[1] = True
• Trigger - Turn on AI Hero 1 Blood Elf Champion <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 2
• HeroUsed[2] Equal to False
• Then - Actions
• Unit - Create 1 Sealed Python for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Sealed Python from all marketplaces
• Hero - Learn skill for (Last created unit): Summon Reef Elemental
• Unit Group - Add (Last created unit) to HeroInt
• Set HeroUsed[2] = True
• Trigger - Turn on AI Hero 2 Sealed Python <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 3
• HeroUsed[3] Equal to False
• Then - Actions
• Unit - Create 1 Crystal Lord for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Crystal Lord from all marketplaces
• Hero - Learn skill for (Last created unit): Pulverize
• Unit Group - Add (Last created unit) to HeroStr
• Set HeroUsed[3] = True
• Trigger - Turn on AI Hero 3 Crystal Lord <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 4
• HeroUsed[4] Equal to False
• Then - Actions
• Unit - Create 1 Flower Dryad for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Flower Dryad from all marketplaces
• Hero - Learn skill for (Last created unit): Faerie Fire
• Unit Group - Add (Last created unit) to HeroInt
• Set HeroUsed[4] = True
• Trigger - Turn on AI Hero 4 Flower Dryad <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 5
• HeroUsed[5] Equal to False
• Then - Actions
• Unit - Create 1 Nerubian Mauler for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Nerubian Mauler from all marketplaces
• Hero - Learn skill for (Last created unit): Unholy Aura
• Unit Group - Add (Last created unit) to HeroAgi
• Set HeroUsed[5] = True
• Trigger - Turn on AI Hero 5 Nerubian Mauler <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 6
• HeroUsed[6] Equal to False
• Then - Actions
• Unit - Create 1 Goblin Gunner for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Goblin Gunner from all marketplaces
• Hero - Learn skill for (Last created unit): Pride of War
• Unit Group - Add (Last created unit) to HeroAgi
• Set HeroUsed[6] = True
• Trigger - Turn on AI Hero 6 Goblin Gunner <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 7
• HeroUsed[7] Equal to False
• Then - Actions
• Unit - Create 1 Soul Devourer for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Soul Devourer from all marketplaces
• Hero - Learn skill for (Last created unit): Siphon Aura
• Unit Group - Add (Last created unit) to HeroStr
• Set HeroUsed[7] = True
• Trigger - Turn on AI Hero 7 Soul Devourer <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 8
• HeroUsed[8] Equal to False
• Then - Actions
• Unit - Create 1 Overqueen for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Overqueen from all marketplaces
• Hero - Learn skill for (Last created unit): Shadow Strike
• Unit Group - Add (Last created unit) to HeroAgi
• Set HeroUsed[8] = True
• Trigger - Turn on AI Hero 8 Overqueen <gen>
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• AIRandomInt Equal to 9
• HeroUsed[9] Equal to False
• Then - Actions
• Unit - Create 1 Ogre Gladiator for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Neutral Building - Remove Ogre Gladiator from all marketplaces
• Hero - Learn skill for (Last created unit): Command Aura
• Unit Group - Add (Last created unit) to HeroStr
• Set HeroUsed[9] = True
• Trigger - Turn on AI Hero 9 Ogre Gladiator <gen>
• Else - Actions
• Trigger - Run (This trigger) (checking conditions)
• Else - Actions
• Hero Picked
• Events
• Unit - A unit Sells a unit
• Conditions
• Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• (Unit-type of (Selling unit)) Equal to Agilty Tavern
• (Unit-type of (Selling unit)) Equal to Intelligence Tavern
• (Unit-type of (Selling unit)) Equal to Strength Tavern
• Then - Actions
• Set TempUnit = (Buying unit)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• (Owner of TempUnit) Equal to Player 1 (Red)
• (Owner of TempUnit) Equal to Player 2 (Blue)
• (Owner of TempUnit) Equal to Player 3 (Teal)
• (Owner of TempUnit) Equal to Player 4 (Purple)
• Then - Actions
• Set TempPoint = (Random point in NorthHeroSpawn <gen>)
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• (Owner of TempUnit) Equal to Player 5 (Yellow)
• (Owner of TempUnit) Equal to Player 6 (Orange)
• (Owner of TempUnit) Equal to Player 7 (Green)
• (Owner of TempUnit) Equal to Player 8 (Pink)
• Then - Actions
• Set TempPoint = (Random point in SouthHeroSpawn <gen>)
• Else - Actions
• Unit - Move (Sold unit) instantly to TempPoint
• Camera - Pan camera for (Owner of (Sold unit)) to TempPoint over 2.00 seconds
• Neutral Building - Remove (Unit-type of (Sold unit)) from all marketplaces
• Set PlayerHero[(Player number of (Owner of (Sold unit)))] = (Sold unit)
• Trigger - Run Check Hero <gen> (checking conditions)
• Else - Actions
• Check Hero
• Events
• Conditions
• Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Blood Elf Champion
• Then - Actions
• Set HeroUsed[1] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Sealed Python
• Then - Actions
• Set HeroUsed[2] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Crystal Lord
• Then - Actions
• Set HeroUsed[3] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Flower Dryad
• Then - Actions
• Set HeroUsed[4] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Nerubian Mauler
• Then - Actions
• Set HeroUsed[5] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Goblin Gunner
• Then - Actions
• Set HeroUsed[6] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Soul Devourer
• Then - Actions
• Set HeroUsed[7] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Overqueen
• Then - Actions
• Set HeroUsed[8] = True
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of (Last created unit)) Equal to Ogre Gladiator
• Then - Actions
• Set HeroUsed[9] = True
• Else - Actions

The first trigger is for the computer players and is triggered by a separate trigger that is triggered by an elapsed time trigger. The bottom 2 are for when a hero picks a hero where the first one triggers the second one.

#### Malhorne

Level 18
You set the random number between 2 and 9 but you make a condition for 1 ?

#### Karzama

Level 13
Oh yer that was to make them get the 9th hero for testing purposes. The lag spike was still there either way

#### Malhorne

Level 18
Infact this lag spike is normal because see this trigger it's way huge :/
I think some conditions can be shortened...

#### Karzama

Level 13
Would doing something like this work better do you think?

• Hero Type
• Events
• Map initialization
• Conditions
• Actions
• Set HeroType[1] = Blood Elf Champion
• Set HeroType[2] = Sealed Python
• Set HeroType[3] = Crystal Lord
• Set HeroType[4] = Flower Dryad
• Set HeroType[5] = Nerubian Mauler
• Set HeroType[6] = Goblin Gunner
• Set HeroType[7] = Soul Devourer
• Set HeroType[8] = Overqueen
• Set HeroType[9] = Ogre Gladiator

#### Malhorne

Level 18
It could help do some settings on initialization that's sure

#### Karzama

Level 13
Will start doing that then. XD

#### Malhorne

Level 18
Doing some initialization stuff in arrays will allow you to get those data with integer loop which could be faster than what you did.

#### jonhysone

Level 15
First trigger :
Why not use for each integer Variable from 1 to 9. You can shorten them really easy , About unit types , Store them as you posted then .

#### Karzama

Level 13
Not sure if this is what you meant but this is what I've got now and the lag spike seemed to be worse!!

• AI Pick Hero
• Events
• Conditions
• Actions
• Player Group - Pick every player in AIPlayerGroup and do (Actions)
• Loop - Actions
• Set AITempPlayer = (Picked player)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• PlayerHero[(Player number of AITempPlayer)] Equal to No unit
• Then - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• AITempPlayer Equal to Player 1 (Red)
• AITempPlayer Equal to Player 2 (Blue)
• AITempPlayer Equal to Player 3 (Teal)
• AITempPlayer Equal to Player 4 (Purple)
• Then - Actions
• Set TempPoint = (Random point in NorthHeroSpawn <gen>)
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• AITempPlayer Equal to Player 5 (Yellow)
• AITempPlayer Equal to Player 6 (Orange)
• AITempPlayer Equal to Player 7 (Green)
• AITempPlayer Equal to Player 8 (Pink)
• Then - Actions
• Set TempPoint = (Random point in SouthHeroSpawn <gen>)
• Else - Actions
• Set AIRandomInt = (Random integer number between 1 and 9)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• HeroUsed[AIRandomInt] Equal to False
• Then - Actions
• Unit - Create 1 HeroType[AIRandomInt] for AITempPlayer at TempPoint facing Default building facing degrees
• Set PlayerHero[(Player number of AITempPlayer)] = (Last created unit)
• Set TempUnit = (Last created unit)
• Neutral Building - Remove HeroType[AIRandomInt] from all marketplaces
• Set HeroUsed[AIRandomInt] = True
• Trigger - Turn on HeroTrigger[AIRandomInt]
• Trigger - Run AI Learn First Spell <gen> (checking conditions)
• Else - Actions
• Trigger - Run (This trigger) (checking conditions)
• Else - Actions
• Hero Type
• Events
• Map initialization
• Conditions
• Actions
• Set HeroType[1] = Blood Elf Champion
• Set HeroTrigger[1] = AI Hero 1 Blood Elf Champion <gen>
• Set HeroType[2] = Sealed Python
• Set HeroTrigger[2] = AI Hero 2 Sealed Python <gen>
• Set HeroType[3] = Crystal Lord
• Set HeroTrigger[3] = AI Hero 3 Crystal Lord <gen>
• Set HeroType[4] = Flower Dryad
• Set HeroTrigger[4] = AI Hero 4 Flower Dryad <gen>
• Set HeroType[5] = Nerubian Mauler
• Set HeroTrigger[5] = AI Hero 5 Nerubian Mauler <gen>
• Set HeroType[6] = Goblin Gunner
• Set HeroTrigger[6] = AI Hero 6 Goblin Gunner <gen>
• Set HeroType[7] = Soul Devourer
• Set HeroTrigger[7] = AI Hero 7 Soul Devourer <gen>
• Set HeroType[8] = Overqueen
• Set HeroTrigger[8] = AI Hero 8 Overqueen <gen>
• Set HeroType[9] = Ogre Gladiator
• Set HeroTrigger[9] = AI Hero 9 Ogre Gladiator <gen>
The trigger arrays are there to turn on the triggers to make them learn spells. I had to add in a trigger which ended up basically being like the original to get them to learn their first spell and to add them into a group for their primary attribute as that's used for items. That trigger is here:

• AI Learn First Spell
• Events
• Conditions
• Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Blood Elf Champion
• Then - Actions
• Hero - Learn skill for TempUnit: Sword of Leaders
• Unit Group - Add TempUnit to HeroStr
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Sealed Python
• Then - Actions
• Hero - Learn skill for TempUnit: Summon Reef Elemental
• Unit Group - Add TempUnit to HeroInt
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Crystal Lord
• Then - Actions
• Hero - Learn skill for TempUnit: Pulverize
• Unit Group - Add TempUnit to HeroStr
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Flower Dryad
• Then - Actions
• Hero - Learn skill for TempUnit: Faerie Fire
• Unit Group - Add TempUnit to HeroInt
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Nerubian Mauler
• Then - Actions
• Hero - Learn skill for TempUnit: Unholy Aura
• Unit Group - Add TempUnit to HeroAgi
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Goblin Gunner
• Then - Actions
• Hero - Learn skill for TempUnit: Pride of War
• Unit Group - Add TempUnit to HeroAgi
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Soul Devourer
• Then - Actions
• Hero - Learn skill for TempUnit: Siphon Aura
• Unit Group - Add TempUnit to HeroStr
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Overqueen
• Then - Actions
• Hero - Learn skill for TempUnit: Shadow Strike
• Unit Group - Add TempUnit to HeroAgi
• Else - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Unit-type of TempUnit) Equal to Ogre Gladiator
• Then - Actions
• Hero - Learn skill for TempUnit: Command Aura
• Unit Group - Add TempUnit to HeroStr
• Else - Actions

#### Malhorne

Level 18
I will see this tomorrow if nobody found something

Replies
3
Views
382
Replies
2
Views
417
Replies
7
Views
481
Replies
8
Views
581
Replies
3
Views
1K