Kryose's AI question(s) - ongoing

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
Kryose
Posts: 49
Joined: Fri Apr 25, 2008 4:26 pm

Postby Kryose » Mon May 05, 2008 12:10 pm

[quote name='bajadulce' post='3780' date='May 3 2008, 10:10 AM']The information in SCAIEDit's tutorial as well as Michel's tutorial are outdated in terms of building .exe's for your modified scripts. We use MPQDRaft exclusively to build SEMPQ's. (the little gear-shaped exes) you see around here. BUT, you can skip that if you have WINMPQ and an existing .exe (such as the one ashara made) by overwriting the existing aiscript.bin with your file. I made a small guide here at this site for doing such a thing, but some clown deleted it because he thought firegraft was better for some reason. That was the last straw and I axed all the moderators on the site.

Anyways, the OLD forum still has some info in regards to this: just replace "blankAI.exe" with Asharas or BlankAi_Vista.exe.
http://z8.invisionfree.com/BroodWarAi/index.php?showtopic=10[/quote]

Thanks Bajadulce, I went through the steps and was able to update my AI to the newer one. The one thing that might be a problem though is that I think it cleared out the protoss and zerg AI in the process, as they now do nothing. Did I miss anything?

UPDATE: I have been reading through Ashara's Tutorial and it addresses this.

Also, I am still having problems with the comsat station. My AI does not build ANY... but in late game, it does build a nuclear silo and I believe I am using the same logic. I tried moving the SCV's to build after the comsat is being built just in case the comsat cannot be built because the command center is busy. But no luck. Any suggestions? Also, is there any way to randomize? Say I want it to randomly pick between this tech tree and that tech tree, is that possible?

From my other changes...
-The AI expands like a dream now, although I need to add a loop at the end to keep it expanding after it completes it's tech.
-Moving the startdefense to earlier in the main made sure that there were marines in the defensive bunker.
-The Physics Lab/Covert Ops problem could still be a problem, but that's because I forgot to check if it was fixed.
-The same goes for the extra SCVs. I didn't really check if there were enough, although the extra's that I did add probably made a big difference

Thanks,
Kryose

- Newest version
[spoiler]; ASC3 File generated by ScAIEdit III
;
; Script name : Terran Expansion Custom Level
;
; Terran Multirun Script v1.01 - Created by Kryose - Modified by Ashara
;

script_name Terran Expansion Custom Level
script_id TMCx

; === STARTUP COMMANDS ===
start_town
transports_off
farms_notiming

; === MAX UNIT DEFINITION ===

define_max 100 scv
define_max 75 marine
define_max 75 medic
define_max 25 firebat
define_max 50 ghost
define_max 75 vulture
define_max 20 siege_tank
define_max 20 goliath
define_max 40 wraith
define_max 20 battlecruiser
define_max 2 nuclear_missile
define_max 4 science_vessel
define_max 3 dropship
define_max 2 valkyrie


; === START ===

build 1 command_center 150
wait_build 1 command_center
build 4 scv 130
wait_build 4 scv

multirun m_funding


; === MAIN ===

; --- RESEARCH ---

multirun r_academy
multirun r_engineering_bay
multirun r_machine_shop
multirun r_control_tower
multirun r_armory
multirun r_covert_ops
multirun r_physics_lab
multirun r_science_facility

; --- ECONOMY/BUILDING ---

build 5 scv 80
wait_buildstart 5 scv
build 6 scv 80
wait_buildstart 6 scv
build 7 scv 80
wait_buildstart 7 scv
build 1 supply_depot 80
wait_buildstart 1 supply_depot
build 8 scv 80
wait_buildstart 8 scv

goto b_barracks1
:a_barracks1

farms_timing

build 9 scv 80
wait_buildstart 9 scv
build 10 scv 80
wait_buildstart 10 scv
build 1 refinery 80
wait_buildstart 1 refinery

goto b_bunker1
:a_bunker1

build 11 scv 80
wait_buildstart 11 scv

goto b_academy
:a_academy

build 12 scv 80
wait_buildstart 12 scv

goto b_barracks2
:a_barracks2

goto b_startdefense
:a_startdefense

build 13 scv 80
wait_buildstart 13 scv
build 14 scv 80
wait_buildstart 14 scv
build 15 scv 80
wait_buildstart 15 scv
build 16 scv 80
wait_buildstart 16 scv
build 17 scv 80
wait_buildstart 17 scv

goto b_engineeringbay
:a_engineeringbay

multirun m_rushcheck

expand 99 b_expansion

goto b_factory1
:a_factory1

build 4 scv 80

multirun m_rushcheck

build 4 scv 80

expand 99 b_expansion

goto b_factory2
:a_factory2

goto b_armory
:a_armory

multirun m_rushcheck

build 4 scv 80

goto b_starport
:a_starport

build 3 scv 80

multirun m_rushcheck

goto b_bunker2
:a_bunker2

goto b_turret
:a_turret

build 3 scv 80

multirun m_rushcheck

expand 99 b_expansion

goto b_starport2
:a_starport2

build 2 scv 80

goto b_sciencefacility
:a_sciencefacility

multirun m_rushcheck

goto b_finaldefense
:a_finaldefense

build 2 scv 80

expand 99 b_expansion

multirun m_rushcheck

expand 99 b_expansion

; === END LOOP ===

:suicideloop
multirun m_masscheck
expand 99 b_expansion
wait 4000
send_suicide 0
goto suicideloop

; === FUNDING MULTI-RUN ===

:m_funding
wait 1000
give_money
goto m_funding


; === EXPANSION SCRIPT ===

:b_expansion
start_town
build 1 command_center 80
wait_build 1 command_center
build 8 scv 70
wait_build 1 barracks
build 1 bunker 70
build 1 refinery 70

