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

How can i prevent unit not to take order while cooldown

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,137
Update: I give up.

I think it is advanced level system and i don't think someone can solve this easily.

I am requesting for lock this topic because 49 days have been passed and everyhing is complicated in here and still my issue is not solved. I will create new topic for simple questions that can help me.

Because i have realized it is too advanced system for me. I have to ask simple questions and proceed step by step with people who try to help me.

I need a solutions that "i can understand" OR i need to someone who tell me "exactly what should i do"

If someone enters this topic and decides to help me, they have to read lots of messages, fixes, solutions and updates. It is terrible for someone who wants to help.

I am giving up for this topic and probably nowadays i will create new topic with lot of explanation and try to stick with the topic and i will go step by step. Everything is messed up in here.

I want to thanks for everyone who tried to help me. We will meet in new topic another time.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
I don't really understand why you need that For Loop. Why does this condition matter?
  • (zU_AIHero[(Integer A)] is in zUG_RegenALL) Equal to False
But more importantly, can't you just use (Picked unit) instead, it'll be equal to your Bot hero:
  • (Picked unit) is in zUG_RegenALL) Equal to False
Also, this isn't a very good filter:
  • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True)))
Dead units, Invulnerable units, and Structures will all be put inside this group. This can cause problems.

You also put these at the end of the For Loop but they're already destroyed inside the Pick Every Unit loop:
  • Custom script: call DestroyGroup (udg_TempGroup)
  • Custom script: call RemoveLocation (udg_TempPoint)
  • Custom script: call RemoveLocation (udg_TempPoint2)
So the end result could look something like this:
  • SkillsAoE
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • Set AI_Hero = (Picked unit)
          • Set AI_Player = (Owner of AI_Hero)
          • Set AI_PN = (Player number of AI_Player)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (AI_Hero is in zUG_RegenALL) Equal to False
              • zBool_AIKaciyor_Creepten[AI_PN] Equal to False
              • zBool_AIKaciyor_Herodan[AI_PN] Equal to False
              • zBool_AIKaciyor_Kuleden[AI_PN] Equal to False
            • Then - Actions
              • Set TempPoint = (Position of AI_Hero)
              • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and (((Matching unit) belongs to an enemy of AI_Player) Equal to True)) and Matching unit is alive + vulnerable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Number of units in TempGroup Greater than 0
                • Then - Actions
                  • Set AI_Target = (Random unit from TempGroup)
                  • Set TempPoint2 = (Position of AI_Target)
                  • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPoint2
                  • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPoint2
                  • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPoint2
                  • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPoint2
                  • Custom script: call RemoveLocation (udg_TempPoint2)
                • Else - Actions
              • Custom script: call DestroyGroup (udg_TempGroup)
              • Custom script: call RemoveLocation (udg_TempPoint)
            • Else - Actions
If that doesn't work it's probably because the Orders are being interrupted. You're telling the unit to do 4 things at once, so it'll only listen to the very last order given (Shockwave in this case). You can add an If Then Else to each ability to check if the unit actually has the ability before trying to use it.

Another idea for a better system would be to use a different timer for each type of ability.
You could start out with 2 timer types: Immediate (no target) and Unit/Point target.
Then you create a trigger for each Hero. These triggers will contain the hero's "AI" and will order the unit to only use abilities that are available to it.
Then you link these triggers to each Hero using a Hashtable. You can use the Hero's unit-type id as the Parent key and save the Trigger at child key 0.
So when for example your Unit/Point timer expires, you Pick through all of the Bot heroes like you're doing now, and then Run their AI trigger by loading it from the Hashtable. But right before that you set the AI variables like AI_Hero, AI_Player, AI_PN, and anything else that will be needed so you can reference everything in the AI trigger. You also need to let the AI trigger know which of the 2 Timers expired, which you can do by setting an Integer variable: 1 = Immediate, 2 = Unit/Point.

For example, your AI trigger for the Paladin could look like this:
  • Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • AI_Ability_Targeting_Type Equal to 1
    • Then - Actions
      • // Order the AI_Hero to use one of it's Immediate abilities --> Divine Shield or Ressurrect
    • Else - Actions
      • // Order the AI_Hero to use it's only Unit/Point ability --> Holy Light
This requires a trigger per Hero but at least it gives you greater control over everything. You can make unique AI for each Hero.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
I don't really understand why you need that For Loop. Why does this condition matter?

  • (zU_AIHero[(Integer A)] is in zUG_RegenALL) Equal to False
But more importantly, can't you just use (Picked unit) instead, it'll be equal to your Bot hero:

  • (Picked unit) is in zUG_RegenALL) Equal to False

RegenAll group orders all bots to the base for the regeneration but hmmm yes you are right. I have changed it with Picked Unit.

Also, this isn't a very good filter:

  • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True)))
Dead units, Invulnerable units, and Structures will all be put inside this group. This can cause problems.

Many of my maps i am removing dying units within unit group but probably i didn't do that for HerolarAll

HerolarAll is group for heroes only. They cannot be structure or mechanic like something. But yes it will try to pick dead units also. I will make rearrangement.

You also put these at the end of the For Loop but they're already destroyed inside the Pick Every Unit loop:
  • Custom script: call DestroyGroup (udg_TempGroup)
  • Custom script: call RemoveLocation (udg_TempPoint)
  • Custom script: call RemoveLocation (udg_TempPoint2)
Hmm i wasn't knew that.

By the way you are talking about Hashtable. I don't know what is it and how to use it. My friends told me that "hashtable exceeds your limits" because i am a stupid person and if they say something like this, probably they are right. Currently i will try to fix issues with your new suggestions. I hope it will solve my issues. I don't think i can handle hashtable thing.. I just want to make my ai heroes cast spells randomly. Thank you for your help.

Here is the situation. Hero has all 3 skills but it is casting Shockwave only.
All spells have a 1 cooldown and mana for the testing purpose. It has other skills as well but casting Shockwave only.

  • SkillsAoE
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in zUG_RegenALL) Equal to False
                  • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
                • Then - Actions
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
                  • Set TempPoint2 = (Position of (Random unit from TempGroup))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Shockwave // for (Picked unit)) Greater than or equal to 1
                    • Then - Actions
                      • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPoint2
                      • Custom script: call DestroyGroup (udg_TempGroup)
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Custom script: call RemoveLocation (udg_TempPoint2)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Rain of Fire // for (Picked unit)) Greater than or equal to 1
                    • Then - Actions
                      • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPoint2
                      • Custom script: call DestroyGroup (udg_TempGroup)
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Custom script: call RemoveLocation (udg_TempPoint2)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Inferno // for (Picked unit)) Greater than or equal to 1
                    • Then - Actions
                      • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPoint2
                      • Custom script: call DestroyGroup (udg_TempGroup)
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Custom script: call RemoveLocation (udg_TempPoint2)
                    • Else - Actions
                      • Custom script: call DestroyGroup (udg_TempGroup)
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Custom script: call RemoveLocation (udg_TempPoint2)
                • Else - Actions
                  • Custom script: call DestroyGroup (udg_TempGroup)
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Custom script: call RemoveLocation (udg_TempPoint2)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint2)
  • SkillsAoE Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in zUG_RegenALL) Equal to False
                  • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
                • Then - Actions
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
                  • Set TempPoint2 = (Position of (Random unit from TempGroup))
                  • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPoint2
                  • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPoint2
                  • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPoint2
                • Else - Actions
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint2)

I think we have to solve this one first.
It can cast Rain of Fire and Inferno one by one but never casts Shockwave.
If i put 0.25 wait after the Shockwave, it casts only shockwave.
Edit: I have figured it out. I was set their cooldowns as 1 for the testing purposes. Now i set it to 4 and now they can cast all spells. Now i am working on about this attack and stop thing.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
TempGroup is temporary-which means it's repeatedly created/destroyed, that's why you need to create it exactly how you want it from the start -> Units matching alive, enemy, vulnerable, etc. The act of constantly creating/destroying this Unit Group removes the need for you to manually Add/Remove units to/from it since a destroyed Unit Group is emptied automatically.

Your other Unit Groups like HerolarBotALL are permanent Unit Groups which are meant to be created once and never destroyed. That's why you may need to take extra steps to maintain them, which you mentioned you were doing.

Also, you don't want to put Waits inside of the Pick Every Unit action, that will cause problems and delay the system heavily for multiple units.

The Hashtable thing isn't really that difficult to setup in this case but it's just one option I figured I'd throw out there.

I'm not 100% sure what you mean by the Attack interrupt thing, but if you order a unit to cast a spell or spells every 2.00 seconds that's going to interrupt their attacks-IF any of the spells are available at that time. I'm pretty sure the unit won't get interrupted if the spells are on cooldown. You're on an older version of Warcraft 3 so I imagine you're missing a lot of the functions that can help in this situation, like checking the Remaining cooldown of an ability.

Lastly, those triggers you posted have mistakes in them. Your Custom Script is in the wrong spot in a few places and you're still using the For Loop. Maybe they were older triggers but remember to delete the For Loop entirely.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
TempGroup is temporary-which means it's repeatedly created/destroyed, that's why you need to create it exactly how you want it from the start -> Units matching alive, enemy, vulnerable, etc. The act of constantly creating/destroying this Unit Group removes the need for you to manually Add/Remove units to/from it since a destroyed Unit Group is emptied automatically.

Your other Unit Groups like HerolarBotALL are permanent Unit Groups which are meant to be created once and never destroyed. That's why you may need to take extra steps to maintain them, which you mentioned you were doing.

Also, you don't want to put Waits inside of the Pick Every Unit action, that will cause problems and delay the system heavily for multiple units.

The Hashtable thing isn't really that difficult to setup in this case but it's just one option I figured I'd throw out there.

I'm not 100% sure what you mean by the Attack interrupt thing, but if you order a unit to cast spells every 2.00 seconds that's going to interrupt their attacks-IF any of the spells are available at that time. I'm pretty sure the unit won't get interrupted if the spells are on cooldown. You're on an older version of Warcraft 3 so I imagine you're missing a lot of the functions that can help in this situation, like checking the Remaining cooldown of an ability.

Lastly, those triggers you posted have mistakes in them. Your Custom Script is in the wrong spot in a few places and you're still using the For Loop. Maybe they were older triggers but remember to delete the For Loop entirely.
Ok here is the situation. Let me tell you what happens.
I am deleting TempGroup, TempPoint1 and TempGroup2 in the end of the trigger for now. At least i think i am doing this. Warn me if i have failed.

I have currently created 2 triggers. 1 For point, and 1 for target.
I have put explanations within the trigger.

  • SkillsAoE
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in zUG_RegenALL) Equal to False
                  • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
                • Then - Actions
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
                  • Set TempPoint2 = (Position of (Random unit from TempGroup))
                  • Set TempBot = (Picked unit)
                  • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPoint2
                  • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPoint2
                  • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPoint2
                  • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPoint2
                  • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPoint2
                  • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
                  • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                    • Then - Actions
                      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup2) Greater than or equal to 1
                            • Then - Actions
                              • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                              • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                            • Else - Actions
                              • -------- There are no creeps. Fall back to the previous target. --------
                              • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                    • Else - Actions
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup2) Greater than or equal to 1
                            • Then - Actions
                              • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                            • Else - Actions
                              • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Custom script: call RemoveLocation (udg_TempPoint2)
                  • Custom script: call DestroyGroup (udg_TempGroup2)
                  • Set TempBot = No unit
                • Else - Actions
          • Custom script: call DestroyGroup (udg_TempGroup)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Custom script: call RemoveLocation (udg_TempPoint2)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint2)

  • SkillsTarget
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in zUG_RegenALL) Equal to False
                  • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
                  • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
                • Then - Actions
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
                  • Set TempPoint2 = (Position of (Random unit from TempGroup))
                  • Set TempBot = (Picked unit)
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Undead Lich - Frost Nova TempUnit
                  • Unit - Order (Picked unit) to Undead Necromancer - Cripple TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral Fire Lord - Soul Burn TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPoint2
                  • Unit - Order (Picked unit) to Orc Raider - Ensnare TempUnit
                  • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
                  • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                    • Then - Actions
                      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup2) Greater than or equal to 1
                            • Then - Actions
                              • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                              • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                            • Else - Actions
                              • -------- There are no creeps. Fall back to the previous target. --------
                              • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                    • Else - Actions
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup2) Greater than or equal to 1
                            • Then - Actions
                              • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                            • Else - Actions
                              • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call RemoveLocation (udg_TempPoint)
                  • Custom script: call RemoveLocation (udg_TempPoint2)
                  • Custom script: call DestroyGroup (udg_TempGroup2)
                  • Set TempBot = No unit
                • Else - Actions
              • Custom script: call DestroyGroup (udg_TempGroup)
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Custom script: call RemoveLocation (udg_TempPoint2)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint2)

