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

Transports and the AI editor

Status
Not open for further replies.
Level 17
Joined
Aug 19, 2007
Messages
1,380
Hi all,

edit, fixed it. You can let custom AI load and unload units with flying transports with these triggers (works pretty well for small harassment attacks).

Leaks fixed (atleast most of them) and triggers improved. Now works pretty well. Tested it with 7 cpu players.

Please note that I made it only for player 2 & 3 cause this was a test and that the Aurochs (& Broodmother & Overlord) is the flying transport here. Change these into your transport unit. The units it picks up are here Bionic Marine and Chemical Bot.

For those of you wondering this was for my Starcraft Hybrids map.

First loading:

  • AI transport load units
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) controller) Equal to Computer
          • Or - Any (Conditions) are true
            • Conditions
              • (Number of living Aurochs units owned by Player 2 (Blue)) Greater than 0
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 2 (Blue) of type Aurochs) and do (Unit - Order (Picked unit) to Load (Random unit from (Units owned by (Owner of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Bionic Marine) or ((Unit-type of (Matching unit)) Equal to Chemical Bot)))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 3 (Teal) controller) Equal to Computer
          • Or - Any (Conditions) are true
            • Conditions
              • (Number of living Aurochs units owned by Player 3 (Teal)) Greater than 0
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 3 (Teal) of type Aurochs) and do (Unit - Order (Picked unit) to Load (Random unit from (Units owned by (Owner of (Picked unit)) matching (((Unit-type of (Matching unit)) Equal to Bionic Marine) or ((Unit-type of (Matching unit)) Equal to Chemical Bot)))))
        • Else - Actions
Now unloading:
Now 2 triggers for unloading. One that checks when the transport is full moves it to an enemy base. And one that unloads its units when the transport is attacked (usually by an enemy tower).

  • AI transport unload units 1
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) controller) Equal to Computer
          • Or - Any (Conditions) are true
            • Conditions
              • (Number of living Aurochs units owned by Player 2 (Blue)) Greater than 0
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 2 (Blue) matching (((Unit-type of (Matching unit)) Equal to Aurochs) or (((Unit-type of (Matching unit)) Equal to Broodmother) or ((Unit-type of (Matching unit)) Equal to Overlord of the Void)))) and do (Actions)
            • Loop - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) Equal to (Picked unit)) and ((Current order of (Matching unit)) Not equal to (Order(unloadall))))) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in (Units owned by (Owner of (Picked unit)) matching (((Matching unit) is loaded into (Picked unit)) Equal to True))) Greater than or equal to 4
                    • Then - Actions
                      • Set TEMP_PointTransport = (Position of (Random unit from (Units owned by (Random player from (All enemies of (Owner of (Picked unit)))) matching (((Matching unit) is A town-hall-type unit) Equal to True))))
                      • Unit - Order (Picked unit) to Unload All At TEMP_PointTransport
                      • Custom script: call RemoveLocation(udg_TEMP_PointTransport)
                    • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 3 (Teal) controller) Equal to Computer
          • Or - Any (Conditions) are true
            • Conditions
              • (Number of living Aurochs units owned by Player 3 (Teal)) Greater than 0
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by Player 3 (Teal) matching (((Unit-type of (Matching unit)) Equal to Aurochs) or (((Unit-type of (Matching unit)) Equal to Broodmother) or ((Unit-type of (Matching unit)) Equal to Overlord of the Void)))) and do (Actions)
            • Loop - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) Equal to (Picked unit)) and ((Current order of (Matching unit)) Not equal to (Order(unloadall))))) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in (Units owned by (Owner of (Picked unit)) matching (((Matching unit) is loaded into (Picked unit)) Equal to True))) Greater than or equal to 4
                    • Then - Actions
                      • Set TEMP_PointTransport = (Position of (Random unit from (Units owned by (Random player from (All enemies of (Owner of (Picked unit)))) matching (((Matching unit) is A town-hall-type unit) Equal to True))))
                      • Unit - Order (Picked unit) to Unload All At TEMP_PointTransport
                      • Custom script: call RemoveLocation(udg_TEMP_PointTransport)
                    • Else - Actions
        • Else - Actions
  • AI transport unload units 2
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) controller) Equal to Computer
      • (Percentage life of (Attacked unit)) Less than or equal to 40.00
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacked unit)) Equal to Aurochs
          • (Unit-type of (Attacked unit)) Equal to Broodmother
          • (Unit-type of (Attacked unit)) Equal to Overlord of the Void
    • Actions
      • Unit - Order (Attacked unit) to Unload All At (Position of (Attacked unit))
 
Last edited:
Status
Not open for further replies.
Top