notowns_jump engineering_bay b_comsatexpo
build 4 missile_turret 70

:b_comsatexpo
notowns_jump academy endexpo
build 1 comsat_station 80

:endexpo
stop


; === BUILD SCRIPT ===

; --- BARRACKS ---

:b_barracks1
build 1 barracks 80
wait_buildstart 1 barracks
build 2 supply_depot 80
wait_buildstart 2 supply_depot
wait_build 1 barracks
train 1 marine
goto a_barracks1

; --- BUNKER1 ---

:b_bunker1
wait_build 1 barracks
build 1 bunker 80
wait_buildstart 1 bunker
train 4 marine
goto a_bunker1


; --- ACADEMY ---

:b_academy
wait_build 1 barracks
build 1 academy 80
wait_buildstart 1 academy
goto a_academy


; --- BARRACKS2 ---

:b_barracks2
build 4 barracks 80
wait_buildstart 4 barracks
wait_build 1 academy
wait_build 4 barracks
train 4 marine
train 2 firebat
train 2 medic
goto a_barracks2


; --- ENGINEERING BAY ---

:b_engineeringbay
wait_build 1 barracks
build 1 engineering_bay 80
wait_buildstart 1 engineering_bay
wait_build 1 engineering_bay
build 3 missile_turret 70
goto a_engineeringbay


; --- FACTORY1 ---

:b_factory1
wait_build 1 barracks
build 1 factory 80
wait_buildstart 1 factory
wait_build 1 factory
train 2 vulture
build 1 machine_shop 80
wait_buildstart 1 machine_shop
wait_build 1 machine_shop
train 2 siege_tank
train 2 vulture
goto a_factory1


; --- FACTORY2 ---

:b_factory2
wait_build 1 barracks
build 4 factory 80
wait_buildstart 4 factory
wait_build 4 factory
build 2 machine_shop 80
wait_buildstart 2 machine_shop
wait_build 2 machine_shop
train 3 siege_tank
goto a_factory2


; --- ARMORY ---

:b_armory
wait_build 1 factory
build 2 armory 80
wait_buildstart 2 armory
wait_build 1 armory
train 3 goliath
goto a_armory


; --- STARPORT ---

:b_starport
wait_build 1 factory
build 1 starport 80
wait_buildstart 1 starport
wait_build 1 starport
train 2 wraith
build 1 control_tower 80
wait_buildstart 1 control_tower
goto a_starport


; --- BUNKER2 ---

:b_bunker2
wait_build 1 barracks
build 5 bunker 80
train 10 marine
train 4 firebat
goto a_bunker2


; --- TURRET ---

:b_turret
wait_build 1 engineering_bay
build 10 missile_turret 80
goto a_turret


; --- STARPORT2 ---

:b_starport2
wait_build 1 factory
build 4 starport 80
wait_buildstart 4 starport
wait_build 4 starport
build 3 control_tower 80
goto a_starport2


; --- SCIENCE FACILITY ---

:b_sciencefacility
wait_build 1 starport
build 2 science_facility 80
wait_buildstart 2 science_facility
wait_build 2 science_facility
train 2 science_vessel
build 1 physics_lab 80
wait_buildstart 1 physics_lab
build 1 covert_ops 80
wait_buildstart 1 covert_ops
wait_build 1 physics_lab
train 1 battlecruiser
wait_build 1 covert_ops
build 1 nuclear_silo 80
goto a_sciencefacility


; === DEFENSE SCRIPTS ===

; --- STARTING DEFENSE ---

:b_startdefense
defenseclear_gg
defensebuild_gg 2 marine
defenseuse_gg 2 marine
defensebuild_gg 1 firebat
defenseuse_gg 1 firebat
defensebuild_gg 1 vulture
defenseuse_gg 1 vulture
defensebuild_gg 2 siege_tank
defenseuse_gg 2 siege_tank
defensebuild_gg 1 goliath
defenseuse_gg 1 goliath
defensebuild_gg 1 wraith
defenseuse_gg 1 wraith
defensebuild_gg 1 battlecruiser
defenseuse_gg 1 battlecruiser
defenseclear_ag
defensebuild_ag 2 marine
defenseuse_ag 2 marine
defensebuild_ag 1 goliath
defenseuse_ag 1 goliath
defensebuild_ag 1 wraith
defenseuse_ag 1 wraith
defensebuild_ag 1 battlecruiser
defenseuse_ag 1 battlecruiser
defenseclear_aa
defensebuild_aa 1 valkyrie
defenseuse_aa 1 valkyrie
defensebuild_aa 1 wraith
defenseuse_aa 1 wraith
defensebuild_aa 1 battlecruiser
defenseuse_aa 1 battlecruiser
defenseclear_ga
defensebuild_ga 1 wraith
defenseuse_ga 1 wraith
defensebuild_ga 1 battlecruiser
defenseuse_ga 1 battlecruiser
goto a_startdefense


; --- FINAL DEFENSE ---

:b_finaldefense
defenseclear_gg
defensebuild_gg 2 ghost
defenseuse_gg 2 ghost
defensebuild_gg 2 siege_tank
defenseuse_gg 2 siege_tank
defensebuild_gg 2 goliath
defenseuse_gg 2 goliath
defensebuild_gg 2 wraith
defenseuse_gg 2 wraith
defensebuild_gg 2 battlecruiser
defenseuse_gg 2 battlecruiser
defenseclear_ag
defensebuild_ag 1 goliath
defenseuse_ag 1 goliath
defensebuild_ag 2 ghost
defenseuse_ag 2 ghost
defensebuild_ag 1 wraith
defenseuse_ag 1 wraith
defensebuild_ag 1 battlecruiser
defenseuse_ag 1 battlecruiser
defenseclear_aa
defensebuild_aa 1 valkyrie
defenseuse_aa 1 valkyrie
defensebuild_aa 1 wraith
defenseuse_aa 1 wraith
defensebuild_aa 1 battlecruiser
defenseuse_aa 1 battlecruiser
defenseclear_ga
defensebuild_ga 1 wraith
defenseuse_ga 1 wraith
defensebuild_ga 1 battlecruiser
defenseuse_ga 1 battlecruiser
goto a_finaldefense