I think i am destroying TempGroups and TempLocations at correct place.
HerolarBotAll as the tag says it is a unit group for AI controlled heroes. It is permanent group.
When it comes to wait, yes i don't think i am going to use it.
About the Hasthtable, i have tried to learn it from one of the guides in here but sadly i don't understand. I am telling you i am idiot person. You are not idiot and you will never understand how it looks like.

And there is serious problem started after i do that. When this triggers turned on, CORRIDOR CREEPS GOING INCORRECT LOCATIONS.
CreepsDevil (Player 1)
CreepsReaper (Player 7)
For example creeps coming into middle corridor, they are GOING TO TOP OR BOTTOM CORRIDOR.
Trying to figure it out. First i have to find out why this happening, then i will proceed bot controlled heroes casting spells thing..

This is my trigger for the creeps (player 1 and player 7 units)

  • Creep Yollari
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- S P A W N P O I N T S --------
      • Set DevilSpawnNoktasi[1] = (Center of DevilSpawn1 <gen>)
      • Set DevilSpawnNoktasi[2] = (Center of DevilSpawn2 <gen>)
      • Set DevilSpawnNoktasi[3] = (Center of DevilSpawn3 <gen>)
      • Set ReaperSpawnNoktasi[1] = (Center of ReaperSpawn1 <gen>)
      • Set ReaperSpawnNoktasi[2] = (Center of ReaperSpawn2 <gen>)
      • Set ReaperSpawnNoktasi[3] = (Center of ReaperSpawn3 <gen>)
      • -------- ___________________________ --------
      • Set CreepHedeflerRegion[1] = DevilSpawn1 <gen>
      • Set CreepHedeflerRegion[2] = DevilSol <gen>
      • Set CreepHedeflerRegion[3] = AltMid <gen>
      • Set CreepHedeflerRegion[4] = Reapersol <gen>
      • Set CreepHedeflerRegion[5] = ReaperSpawn1 <gen>
      • Set CreepHedeflerRegion[6] = DevilSpawn2 <gen>
      • Set CreepHedeflerRegion[7] = ReaperSpawn2 <gen>
      • Set CreepHedeflerRegion[8] = DevilSpawn3 <gen>
      • Set CreepHedeflerRegion[9] = DevilSag <gen>
      • Set CreepHedeflerRegion[10] = UstMid <gen>
      • Set CreepHedeflerRegion[11] = ReaperSag <gen>
      • Set CreepHedeflerRegion[12] = ReaperSpawn3 <gen>
      • Set CreepHedefSayisi = 12
      • For each (Integer A) from 1 to CreepHedefSayisi, do (Actions)
        • Loop - Actions
          • Set CreepHedefler[(Integer A)] = (Center of CreepHedeflerRegion[(Integer A)])
          • Trigger - Add to Creep Yonlendirme <gen> the event (Unit - A unit enters CreepHedeflerRegion[(Integer A)])
      • Set DevilNextHedef[1] = (Center of DevilSol <gen>)
      • Set DevilNextHedef[2] = (Center of AltMid <gen>)
      • Set DevilNextHedef[3] = (Center of Reapersol <gen>)
      • Set DevilNextHedef[4] = (Center of ReaperSpawn1 <gen>)
      • Set DevilNextHedef[5] = (Center of ValueReaper <gen>)
      • Set DevilNextHedef[6] = (Center of ReaperSpawn2 <gen>)
      • Set DevilNextHedef[7] = (Center of ValueReaper <gen>)
      • Set DevilNextHedef[8] = (Center of DevilSag <gen>)
      • Set DevilNextHedef[9] = (Center of UstMid <gen>)
      • Set DevilNextHedef[10] = (Center of ReaperSag <gen>)
      • Set DevilNextHedef[11] = (Center of ReaperSpawn3 <gen>)
      • Set DevilNextHedef[12] = (Center of ValueReaper <gen>)
      • Set ReaperNextHedef[1] = (Center of DevilSlayer <gen>)
      • Set ReaperNextHedef[2] = (Center of DevilSpawn1 <gen>)
      • Set ReaperNextHedef[3] = (Center of DevilSol <gen>)
      • Set ReaperNextHedef[4] = (Center of AltMid <gen>)
      • Set ReaperNextHedef[5] = (Center of Reapersol <gen>)
      • Set ReaperNextHedef[6] = (Center of DevilSlayer <gen>)
      • Set ReaperNextHedef[7] = (Center of DevilSpawn2 <gen>)
      • Set ReaperNextHedef[8] = (Center of DevilSlayer <gen>)
      • Set ReaperNextHedef[9] = (Center of DevilSpawn3 <gen>)
      • Set ReaperNextHedef[10] = (Center of DevilSag <gen>)
      • Set ReaperNextHedef[11] = (Center of UstMid <gen>)
      • Set ReaperNextHedef[12] = (Center of ReaperSag <gen>)
      • -------- ___________________________ --------
      • Set DevilSpawnHedef[1] = (Center of DevilSol <gen>)
      • Set DevilSpawnHedef[2] = (Center of ReaperSpawn2 <gen>)
      • Set DevilSpawnHedef[3] = (Center of DevilSag <gen>)
      • Set ReaperSpawnHedef[1] = (Center of Reapersol <gen>)
      • Set ReaperSpawnHedef[2] = (Center of DevilSpawn2 <gen>)
      • Set ReaperSpawnHedef[3] = (Center of ReaperSag <gen>)
      • Set DevilSpawnCreepAbilityLevel[1] = 1
      • Set DevilSpawnCreepAbilityLevel[2] = 6
      • Set DevilSpawnCreepAbilityLevel[3] = 8
      • Set ReaperSpawnCreepAbilityLevel[1] = 5
      • Set ReaperSpawnCreepAbilityLevel[2] = 7
      • Set ReaperSpawnCreepAbilityLevel[3] = 12
  • Creep Yonlendirme
    • Events
    • Conditions
      • ((Owner of (Triggering unit)) Equal to ClanDevilPlayer) or ((Owner of (Triggering unit)) Equal to ClanReaperPlayer)
    • Actions
      • Wait 0.01 seconds
      • For each (Integer A) from 1 to CreepHedefSayisi, do (Actions)
        • Loop - Actions
          • Custom script: if IsLocationInRegion(GetTriggeringRegion(), udg_CreepHedefler[bj_forLoopAIndex]) then
          • -------- Integer A girilen region --------
          • Unit - Set level of BEN CREEBIM for (Triggering unit) to (Integer A)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to ClanDevilPlayer
            • Then - Actions
              • Unit - Order (Triggering unit) to Attack-Move To DevilNextHedef[(Integer A)]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Triggering unit)) Equal to ClanReaperPlayer
                • Then - Actions
                  • Unit - Order (Triggering unit) to Attack-Move To ReaperNextHedef[(Integer A)]
                • Else - Actions
          • Custom script: endif
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
You still have that For Loop in the Skill triggers for some reason. It's repeating the actions 12 times!

And you only need to destroy/remove things that actually exist.

For example, this is basically how your Custom Script should look:
  • Set Variable Point = Some place in the map
  • Set Variable Group = Some unit group
  • /// reference Point/Group in your Actions
  • Custom script: call RemoveLocation(udg_Point)
  • Custom script: call DestroyGroup(udg_Group)
This on the other hand is what you're doing which is wrong:
  • Set Variable Point = Some place in the map
  • Set Variable Group = Some unit group
  • Custom script: call RemoveLocation(udg_Point)
  • Custom script: call RemoveLocation(udg_Point)
  • Custom script: call RemoveLocation(udg_Point)
  • Custom script: call DestroyGroup(udg_Group)
  • Custom script: call DestroyGroup(udg_Group)
  • Custom script: call DestroyGroup(udg_Group)
The pattern is very simple, a Unit Group or Point must be destroyed/removed before they get Set again.

Set -> Use -> Remove -> Repeat


Here's the Actions for your SkillsAoE trigger after I applied some of the fixes:
  • Actions
  • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is in zUG_RegenALL) Equal to False
          • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
          • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
          • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
        • Then - Actions
          • Set TempBot = (Picked unit)
          • Set TempPoint = (Position of (Picked unit))
          • Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
          • Set TempPoint2 = (Position of (Random unit from TempGroup))
          • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPoint2
          • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPoint2
          • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPoint2
          • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPoint2
          • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPoint2
          • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
          • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player number of (Owner of (Picked unit))) Less than or equal to 6
            • Then - Actions
              • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
              • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
              • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
              • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in TempGroup2) Greater than or equal to 1
                    • Then - Actions
                      • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                      • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                    • Else - Actions
                      • -------- There are no creeps. Fall back to the previous target. --------
                      • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
              • Custom script: call DestroyGroup (udg_TempGroup2)
            • Else - Actions
              • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
              • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
              • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in TempGroup2) Greater than or equal to 1
                    • Then - Actions
                      • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                    • Else - Actions
                      • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
              • Custom script: call DestroyGroup (udg_TempGroup2)
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Custom script: call RemoveLocation (udg_TempPoint2)
          • Custom script: call DestroyGroup (udg_TempGroup)
          • Set TempBot = No unit
        • Else - Actions
Notice how I got rid of the For Loop at the start and deleted some of the unnecessary Custom Script. I also added and moved some Custom Script.

Also, you're forgetting to use TempBot in most of the Actions. Most of the time it'll help make the trigger more efficient/safer if you reference Variables rather than Event Responses, especially when you use the same Event Response multiple times.

Also, the Center of a Region will leak a Point:
  • /// these both leak:
  • (Center of NextTarget[(Player number of (Owner of TempBot))])
  • (Center of PreviousTarget[(Player number of (Owner of TempBot))])
The rest looks very messy but if it works then that's fine. It doesn't need to be perfect.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
I am using DestroyGroups and RemoveLocations at the bottom of the trigger but i don't get it where am i making mistakes. Is it not remove and destroy location within my tiggers? I was thinking it was working like this

Event
Condition
Actions
bla bla bla
bla bla bla
If then else etc etc
bla bla bla bla
bla bla bla bla
If no
bla bla bla bla
bla bla bla bla
_________
DestroyGroup or Location at here will destroy every location and groups top of the list

