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

Why not all ai heroes get heroes?

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,137
Here is the trigger. Sometimes 4 computers get heroes, sometimes 2 and sometimes 3. What can cause this? I can provide extra details if you want.

  • HeroSectirme
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to Computer
              • BotHeroSecti[(Integer A)] Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player number of (Player((Integer A)))) Less than or equal to 6
                • Then - Actions
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[(Random integer number between 1 and 24)] for (Player((Integer A))) at (Center of GameGuideDevil <gen>) facing Default building facing degrees
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Hero - Modify Strength of (Last created unit): Add 10
                  • Hero - Modify Agility of (Last created unit): Add 10
                  • Hero - Modify Intelligence of (Last created unit): Add 10
                  • Unit Group - Add (Last created unit) to zUG_HerolarAIDevil
                  • Unit Group - Add (Last created unit) to DevilHerolariHepsi
                  • Player Group - Add (Player((Integer A))) to ClanDevilPlayers
                  • Unit - Set the custom value of (Last created unit) to 0
                  • Set HeroCountDevil = (HeroCountDevil + 1)
                • Else - Actions
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[(Random integer number between 1 and 24)] for (Player((Integer A))) at (Center of GameGuideReaper <gen>) facing Default building facing degrees
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Hero - Modify Strength of (Last created unit): Add 10
                  • Hero - Modify Agility of (Last created unit): Add 10
                  • Hero - Modify Intelligence of (Last created unit): Add 10
                  • Unit Group - Add (Last created unit) to zUG_HerolarAIReaper
                  • Unit Group - Add (Last created unit) to ReaperHerolarinHepsi
                  • Player Group - Add (Player((Integer A))) to ClanReaperPlayers
                  • Unit - Set the custom value of (Last created unit) to 0
                  • Set HeroCountReaper = (HeroCountReaper + 1)
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
I'm going to assume it's because BotHerolar[] doesn't have 24 values ranging from 1 to 24. So sometimes the Random number returns them nothing.

Some other notes:
The default custom value of every unit is 0 so setting it to that seems unnecessary.
You're leaking a Point every time you create a Hero.
Why is the Event a Periodic Interval? It shouldn't need to run multiple times.
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
I'm going to assume it's because BotHerolar[] doesn't have 24 values ranging from 1 to 24. So sometimes the Random number returns them nothing.

Some other notes:
The default custom value of every unit is 0 so setting it to that seems unnecessary.
You're leaking a Point every time you create a Hero.
Why is the Event a Periodic Interval? It shouldn't need to run multiple times.

It is unit-type array 24.
I am using custom values for some other reasons. I wasn't know it was 0 as default.
Yes just realized, i will clean leaks later.
It is periodic because after this issue happens, i have decided to let it run for few seconds, then i am turning it off 10 seconds later.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
It is unit-type array 24.
I am using custom values for some other reasons. I wasn't know it was 0 as default.
Yes just realized, i will clean leaks later.
It is periodic because after this issue happens, i have decided to let it run for few seconds, then i am turning it off 10 seconds later.
Can I see your trigger that initializes the Array? That's really the only possible issue I can think of.
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
Can I see your trigger that initializes the Array? That's really the only possible issue I can think of.
  • HeroSetuplar
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set BotHerolar[1] = Diabolist Arconun
      • Set BotHerolar[3] = Dreadmage Balnazaar
      • Set BotHerolar[5] = Flame Master Zagan Hellfire
      • Set BotHerolar[7] = Monk Chris Battleaid
      • Set BotHerolar[9] = Shadow Mage Morbid Darkheart
      • Set BotHerolar[11] = Storm Panda Storm
      • Set BotHerolar[13] = Thundercaller Pollon
      • Set BotHerolar[15] = Warlock Archimonde
      • -------- str --------
      • Set BotHerolar[2] = Abomination Brutillus
      • Set BotHerolar[4] = Crusader Lord Nicholas
      • Set BotHerolar[6] = Chillwind Spider Iratha
      • Set BotHerolar[8] = Mountain King Modi Stonesmith
      • Set BotHerolar[10] = Naga Guardian Azshara Tidalfury
      • Set BotHerolar[12] = Pandaren Earth
      • Set BotHerolar[14] = Pit Lord Azgalor
      • Set BotHerolar[16] = Tauren Chieftain Cairne Bloodhoof
      • -------- agi --------
      • Set BotHerolar[3] = Assassin Mars Deimoss
      • Set BotHerolar[6] = Demon Hunter Illidan Stormrage
      • Set BotHerolar[9] = Fire Panda Volcano
      • Set BotHerolar[12] = Ranger Anya Moonbow
      • Set BotHerolar[15] = Manslayer Himura Kenshin
      • Set BotHerolar[18] = Wolf of Mibu Hajime Saito
      • Set BotHerolar[21] = Warden Maiev Shadowsong
      • Set BotHerolar[24] = Zergling Slydig
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Hmm, that's weird. Can you try Displaying text messages to see if the Actions are at least running for each Computer.

If you see all of the text messages but some Heroes aren't being created then something went wrong during the Unit creation process:
1) The unit-type of the Hero is incorrect
2) The position where the Hero should be created is incorrect
3) The Hero is getting removed/hidden after being created
4) Another trigger is interfering

If you don't see a message then that means the Player isn't a Computer or BotHeroSecti[] is already True.
 
Status
Not open for further replies.
Top