; === RUSH CHECKS ===

:m_rushcheck

; --- RUSH BATTLECRUISER/WRAITH CHECK---

notowns_jump physics_lab b_wraithcheck
notowns_jump control_tower b_wraithcheck
wait 1200
resources_jump 1500 1000 b_cruiserrush
:a_cruiserrush


; --- RUSH WRAITH CHECK ---

:b_wraithcheck
notowns_jump starport b_groundcheck
wait 800
resources_jump 750 400 b_wraithrush
:a_wraithrush


; --- RUSH MEDIC/MARINE/VULTURE/TANK CHECK ---

:b_groundcheck
notowns_jump machine_shop b_tankcheck
notowns_jump academy b_tankcheck
notowns_jump barracks b_tankcheck
wait 600
resources_jump 1200 300 b_groundrush
:a_groundrush


; --- RUSH VULTURE/TANK CHECK ---

:b_tankcheck
notowns_jump machine_shop b_marinecheck
wait 400
resources_jump 750 300 b_tankrush
:a_tankrush


; --- RUSH MEDIC/MARINE CHECK ---

:b_marinecheck
notowns_jump academy nocheck
notowns_jump barracks nocheck
wait 200
resources_jump 500 50 b_marinerush
:a_marinerush

:nocheck
stop


; === RUSH ATTACK SCRIPTS ===

; --- MEDIC/MARINE RUSH ---

:b_marinerush
wait_build 1 barracks
wait_build 1 academy
train 10 marine
train 4 medic
attack_add 10 marine
attack_add 4 medic
attack_prepare
attack_do
attack_clear
goto a_marinerush


; --- VULTURE/TANK RUSH ---

:b_tankrush
wait_build 1 factory
wait_build 1 machine_shop
train 5 siege_tank
train 5 vulture
attack_add 5 siege_tank
attack_add 5 vulture
attack_prepare
attack_do
attack_clear
goto a_tankrush


; --- MEDIC/MARINE/VULTURE/TANK RUSH ---

:b_groundrush
wait_build 1 barracks
wait_build 1 academy
wait_build 1 factory
wait_build 1 machine_shop
train 5 siege_tank
train 4 vulture
train 8 marine
train 3 medic
attack_add 5 siege_tank
attack_add 4 vulture
attack_add 8 marine
attack_add 3 medic
attack_prepare
attack_do
attack_clear
goto a_groundrush


; --- WRAITH RUSH ---

:b_wraithrush
wait_build 1 starport
train 6 wraith
attack_add 6 wraith
attack_prepare
attack_do
attack_clear
goto a_wraithrush


; --- BATTLECRUISER/WRAITH RUSH ---

:b_cruiserrush
wait_build 1 starport
wait_build 1 control_tower
wait_build 1 science_facility
wait_build 1 physics_lab
train 4 wraith
train 2 battlecruiser
attack_add 4 wraith
attack_add 2 battlecruiser
attack_prepare
attack_do
attack_clear
goto a_cruiserrush


; === MASS CHECKS ===

:m_masscheck

; --- MASS BATTLECRUISER CHECK ---

notowns_jump control_tower b_masswraithcheck
notowns_jump physics_lab b_masswraithcheck
wait 1000
resources_jump 2000 2000 b_cruisermass
:a_cruisermass

; --- MASS WRAITH CHECK ---

:b_masswraithcheck
notowns_jump starport b_masstankcheck
wait 1000
resources_jump 2000 1800 b_wraithmass
:a_wraithmass

; --- MASS VULTURE/TANK/GOLIATH CHECK ---

:b_masstankcheck
notowns_jump machine_shop b_massinfantrycheck
notowns_jump armory b_massinfantrycheck
wait 1000
resources_jump 2000 1500 b_tankmass
:a_tankmass

; --- MASS MEDIC/MARINE/GHOST CHECK ---

:b_massinfantrycheck
notowns_jump academy b_massmedicmarinecheck
notowns_jump barracks b_massmedicmarinecheck
notowns_jump covert_ops b_massmedicmarinecheck
wait 1000
resources_jump 2000 500 b_infantrymass
:a_infantrymass

; --- MASS MEDIC/MARINE CHECK ---

:b_massmedicmarinecheck
notowns_jump academy b_massmarinecheck
notowns_jump barracks b_massmarinecheck
wait 1000
resources_jump 2000 250 b_medicmarinemass
:a_medicmarinemass

; --- MASS MARINE CHECK ---

:b_massmarinecheck
notowns_jump academy nomasscheck
notowns_jump barracks nomasscheck
wait 1000
resources_jump 2000 0 b_marinemass
:a_marinemass

:nomasscheck
stop


; === MASS ATTACK SCRIPTS ===

; --- MARINE MASS ---


:b_marinemass
wait_build 1 barracks
train 50 marine
goto a_marinemass


; --- MEDIC/MARIN MASS ---

:b_medicmarinemass
wait_build 1 barracks
wait_build 1 armory
train 40 marine
train 10 medic
goto a_medicmarinemass


; --- MEDIC/MARINE/GHOST MASS ---

:b_infantrymass
wait_build 1 barracks
wait_build 1 academy
wait_build 1 covert_ops
train 30 marine
train 10 medic
train 10 ghost
train 1 science_vessel
train 1 nuclear_missile
goto a_infantrymass