Am i wrong? Now i rearranged my trigger as you said but currently i cannot test it for now. Today i will test and let you know about the result.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Next thing you should do is replace all instances of (Picked unit) with TempBot. Also, make sure TempBot is Set as the very first action inside of the Pick Every Unit Loop like this:
  • Loop - Actions
  • Set TempBot = (Picked unit)
  • If (All Conditions are True then do (Then Actions else do (Else Actions)
  • /// do everything else like you're doing now
You can also add the TempBotPlayer and TempBotPN variables to help improve the trigger.

If TempPoint2 pings the center of the map then that means TempPoint2 has been removed. The center of the map is the default position that the game will use when the Point is lost. If you move the Ping minimap action so it happens immediately after you Set TempPoint2 it will probably work properly. This is because your Unit - Order action is most likely causing another trigger to run which Sets/Removes TempPoint2.

To debug it, you can use Text Messages. For example, you can display the name of TempBot in a message so you know which Hero is being told to cast spells. You should also disable the other Skill trigger when testing this one out.
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
I am giving up for now. Since 4 hours i am working on this trigger only.
Not working. They are not casting spells. I don't remember how many times i have tested it. Tired, bored and i am hopeless now.


  • SkillsAoE
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempBot = (Picked unit)
              • Set TempPointCaster = (Position of (Picked unit))
              • Set TempGroupEnemy = (Units within 1000.00 of TempPointCaster matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempPointTarget = (Position of (Random unit from TempGroupEnemy))
              • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPointTarget
              • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPointTarget
              • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPointTarget
              • Cinematic - Ping minimap for (All players) at TempPointCaster for 1.00 seconds
              • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
              • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                • Then - Actions
                  • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                  • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                          • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                        • Else - Actions
                          • -------- There are no creeps. Fall back to the previous target. --------
                          • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
                • Else - Actions
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                  • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                        • Else - Actions
                          • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
              • Custom script: call RemoveLocation (udg_TempPointCaster)
              • Custom script: call RemoveLocation (udg_TempPointTarget)
              • Custom script: call DestroyGroup (udg_TempGroupEnemy)
              • Set TempBot = No unit
            • Else - Actions

Edit: Just realized you posted before my post but i have to go and sleep now. Very tired..
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Here's a simple system I threw together that is tested and working:
  • AI Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet AI_Hashtable = (Last created hashtable)
      • -------- --------
      • -------- Setup Paladin AI: --------
      • Unit - Create 1 Paladin for Player 2 (Blue) at ((Center of (Playable map area)) offset by (-200.00, 0.00)) facing Default building facing degrees
      • Hero - Set (Last created unit) Hero-level to 10, Hide level-up graphics
      • Unit Group - Add (Last created unit) to AI_Hero_Group
      • Hashtable - Save Handle OfPaladin AI <gen> as 0 of (Key (Last created unit).) in AI_Hashtable.
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Hero - Learn skill for (Last created unit): Human Paladin - Divine Shield
          • Hero - Learn skill for (Last created unit): Human Paladin - Holy Light
          • Hero - Learn skill for (Last created unit): Human Paladin - Devotion Aura
          • Hero - Learn skill for (Last created unit): Human Paladin - Resurrection
      • -------- --------
      • -------- Setup Archmage AI: --------
      • Unit - Create 1 Archmage for Player 3 (Teal) at ((Center of (Playable map area)) offset by (200.00, 0.00)) facing Default building facing degrees
      • Hero - Set (Last created unit) Hero-level to 10, Hide level-up graphics
      • Unit Group - Add (Last created unit) to AI_Hero_Group
      • Hashtable - Save Handle OfArchmage AI <gen> as 0 of (Key (Last created unit).) in AI_Hashtable.
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Hero - Learn skill for (Last created unit): Human Archmage - Blizzard
          • Hero - Learn skill for (Last created unit): Human Archmage - Summon Water Elemental
          • Hero - Learn skill for (Last created unit): Human Archmage - Brilliance Aura
          • Hero - Learn skill for (Last created unit): Human Archmage - Mass Teleport
      • -------- --------
      • Countdown Timer - Start AI_Timer_Instant as a Repeating timer that will expire in 2.00 seconds
      • Countdown Timer - Start AI_Timer_Target as a Repeating timer that will expire in 3.00 seconds
  • AI Timer Instant
    • Events
      • Time - AI_Timer_Instant expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AI_Hero_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet AI_Hero = (Picked unit)
          • Set VariableSet AI_Player = (Owner of AI_Hero)
          • Set VariableSet AI_Timer_Type = 1
          • Trigger - Run (Load 0 of (Key (Picked unit).) in AI_Hashtable.) (ignoring conditions)
  • AI Timer Target
    • Events
      • Time - AI_Timer_Target expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AI_Hero_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet AI_Hero = (Picked unit)
          • Set VariableSet AI_Player = (Owner of AI_Hero)
          • Set VariableSet AI_Timer_Type = 2
          • Trigger - Run (Load 0 of (Key (Picked unit).) in AI_Hashtable.) (ignoring conditions)
  • Paladin AI
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AI_Timer_Type Equal to 1
        • Then - Actions
          • -------- [ Instant Abilities ] --------
          • Unit - Order AI_Hero to Human Paladin - Activate Divine Shield.
          • Unit - Order AI_Hero to Human Paladin - Resurrection.
        • Else - Actions
          • -------- [ Target Abilities ] --------
          • Set VariableSet AI_Temp_Point = (Position of AI_Hero)
          • Set VariableSet AI_Temp_Group = (Units within 800.00 of AI_Temp_Point.)
          • Custom script: call RemoveLocation(udg_AI_Temp_Point)
          • -------- --------
          • Unit Group - Pick every unit in AI_Temp_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet AI_Temp_Target = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AI_Temp_Target Not equal to AI_Hero
                  • (AI_Temp_Target belongs to an ally of AI_Player.) Equal to True
                  • (AI_Temp_Target is alive) Equal to True
                  • (AI_Temp_Target is A structure) Equal to False
                • Then - Actions
                  • -------- Legal target found! --------
                • Else - Actions
                  • Unit Group - Remove AI_Temp_Target from AI_Temp_Group.
          • Set VariableSet AI_Temp_Target = (Random unit from AI_Temp_Group)
          • Unit - Order AI_Hero to Human Paladin - Holy Light AI_Temp_Target
          • -------- --------
          • Set VariableSet AI_Temp_Target = No unit
          • Custom script: call DestroyGroup(udg_AI_Temp_Group)
  • Archmage AI
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AI_Timer_Type Equal to 1
        • Then - Actions
          • -------- [ Instant Abilities ] --------
          • Unit - Order AI_Hero to Human Archmage - Summon Water Elemental.
        • Else - Actions
          • -------- [ Target Abilities ] --------
          • Set VariableSet AI_Temp_Point = (Position of AI_Hero)
          • Set VariableSet AI_Temp_Group = (Units within 800.00 of AI_Temp_Point.)
          • Custom script: call RemoveLocation(udg_AI_Temp_Point)
          • -------- --------
          • Unit Group - Pick every unit in AI_Temp_Group and do (Actions)
            • Loop - Actions
              • Set VariableSet AI_Temp_Target = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (AI_Temp_Target belongs to an enemy of AI_Player.) Equal to True
                  • (AI_Temp_Target is alive) Equal to True
                  • (AI_Temp_Target is invulnerable) Equal to False
                • Then - Actions
                  • -------- Legal target found! --------
                • Else - Actions
                  • Unit Group - Remove AI_Temp_Target from AI_Temp_Group.
          • Set VariableSet AI_Temp_Target = (Random unit from AI_Temp_Group)
          • Set VariableSet AI_Temp_Point = (Position of AI_Temp_Target)
          • Unit - Order AI_Hero to Human Archmage - Blizzard AI_Temp_Point
          • -------- --------
          • Set VariableSet AI_Temp_Target = No unit
          • Custom script: call RemoveLocation(udg_AI_Temp_Point)
          • Custom script: call DestroyGroup(udg_AI_Temp_Group)
NOTE:
If the Heroes in your map are pre-placed inside of the Editor then you probably won't want to Create them in the AI Setup trigger.
Don't worry, you don't need to Create the heroes. You can find all of the pre-placed Paladins and Archmages and add them to the Hashtable like this:
  • AI Setup Alternate
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet AI_Hashtable = (Last created hashtable)
      • -------- --------
      • -------- Setup Paladin AI: --------
      • Set VariableSet AI_Temp_Group = (Units of type Paladin)
      • Unit Group - Pick every unit in AI_Temp_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to AI_Hero_Group
          • Hashtable - Save Handle OfPaladin AI <gen> as 0 of (Key (Picked unit).) in AI_Hashtable.
      • Custom script: call DestroyGroup(udg_AI_Temp_Group)
      • -------- --------
      • -------- Setup Archmage AI: --------
      • Set VariableSet AI_Temp_Group = (Units of type Archmage)
      • Unit Group - Pick every unit in AI_Temp_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to AI_Hero_Group
          • Hashtable - Save Handle OfArchmage AI <gen> as 0 of (Key (Picked unit).) in AI_Hashtable.
      • Custom script: call DestroyGroup(udg_AI_Temp_Group)
      • -------- --------
      • Countdown Timer - Start AI_Timer_Instant as a Repeating timer that will expire in 2.00 seconds
      • Countdown Timer - Start AI_Timer_Target as a Repeating timer that will expire in 3.00 seconds
  • It creates a Paladin and Archmage which are immediately leveled up to 10, given all of their skills, and registered to my AI Hashtable.
  • Then it starts two Timers, one for Instant abilities and the other for Targeted abilities similar to your SkillAoE and SkillTarget triggers.
  • When a Timer expires it Picks through the AI_Hero_Group which contains all of our Bot Heroes.
  • It then sets the Picked Hero to AI_Hero and it's owner to AI_Player.
  • Then the AI_Timer_Type variable is Set to either 1 or 2 --> 1 = Instant, 2 = Targeted. You can see this determines which type of spell is cast.
  • Finally, the Hero's associated AI trigger is loaded from the Hashtable and run.
So if the (Picked unit) is the Paladin then it runs the Paladin AI trigger. But if the (Picked unit) is the Archmage then it runs the Archmage AI trigger.
You can see inside of the AI Paladin/AI Archmage triggers that I am able to manually control which spells are used and how.

You would of course want to replace the Paladin and Archmage with your own custom Heroes / custom AI triggers. This is just an example since I don't have your map and don't know your Heroes.
 

Attachments

  • AI Spellcasting 1.w3m
    20.6 KB · Views: 8
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Good morning Uncle. I always admire you and you are some kind of super character for me. Because you are kind and nice person and always trying to help people.

Before we get into details could you please talk about my trigger?

  • SkillsAoE
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempBot = (Picked unit)
              • Set TempPointCaster = (Position of (Picked unit))
              • Set TempGroupEnemy = (Units within 1000.00 of TempPointCaster matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempPointTarget = (Position of (Random unit from TempGroupEnemy))
              • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPointTarget
              • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPointTarget
              • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPointTarget
              • Cinematic - Ping minimap for (All players) at TempPointCaster for 1.00 seconds
              • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
              • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                • Then - Actions
                  • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                  • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                          • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                        • Else - Actions
                          • -------- There are no creeps. Fall back to the previous target. --------
                          • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
                • Else - Actions
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                  • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                        • Else - Actions
                          • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
              • Custom script: call RemoveLocation (udg_TempPointCaster)
              • Custom script: call RemoveLocation (udg_TempPointTarget)
              • Custom script: call DestroyGroup (udg_TempGroupEnemy)
              • Set TempBot = No unit
            • Else - Actions

But when i implement it to my map, ai heroes not casting spells. First of all i want to find out "why"
And then i have decided to turn back to learn skills for them. I have opened new map, deleted my old trigger and started to work on new trigger for learn skills for them and it becomes another problem. Now i am going to create topic about it.
I was always verified it is not about our trigger when i test it on test map. Because it is working on my test map and they we're pre placed heroes.


Update: I have solved by myself and decided to make it guide instead of question. Now i am going to implement into my map and going to make tests about it. I will reply to you when i am done. It will gonna take hours. Then i will try to solution you shared. Let me go step by step first.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Here is the update. I am getting tired to see this. My 3 days i am spenting my time to this. Tested nearly 50 times..

It works on my test map. But it is not working on my map.

Why they are not using their skills properly?
This time i am starting to tell you from beginning.




This trigger creates ai controlled heroes for computer slots.
I am adding them within this groups

Player 1 (Clan Devil) and his allies Player 2 to 6
Unit Group - Add (Last created unit) to HerolarALL
Unit Group - Add (Last created unit) to HerolarDevilAll
Unit Group - Add (Last created unit) to HerolarBotALL
Unit Group - Add (Last created unit) to HerolarBotDevil

Player 7 (Clan Reaper) and his allies Player 7 to 12
Unit Group - Add (Last created unit) to HerolarALL
Unit Group - Add (Last created unit) to HerolarReaperALL
Unit Group - Add (Last created unit) to HerolarBotALL
Unit Group - Add (Last created unit) to HerolarBotReaperr

  • HeroSectirme
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: |cff00ff00Yapay zek...
      • Game - Display to (All players) for 10.00 seconds the text: |cff00ff00Yapay zek...
      • 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
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 10)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Neutral Building - Remove BotHerolar[randomInt] from all marketplaces
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • 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 HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarDevilAll
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarBotDevil
                  • Player Group - Add (Player((Integer A))) to ClanDevilPlayers
                  • Player Group - Add (Player((Integer A))) to ClanDevilBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Unit - Set the custom value of (Last created unit) to 0
                  • Set HeroCountDevil = (HeroCountDevil + 1)
                • Else - Actions
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 11)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of GameGuideReaper <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • 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 HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarReaperALL
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarBotReaper
                  • Player Group - Add (Player((Integer A))) to ClanReaperPlayers
                  • Player Group - Add (Player((Integer A))) to ClanReaperBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Unit - Set the custom value of (Last created unit) to 0
                  • Set HeroCountReaper = (HeroCountReaper + 1)
            • Else - Actions

  • EnterMap
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unspent skill points of (Triggering unit)) Equal to 1
      • (Hero level of (Triggering unit)) Equal to 1
    • Actions
      • Trigger - Run GainLevel <gen> (ignoring conditions)
  • GainLevel
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Hero - Learn skill for (Triggering unit): Nether Pulse
      • Hero - Learn skill for (Triggering unit): Arcane Explosion // arcane
      • Hero - Learn skill for (Triggering unit): Polymorph //
      • Hero - Learn skill for (Triggering unit): Arcane Shock //
      • Hero - Learn skill for (Triggering unit): Elemental Hit // Ehementalist
      • Hero - Learn skill for (Triggering unit): Fire // Ehementalist
      • Hero - Learn skill for (Triggering unit): Frost // Ehementalist
      • Hero - Learn skill for (Triggering unit): Lightning // Ehementalist
      • Hero - Learn skill for (Triggering unit): Chain Flame //
      • Hero - Learn skill for (Triggering unit): Fireball //
      • Hero - Learn skill for (Triggering unit): Meteor //
      • Hero - Learn skill for (Triggering unit): Soul Burn //
      • Hero - Learn skill for (Triggering unit): Tranquility //
      • Hero - Learn skill for (Triggering unit): Holy Light //
      • Hero - Learn skill for (Triggering unit): Healing Wave //
      • Hero - Learn skill for (Triggering unit): Brilliance Aura //
      • Hero - Learn skill for (Triggering unit): Vanquish //
      • Hero - Learn skill for (Triggering unit): Banish //
      • Hero - Learn skill for (Triggering unit): Spiritual Power //
      • Hero - Learn skill for (Triggering unit): Blaze Lightning //
      • Hero - Learn skill for (Triggering unit): Chain Lightning //POLLON
      • Hero - Learn skill for (Triggering unit): Forked Lightning //
      • Hero - Learn skill for (Triggering unit): Field of Lightning //
      • Hero - Learn skill for (Triggering unit): Disease Cloud //
      • Hero - Learn skill for (Triggering unit): Poisonous Spit //
      • Hero - Learn skill for (Triggering unit): Flesh Skin //
      • Hero - Learn skill for (Triggering unit): Cannibalize //
      • Hero - Learn skill for (Triggering unit): Holy Shield //
      • Hero - Learn skill for (Triggering unit): Shield Bash //
      • Hero - Learn skill for (Triggering unit): Ardent Defender //
      • Hero - Learn skill for (Triggering unit): Heaven's Swing //
      • Hero - Learn skill for (Triggering unit): Tome of Knowledge
      • Hero - Learn skill for (Triggering unit): Holy Light //
      • Hero - Learn skill for (Triggering unit): Protect //
      • Hero - Learn skill for (Triggering unit): Double Hit //
      • Hero - Learn skill for (Triggering unit): Infernal Dreadlord
      • Hero - Learn skill for (Triggering unit): Carrion Swarm //
      • Hero - Learn skill for (Triggering unit): Carrion Swarm //iratha
      • Hero - Learn skill for (Triggering unit): Vampiric Aura //
      • Hero - Learn skill for (Triggering unit): Tusk Crusher (mammoth)
      • Hero - Learn skill for (Triggering unit): Horn Buster //
      • Hero - Learn skill for (Triggering unit): Mammoth Regeneration //
      • Hero - Learn skill for (Triggering unit): Nature Frenzy //
For the testing purpose i am not adding condition. I wanted to pick hero and see it on myself is it works or not.

  • SkillsAoE Copy
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempBot = (Picked unit)
              • Set TempPointCaster = (Position of (Picked unit))
              • Set TempGroupEnemy = (Units within 1000.00 of TempPointCaster matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempPointTarget = (Position of (Random unit from TempGroupEnemy))
              • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPointTarget
              • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPointTarget
              • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPointTarget
              • Cinematic - Ping minimap for (All players) at TempPointCaster for 1.00 seconds
              • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
              • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                • Then - Actions
                  • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                  • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                          • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                        • Else - Actions
                          • -------- There are no creeps. Fall back to the previous target. --------
                          • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
                • Else - Actions
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                  • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Order TempBot to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBot))])
                        • Else - Actions
                          • Unit - Order TempBot to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBot))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
              • Custom script: call RemoveLocation (udg_TempPointCaster)
              • Custom script: call RemoveLocation (udg_TempPointTarget)
              • Custom script: call DestroyGroup (udg_TempGroupEnemy)
              • Set TempBot = No unit
            • Else - Actions
