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

Computer Controlled units Behavior

Status
Not open for further replies.
Level 3
Joined
Apr 30, 2011
Messages
22
Hello,

I have this problem with the map i'm making is that basicaly,

Player controlled heroes have to survive waves of enemy computer controlled units (and heroes).

Heres what I did :

Player_Hero : Unit_Group of all heroes, summoned and constructed units


  • Tier 0 Spawn
    • Events
      • Time - spawnTimerTier0 expires
    • Conditions
    • Actions
      • Set tempPoint_Zombie[1] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[2] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[3] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[4] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[5] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[6] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[7] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[8] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[9] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[10] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[11] = (Random point in Zombie spawn <gen>)
      • Set tempPoint_Zombie[12] = (Random point in Zombie spawn <gen>)
      • For each (Integer A) from 1 to 1, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Zombie for Player 9 (Gray) at tempPoint_Zombie[1] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 10 (Light Blue) at tempPoint_Zombie[2] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 11 (Dark Green) at tempPoint_Zombie[3] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 12 (Brown) at tempPoint_Zombie[4] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 13 (Maroon) at tempPoint_Zombie[5] facing Default building facing degrees
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 3
        • Then - Actions
          • Unit - Create 1 Zombie for Player 15 (Turquoise) at tempPoint_Zombie[7] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 4
        • Then - Actions
          • Unit - Create 1 Zombie for Player 16 (Violet) at tempPoint_Zombie[8] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 5
        • Then - Actions
          • Unit - Create 1 Zombie for Player 17 (Wheat) at tempPoint_Zombie[9] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 6
        • Then - Actions
          • Unit - Create 1 Zombie for Player 9 (Gray) at tempPoint_Zombie[1] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 18 (Peach) at tempPoint_Zombie[10] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 7
        • Then - Actions
          • Unit - Create 1 Zombie for Player 10 (Light Blue) at tempPoint_Zombie[2] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 19 (Mint) at tempPoint_Zombie[11] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 8
        • Then - Actions
          • Unit - Create 1 Zombie for Player 11 (Dark Green) at tempPoint_Zombie[3] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 20 (Lavender) at tempPoint_Zombie[12] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 9
        • Then - Actions
          • Unit - Create 1 Zombie for Player 12 (Brown) at tempPoint_Zombie[4] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 10
        • Then - Actions
          • Unit - Create 1 Zombie for Player 13 (Maroon) at tempPoint_Zombie[5] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 11
        • Then - Actions
          • Unit - Create 1 Zombie for Player 15 (Turquoise) at tempPoint_Zombie[7] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 16 (Violet) at tempPoint_Zombie[8] facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerN Greater than or equal to 12
        • Then - Actions
          • Unit - Create 1 Zombie for Player 9 (Gray) at tempPoint_Zombie[1] facing Default building facing degrees
          • Unit - Create 1 Zombie for Player 17 (Wheat) at tempPoint_Zombie[9] facing Default building facing degrees
        • Else - Actions
      • Set tempGroup_Zombie[1] = (Units in (Playable map area) owned by Player 9 (Gray))
      • Set tempGroup_Zombie[2] = (Units in (Playable map area) owned by Player 10 (Light Blue))
      • Set tempGroup_Zombie[3] = (Units in (Playable map area) owned by Player 11 (Dark Green))
      • Set tempGroup_Zombie[4] = (Units in (Playable map area) owned by Player 12 (Brown))
      • Set tempGroup_Zombie[5] = (Units in (Playable map area) owned by Player 13 (Maroon))
      • Set tempGroup_Zombie[6] = (Units in (Playable map area) owned by Player 14 (Navy))
      • Set tempGroup_Zombie[7] = (Units in (Playable map area) owned by Player 15 (Turquoise))
      • Set tempGroup_Zombie[8] = (Units in (Playable map area) owned by Player 16 (Violet))
      • Set tempGroup_Zombie[9] = (Units in (Playable map area) owned by Player 17 (Wheat))
      • Set tempGroup_Zombie[10] = (Units in (Playable map area) owned by Player 18 (Peach))
      • Set tempGroup_Zombie[11] = (Units in (Playable map area) owned by Player 19 (Mint))
      • Set tempGroup_Zombie[12] = (Units in (Playable map area) owned by Player 20 (Lavender))
      • Set tempPoint_Hero[1] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[2] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[3] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[4] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[5] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[6] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[7] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[8] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[9] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[10] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[11] = (Position of (Random unit from Player_Hero))
      • Set tempPoint_Hero[12] = (Position of (Random unit from Player_Hero))
      • Unit Group - Pick every unit in tempGroup_Zombie[1] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[1]
      • Unit Group - Pick every unit in tempGroup_Zombie[2] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[2]
      • Unit Group - Pick every unit in tempGroup_Zombie[3] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[3]
      • Unit Group - Pick every unit in tempGroup_Zombie[4] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[4]
      • Unit Group - Pick every unit in tempGroup_Zombie[5] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[5]
      • Unit Group - Pick every unit in tempGroup_Zombie[6] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[6]
      • Unit Group - Pick every unit in tempGroup_Zombie[7] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[7]
      • Unit Group - Pick every unit in tempGroup_Zombie[8] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[8]
      • Unit Group - Pick every unit in tempGroup_Zombie[9] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[9]
      • Unit Group - Pick every unit in tempGroup_Zombie[10] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[10]
      • Unit Group - Pick every unit in tempGroup_Zombie[11] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[11]
      • Unit Group - Pick every unit in tempGroup_Zombie[12] and do (Actions)
        • Loop - Actions
          • AI - Ignore (Picked unit)'s guard position
          • Unit - Order (Picked unit) to Attack-Move To tempPoint_Hero[12]
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[1])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[2])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[3])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[4])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[5])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[6])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[7])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[8])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[9])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[10])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[11])
      • Custom script: call RemoveLocation(udg_tempPoint_Zombie[12])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[1])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[2])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[3])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[4])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[5])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[6])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[7])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[8])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[9])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[10])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[11])
      • Custom script: call RemoveLocation(udg_tempPoint_Hero[12])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[1])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[2])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[3])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[4])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[5])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[6])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[7])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[8])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[9])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[10])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[11])
      • Custom script: call DestroyGroup(udg_tempGroup_Zombie[12])

I found that with this trigger, units will go to a random unit location and attack the closest unit going to the point. With summoned unit it works really well, they will easily tank for the heroic units.

The problem is that structures will not aggro enemy units if there is a hero in range, they will target as
1. Summoned/Units
2. Heroes
3. Structures
I tried using a ''Melee ai'' with target hero priority unchecked and it did not work, I also tried things and found that ''moving'' will aggro the enemy units but if the structure can't move at all, it won't be prioritized.

Other Notes :

-Tried with not mechanised, structure Booleans with no succes.
-Buildings are not using ''Fortified'' armor.
-I can provide any info needed that I have to included in this post as well as the map itself.

If anyone has some knowledge about this kind of problem let me know!
 
Level 13
Joined
Jul 15, 2007
Messages
763
Units ignoring structures (even if those structures have attacks) is a hard-coded part of the WC3 AI. To my knowledge it cannot be disabled. There's lots of creative solutions that all ultimately revolve around you making a custom aggro system. For example: you can make your enemies "fixate" on certain targets for a short period of time by using a custom auto-cast based spell and a few simple triggers.
 
Level 12
Joined
Jun 15, 2016
Messages
472
Another possibility is specifying those units as "siege" units, and enable the "smart artillery" flag on the AI. I'm not sure it will actually work, though, as the artillery units might need to be a part of an attack group. Still worth a shot.
 
Status
Not open for further replies.
Top