; --- VULTURE/TANK/GOLIATH MASS ---

:b_tankmass
wait_build 1 machine_shop
wait_build 1 armory
train 12 siege_tank
train 20 vulture
train 15 goliath
train 1 science_vessel
goto a_tankmass


; --- WRAITH MASS ---

:b_wraithmass
wait_build 1 starport
train 30 wraith
train 2 science_vessel
goto a_wraithmass


; --- BATTLECRUISER MASS ---


:b_cruisermass
wait_build 1 control_tower
wait_build 1 physics_lab
train 15 battlecruiser
train 2 science_vessel
goto a_cruisermass


; === RESEARCH MULTI-RUN ===

; --- ACADEMY UPGRADES ---

:r_academy
wait_build 1 academy
tech stim_packs 70
wait 3600
upgrade 1 marine_range 70
wait 3600
tech optical_flare 70
wait 3600
upgrade 1 medic_mana 70
wait 3600
tech restoration 70
stop


; --- ENGINEERING BAY UPGRADES ---

:r_engineering_bay
wait_build 1 engineering_bay
upgrade 1 t_infantry_weapon 70
wait 3600
upgrade 1 t_infantry_armor 70
wait 3600
wait_build 1 science_facility
upgrade 2 t_infantry_weapon 70
wait 3600
upgrade 2 t_infantry_armor 70
wait 3600
upgrade 3 t_infantry_weapon 70
wait 3600
upgrade 3 t_infantry_armor 70
stop


; --- MACHINE SHOP UPGRADES ---

:r_machine_shop
wait_build 1 machine_shop
tech spider_mines 70
wait 3600
tech siege_mode 70
wait 3600
upgrade 1 vulture_speed 70
wait 3600
wait_build 1 armory
upgrade 1 goliath_range 70
stop


; --- CONTROL TOWER UPGRADES ---

:r_control_tower
wait_build 1 control_tower
tech cloaking_field 70
wait 3600
upgrade 1 wraith_mana 70
stop


; --- ARMORY UPGRADES ---

:r_armory
wait_build 2 armory
upgrade 1 t_vehicle_weapon 70
upgrade 1 t_ship_weapon 70
wait 3600
wait_build 1 science_facility
upgrade 2 t_vehicle_weapon 70
upgrade 2 t_ship_weapon 70
wait 3600
upgrade 3 t_vehicle_weapon 70
upgrade 3 t_ship_weapon 70
stop


; --- COVERT OPS UPGRADES ---

:r_covert_ops
wait_build 1 covert_ops
tech personnel_cloaking 70
wait 3600
upgrade 1 ghost_mana 70
wait 3600
tech lockdown 70
wait 3600
upgrade 1 ghost_sight 70
stop


; --- PHYSICS LAB UPGRADES ---

:r_physics_lab
wait_build 1 physics_lab
tech yamato_gun 70
wait 3600
upgrade 1 battlecruiser_mana 70
stop

; --- SCIENCE FACILITY UPGRADES ---

:r_science_facility
wait_build 1 science_facility
wait_build 1 physics_lab
wait_build 1 covert_ops
tech irradiate 70
wait 3600
tech emp_shockwave 70
wait 3600
upgrade 1 science_vessel_mana 70
wait 3600
tech defensive_matrix 70
stop[/spoiler]
Kryose
Posts: 49
Joined: Fri Apr 25, 2008 4:26 pm

Postby Kryose » Mon May 05, 2008 7:57 pm

1. When you want to train an Archon or a Dark Archon, do you need to first train 2 High Templars or 2 Dark Templars?

2. I assume multi-runs can be used for any section of code not only including research, but also building. Is it worth it to code an AI that uses multi-runs for individual buildings? From my perspective, as long as you have proper wait_build statements, it should work out fine... though just thinking about it now, it could screw over your rush attacks. Any thoughts on this?

That's all the questions for now. If I have more I will try to post them in this thread so that I don't bung up the forum.

Thanks,
Kryose
User avatar
ashara
Posts: 170
Joined: Wed Feb 06, 2008 11:12 pm

Postby ashara » Mon May 05, 2008 8:44 pm

A question thread, like everyone making new AI's including me :)
Actually my guess would have been a wrong answer to the first one, I still have many things to learn :P

1. When you want to train an Archon or a Dark Archon, do you need to first train 2 High Templars or 2 Dark Templars?

I just tried it and you don't need to train High Templars or Dark Templars before, the AI will automatically train them.


2. I assume multi-runs can be used for any section of code not only including research, but also building. Is it worth it to code an AI that uses multi-runs for individual buildings? From my perspective, as long as you have proper wait_build statements, it should work out fine... though just thinking about it now, it could screw over your rush attacks. Any thoughts on this?


multiruns can be used everywhere. I used multiruns for individual buildings, but it's not really worth it because I haven't understood how prioritization between the different multirun works and too many multirun running at the same time make the AI lagging and ignoring some of them.
I prefer using wait_buildstart instead of wait_build, at least for Terran because it's not blocking if the building SCV is killed.
I nearly always separate training from building by using a multirun, this enables the AI to build even if training is blocked somehow and vice-versa.
Kryose
Posts: 49
Joined: Fri Apr 25, 2008 4:26 pm

Postby Kryose » Wed May 07, 2008 2:20 pm

Thanks for the answers... now here is another question...

Is there any way to randomize what the AI is going to do? eg. randomly selecting between building 6 barracks with tons of marines, or 6 starports with a bunch of wraiths.

Kryose
User avatar
poiuy_qwert
Posts: 548
Joined: Sun Jan 13, 2008 2:14 am

Postby poiuy_qwert » Wed May 07, 2008 2:33 pm

Yes there is, use the "random_jump (byte) (block)" command, and the list of commands says:
There is %1(byte) chances out of 256 to jump to %2(block).