And here we go. By the way let me explain something. It is working but not 100%
For example currently i am watching Dreadlord. It has Carrion Swarm ability. I have a test command that changes ownership.
It has Carrion Swarm but never casts it. BUT it is using Infernal. It is very annoying.

Please let me know if i am missing something. Maybe i am not paying attention to some basic things... And now we can talk about your system dear @Uncle but let us verify this one first..
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
I am nearly giving up. By the way i want to thank you but i said i am stupid person and i don't understand Hash. I am looking it and not understand. When someone tried to help me with their own way, i am forcing my self to learn it. But i sadly i don't understand your trigger about Hashtable. I am very sorry. Being stupid wasn't my choice. And now i am feeling being rude against you. But i am sorry my brain cannot handle this Hashtable thing. It is far beyond that i can understand. I have to solve it with my own system OR i need simple or at least intermediate system. I feel sorry about that @Uncle you are amazing, kind and nice person. But it is above my capabilities.

GainLevel
  • Events
    • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Hero - Learn skill for (Triggering unit): Nether Pulse
      • Hero - Learn skill for (Triggering unit): Arcane Explosion // arcane
      • Hero - Learn skill for (Triggering unit): Polymorph //
      • Hero - Learn skill for (Triggering unit): Arcane Shock //
      • Hero - Learn skill for (Triggering unit): Elemental Hit // Ehementalist
      • Hero - Learn skill for (Triggering unit): Fire // Ehementalist
      • Hero - Learn skill for (Triggering unit): Frost // Ehementalist
      • Hero - Learn skill for (Triggering unit): Lightning // Ehementalist
      • Hero - Learn skill for (Triggering unit): Chain Flame //
      • Hero - Learn skill for (Triggering unit): Fireball //
      • Hero - Learn skill for (Triggering unit): Meteor //
      • Hero - Learn skill for (Triggering unit): Soul Burn //
      • Hero - Learn skill for (Triggering unit): Tranquility //
      • Hero - Learn skill for (Triggering unit): Holy Light //
      • Hero - Learn skill for (Triggering unit): Healing Wave //
      • Hero - Learn skill for (Triggering unit): Brilliance Aura //
      • Hero - Learn skill for (Triggering unit): Vanquish //
      • Hero - Learn skill for (Triggering unit): Banish //
      • Hero - Learn skill for (Triggering unit): Spiritual Power //
      • Hero - Learn skill for (Triggering unit): Blaze Lightning //
      • Hero - Learn skill for (Triggering unit): Chain Lightning //POLLON
      • Hero - Learn skill for (Triggering unit): Forked Lightning //
      • Hero - Learn skill for (Triggering unit): Field of Lightning //
      • Hero - Learn skill for (Triggering unit): Disease Cloud //
      • Hero - Learn skill for (Triggering unit): Poisonous Spit //
      • Hero - Learn skill for (Triggering unit): Flesh Skin //
      • Hero - Learn skill for (Triggering unit): Cannibalize //
      • Hero - Learn skill for (Triggering unit): Holy Shield //
      • Hero - Learn skill for (Triggering unit): Shield Bash //
      • Hero - Learn skill for (Triggering unit): Ardent Defender //
      • Hero - Learn skill for (Triggering unit): Heaven's Swing //
      • Hero - Learn skill for (Triggering unit): Tome of Knowledge
      • Hero - Learn skill for (Triggering unit): Holy Light //
      • Hero - Learn skill for (Triggering unit): Protect //
      • Hero - Learn skill for (Triggering unit): Double Hit //
      • Hero - Learn skill for (Triggering unit): Infernal Dreadlord
      • Hero - Learn skill for (Triggering unit): Carrion Swarm // dreadlord
      • Hero - Learn skill for (Triggering unit): Carrion Swarm //iratha
      • Hero - Learn skill for (Triggering unit): Vampiric Aura //
      • -------- Sleep --------
      • Hero - Learn skill for (Triggering unit): Tusk Crusher (mammoth)
      • Hero - Learn skill for (Triggering unit): Horn Buster //
      • Hero - Learn skill for (Triggering unit): Mammoth Regeneration //
      • Hero - Learn skill for (Triggering unit): Nature Frenzy //

