It's time to extend and improve our original script. We'll use the script parts introduced in the last sections and create our first competitive AI script. Let's do it!
We reuse the basic script, with the exception of the zealot rush loop. We just replace it with the first instance of our multirun m_rushcheck script part. We also include the other research multirun script parts after the ground upgrades multirun.
...
build 4 probe 130
wait_build 4 probe
; === MAIN ===
multirun m_myfunding
; --- RESEARCH
multirun r_groundupgrades
multirun r_cybupgrades
multirun r_roboticsupgrades
multirun r_observerupgrades
multirun r_templarupgrades
multirun r_airupgrades
build 5 probe 80
wait_buildstart 5 probe
...
goto b_gateway
:a_gateway
farms_timing
build 9 probe 80
wait_buildstart 9 probe
build 10 probe 80
wait_buildstart 10 probe
build 1 assimilator 80
wait_buildstart 1 assimilator
goto b_forge
:a_forge
build 11 probe 80
wait_buildstart 11 probe
multirun m_rushcheck
Thanks to the delays in the rush check, we might just have enough resources (700+ minerals) by the time
it reaches the zealot rush check. On the Fastest Map Ever a zealot rush this early will likely surprise
a slow Terran player.
The next two lines define the defense units using the start defense block we have seen earlier.
goto b_startdefenseblock
:a_startdefenseblock
Should the AI be attacked it will now react properly.
The next two lines might bring a smile to your face. It's these two lines that really make this a "Fastest Map Ever" AI script.
build 2 nexus 80
wait_buildstart 2 nexus
This doubles our probe building capacity. It's a pity the amount of probes for the main base
is maxed (hard-coded) at 30 for any AI script.
The next block of code is quite long, but it contains mostly pylon and probe building lines. "Why still tell the AI to build pylons? You already included the farms_timing command!", you might think. The reason is simple: sometimes it's hard for the AI to find the space (near a pylon) to build for example a templar archives, stargate or a fleet_beacon. By telling it to first build extra pylons and immediately after that start the construction of the needed building (e.g. templar archives) the buildup will not be slowed down.
build 14 probe 80
wait_buildstart 14 probe
build 5 pylon 80
wait_buildstart 5 pylon
goto b_cybernetics
:a_cybernetics
build 16 probe 80
wait_buildstart 16 probe
train 4 dragoon
build 18 probe 80
wait_buildstart 18 probe
build 7 pylon 80
wait_buildstart 7 pylon
goto b_shield
:a_shield
build 20 probe 80
wait_buildstart 20 probe
build 22 probe 80
wait_buildstart 22 probe
build 9 pylon 80
wait_buildstart 9 pylon
goto b_cannon0
:a_cannon0
multirun m_rushcheck
build 24 probe 80
wait_buildstart 24 probe
goto b_robotics0
:a_robotics0
build 26 probe 80
wait_buildstart 26 probe
build 11 pylon 80
wait_buildstart 11 pylon
goto b_cannon1
:a_cannon1
build 28 probe 80
wait_buildstart 28 probe
build 13 pylon 80
wait_buildstart 13 pylon
goto b_templar
:a_templar
multirun m_rushcheck
build 30 probe 80
wait_buildstart 30 probe
build 15 pylon 80
wait_buildstart 15 pylon
build 17 pylon 80
wait_buildstart 17 pylon
goto b_robotics1
:a_robotics1
A summary of the above is:
Now that we are able to build advanced units for defense we use the final defense block:
goto b_finaldefenseblock
:a_finaldefenseblock
Easy! We are getting close to the finish line now.
We round up our build up phase with:
build 19 pylon 80
wait_buildstart 19 pylon
goto b_fleet
:a_fleet
multirun m_rushcheck
build 21 pylon 80
wait_buildstart 21 pylon
build 23 pylon 80
wait_buildstart 23 pylon
goto b_arbiter
:a_arbiter
multirun m_rushcheck
goto b_robotics2
:a_robotics2
And not to forget 6 extra pylons.
Now we are ready to start our repeat loop:
; === REPEAT LOOP ===
:repeatmain
send_suicide 0
multirun m_bigattackcheck
wait 4000
goto repeatmain
Here we finally use the send_suicide 0 to launch large scale
attacks on our enemies. In combination with the "m_bigattackcheck"
multirun script we keep training a huge attack force and sending them
on suicide missions. We include a delay to give the AI the time to
train the necessary units. That's it!
Here is our script "Protoss Expansion Custom Level.asc3" in its full glory (640 lines!):
; ASC3 File generated by ScAIEdit III
;
; Script name : Protoss Expansion Custom Level
;
; Protoss Multirun Script v1.0 - Created by [M_K]
;
script_name Protoss Expansion Custom Level
script_id PMCx
; === STARTUP COMMANDS ===
start_town
transports_off
farms_notiming
; === DEFINE MAX PER UNIT ===
define_max 100 probe
define_max 100 zealot
define_max 100 dragoon
define_max 100 reaver
define_max 100 scout
define_max 100 shuttle
define_max 100 carrier
define_max 100 observer
define_max 100 corsair
define_max 100 high_templar
define_max 100 dark_archon
define_max 100 archon
define_max 100 arbiter
define_max 100 dark_templar
; === START ===
build 1 nexus 150
wait_build 1 nexus
build 4 probe 130
wait_build 4 probe
; === MAIN ===
multirun m_myfunding
; --- RESEARCH
multirun r_roboticsupgrades
multirun r_groundupgrades
multirun r_cybupgrades
multirun r_observerupgrades
multirun r_templarupgrades
multirun r_airupgrades
build 5 probe 80
wait_buildstart 5 probe
build 6 probe 80
wait_buildstart 6 probe
build 1 pylon 80
wait_buildstart 1 pylon
build 7 probe 80
wait_buildstart 7 probe
build 8 probe 80
wait_buildstart 8 probe
goto b_gateway
:a_gateway
farms_timing
build 9 probe 80
wait_buildstart 9 probe
build 10 probe 80
wait_buildstart 10 probe
build 1 assimilator 80
wait_buildstart 1 assimilator
goto b_forge
:a_forge
build 11 probe 80
wait_buildstart 11 probe
multirun m_rushcheck
goto b_startdefenseblock
:a_startdefenseblock
build 2 nexus 80
wait_buildstart 2 nexus
build 14 probe 80
wait_buildstart 14 probe
build 5 pylon 80
wait_buildstart 5 pylon
goto b_cybernetics
:a_cybernetics
build 16 probe 80
wait_buildstart 16 probe
train 4 dragoon
build 18 probe 80
wait_buildstart 18 probe
build 7 pylon 80
wait_buildstart 7 pylon
goto b_shield
:a_shield
build 20 probe 80
wait_buildstart 20 probe
build 22 probe 80
wait_buildstart 22 probe
build 9 pylon 80
wait_buildstart 9 pylon
goto b_cannon0
:a_cannon0
multirun m_rushcheck
build 24 probe 80
wait_buildstart 24 probe
goto b_robotics0
:a_robotics0
build 26 probe 80
wait_buildstart 26 probe
build 11 pylon 80
wait_buildstart 11 pylon
goto b_cannon1
:a_cannon1
build 28 probe 80
wait_buildstart 28 probe
build 13 pylon 80
wait_buildstart 13 pylon
goto b_templar
:a_templar
multirun m_rushcheck
build 30 probe 80
wait_buildstart 30 probe
build 15 pylon 80
wait_buildstart 15 pylon
build 17 pylon 80
wait_buildstart 17 pylon
goto b_robotics1
:a_robotics1
goto b_finaldefenseblock
:a_finaldefenseblock
build 19 pylon 80
wait_buildstart 19 pylon
goto b_fleet
:a_fleet
multirun m_rushcheck
build 21 pylon 80
wait_buildstart 21 pylon
build 23 pylon 80
wait_buildstart 23 pylon
goto b_arbiter
:a_arbiter
multirun m_rushcheck
goto b_robotics2
:a_robotics2
; === REPEAT LOOP ===
:repeatmain
send_suicide 0
multirun m_bigattackcheck
wait 4000
goto repeatmain
; === BUILD SCRIPT PARTS ===
; >> GATEWAY SCRIPT PART
:b_gateway
wait_build 1 pylon
build 1 gateway 80
wait_buildstart 1 gateway
build 2 pylon 80
wait_buildstart 2 pylon
wait_build 1 gateway
train 1 zealot
build 3 gateway 80
wait_build 3 gateway
train 4 zealot
goto a_gateway
; >> FORGE SCRIPT PART
:b_forge
wait_build 1 pylon
build 2 forge 80
wait_buildstart 2 forge
goto a_forge
; >> PHOTON CANNON 0 SCRIPT PART
:b_cannon0
wait_build 1 forge
build 1 photon_cannon 80
wait_buildstart 1 photon_cannon
build 2 photon_cannon 80
wait_buildstart 2 photon_cannon
goto a_cannon0
; >> SHIELD BATTERY SCRIPT PART
:b_shield
wait_build 1 cybernetics_core
build 1 shield_battery 80
wait_build 1 shield_battery
build 2 shield_battery 80
wait_build 2 shield_battery
goto a_shield
; >> CYBERNETICS CORE SCRIPT PART
:b_cybernetics
wait_build 1 gateway
build 2 cybernetics_core 80
wait_buildstart 2 cybernetics_core
build 4 gateway 80
wait_buildstart 4 gateway
goto a_cybernetics
; >> ROBOTICS 0 SCRIPT PART
:b_robotics0
wait_build 1 cybernetics_core
build 1 robotics_facility 80
wait_buildstart 1 robotics_facility
wait_build 1 robotics_facility
train 1 shuttle
goto a_robotics0
; >> ROBOTICS 1 SCRIPT PART
:b_robotics1
wait_build 1 robotics_facility
build 1 robotics_support_bay 80
wait_buildstart 1 robotics_support_bay
build 1 observatory 80
wait_buildstart 1 observatory
build 2 robotics_facility 80
wait_buildstart 2 robotics_facility
wait_build 1 robotics_support_bay
train 1 reaver
wait_build 1 observatory
train 1 observer
goto a_robotics1
; >> ROBOTICS 2 SCRIPT PART
:b_robotics2
wait_build 1 robotics_facility
build 4 robotics_facility 80
wait_buildstart 4 robotics_facility
goto a_robotics2
; >> FLEET SCRIPT PART
:b_fleet
wait_build 1 cybernetics_core
build 1 stargate 80
wait_buildstart 1 stargate
wait_build 1 stargate
train 1 corsair
build 1 fleet_beacon 80
wait_buildstart 1 fleet_beacon
build 3 stargate 80
wait_buildstart 3 stargate
goto a_fleet
; >> TEMPLAR SCRIPT PART
:b_templar
wait_build 1 cybernetics_core
build 1 citadel_of_adun 80
wait_buildstart 1 citadel_of_adun
wait_build 1 citadel_of_adun
build 1 templar_archives 80
wait_buildstart 1 templar_archives
build 5 gateway 80
wait_buildstart 5 gateway
wait_build 1 templar_archives
train 4 high_templar
goto a_templar
; >> ARBITER SCRIPT PART
:b_arbiter
wait_build 1 stargate
wait_build 1 templar_archives
build 1 arbiter_tribunal 80
wait_buildstart 1 arbiter_tribunal
build 5 stargate 80
wait_buildstart 5 stargate
wait_build 1 arbiter_tribunal
place_guard arbiter 0
train 3 carrier
train 1 arbiter
build 6 stargate 80
wait_buildstart 6 stargate
goto a_arbiter
; >> PHOTON CANNON 1 SCRIPT PART
:b_cannon1
wait_build 1 forge
build 3 photon_cannon 80
wait_buildstart 3 photon_cannon
build 4 photon_cannon 80
wait_buildstart 4 photon_cannon
build 5 photon_cannon 80
wait_buildstart 5 photon_cannon
goto a_cannon1
; === ATTACK SCRIPT PARTS ===
; >> ZEALOT RUSH SCRIPT PART
:b_zealotrush
wait_build 1 gateway
train 7 zealot
attack_add 7 zealot
attack_prepare
attack_do
attack_clear
goto a_zealotrush
; >> DRAGOON RUSH SCRIPT PART
:b_dragoonrush
wait_build 1 gateway
wait_build 1 cybernetics_core
train 8 zealot
train 4 dragoon
attack_add 8 zealot
attack_add 4 dragoon
attack_prepare
attack_do
attack_clear
goto a_dragoonrush
; >> DARK TEMPLAR RUSH SCRIPT PART
:b_darkrush
wait_build 1 gateway
wait_build 1 templar_archives
train 5 dark_templar
attack_add 5 dark_templar
attack_prepare
attack_do
attack_clear
goto a_darkrush
; >> CARRIER RUSH SCRIPT PART
:b_carrierrush
wait_build 1 stargate
wait_build 1 fleet_beacon
train 3 carrier
attack_add 3 carrier
attack_prepare
attack_do
attack_clear
goto a_carrierrush
; >> ARBITER RUSH SCRIPT PART
:b_arbiterrush
wait_build 1 stargate
wait_build 1 fleet_beacon
wait_build 1 arbiter_tribunal
train 8 carrier
train 2 arbiter
attack_add 8 carrier
attack_add 2 arbiter
attack_prepare
attack_do
attack_clear
goto a_arbiterrush
; >> MASS ZEALOT SCRIPT PART
:b_masszealot
wait_build 1 gateway
train 30 zealot
goto a_masszealot
; >> MASS DARK TEMPLAR SCRIPT PART
:b_massdark
wait_build 1 gateway
wait_build 1 templar_archives
train 20 dark_templar
goto a_massdark
; >> MASS SCOUT/REAVER SCRIPT PART
:b_massreaver
wait_build 1 stargate
wait_build 1 robotics_support_bay
wait_build 1 robotics_facility
train 12 scout
train 8 reaver
goto a_massreaver
; >> MASS ARBITER SCRIPT PART
:b_massarbiter
wait_build 1 stargate
wait_build 1 fleet_beacon
wait_build 1 arbiter_tribunal
train 6 arbiter
train 12 carrier
goto a_massarbiter
; --- FUNDING MULTIRUN SCRIPT
:m_myfunding
wait 1000
give_money
goto m_myfunding
; --- START DEFENSE BLOCK
:b_startdefenseblock
defenseclear_gg
defensebuild_gg 1 zealot
defenseuse_gg 1 zealot
defensebuild_gg 1 dragoon
defenseuse_gg 1 dragoon
defensebuild_gg 1 reaver
defenseuse_gg 1 reaver
defensebuild_gg 1 dark_templar
defenseuse_gg 1 dark_templar
defensebuild_gg 1 carrier
defenseuse_gg 1 carrier
defensebuild_gg 1 scout
defenseuse_gg 1 scout
defensebuild_gg 1 archon
defenseuse_gg 1 archon
defenseclear_ag
defensebuild_ag 1 scout
defenseuse_ag 1 scout
defensebuild_ag 1 dragoon
defenseuse_ag 1 dragoon
defensebuild_ag 1 archon
defenseuse_ag 1 archon
defensebuild_ag 1 dark_archon
defenseuse_ag 1 dark_archon
defensebuild_ag 1 carrier
defenseuse_ag 1 carrier
defensebuild_aa 1 corsair
defenseuse_aa 1 corsair
defensebuild_aa 1 scout
defenseuse_aa 1 scout
defensebuild_aa 1 carrier
defenseuse_aa 1 carrier
defensebuild_ga 1 carrier
defenseuse_ga 1 carrier
defensebuild_ga 1 scout
defenseuse_ga 1 scout
goto a_startdefenseblock
; --- FINAL DEFENSE BLOCK
:b_finaldefenseblock
defenseclear_gg
defensebuild_gg 1 reaver
defenseuse_gg 1 reaver
defensebuild_gg 1 dark_templar
defenseuse_gg 1 dark_templar
defensebuild_gg 1 carrier
defenseuse_gg 1 carrier
defenseclear_ag
defensebuild_ag 1 scout
defenseuse_ag 1 scout
defensebuild_ag 1 dragoon
defenseuse_ag 1 dragoon
defensebuild_ag 1 archon
defenseuse_ag 1 archon
defensebuild_ag 1 dark_archon
defenseuse_ag 1 dark_archon
defensebuild_ag 1 carrier
defenseuse_ag 1 carrier
defensebuild_aa 1 corsair
defenseuse_aa 1 corsair
defensebuild_aa 1 scout
defenseuse_aa 1 scout
defensebuild_aa 1 carrier
defenseuse_aa 1 carrier
defensebuild_ga 1 carrier
defenseuse_ga 1 carrier
defensebuild_ga 1 scout
defenseuse_ga 1 scout
goto a_finaldefenseblock
; --- RUSH CHECK MULTIRUN SCRIPT PART
:m_rushcheck
notowns_jump arbiter_tribunal carriercheck
wait 1200
resources_jump 2000 2000 b_arbiterrush
:a_arbiterrush
:carriercheck
notowns_jump fleet_beacon darkcheck
wait 600
resources_jump 1000 700 b_carrierrush
:a_carrierrush
:darkcheck
notowns_jump templar_archives dragooncheck
wait 400
resources_jump 600 400 b_darkrush
:a_darkrush
:dragooncheck
notowns_jump cybernetics_core zealotcheck
wait 200
resources_jump 1200 200 b_dragoonrush
:a_dragoonrush
:zealotcheck
notowns_jump gateway nocheck
wait 100
resources_jump 700 0 b_zealotrush
:a_zealotrush
:nocheck
stop
; --- BIG ATTACK CHECK MULTIRUN SCRIPT PART
:m_bigattackcheck
notowns_jump arbiter_tribunal massreavercheck
wait 1000
resources_jump 2000 2000 b_massarbiter
:a_massarbiter
:massreavercheck
notowns_jump robotics_support_bay massdarkcheck
notowns_jump stargate massdarkcheck
wait 1000
resources_jump 2000 1000 b_massreaver
:a_massreaver
:massdarkcheck
notowns_jump templar_archives masszealotcheck
wait 1000
resources_jump 2000 1500 b_massdark
:a_massdark
:masszealotcheck
notowns_jump gateway nomasscheck
wait 1000
resources_jump 2000 0 b_masszealot
:a_masszealot
:nomasscheck
stop
; --- RESEARCH MULTIRUN SCRIPTS
:r_groundupgrades
wait_build 2 forge
upgrade 1 p_ground_weapon 70
upgrade 1 p_plasma_shield 70
wait 2700
wait_build 1 cybernetics_core
upgrade 1 p_armor 70
upgrade 2 p_plasma_shield 70
wait 3600
wait_build 1 templar_archives
upgrade 2 p_ground_weapon 70
upgrade 3 p_plasma_shield 70
wait 4500
upgrade 3 p_ground_weapon 70
upgrade 2 p_armor 70
wait 4500
upgrade 3 p_armor 70
stop
:r_cybupgrades
wait_build 2 cybernetics_core
upgrade 1 dragoon_range 70
upgrade 1 p_air_weapon 70
wait 2700
upgrade 1 p_plating 70
stop
:r_roboticsupgrades
wait_build 1 robotics_support_bay
upgrade 1 shuttle_speed 70
wait 3600
upgrade 1 reaver_capacity 70
wait 3600
upgrade 1 scarab_damage 70
stop
:r_observerupgrades
wait_build 1 observatory
upgrade 1 observer_speed 70
wait 2700
upgrade 1 observer_sight 70
stop
:r_templarupgrades
wait_build 1 citadel_of_adun
upgrade 1 zealot_speed 70
wait_build 1 templar_archives
tech psionic_storm 70
wait 2700
tech maelstrom 70
wait 2700
upgrade 1 templar_mana 70
wait 2700
upgrade 1 dark_archon_mana 70
wait 3600
tech mind_control 70
stop
:r_airupgrades
wait_build 1 fleet_beacon
upgrade 1 carrier_capacity 70
upgrade 2 p_air_weapon 70
upgrade 2 p_plating 70
wait 3600
tech disruption_web 70
upgrade 3 p_air_weapon 70
upgrade 3 p_plating 70
wait 4500
upgrade 1 scout_speed 70
wait 3600
upgrade 1 corsair_mana 70
wait 3600
upgrade 1 scout_sight 70
wait_build 1 arbiter_tribunal
tech statis_field 70
wait 4500
upgrade 1 arbiter_mana 70
stop
You can also find the source here. Just save it to "Protoss Expansion Custom Level.asc3".
If we want to make sure the script performs adequately we test it
against other AI scripts. We will first test it against a Terran and Zerg
1.04 Broodwar AI script. The 1.04 Broodwar AI scripts are not designed to
cope with the abundant resources on Fastest Map Ever. Furthermore, they
don't use the "give_money" command. Knowing this we predict an easy victory
for our AI.
The test setup on Fastest Map Ever.V4 was as follows:
TOP vs BOTTOM, 4 vs 4:
AI_Tester
Computer (Protoss)
vs
Computer (1.04 Terran)
Computer (1.04 Zerg)
The game was a multiplayer IPX game, with one passive (defense only) human player - me ;)








A nice result! In a few lessons we managed to change our simple
zealot rush script into a challenging script,
optimized for high resource ground maps. It uses repeated attacks with a variety
of attack groups to push the opponent into defensive play.
With the information gained from these tutorials it will now be easy for you to create your own Protoss AI,
Terran AI or even Zerg AI for high resource ground maps. Be original,
but make sure your script source stays manageable. Have fun and be sure to check back regularly
for more tutorials, tips and tricks!
| Previous | Back to Index |