So if you wanted a 50/50 chance of doing one thing or another it would be:

Code: Select all

random_jump 128 option2
do option 1...
stop()

:option2
do option 2...
stop()


Be carefull though, doing:

Code: Select all

random_jump 85 opt2
random_jump 85 opt3
do option 1...
stop()

:opt2
do option 2...
stop()

:opt3
do option 3...
stop()

does not give 1/3 chance to get every option. opt2 will have a 1/3 chance, but the others will then have progressively smaller chances.

Note: I also read that 128 isn't always 50/50 chance, but im not sure. Someone else will help clearify.
Kryose
Posts: 49
Joined: Fri Apr 25, 2008 4:26 pm

Postby Kryose » Wed May 07, 2008 2:45 pm

I think I figured out my comsat issue (where it would not build a comsat during the expansion script).

Before the expansion section looked like this...

[spoiler]; === EXPANSION SCRIPT ===

:b_expansion
start_town
build 1 command_center 80
wait_build 1 command_center
build 8 scv 70
wait_build 1 barracks
build 1 bunker 70
build 1 refinery 70

notowns_jump engineering_bay b_comsatexpo
build 4 missile_turret 70

:b_comsatexpo
notowns_jump academy endexpo
build 1 comsat_station 80

:endexpo
stop[/spoiler]

Now it looks like this...

[spoiler]; === EXPANSION SCRIPT ===

:b_expansion
start_town
build 1 command_center 80
wait_build 1 command_center
build 1 refinery 70

notowns_jump academy b_bunkerexpo
build 1 comsat_station 80

:b_bunkerexpo
notowns_jump barracks b_turretexpo
build 1 bunker 70

:b_turretexpo
notowns_jump engineering_bay endexpo
build 4 missile_turret 70

:endexpo
build 8 scv 80
stop[/spoiler]

As you can see in the old code, I was doing a wait_build 1 barracks command. And from what I have learned so far, the expansion script is considered it's own home-town, so even though I had a barracks build in my main base, the expansion base did not have one, and since it would never have one, it would never get past that line. I have since changed it to a notowns_jump... I will test it when I get home today... unless someone else wants to test it, I have no problems with that.

Thanks,
Kryose

Full code here:

[spoiler]; ASC3 File generated by ScAIEdit III
;
; Script name : Terran Expansion Custom Level
;
; Terran Multirun Script v1.01 - Created by Kryose - Modified by Ashara
;

script_name Terran Expansion Custom Level
script_id TMCx

; === STARTUP COMMANDS ===
start_town
transports_off
farms_notiming

; === MAX UNIT DEFINITION ===

define_max 100 scv
define_max 75 marine
define_max 75 medic
define_max 25 firebat
define_max 50 ghost
define_max 75 vulture
define_max 20 siege_tank
define_max 20 goliath
define_max 40 wraith
define_max 20 battlecruiser
define_max 2 nuclear_missile
define_max 4 science_vessel
define_max 3 dropship
define_max 2 valkyrie


; === START ===

build 1 command_center 150
wait_build 1 command_center
build 4 scv 130
wait_build 4 scv

multirun m_funding


; === MAIN ===

; --- RESEARCH ---

multirun r_academy
multirun r_engineering_bay
multirun r_machine_shop
multirun r_control_tower
multirun r_armory
multirun r_covert_ops
multirun r_physics_lab
multirun r_science_facility

; --- ECONOMY/BUILDING ---

build 5 scv 80
wait_buildstart 5 scv
build 6 scv 80
wait_buildstart 6 scv
build 7 scv 80
wait_buildstart 7 scv
build 1 supply_depot 80
wait_buildstart 1 supply_depot
build 8 scv 80
wait_buildstart 8 scv

goto b_barracks1
:a_barracks1

farms_timing

build 9 scv 80
wait_buildstart 9 scv
build 10 scv 80
wait_buildstart 10 scv
build 1 refinery 80
wait_buildstart 1 refinery

goto b_startdefense
:a_startdefense

goto b_bunker1
:a_bunker1

build 11 scv 80
wait_buildstart 11 scv

goto b_academy
:a_academy

build 12 scv 80
wait_buildstart 12 scv

goto b_barracks2
:a_barracks2

build 13 scv 80
wait_buildstart 13 scv
build 14 scv 80
wait_buildstart 14 scv
build 15 scv 80
wait_buildstart 15 scv
build 16 scv 80
wait_buildstart 16 scv
build 17 scv 80
wait_buildstart 17 scv

goto b_engineeringbay
:a_engineeringbay

multirun m_rushcheck

expand 99 b_expansion

goto b_factory1
:a_factory1

build 4 scv 80

multirun m_rushcheck

build 4 scv 80

expand 99 b_expansion

goto b_factory2
:a_factory2

goto b_armory
:a_armory

multirun m_rushcheck

build 4 scv 80

goto b_starport
:a_starport

build 3 scv 80

multirun m_rushcheck

goto b_bunker2
:a_bunker2

goto b_turret
:a_turret

build 3 scv 80

multirun m_rushcheck

expand 99 b_expansion

goto b_starport2
:a_starport2

build 2 scv 80

goto b_sciencefacility
:a_sciencefacility

multirun m_rushcheck

goto b_finaldefense
:a_finaldefense

build 2 scv 80

expand 99 b_expansion

multirun m_rushcheck

expand 99 b_expansion

; === END LOOP ===

:suicideloop
multirun m_masscheck
expand 99 b_expansion
wait 4000
send_suicide 0
goto suicideloop

; === FUNDING MULTI-RUN ===

:m_funding
wait 1200
give_money
goto m_funding


; === EXPANSION SCRIPT ===

:b_expansion
start_town
build 1 command_center 80
wait_build 1 command_center
build 1 refinery 70