And within this trigger i am ordering him to cast Carrion Swarm to random unit from tempgroup but it doesn't cast.

  • SkillsAoE
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempBotPointCaster = (Picked unit)
              • Set TempPointCaster = (Position of (Picked unit))
              • Set TempGroupEnemy = (Units within 1000.00 of TempPointCaster matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempPointTarget = (Position of (Random unit from TempGroupEnemy))
              • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPointTarget
              • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPointTarget
              • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPointTarget
              • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPointTarget
              • Cinematic - Ping minimap for (All players) at TempPointTarget for 1.00 seconds
              • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
              • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                • Then - Actions
                  • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                  • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • -------- There are no creeps. Fall back to the previous target. --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
                • Else - Actions
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                  • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
              • Custom script: call RemoveLocation (udg_TempPointCaster)
              • Custom script: call RemoveLocation (udg_TempPointTarget)
              • Custom script: call DestroyGroup (udg_TempGroupEnemy)
              • Set TempBotPointCaster = No unit
            • Else - Actions

Still not casting Carrion Swarm. It is my 4'th day and still i am trying to understand this.



By the way it seems we have to change Title. "Why ordered unit not casting spells"

  • Set TempBotPointCaster = (Picked unit)
  • Set TempPointCaster = (Position of (Picked unit))
  • Set TempGroupEnemy = (Units within 1000.00 of TempPointCaster matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
  • Set TempPointTarget = (Position of (Random unit from TempGroupEnemy))
  • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPointTarget
  • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPointTarget
  • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPointTarget
  • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPointTarget
  • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPointTarget
  • Cinematic - Ping minimap for (All players) at TempPointTarget for 1.00 seconds
Why picked unit not casting Carrion Swarm to TempPointTarget.
I have added ping for the TempPointTarget and it pings the correct location.
And now i have added this
Unit - Create 1 Footman for Neutral Hostile at TempPointTarget facing Default building facing degrees
And it is correct also. Footmen spawns at correct location.

  • Hero has the ability
  • Hero has the mana
  • Ping appears at correct location

But hero not casting Carrion Swarm. What am i missing....
By the way Carrion Swarm just an example.

Update: This worked but....

  • SkillsAoE calisti dreadlord
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIKaciyor_Creepten[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Herodan[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIKaciyor_Kuleden[(Player number of (Owner of (Picked unit)))] Equal to False
              • (Unit-type of (Picked unit)) Equal to Dreadlord Varimathras
            • Then - Actions
              • Set TempBotPointCaster = (Picked unit)
              • Set TempPointCaster = (Position of (Picked unit))
              • Set TempGroupEnemy = (Units within 1000.00 of TempPointCaster matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempPointTarget = (Position of (Random unit from TempGroupEnemy))
              • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPointTarget
              • Unit - Create 1 Footman for Neutral Hostile at TempPointTarget facing Default building facing degrees
              • Cinematic - Ping minimap for (All players) at TempPointTarget for 1.00 seconds
              • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
              • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                • Then - Actions
                  • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                  • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • -------- There are no creeps. Fall back to the previous target. --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
                • Else - Actions
                  • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                  • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                  • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroupNew2) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of NextTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                  • Custom script: call DestroyGroup (udg_TempGroupNew2)
              • Custom script: call RemoveLocation (udg_TempPointCaster)
              • Custom script: call RemoveLocation (udg_TempPointTarget)
              • Custom script: call DestroyGroup (udg_TempGroupEnemy)
              • Set TempBotPointCaster = No unit
            • Else - Actions

The only difference is this trigger additionally checking for the unit-type dreadlord
And order list only have a carrion swarm...
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Like I mentioned earlier, if you issue four orders at once you're bound to have an issue. All of my suggestions were meant to fix this issue.
Yes. Sadly you are right. When i delete other orders, they are able to start cast carrion swarm.. Damn it.
Thank you anyway. I would like to understand your solution but as i mentioned it is beyond my knowledge.

Here is the Last Update.

AI can cast spells when pre-placed with this trigger

  • Anan
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit Group - Add Abomination Brutillus 0105 <gen> to HerolarALL
      • Unit Group - Add Abomination Brutillus 0105 <gen> to HerolarBotALL
      • Unit Group - Add Chillwind Spider Iratha 0106 <gen> to HerolarALL
      • Unit Group - Add Chillwind Spider Iratha 0106 <gen> to HerolarBotALL
      • Unit Group - Add Tauren Chieftain Cairne Bloodhoof 0107 <gen> to HerolarALL
      • Unit Group - Add Tauren Chieftain Cairne Bloodhoof 0107 <gen> to HerolarBotALL
      • Unit Group - Add Dreadlord Varimathras 0108 <gen> to HerolarALL
For example Abomination Brutillus are able to cast his spell when pre-placed

But not casting when created with this trigger

  • HeroSectirme
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: |cff00ff00Yapay zek...
      • Game - Display to (All players) for 10.00 seconds the text: |cff00ff00Yapay zek...
      • 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
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 10)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Neutral Building - Remove BotHerolar[randomInt] from all marketplaces
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • 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 HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarBotDevil
                  • Unit Group - Add (Last created unit) to HerolarDevilAll
                  • Player Group - Add (Player((Integer A))) to ClanDevilPlayers
                  • Player Group - Add (Player((Integer A))) to ClanDevilBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Unit - Set the custom value of (Last created unit) to 0
                  • Set HeroCountDevil = (HeroCountDevil + 1)
                • Else - Actions
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 11)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of GameGuideReaper <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • 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 HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarReaperALL
                  • Unit Group - Add (Last created unit) to HerolarBotReaper
                  • Player Group - Add (Player((Integer A))) to ClanReaperPlayers
                  • Player Group - Add (Player((Integer A))) to ClanReaperBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Unit - Set the custom value of (Last created unit) to 0
                  • Set HeroCountReaper = (HeroCountReaper + 1)
            • Else - Actions

Both triggers adding them to HerolarALL and HerolarBotALL
They can cast when pre-placed but they cannot when created with this trigger.
Alternatively i am adding them when try to leave base after they created with this trigger.

  • HeroGruplarDebuggBot
    • Events
      • Unit - A unit enters RedBaseKapi <gen>
      • Unit - A unit enters GreenBaseKapi <gen>
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Unit Group - Add (Triggering unit) to HerolarBotALL
But still they are casting spells when pre-placed.

It seems i give up. I wanted to thanks everyone who tried to help me. But of course i would like to hear anything new if you can find.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
You could always recreate my triggers that I posted earlier, it's actually very similar to what you're doing now, there's just a couple of extra steps.
Keep in mind you'll need to create a unique AI trigger for all 72 heroes so if that's too much then don't bother doing it.

Anyway, maybe I can help explain the Hashtable a bit better.

Think of a Hashtable like a more advanced Array. I saw you were using Arrays before, so if you understand those then you can understand a Hashtable.

What's special about a Hashtable is that it can use things like Units, Items, Players, Triggers, Regions, etc. as the [index] in it's Array.

So this is a normal array that's storing our AI triggers:
  • Set AI_Array[1] = Paladin AI Trigger <gen>
  • Set AI_Array[2] = Archmage AI Trigger <gen>
And this is our Hashtable doing the same thing but notice how I'm putting a Hero into the [index] and not a number:
  • Set AI_Hashtable[Paladin] = Paladin AI Trigger <gen>
  • Set AI_Hashtable[Archmage] = Archmage AI Trigger <gen>
Here I am using the Paladin and Archmage hero as the [index] instead of an integer like 1, 2, 3, etc...

So what this does is store the Paladin's AI Trigger to the Paladin. This means that I am now able to get access to that AI trigger as long as I have access to the Paladin, and that should happen when we Loop over HerolarBotALL since our Paladin will be in that Unit Group.

Now this is just an example to help you understand the concept better, an actual Hashtable looks different than what I posted above and has even more useful features.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
So you'll want to do something a little different for your AI Setup trigger than what I did in my example.

I see that you have 10 Bot Heroes to choose from:
  • Set randomInt = (Random integer number between 1 and 10)
  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
So this means that you have an Array like this:
  • Set BotHerolar[1] = Paladin
  • Set BotHerolar[2] = Archmage
  • Set BotHerolar[3] = Hero3
  • Set BotHerolar[4] = Hero4
  • Set BotHerolar[5] = Hero5
  • Set BotHerolar[6] = Hero6
  • Set BotHerolar[7] = Hero7
  • Set BotHerolar[8] = Hero8
  • Set BotHerolar[9] = Hero9
  • Set BotHerolar[10] = Hero10
What you want to do is create a new Trigger array variable which goes along with those 10 Heroes:
  • Set BotHerolar_Trigger[1] = Paladin's AI Trigger <gen>
  • Set BotHerolar_Trigger[2] = Archmage's AI Trigger <gen>
  • Set BotHerolar_Trigger[3] = Hero3's AI Trigger <gen>
  • Set BotHerolar_Trigger[4] = Hero4's AI Trigger <gen>
  • Set BotHerolar_Trigger[5] = Hero5's AI Trigger <gen>
  • Set BotHerolar_Trigger[6] = Hero6's AI Trigger <gen>
  • Set BotHerolar_Trigger[7] = Hero7's AI Trigger <gen>
  • Set BotHerolar_Trigger[8] = Hero8's AI Trigger <gen>
  • Set BotHerolar_Trigger[9] = Hero9's AI Trigger <gen>
  • Set BotHerolar_Trigger[10] = Hero10's AI Trigger <gen>
This stores the AI triggers for each of those Heroes.

Now your AI Setup trigger becomes a lot more simple. It should look like this:
  • AI Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set AI_Hashtable = (Last created hashtable)
      • -------- You can add a Wait here to start these timers whenever you want. Once they start the AI will try to cast spells --------
      • Countdown Timer - Start AI_Timer_Instant as a Repeating timer that will expire in 2.00 seconds
      • Countdown Timer - Start AI_Timer_Target as a Repeating timer that will expire in 3.00 seconds
Then inside of your HeroSectirme trigger you'll want to add one new action after creating a Hero:
  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
  • Hashtable - Save Handle of BotHerolar_Trigger[randomInt] as 0 of (Key (Last created unit)) in AI_Hashtable
That will save the Hero and it's AI Trigger together. That's it! Much easier than what I had you doing before.

Also, these are ALL of the other Variables you'll need to get started. I recommend creating these first:
AI_Hashtable = Hashtable
AI_Hero = Unit
AI_Player = Player
AI_Hero_Group = Unit Group
AI_Timer_Type = Integer
AI_Timer_Instant = Timer
AI_Timer_Target = Timer
AI_Temp_Point = Point
AI_Temp_Group = Unit Group
AI_Temp_Target = Unit
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Today i will try this. But i will create another topic about pre-placed and created by trigger thing. Don't take it to the wrong way. Because it is another story.

Now the saddest part is, i have started to feel force you for the help me. Because i will try completely new thing that i haven't tried before on complex trigger. And here is the another update. It works for now.
All i have changed their intervals.

AoE every 0.25 seconds
Target every 0.30 seconds

BUT it disables other orders as you mentioned. They are spamming like stop > attack > stop > attack bla bla.

When i get close to AI, they are using spells without any issues onto me. But it happens when there are no creeps around the casters.

Today i will empty my mind and try to learn this hashtable thing and try to implement your system. Wish luck to me.
 

Attachments

  • yes.png
    yes.png
    37.6 KB · Views: 4

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
That's a weird issue. I'm pretty unfamiliar with the older versions of the editor but try this:

Create a Handle variable and then Set it like so:
  • Loop - Actions
    • Set AI_Handle = (Picked unit)
Then see if it shows up as an option in your Hashtable - Load action.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
That's really weird that you can't use a Hashtable on your version.

Anyway, an alternate solution would be to use a Unit Indexer and then do this:

In your trigger that creates the Bot hero, store it's AI trigger like so:
  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
  • Set BotTrigger[Custom value of (Last created unit)] = BotHerolar_Trigger[randomInt]
Then in the Timer triggers, instead of Running the loaded trigger from the Hashtable, you simply do this:
  • Trigger - Run BotTrigger[Custom value of AI_Hero] (ignoring conditions)

How it works:
A Unit Indexer is a system that automatically assigns a unique Custom Value to each of your units. This allows you to store data directly to your units by using their Custom Value as the [index] in your Array variables. You CANNOT set a unit's Custom Value yourself otherwise you'll mess up the system.
So you cannot do this anymore:
  • Unit - Set Custom Value of (Triggering unit) to 100
But that's fine, because now you can use a Variable instead:
  • Set MyInteger[Custom value of (Triggering unit)] = 100
You'll need to find a Unit Indexer compatible with your version.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Hello Uncle. I forgot the mention, my map uses custom values for lot of triggers. It will prevent this system works right?
Still i am looking for the solution and anyone can feel free the suggest "anything" that can help.

Or is there a system something like "STOP AI CASTING SPELLS ON NON-HERO UNITS" can help me.
 
I have not followed this thread from the start, but regarding unit indexer and already using "Custom Value", you'd have to introduce an integer variable array (for example called "customValue") and change occurances of "Unit - Set Custom Value" gui to instead set variable "set customValue[Custom value of (Triggering unit)] = value" to use the unit indexer.

You are also able to bind multiple variables of different type to the same unit, making the unit indexer an extremely powerful tool.
Note that you only need to track an integer to later "get the unit" corresponding to that index and from that index.
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
I have not followed this thread from the start, but regarding unit indexer and already using "Custom Value", you'd have to introduce an integer variable array (for example called "customValue") and change occurances of "Unit - Set Custom Value" gui to instead set variable "set customValue[Custom value of (Triggering unit)] = value" to use the unit indexer.

You are also able to bind multiple variables of different type to the same unit, making the unit indexer an extremely powerful tool.
Note that you only need to track an integer to later "get the unit" corresponding to that index and from that index.
But still i am so confused how this system can help me? Here is my system with lot of flaws. It is the latest version.

  • SkillsAoE
    • Events
      • Time - Every 1.10 seconds of game time
    • Conditions
    • Actions
      • -------- First of all, i am picking every hero controlled by AI with few conditions. --------
      • -------- First of all, i am picking every hero controlled by AI with few conditions. --------
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIFallBackCREEP[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackHERO[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackTOWER[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • -------- Then i am creating TempPoint, TempGroups and TempBotCasters --------
              • Set TempBotPointCaster = (Picked unit)
              • Set TempPointCaster = (Position of (Picked unit))
              • -------- There is a HUGE FLAW in here. I think they can try to cast spells from thousands range away enemies. And they stop casting because they cannot reach them. --------
              • -------- I am not sure about it but is that a correct picking? --------
              • Set TempGroupEnemy = (Units within 1000.00 of TempPointCaster matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempPointTarget = (Position of (Random unit from TempGroupEnemy))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempGroupEnemy) Greater than or equal to 1
                • Then - Actions
                  • Unit Group - Add (Picked unit) to TempCastGroup
                  • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm TempPointTarget
                  • Unit - Order (Picked unit) to Human Archmage - Blizzard TempPointTarget
                  • Unit - Order (Picked unit) to Neutral Pit Lord - Rain Of Fire TempPointTarget
                  • Unit - Order (Picked unit) to Undead Dreadlord - Inferno TempPointTarget
                  • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave TempPointTarget
                  • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
                  • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                    • Then - Actions
                      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                      • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                      • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroupNew2) Greater than or equal to 1
                            • Then - Actions
                              • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotPointCaster))])
                            • Else - Actions
                              • -------- There are no creeps. Fall back to the previous target. --------
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotPointCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroupNew2)
                    • Else - Actions
                      • Set TempGroupNew2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                      • Unit Group - Pick every unit in TempGroupNew2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroupNew2) Greater than or equal to 1
                            • Then - Actions
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
                            • Else - Actions
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroupNew2)
                • Else - Actions
                  • Custom script: call RemoveLocation (udg_TempPointCaster)
                  • Custom script: call RemoveLocation (udg_TempPointTarget)
                  • Custom script: call DestroyGroup (udg_TempGroupEnemy)
                  • Set TempBotPointCaster = No unit
              • Custom script: call RemoveLocation (udg_TempPointCaster)
              • Custom script: call RemoveLocation (udg_TempPointTarget)
              • Custom script: call DestroyGroup (udg_TempGroupEnemy)
              • Set TempBotPointCaster = No unit
              • Unit Group - Remove all units from TempCastGroup
            • Else - Actions