notowns_jump academy b_bunkerexpo
build 1 comsat_station 80

:b_bunkerexpo
notowns_jump barracks b_turretexpo
build 1 bunker 70

:b_turretexpo
notowns_jump engineering_bay endexpo
build 4 missile_turret 70

:endexpo
build 8 scv 80
stop


; === BUILD SCRIPT ===

; --- BARRACKS ---

:b_barracks1
build 1 barracks 80
wait_buildstart 1 barracks
build 2 supply_depot 80
wait_buildstart 2 supply_depot
wait_build 1 barracks
train 1 marine
goto a_barracks1

; --- BUNKER1 ---

:b_bunker1
wait_build 1 barracks
build 1 bunker 80
wait_buildstart 1 bunker
train 4 marine
goto a_bunker1


; --- ACADEMY ---

:b_academy
wait_build 1 barracks
build 1 academy 80
wait_buildstart 1 academy
goto a_academy


; --- BARRACKS2 ---

:b_barracks2
build 4 barracks 80
wait_buildstart 4 barracks
wait_build 1 academy
wait_build 4 barracks
train 4 marine
train 2 firebat
train 2 medic
goto a_barracks2


; --- ENGINEERING BAY ---

:b_engineeringbay
wait_build 1 barracks
build 1 engineering_bay 80
wait_buildstart 1 engineering_bay
wait_build 1 engineering_bay
build 3 missile_turret 70
goto a_engineeringbay


; --- FACTORY1 ---

:b_factory1
wait_build 1 barracks
build 1 factory 80
wait_buildstart 1 factory
wait_build 1 factory
train 2 vulture
build 1 machine_shop 80
wait_buildstart 1 machine_shop
wait_build 1 machine_shop
train 2 siege_tank
train 2 vulture
goto a_factory1


; --- FACTORY2 ---

:b_factory2
wait_build 1 barracks
build 4 factory 80
wait_buildstart 4 factory
wait_build 4 factory
build 2 machine_shop 80
wait_buildstart 2 machine_shop
wait_build 2 machine_shop
train 3 siege_tank
goto a_factory2


; --- ARMORY ---

:b_armory
wait_build 1 factory
build 2 armory 80
wait_buildstart 2 armory
wait_build 1 armory
train 3 goliath
goto a_armory


; --- STARPORT ---

:b_starport
wait_build 1 factory
build 1 starport 80
wait_buildstart 1 starport
wait_build 1 starport
train 2 wraith
build 1 control_tower 80
wait_buildstart 1 control_tower
goto a_starport


; --- BUNKER2 ---

:b_bunker2
wait_build 1 barracks
build 5 bunker 80
train 10 marine
train 4 firebat
goto a_bunker2


; --- TURRET ---

:b_turret
wait_build 1 engineering_bay
build 10 missile_turret 80
goto a_turret


; --- STARPORT2 ---

:b_starport2
wait_build 1 factory
build 4 starport 80
wait_buildstart 4 starport
wait_build 4 starport
build 3 control_tower 80
goto a_starport2


; --- SCIENCE FACILITY ---

:b_sciencefacility
wait_build 1 starport
build 2 science_facility 80
wait_buildstart 2 science_facility
wait_build 2 science_facility
build 1 physics_lab 80
wait_buildstart 1 physics_lab
build 1 covert_ops 80
wait_buildstart 1 covert_ops
train 2 science_vessel
wait_build 1 covert_ops
build 1 nuclear_silo 80
goto a_sciencefacility


; === DEFENSE SCRIPTS ===

; --- STARTING DEFENSE ---

:b_startdefense
defenseclear_gg
defensebuild_gg 1 marine
defenseuse_gg 1 marine
defensebuild_gg 1 firebat
defenseuse_gg 1 firebat
defensebuild_gg 1 vulture
defenseuse_gg 1 vulture
defensebuild_gg 1 siege_tank
defenseuse_gg 1 siege_tank
defensebuild_gg 1 goliath
defenseuse_gg 1 goliath
defensebuild_gg 1 wraith
defenseuse_gg 1 wraith
defensebuild_gg 1 battlecruiser
defenseuse_gg 1 battlecruiser
defenseclear_ag
defensebuild_ag 1 marine
defenseuse_ag 1 marine
defensebuild_ag 1 goliath
defenseuse_ag 1 goliath
defensebuild_ag 1 wraith
defenseuse_ag 1 wraith
defensebuild_ag 1 battlecruiser
defenseuse_ag 1 battlecruiser
defenseclear_aa
defensebuild_aa 1 valkyrie
defenseuse_aa 1 valkyrie
defensebuild_aa 1 wraith
defenseuse_aa 1 wraith
defensebuild_aa 1 battlecruiser
defenseuse_aa 1 battlecruiser
defenseclear_ga
defensebuild_ga 1 wraith
defenseuse_ga 1 wraith
defensebuild_ga 1 battlecruiser
defenseuse_ga 1 battlecruiser
goto a_startdefense


; --- FINAL DEFENSE ---

:b_finaldefense
defenseclear_gg
defensebuild_gg 2 ghost
defenseuse_gg 2 ghost
defensebuild_gg 1 siege_tank
defenseuse_gg 1 siege_tank
defensebuild_gg 1 goliath
defenseuse_gg 1 goliath
defensebuild_gg 1 wraith
defenseuse_gg 1 wraith
defensebuild_gg 1 battlecruiser
defenseuse_gg 1 battlecruiser
defenseclear_ag
defensebuild_ag 1 goliath
defenseuse_ag 1 goliath
defensebuild_ag 2 ghost
defenseuse_ag 2 ghost
defensebuild_ag 1 wraith
defenseuse_ag 1 wraith
defensebuild_ag 1 battlecruiser
defenseuse_ag 1 battlecruiser
defenseclear_aa
defensebuild_aa 1 valkyrie
defenseuse_aa 1 valkyrie
defensebuild_aa 1 wraith
defenseuse_aa 1 wraith
defensebuild_aa 1 battlecruiser
defenseuse_aa 1 battlecruiser
defenseclear_ga
defensebuild_ga 1 wraith
defenseuse_ga 1 wraith
defensebuild_ga 1 battlecruiser
defenseuse_ga 1 battlecruiser
goto a_finaldefense