I am adding them to TempCastGroup because I DON'T WANT to make them cast spells on NON-HERO units, so i have created system like this.

  • SpellDetect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) is in TempCastGroup) Equal to False
      • ((Casting unit) is in HerolarBotALL) Equal to True
    • Actions
      • Unit - Order (Casting unit) to Stop
      • Wait 0.10 seconds
      • Unit - Order (Casting unit) to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of (Casting unit)))])
      • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + 150.00)
Now i can say my system has a lot of flaws, they are not casting spells as i expected and dear Uncle suggested me Unit Indexer system few posts ago.

Honestly still i don't know how to do that because it looks it is beyond my limits and knowledge. :(

I just want to make my AI Controlled Heroes cast spells onto Enemy Heroes. I wasn't knew that it can be difficult like this.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Shouldn't SpellDetect use the Begins casting Event:
  • Unit - A unit Begins casting an ability
Then the Ability will get interrupted before it spends mana / goes on cooldown.


Anyway, I suggested the Unit Indexer because you said you couldn't use Hashtables. A Unit Indexer is basically a simplified version of a Hashtable and in this case it will work perfectly fine for the system I showed you in my earlier posts. But if it's beyond your knowledge than perhaps it's time to expand your knowledge :D I didn't understand how to use a Unit Indexer at first until I spent a few hours messing around with it. Hell, I didn't even know there were Arrays for most of my early Warcraft 3 modding days.


If you're still confused, here's a simple explanation. A Unit Indexer can be simplified to a single trigger that does this:
  • Events
    • Unit - A unit enters the map
  • Conditions
  • Actions
    • Set Variable INDEX = INDEX + 1
    • Unit - Set Custom value of (Entering unit) to INDEX
What is the result of this trigger? Each unit in your map will be given a different Custom Value. Why is this useful? Because now you can store data directly to your units by using their [Custom value] as the [index] in your Variable Arrays. This might sound confusing but you were already using this method in your triggers!


See how you were using the Player Number to store data directly to your Players:
  • Unit - Order (Casting unit) to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of (Casting unit)))])
Each Player has a different Player Number so you know that CurrentTarget will be unique for each Player.


The Unit Indexer uses this same exact method, except instead of saving data to a Player it allows you to save data to a Unit:
  • Unit - Order (Casting unit) to Attack-Move To (Center of CurrentTarget[(Custom value of (Casting unit)])
Each Unit has a different Custom Value so you know that CurrentTarget will be unique for each Unit.


This opens the door to many new possibilities since you can store as much data as you want to a single Unit.
Let's use the system to give a Hero some new stats, Ability Power, Spell Lifesteal, and Cooldown Reduction:
  • Unit - Create 1 HERO for Player 1 (red)...
  • Set Variable CV = Custom value of (Last created unit)
  • Set Variable AbilityPower[CV] = 100
  • Set Variable SpellLifesteal[CV] = 0.10
  • Set Variable CooldownReduction[CV] = 0.15
Now let's increase one of these stats. For example, let's increase Ability Power when the Hero acquires a special Item:
  • Events
    • Unit - A unit acquires an item
  • Conditions
    • Item-type of (Item being manipulated) Equal to Magic Wand
  • Actions
    • Set Variable CV = Custom value of (Hero manipulating item)
    • Set Variable AbilityPower[CV] = AbilityPower[CV] + 50
Note that CV is an Integer variable I use as a shortcut, it's not needed but makes things easier to work with.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Ok @Uncle you convinced me. Now let's begin with unit creation. I want to go step by step.
I will always share the entire triggers for everything to be clear


Now i am creating variable called IndexThing

  • HeroSectirmeD
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: |cff00ff00Yapay zek...
      • Wait 10.00 seconds
      • Game - Display to (All players) for 5.00 seconds the text: |cff00ff00Yapay zek...
      • Wait 5.00 seconds
      • Game - Display to (All players) for 5.00 seconds the text: |cff00ff00Yapay zek...
      • Wait 5.00 seconds
      • 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
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 13)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Neutral Building - Remove BotHerolar[randomInt] from all marketplaces
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • Set IndexThing = (IndexThing + 1)
                  • Unit - Set the custom value of (Last created unit) to IndexThing
                  • 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 HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarBotDevil
                  • Unit Group - Add (Last created unit) to HerolarDevilAll
                  • Player Group - Add (Player((Integer A))) to ClanDevilPlayers
                  • Player Group - Add (Player((Integer A))) to ClanDevilBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Set HeroCountDevil = (HeroCountDevil + 1)
                • Else - Actions
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 13)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of GameGuideReaper <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • Set IndexThing = (IndexThing + 1)
                  • Unit - Set the custom value of (Last created unit) to IndexThing
                  • 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 HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarReaperALL
                  • Unit Group - Add (Last created unit) to HerolarBotReaper
                  • Player Group - Add (Player((Integer A))) to ClanReaperPlayers
                  • Player Group - Add (Player((Integer A))) to ClanReaperBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Set HeroCountReaper = (HeroCountReaper + 1)
            • Else - Actions
      • Wait 8.00 seconds
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
      • Trigger - Run HeroSectirmeDevam <gen> (checking conditions)
I am setting index in here. Now let me know when we proceed. If you say "there are no problems in here, i will continue to work on it"

  • Set HeroChoosen[randomInt] = True
  • Set IndexThing = (IndexThing + 1)
  • Unit - Set the custom value of (Last created unit) to IndexThing
  • 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
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
The Unit Indexer system automatically assigns Custom Value for you. You don't and SHOULD NOT do it yourself. So what you'd do is this:

Step 1: Import a Unit Indexer into your map. You'll need to find one compatible with your version.

Step 2:
In the HeroSectirmeD trigger you want to delete these two lines:
  • Set IndexThing = (IndexThing + 1)
  • Unit - Set the custom value of (Last created unit) to IndexThing
Now if you want to save something to that newly created Hero you would do it like so:
  • Set HeroNumber[Custom value of (Last created unit)] = randomInt
Thanks to the Unit Indexer you can now save any amount of data to your units.

Here's another example, let's save a Special Effect to our Hero:
  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
  • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
  • Set HeroSFX[Custom value of (Last created unit)] = (Last created special effect)
The Unit Indexer system automatically gives this newly created unit a unique Custom Value which we can use right away.

Now when our Hero dies let's Destroy the Special Effect:
  • Events
    • Unit - A unit dies
  • Conditions
    • ((Dying unit) is a Hero) Equal to True
  • Actions
    • Special Effect - Destroy HeroSFX[Custom value of (Dying unit)]
This trigger will work for any Hero that has a HeroSFX[] saved to it, so it's completely MUI thanks to the Unit Indexer.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
What are you trying to do exactly? There's no more steps needed once it's imported, now you can use it.

I would try doing one of the examples I posted above and see for yourself. The Special Effect one is always a good visual showcase.
Same thing as i before. I have deleted those line as you said but i am confused. I don't know use what instead of this one.
  • set.gif
    Set IndexThing = (IndexThing + 1)
  • unit.gif
    Unit - Set the custom value of (Last created unit) to IndexThing
Yes your explanation is amazing and i am trying to understand. I want to save created hero for later use but i don't know which variable for it's use.
 

Attachments

  • WHAT.png
    WHAT.png
    14.7 KB · Views: 4

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Same thing as i before. I have deleted those line as you said but i am confused. I don't know use what instead of this one.
  • set.gif
    Set IndexThing = (IndexThing + 1)
  • unit.gif
    Unit - Set the custom value of (Last created unit) to IndexThing
Yes your explanation is amazing and i am trying to understand. I want to save created hero for later use but i don't know which variable for it's use.
I'm not 100% sure what you mean, but you're already storing your Hero for later use by putting it into several Unit Groups.

If you're talking about changing all of your old Custom Value actions then simply replace them with an Integer array variable:
  • Set SomeInteger[Custom value of (Your unit)] = Some value
ThompZon explained how to do this in his post.

Also, I showed you how you would adjust my system to use a Unit Indexer in one of my earlier posts.

Understand that the Variables you use depends on what you want to store.
Want to save an Integer to a unit? -> Use an Integer array.
Want to save a Special Effect to a unit? -> Use a Special effect array.
Want to save a Floating Text to a unit? -> Use a Floating text array.
etc...

And remember, as long as you have access to a Unit you also have access to it's Custom Value, which gives you access to any Variables that have been set using that Custom Value. So if your AI Hero is in a Unit Group then you have access to them and therefore you can get their Custom Value and all of the data that you've saved to them using the Unit Indexing method.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Ok then i have already stored them as
Set zU_AIHero[(Integer A)] = (Last created unit) ok now we can proceed. Here is the current Hero Selection trigger for AI Controlled Slots.

  • HeroSectirmeD
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • 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
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 13)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of MarketUst <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Neutral Building - Remove BotHerolar[randomInt] from all marketplaces
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • Unit Group - Add (Last created unit) to HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarBotDevil
                  • Unit Group - Add (Last created unit) to HerolarDevilAll
                  • Player Group - Add (Player((Integer A))) to ClanDevilPlayers
                  • Player Group - Add (Player((Integer A))) to ClanDevilBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Set HeroCountDevil = (HeroCountDevil + 1)
                • Else - Actions
                  • For each (Integer LoopInt) from 0 to 1, do (Actions)
                    • Loop - Actions
                      • Set randomInt = (Random integer number between 1 and 13)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • HeroChoosen[randomInt] Equal to False
                        • Then - Actions
                          • Set LoopInt = 1
                        • Else - Actions
                          • Set LoopInt = 0
                  • Set BotHeroSecti[(Integer A)] = True
                  • Unit - Create 1 BotHerolar[randomInt] for (Player((Integer A))) at (Center of GameGuideReaper <gen>) facing Default building facing degrees
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Player - Make BotHerolar[randomInt] Unavailable for training/construction by (Picked player)
                  • Set zU_AIHero[(Integer A)] = (Last created unit)
                  • Set HeroChoosen[randomInt] = True
                  • Set UDex = (UDex + 1)
                  • Unit Group - Add (Last created unit) to HerolarALL
                  • Unit Group - Add (Last created unit) to HerolarBotALL
                  • Unit Group - Add (Last created unit) to HerolarReaperALL
                  • Unit Group - Add (Last created unit) to HerolarBotReaper
                  • Player Group - Add (Player((Integer A))) to ClanReaperPlayers
                  • Player Group - Add (Player((Integer A))) to ClanReaperBotlar
                  • Player Group - Add (Player((Integer A))) to Botlar
                  • Set HeroCountReaper = (HeroCountReaper + 1)

Now let us proceed the second part if it is ok. I cannot proceed it alone because you we're talking about the hashtable and i don't know how to use this thing.
But if it's beyond your knowledge than perhaps it's time to expand your knowledge :D
I feel stressful for this. Because i can disappoint you after all and i don't want to do this... I am very sorry but i really really don't know what is my next step is. Before i post this i have read several times all of your messages but sadly stil i don't understand and it is making me sad because sometimes i am crying because of my capacity. Many people creates amazing systems and i am just looking it like i see the trigger system first time...

I don't know how it helps to fix trigger.

  • SkillsTarget
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIFallBackCREEP[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackHERO[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackTOWER[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempPointCasterTarget = (Position of (Picked unit))
              • Set TempGroupT = (Units within 1000.00 of TempPointCasterTarget matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempUnit = (Random unit from TempGroupT)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempGroupT) Greater than or equal to 1
                • Then - Actions
                  • Unit Group - Add (Picked unit) to TempCastGroup
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Shadow Hunter - Hex TempUnit
                  • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Undead Lich - Frost Nova TempUnit
                  • Unit - Order (Picked unit) to Undead Necromancer - Cripple TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral Fire Lord - Soul Burn TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Raider - Ensnare TempUnit
                  • Game - Display to DebugBotSkills for 1.00 seconds the text: ((Name of (Owner of (Picked unit))) + ( >>> + (Name of (Owner of TempUnit))))
                  • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
                  • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                    • Then - Actions
                      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup2) Greater than or equal to 1
                            • Then - Actions
                              • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
                            • Else - Actions
                              • -------- There are no creeps. Fall back to the previous target. --------
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroup2)
                    • Else - Actions
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in TempGroup2) Greater than or equal to 1
                            • Then - Actions
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
                            • Else - Actions
                              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroup2)
                • Else - Actions
                  • Custom script: call RemoveLocation (udg_TempPointCasterTarget)
                  • Custom script: call DestroyGroup (udg_TempGroupT)
                  • Set TempBotTargetCaster = No unit
                  • Set TempUnit = No unit
              • Custom script: call RemoveLocation (udg_TempPointCasterTarget)
              • Custom script: call DestroyGroup (udg_TempGroupT)
              • Custom script: call DestroyGroup (udg_TempGroup2)
              • Set TempBotTargetCaster = No unit
              • Set TempUnit = No unit
              • Unit Group - Remove all units from TempCastGroup
            • Else - Actions
              • Unit Group - Remove all units from TempCastGroup
      • Unit Group - Remove all units from TempCastGroup
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
The reason I suggested the Unit Indexer was as a replacement to Hashtables so you could get my original triggers working. I never said it would provide a solution to your current triggers.

"Hello Uncle. I forgot the mention, my map uses custom values for lot of triggers. It will prevent this system works right?"

The fix is to use a new Integer array variable instead. For example, if you had a Condition like this:
  • Conditions
    • Custom value of (Triggering unit) Equal to 2
You would want to change it to use a new Variable:
  • Conditions
    • YourInteger[Custom value of (Triggering unit)] Equal to 2
YourInteger is an Integer array. ThompZon explained this well.


Now for some problems I see in the triggers you just posted.

1) Delete this action from the Hero Selection trigger:
  • Set UDex = (UDex + 1)
The Unit Indexer does it's own thing, you shouldn't be touching it's variables (unless told to).

2) You're using Pick Every Unit for no reason in parts of the SkillsTarget trigger. For example here:
  • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
  • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
  • Unit Group - Pick every unit in TempGroup2 and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup2) Greater than or equal to 1
        • Then - Actions
          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
        • Else - Actions
          • -------- There are no creeps. Fall back to the previous target. --------
          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
  • Custom script: call DestroyGroup (udg_TempGroup2)
There's no reason to Pick every unit in TempGroup2, you aren't referencing (Picked unit) and you only want those Actions to run one time. Currently, you're running the Loop - Actions once for EACH unit inside of TempGroup2. So if you had 5 units in TempGroup2, you would Order TempBotTargetCaster to Attack-Move five times!
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
Ok ok i get it. I have copied the Unit Indexer system into my map and i will not manually set it's own things.
And if i have the triggers works with the Custom Value of triggering unit, i will create new integer for it and control it manually by myself.

Now let's continue.

--- Part 2, make the AI Controlled Heroes cast spells on their enemies ---

  • Ok ok i get it. I have copied the Unit Indexer system into my map and i will not manually set it's own things.
  • And if i have the triggers works with the Custom Value of triggering unit, i will create new integer for it and control it manually by myself.
  • [TRIGGER]If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
    • Then - Actions
      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup2) Greater than or equal to 1
            • Then - Actions
              • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
            • Else - Actions
              • -------- There are no creeps. Fall back to the previous target. --------
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
      • Custom script: call DestroyGroup (udg_TempGroup2)
    • Else - Actions
      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup2) Greater than or equal to 1
            • Then - Actions
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
            • Else - Actions
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
      • Custom script: call DestroyGroup (udg_TempGroup2)
Making them cast spells overrides previous order and i have to check their current condition.

1-) After they cast spells, if there are no creeps around them, they have to go for their previous target
2-) After they cast spells, if there are creeps around them, they have to go for their next target.

This is why i am picking them again but if that makes running trigger 5 times, yes it is a problem.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
    • Then - Actions
      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup2) Greater than or equal to 1
            • Then - Actions
              • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
            • Else - Actions
              • -------- There are no creeps. Fall back to the previous target. --------
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
      • Custom script: call DestroyGroup (udg_TempGroup2)
    • Else - Actions
      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup2) Greater than or equal to 1
            • Then - Actions
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
            • Else - Actions
              • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
      • Custom script: call DestroyGroup (udg_TempGroup2)

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
    • Then - Actions
      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup2) Greater than or equal to 1
        • Then - Actions
          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
        • Else - Actions
          • -------- There are no creeps. Fall back to the previous target. --------
          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
      • Custom script: call DestroyGroup (udg_TempGroup2)
    • Else - Actions
      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup2) Greater than or equal to 1
        • Then - Actions
          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
        • Else - Actions
          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
      • Custom script: call DestroyGroup (udg_TempGroup2)

Uhm is that all? If yes, let us proceed the next one. The hashtable system you mentioned.

AI Setup
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Hashtable - Create a hashtable
Set Variable = (Last created hashtable)
Countdown Timer - Start Timer as a Repeating timer that will expire in 2.00 seconds
Countdown Timer - Start Timer as a Repeating timer that will expire in 3.00 seconds

AI Timer Instant
Events
Time - Timer expires
Conditions
Actions
Unit Group - Pick every unit in Unit Group and do (Actions)
Loop - Actions
Set Variable = (Picked unit)
Set Variable = (Picked unit)
Set Variable = Value
Set Variable = Value
Set Variable = (Picked unit)

Now are we going to use this system you mentioned earlier, or are we gonna do something new? In the same time still i am reading and trying to understand. Still i cannot believe making bots casting their skills on randomly could be extremely difficult like this.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Your fixes look correct but I'd have to see the whole trigger. And just to clarify, it wouldn't make the trigger run five times, it would make the Loop - Actions run five times, once for each unit inside of the Unit Group. So with that in mind, look at this:
  • Unit Group - Pick every unit in TempGroup2 and do (Actions)
    • Loop - Actions
      • Unit - Kill (Picked unit)
This will Kill all of the units in TempGroup2. Now ask yourself, why does this kill EVERY unit in TempGroup2? The reason is because each cycle of the Loop one of the units in the Unit Group is set to (Picked unit), which is a Unit variable, and it does this so that you have the option to interact with that individual unit. Here we're killing that (Picked unit). This is because Warcraft 3's game logic orders everything sequentially, for example in this case one unit has to die before another. This is why all of the Events/Event Responses are referencing an individual Unit/Player/Item, etc...

So any actions you put in Loop - Actions will run X times, where X is the number of units in the Unit Group. So when you were checking if the Number of units in TempGroup2 was Greater than or Equal to 1 you were potentially asking that question X times. You only needed to ask that question once therefore Pick Every Unit was unnecessary. Hopefully that makes sense.


About my system, you said you cannot use Hashtables and that's why we started talking about a Unit Indexer in the first place. Understand that I created that system as an example of how you could manage the AI. It's not intended to be the perfect solution since there's 100's of ways of going about creating AI and it all depends on how your map works. It's just one method I think would work nicely. You can recreate those triggers using a Unit Indexer instead of a Hashtable which I already explained in my earlier post. Everything you need to know is already written in this thread in order to create and use those triggers.

But do you even want to use those triggers? That's the question and that's entirely up to you. I've provided a solution that I would use but it may not be the correct solution for you.