; === RUSH CHECKS ===

:m_rushcheck

; --- RUSH BATTLECRUISER/WRAITH CHECK---

notowns_jump physics_lab b_wraithcheck
notowns_jump control_tower b_wraithcheck
wait 1200
resources_jump 1500 1000 b_cruiserrush
:a_cruiserrush


; --- RUSH WRAITH CHECK ---

:b_wraithcheck
notowns_jump starport b_groundcheck
wait 800
resources_jump 750 400 b_wraithrush
:a_wraithrush


; --- RUSH MEDIC/MARINE/VULTURE/TANK CHECK ---

:b_groundcheck
notowns_jump machine_shop b_tankcheck
notowns_jump academy b_tankcheck
notowns_jump barracks b_tankcheck
wait 600
resources_jump 1200 300 b_groundrush
:a_groundrush


; --- RUSH VULTURE/TANK CHECK ---

:b_tankcheck
notowns_jump machine_shop b_marinecheck
wait 400
resources_jump 750 300 b_tankrush
:a_tankrush


; --- RUSH MEDIC/MARINE CHECK ---

:b_marinecheck
notowns_jump academy nocheck
notowns_jump barracks nocheck
wait 200
resources_jump 500 50 b_marinerush
:a_marinerush

:nocheck
stop


; === RUSH ATTACK SCRIPTS ===

; --- MEDIC/MARINE RUSH ---

:b_marinerush
wait_build 1 barracks
wait_build 1 academy
train 10 marine
train 4 medic
attack_add 10 marine
attack_add 4 medic
attack_prepare
attack_do
attack_clear
goto a_marinerush


; --- VULTURE/TANK RUSH ---

:b_tankrush
wait_build 1 factory
wait_build 1 machine_shop
train 5 siege_tank
train 5 vulture
attack_add 5 siege_tank
attack_add 5 vulture
attack_prepare
attack_do
attack_clear
goto a_tankrush


; --- MEDIC/MARINE/VULTURE/TANK RUSH ---

:b_groundrush
wait_build 1 barracks
wait_build 1 academy
wait_build 1 factory
wait_build 1 machine_shop
train 5 siege_tank
train 4 vulture
train 8 marine
train 3 medic
attack_add 5 siege_tank
attack_add 4 vulture
attack_add 8 marine
attack_add 3 medic
attack_prepare
attack_do
attack_clear
goto a_groundrush


; --- WRAITH RUSH ---

:b_wraithrush
wait_build 1 starport
train 6 wraith
attack_add 6 wraith
attack_prepare
attack_do
attack_clear
goto a_wraithrush


; --- BATTLECRUISER/WRAITH RUSH ---

:b_cruiserrush
wait_build 1 starport
wait_build 1 control_tower
wait_build 1 science_facility
wait_build 1 physics_lab
train 4 wraith
train 2 battlecruiser
attack_add 4 wraith
attack_add 2 battlecruiser
attack_prepare
attack_do
attack_clear
goto a_cruiserrush


; === MASS CHECKS ===

:m_masscheck

; --- MASS BATTLECRUISER CHECK ---

notowns_jump control_tower b_masswraithcheck
notowns_jump physics_lab b_masswraithcheck
wait 1000
resources_jump 2000 2000 b_cruisermass
:a_cruisermass

; --- MASS WRAITH CHECK ---

:b_masswraithcheck
notowns_jump starport b_masstankcheck
wait 1000
resources_jump 2000 1800 b_wraithmass
:a_wraithmass

; --- MASS VULTURE/TANK/GOLIATH CHECK ---

:b_masstankcheck
notowns_jump machine_shop b_massinfantrycheck
notowns_jump armory b_massinfantrycheck
wait 1000
resources_jump 2000 1500 b_tankmass
:a_tankmass

; --- MASS MEDIC/MARINE/GHOST CHECK ---

:b_massinfantrycheck
notowns_jump academy b_massmedicmarinecheck
notowns_jump barracks b_massmedicmarinecheck
notowns_jump covert_ops b_massmedicmarinecheck
wait 1000
resources_jump 2000 500 b_infantrymass
:a_infantrymass

; --- MASS MEDIC/MARINE CHECK ---

:b_massmedicmarinecheck
notowns_jump academy b_massmarinecheck
notowns_jump barracks b_massmarinecheck
wait 1000
resources_jump 2000 250 b_medicmarinemass
:a_medicmarinemass

; --- MASS MARINE CHECK ---

:b_massmarinecheck
notowns_jump academy nomasscheck
notowns_jump barracks nomasscheck
wait 1000
resources_jump 2000 0 b_marinemass
:a_marinemass

:nomasscheck
stop


; === MASS ATTACK SCRIPTS ===

; --- MARINE MASS ---


:b_marinemass
wait_build 1 barracks
train 50 marine
goto a_marinemass


; --- MEDIC/MARIN MASS ---

:b_medicmarinemass
wait_build 1 barracks
wait_build 1 armory
train 40 marine
train 10 medic
goto a_medicmarinemass


; --- MEDIC/MARINE/GHOST MASS ---

:b_infantrymass
wait_build 1 barracks
wait_build 1 academy
wait_build 1 covert_ops
train 30 marine
train 10 medic
train 10 ghost
train 1 science_vessel
train 1 nuclear_missile
goto a_infantrymass