Warcraft 3 was never designed to work this way. Units are hardcoded to cast certain spells under certain conditions if they're controlled by a Computer. There's also Melee AI scripts you can run for a Computer Player which may help but those were designed for a Real Time Strategy experience and not a MOBA so I assume they won't work properly or you've already tried them with less than desirable results. There's a lot of threads on Hive about creating your own AI which you can check out as well, I would google search "Hiveworkshop AI" if you can't find any.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
@Uncle Ok understand. Then let me show you the entire trigger

  • SkillsTarget Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIFallBackCREEP[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackHERO[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackTOWER[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempPointCasterTarget = (Position of (Picked unit))
              • Set TempGroupT = (Units within 1000.00 of TempPointCasterTarget matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempUnit = (Random unit from TempGroupT)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempGroupT) Greater than or equal to 1
                • Then - Actions
                  • Unit Group - Add (Picked unit) to TempCastGroup
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Shadow Hunter - Hex TempUnit
                  • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Undead Lich - Frost Nova TempUnit
                  • Unit - Order (Picked unit) to Undead Necromancer - Cripple TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral Fire Lord - Soul Burn TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Raider - Ensnare TempUnit
                  • Game - Display to DebugBotSkills for 1.00 seconds the text: ((Name of (Owner of (Picked unit))) + ( >>> + (Name of (Owner of TempUnit))))
                  • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
                  • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                    • Then - Actions
                      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroup2) Greater than or equal to 1
                        • Then - Actions
                          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • -------- There are no creeps. Fall back to the previous target. --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroup2)
                    • Else - Actions
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroup2) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroup2)
                • Else - Actions
                  • Custom script: call RemoveLocation (udg_TempPointCasterTarget)
                  • Custom script: call DestroyGroup (udg_TempGroupT)
                  • Set TempBotTargetCaster = No unit
                  • Set TempUnit = No unit
              • Custom script: call RemoveLocation (udg_TempPointCasterTarget)
              • Custom script: call DestroyGroup (udg_TempGroupT)
              • Custom script: call DestroyGroup (udg_TempGroup2)
              • Set TempBotTargetCaster = No unit
              • Set TempUnit = No unit
              • Unit Group - Remove all units from TempCastGroup
            • Else - Actions
              • Unit Group - Remove all units from TempCastGroup
      • Unit Group - Remove all units from TempCastGroup

and let me simplify the question again because it's so confusing for someone who recently read our messages.
Hello, if you are new and started to read topic from here, this is for you
How can i make them not to take order while their abilities on cooldown and prevent them casting spells on non-hero units? They are acting like attack starts, then stops, then starts the attack. They are doing this every second.
This trigger orders them to cast spells on Heroes but they are able to cast them on non-hero units because of Warcraft III Default
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
You can change the Targets Allowed on the ability in the Object Editor to target Heroes only.

Regarding cooldown, on your version you cannot check if an ability is on Cooldown natively but you could come up with a rather advanced system to do so using Timers/Hashtable/Unit Indexer.

Anyway, it's very difficult for people to provide solutions to that trigger without more information but here's a slightly improved version. It can still be improved a lot with Variables as it's extremely inefficient and leaks but those issues shouldn't prevent it from working properly:
  • SkillsTarget Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIFallBackCREEP[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackHERO[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackTOWER[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempPointCasterTarget = (Position of (Picked unit))
              • Set TempGroupT = (Units within 1000.00 of TempPointCasterTarget matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempUnit = (Random unit from TempGroupT)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempGroupT) Greater than or equal to 1
                • Then - Actions
                  • Unit Group - Add (Picked unit) to TempCastGroup
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Shadow Hunter - Hex TempUnit
                  • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Undead Lich - Frost Nova TempUnit
                  • Unit - Order (Picked unit) to Undead Necromancer - Cripple TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral Fire Lord - Soul Burn TempUnit
                  • Unit - Order (Picked unit) to Neutral Naga Sea Witch - Forked Lightning TempUnit
                  • Unit - Order (Picked unit) to Special Archimonde - Finger Of Death TempUnit
                  • Unit - Order (Picked unit) to Neutral - Firebolt TempUnit
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit
                  • Unit - Order (Picked unit) to Orc Raider - Ensnare TempUnit
                  • Game - Display to DebugBotSkills for 1.00 seconds the text: ((Name of (Owner of (Picked unit))) + ( >>> + (Name of (Owner of TempUnit))))
                  • -------- This trigger picks CreepsDevil around the Hero. Because after it casts spells, it has go to next or previous target --------
                  • -------- If player number lesser than or equal to 6 that means CreepsDevil are allies. (Player 1 red ally with 2-3-4-5-6) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Picked unit))) Less than or equal to 6
                    • Then - Actions
                      • -------- I am creating TempGroup2 that includes CreepsDevil (allies of picked unit) --------
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsDevil) Equal to True))
                      • -------- Don't worry, i am removing dying CreepsDevil from CreepsDevil unit group --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroup2) Greater than or equal to 1
                        • Then - Actions
                          • -------- There are still 1 or more creeps available around the picked unit. Go for the NextTarget --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • -------- There are no creeps. Fall back to the previous target. --------
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroup2)
                    • Else - Actions
                      • Set TempGroup2 = (Units within 500.00 of (Position of (Picked unit)) matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
                      • -------- Else. That means player number of picked player NOT lesser or equal to 6. That means picked unit ally with CreepsReaper (player 7 allied with 8-9-10-11-12) --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in TempGroup2) Greater than or equal to 1
                        • Then - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of CurrentTarget[(Player number of (Owner of TempBotTargetCaster))])
                        • Else - Actions
                          • Unit - Order TempBotTargetCaster to Attack-Move To (Center of PreviousTarget[(Player number of (Owner of TempBotTargetCaster))])
                      • Custom script: call DestroyGroup (udg_TempGroup2)
                • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPointCasterTarget)
              • Custom script: call DestroyGroup (udg_TempGroupT)
              • Set TempBotTargetCaster = No unit
              • Set TempUnit = No unit
            • Else - Actions
      • Unit Group - Remove all units from TempCastGroup
Things to note:
TempBotTargetCaster isn't Set in this trigger, I'm assuming it's like CurrentTarget/PreviousTarget and gets Set in another trigger.
It's usually not necessary to Set Unit variables = No unit. But maybe you have a reason?
Orders will interrupt other orders, so in that trigger your unit will always get issued the LAST order it's able to do.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,137
@Uncle I have used TempBotTargetCaster from here but is it unnecessary?

Set TempPointCasterTarget = (Position of (Picked unit))
Set TempGroupT = (Units within 1000.00 of TempPointCasterTarget matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))

Yes it seems it is enough

i will delete this >>> Set TempPointCasterTarget = (Position of (Picked unit))
Set TempGroupT = (Units within 1000.00 of i will replace this >>>TempPointCasterTarget with this one > Picked Unit matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))

Right?

By the way yes orders are bit of problem to me. For example i have a Hero called Elementalist, it's combo must be cast immediately. Maybe we can create bot specific triggers if it helps me? Because only 1 player can pick each hero. For example here is the order ID skills of the Elementalist

Firebolt - Frost Nova - Chain Lightning - Cripple

Now i am going to create Hero Specific trigger but it is another story, i will use this topic for it's main reason.
Somehow i want to prevent them not to take order while not casting spells. Because this trigger causes make them stop for every 1 second in the game. And that causes this.
What we are doing while attacking: Attack animation starts > attack starts.
What is happening: Attack animation starts > stops > attack animation starts > attack starts.

Because this trigger trying to give them orders every seconds right?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
I can't tell you if TempBotTargetCaster is necessary or not. I don't know what it's used for or whether it's Set in another trigger or not. If it's NOT Set anywhere then it won't do anything.

I don't know why you would delete TempPointCasterTarget, don't you want to check for units within 1000.00 range? I have no idea what you want to do.

I already showed you how to create Hero specific triggers, that's what half of my posts have been about from the start.

Yes, you're interrupting their attacks by issuing orders. That's why you don't want a system that issues random orders (most of which the unit cannot even use) at a rate of every 1.00 second. If you put enough delay between issuing orders you'll at least give your units some time to attack.
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
I can't tell you if TempBotTargetCaster is necessary or not. I don't know what it's used for or whether it's Set in another trigger or not. If it's NOT Set anywhere then it won't do anything.
Yes it won't do anything. I have just realized after your post

I don't know why you would delete TempPointCasterTarget, don't you want to check for units within 1000.00 range? I have no idea what you want to do.

After your post i have realized it was not necessary. Because i am already picking units. I want to make them cast spells 1000 aoe around them.
Pick every unit in HerolarBotALL
I will delete this >>> Set TempPointCasterTarget = (Position of (Picked unit))
Set TempGroupT = (Units within 1000.00 of i will replace this >>>TempPointCasterTarget with this one > Picked Unit matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))

Did i wrong? I am not sure after your message.

  • SkillsTarget Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HerolarBotALL and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in zUG_RegenALL) Equal to False
              • zBool_AIFallBackCREEP[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackHERO[(Player number of (Owner of (Picked unit)))] Equal to False
              • zBool_AIFallBackTOWER[(Player number of (Owner of (Picked unit)))] Equal to False
            • Then - Actions
              • Set TempGroupT = (Units within 1000.00 of (Position of (Picked unit)) matching ((((Matching unit) is in HerolarALL) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
              • Set TempUnit = (Random unit from TempGroupT)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempGroupT) Greater than or equal to 1
                • Then - Actions
                  • Unit Group - Add (Picked unit) to TempCastGroup
                  • Unit - Order (Picked unit) to Human Sorceress - Polymorph TempUnit


I already showed you how to create Hero specific triggers, that's what half of my posts have been about from the start.

Yes but sadly it requires HashTable and i cannot use it because of the missing feature. But let me know if i am mistaken.

Yes, you're interrupting their attacks by issuing orders. That's why you don't want a system that issues random orders (most of which the unit cannot even use) at a rate of every 1.00 second. If you put enough delay between issuing orders you'll at least give your units some time to attack.

But they will not gonna cast spells. They have 4 skills and here is the result
Ability 1-2-3-4: Ready
Ability 1: Cast
Wait 5 seconds
Ability 2: Cast
Wait 5 seconds goes on like this.

I will search and try to find proper way with the system you mentioned. Unit Index thing.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Did i wrong? I am not sure after your message.
TempPointCasterTarget is there to prevent a Memory Leak. By getting rid of it you're simply adding a new problem.

"Yes but sadly it requires HashTable and i cannot use it because of the missing feature."
You would use the Unit Indexer instead of a Hashtable. Look at my earlier post right after you said you can't use a Hashtable, the Unit Indexer is the SOLUTION! I explained how these two things are very similar and that my system can use either one.
 
Level 17
Joined
Jun 2, 2009
Messages
1,137
I think it is advanced level system and i don't think someone can solve this easily.

I am requesting for lock this topic because 49 days have been passed and everyhing is complicated in here and still my issue is not solved. I will create new topic for simple questions that can help me.

Because i have realized it is too advanced system for me. I have to ask simple questions and proceed step by step with people who try to help me.

I need a solutions that "i can understand" OR i need to someone who tell me "exactly what should i do"

If someone enters this topic and decides to help me, they have to read lots of messages, fixes, solutions and updates. It is terrible for someone who wants to help.

I am giving up for this topic and probably nowadays i will create new topic with lot of explanation and try to stick with the topic and i will go step by step. Everything is messed up in here.

I want to thanks for everyone who tried to help me. We will meet in new topic another time.
 
Status
Not open for further replies.
Top