; --- VULTURE/TANK/GOLIATH MASS ---

:b_tankmass
wait_build 1 machine_shop
wait_build 1 armory
train 12 siege_tank
train 20 vulture
train 15 goliath
train 1 science_vessel
goto a_tankmass


; --- WRAITH MASS ---

:b_wraithmass
wait_build 1 starport
train 30 wraith
train 2 science_vessel
goto a_wraithmass


; --- BATTLECRUISER MASS ---


:b_cruisermass
wait_build 1 control_tower
wait_build 1 physics_lab
train 15 battlecruiser
train 2 science_vessel
goto a_cruisermass


; === RESEARCH MULTI-RUN ===

; --- ACADEMY UPGRADES ---

:r_academy
wait_build 1 academy
tech stim_packs 70
wait 3600
upgrade 1 marine_range 70
wait 3600
tech optical_flare 70
wait 3600
upgrade 1 medic_mana 70
wait 3600
tech restoration 70
stop


; --- ENGINEERING BAY UPGRADES ---

:r_engineering_bay
wait_build 1 engineering_bay
upgrade 1 t_infantry_weapon 70
wait 3600
upgrade 1 t_infantry_armor 70
wait 3600
wait_build 1 science_facility
upgrade 2 t_infantry_weapon 70
wait 3600
upgrade 2 t_infantry_armor 70
wait 3600
upgrade 3 t_infantry_weapon 70
wait 3600
upgrade 3 t_infantry_armor 70
stop


; --- MACHINE SHOP UPGRADES ---

:r_machine_shop
wait_build 1 machine_shop
tech spider_mines 70
wait 3600
tech siege_mode 70
wait 3600
upgrade 1 vulture_speed 70
wait 3600
wait_build 1 armory
upgrade 1 goliath_range 70
stop


; --- CONTROL TOWER UPGRADES ---

:r_control_tower
wait_build 1 control_tower
tech cloaking_field 70
wait 3600
upgrade 1 wraith_mana 70
stop


; --- ARMORY UPGRADES ---

:r_armory
wait_build 2 armory
upgrade 1 t_vehicle_weapon 70
upgrade 1 t_ship_weapon 70
wait 3600
wait_build 1 science_facility
upgrade 2 t_vehicle_weapon 70
upgrade 2 t_ship_weapon 70
wait 3600
upgrade 3 t_vehicle_weapon 70
upgrade 3 t_ship_weapon 70
stop


; --- COVERT OPS UPGRADES ---

:r_covert_ops
wait_build 1 covert_ops
tech personnel_cloaking 70
wait 3600
upgrade 1 ghost_mana 70
wait 3600
tech lockdown 70
wait 3600
upgrade 1 ghost_sight 70
stop


; --- PHYSICS LAB UPGRADES ---

:r_physics_lab
wait_build 1 physics_lab
tech yamato_gun 70
wait 3600
upgrade 1 battlecruiser_mana 70
stop

; --- SCIENCE FACILITY UPGRADES ---

:r_science_facility
wait_build 1 science_facility
wait_build 1 physics_lab
wait_build 1 covert_ops
tech irradiate 70
wait 3600
tech emp_shockwave 70
wait 3600
upgrade 1 science_vessel_mana 70
wait 3600
tech defensive_matrix 70
stop[/spoiler]
Kryose
Posts: 49
Joined: Fri Apr 25, 2008 4:26 pm

Postby Kryose » Wed May 07, 2008 2:57 pm

[quote name='poiuy_qwert' post='3877' date='May 7 2008, 09:33 AM']Be carefull though, doing:

Code: Select all

random_jump 85 opt2
random_jump 85 opt3
do option 1...
stop()

:opt2
do option 2...
stop()

:opt3
do option 3...
stop()

does not give 1/3 chance to get every option. opt2 will have a 1/3 chance, but the others will then have progressively smaller chances.[/quote]

I just want to make sure I understand what you mean by progressively smaller chances. From your second example you have:

random_jump 85 opt2

This is telling me that option 1 has a 2/3 chance and option 2 has a 1/3 chance. Then adding the next line:

random_jump 85 opt3

This now tells me that option 1 will have 2/3 chance over option 3 which has a 1/3 chance. When put in perspective with option 2's chances, we get:

Option 1 = 44.4% chance
Option 2 = 33.3% chance
Option 3 = 22.2% chance

To make this perfectly 1/3, 1/3 and 1/3. I assume the code used would be the following:

Code: Select all

random_jump 85 opt2
random_jump 128 opt3
do option 1...
stop()

:opt2
do option 2...
stop()

:opt3
do option 3...
stop()


Is this correct?

Thanks for the info,
Kryose
User avatar
poiuy_qwert
Posts: 548
Joined: Sun Jan 13, 2008 2:14 am

Postby poiuy_qwert » Wed May 07, 2008 3:45 pm

Yeah thats right.
Bhodi
Posts: 21
Joined: Fri Mar 21, 2008 4:18 pm

Postby Bhodi » Thu May 08, 2008 7:50 pm

[quote name='Kryose' post='3879' date='May 7 2008, 06:45 AM']I think I figured out my comsat issue (where it would not build a comsat during the expansion script).

As you can see in the old code, I was doing a wait_build 1 barracks command. And from what I have learned so far, the expansion script is considered it's own home-town, so even though I had a barracks build in my main base, the expansion base did not have one, and since it would never have one, it would never get past that line.[/quote]

from what I understand each time you use the start_town command the buildings are "reset". So

build 10 probe 80
build 1 barracks 80
start_town
build 10 probe 80
build 1 barracks 80
start_town
build 10 probe 80
build 1 barracks 80

this will produce 30 probes and 3 barracks.

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 1 guest