Zerg AI problem

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
User avatar
pandut
Posts: 26
Joined: Tue Jul 03, 2007 6:17 am

Zerg AI problem

Postby pandut » Fri Aug 07, 2009 3:22 am

Hay all, I've been having a very annoying problem with a custom zerg AI script I made.

The problem, is that after the first two buildings, the zerg AI will ignore all other commands until he's massed an army of 15-100 hydralisks. I have no idea why it's doing that, and I'd like it to not do that.

Here is the script I'm using:

CODEextdef C:/Program Files/Starcraft/Mods stuff/Modding Pack/PyMSwinEXE/PyMSwinEXE/unitdef.txt


# stat_txt.tbl entry 1344: Zerg Expansion Custom Level<0>
ZMCx(1344, 111, aiscript):
start_town()
transports_off()
farms_notiming()
define_max(20, defiler)
define_max(70, drone)
define_max(100, zergling)
define_max(20, overlord)
define_max(40, hydralisk)
define_max(16, ultralisk)
build(1, hatchery, 80)
build(4, drone, 40)
train(1, zergling)
train(1, zergling)
train(1, zergling)
train(1, zergling)
train(1, zergling)
train(1, zergling)
build(5, drone, 40)
build(6, drone, 40)
build(7, drone, 40)
build(8, drone, 40)
build(1, creep_colony, 80)
wait_buildstart(1, creep_colony)
build(1, sunken_colony, 80)
wait_buildstart(1, sunken_colony)
give_money()
defensebuild_gg(10, zergling)
build(1, evolution_chamber, 80)
wait(1800)

attack_add(4, zergling)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
wait(600)

give_money()
attack_add(8, zergling)
attack_add(2, hydralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
build(2, evolution_chamber, 80)
multirun(ZMCx 0001)
build(9, drone, 40)
build(10, drone, 40)
build(11, drone, 40)
build(12, drone, 40)
build(2, hatchery, 80)
build(2, creep_colony, 80)
wait_buildstart(2, creep_colony)
build(2, sunken_colony, 80)
wait_buildstart(2, sunken_colony)
build(3, creep_colony, 80)
wait_buildstart(3, creep_colony)
build(3, sunken_colony, 80)
wait_buildstart(3, sunken_colony)
build(14, drone, 40)
build(15, drone, 40)
build(16, drone, 40)
creep(1)
build(4, creep_colony, 80)
wait_buildstart(4, creep_colony)
build(4, sunken_colony, 80)
wait_buildstart(4, sunken_colony)
build(17, drone, 40)
build(18, drone, 40)
build(19, drone, 40)
build(20, drone, 40)
train(1, zergling)
build(1, overlord, 40)
train(1, zergling)
train(1, ultralisk)
build(3, hatchery, 80)
build(21, drone, 40)
build(22, drone, 40)
build(23, drone, 40)
build(24, drone, 40)
give_money()
attack_add(18, zergling)
attack_add(1, defiler)
attack_add(6, hydralisk)
build(1, overlord, 40)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
build(25, drone, 40)
build(26, drone, 40)
build(27, drone, 40)
build(28, drone, 40)
build(5, creep_colony, 80)
wait_buildstart(5, creep_colony)
build(1, spore_colony, 80)
wait_buildstart(1, spore_colony)
build(6, creep_colony, 80)
wait_buildstart(6, creep_colony)
build(5, sunken_colony, 80)
wait_buildstart(5, sunken_colony)
multirun(ZMCx 0002)
creep(2)
build(4, hatchery, 80)
expand(1, ZMCx 0000)
build(29, drone, 40)
build(30, drone, 40)
build(31, drone, 40)
build(32, drone, 40)
wait(1400)

attack_add(20, zergling)
attack_add(2, defiler)
attack_add(10, hydralisk)
attack_add(2, ultralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
build(33, drone, 40)
build(34, drone, 40)
build(35, drone, 40)
build(36, drone, 40)
build(7, creep_colony, 80)
wait_buildstart(7, creep_colony)
build(6, sunken_colony, 80)
wait_buildstart(6, sunken_colony)
train(1, zergling)
build(1, overlord, 40)
build(1, overlord, 40)
build(37, drone, 40)
build(38, drone, 40)
build(39, drone, 40)
build(40, drone, 40)
train(1, zergling)
train(1, ultralisk)
multirun(ZMCx 0003)
give_money()
defensebuild_gg(10, zergling)
build(1, overlord, 40)
give_money()
build(8, creep_colony, 80)
wait_buildstart(8, creep_colony)
build(7, sunken_colony, 80)
wait_buildstart(7, sunken_colony)
creep(3)
build(5, hatchery, 80)
expand(2, ZMCx 0000)
build(41, drone, 40)
build(42, drone, 40)
build(43, drone, 40)
build(44, drone, 40)
wait(1200)

attack_add(24, zergling)
attack_add(2, defiler)
attack_add(16, hydralisk)
attack_add(4, ultralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
defensebuild_gg(6, hydralisk)
train(1, zergling)
train(1, hydralisk)
train(1, zergling)
train(1, ultralisk)
build(1, overlord, 40)
multirun(ZMCx 0004)
build(9, creep_colony, 80)
wait_buildstart(9, creep_colony)
build(8, sunken_colony, 80)
wait_buildstart(8, sunken_colony)
expand(3, ZMCx 0000)
wait(100)

attack_add(28, hydralisk)
attack_add(4, ultralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
build(1, overlord, 40)
train(1, zergling)
train(1, hydralisk)
build(13, drone, 40)
upgrade(2, z_carapace, 70)
train(1, zergling)
train(1, ultralisk)
wait(900)

train(1, zergling)
train(1, hydralisk)
train(1, zergling)
train(1, ultralisk)
build(10, creep_colony, 80)
wait_buildstart(10, creep_colony)
build(9, sunken_colony, 80)
wait_buildstart(9, sunken_colony)
creep(4)
attack_add(38, zergling)
attack_add(3, defiler)
attack_add(22, hydralisk)
attack_add(6, ultralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
defensebuild_gg(10, zergling)
defensebuild_gg(6, hydralisk)
build(1, overlord, 40)
expand(4, ZMCx 0000)
build(11, creep_colony, 80)
wait_buildstart(11, creep_colony)
build(10, sunken_colony, 80)
wait_buildstart(10, sunken_colony)
build(12, creep_colony, 80)
wait_buildstart(12, creep_colony)
build(2, spore_colony, 80)
wait_buildstart(2, spore_colony)
creep(5)
wait(800)

attack_add(48, zergling)
attack_add(8, ultralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
build(12, creep_colony, 80)
wait_buildstart(12, creep_colony)
build(3, spore_colony, 80)
wait_buildstart(3, spore_colony)
build(13, creep_colony, 80)
wait_buildstart(13, creep_colony)
build(4, spore_colony, 80)
wait_buildstart(4, spore_colony)
creep(6)
train(1, zergling)
train(1, hydralisk)
train(1, zergling)
train(1, ultralisk)
build(1, overlord, 40)
build(14, creep_colony, 80)
wait_buildstart(14, creep_colony)
build(11, sunken_colony, 80)
wait_buildstart(11, sunken_colony)
build(15, creep_colony, 80)
wait_buildstart(15, creep_colony)
build(12, sunken_colony, 80)
wait_buildstart(12, sunken_colony)
wait(700)

attack_add(18, zergling)
attack_add(16, hydralisk)
attack_add(10, ultralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
train(1, hydralisk)
train(1, hydralisk)
train(1, zergling)
train(1, hydralisk)
train(1, zergling)
train(1, ultralisk)
build(16, creep_colony, 80)
wait_buildstart(16, creep_colony)
build(13, sunken_colony, 80)
wait_buildstart(13, sunken_colony)
build(17, creep_colony, 80)
wait_buildstart(17, creep_colony)
creep(7)
build(5, spore_colony, 80)
wait_buildstart(5, spore_colony)
build(1, overlord, 40)
upgrade(3, z_carapace, 70)
build(18, creep_colony, 80)
wait_buildstart(18, creep_colony)
build(14, sunken_colony, 80)
wait_buildstart(14, sunken_colony)
wait(700)


--block1--
give_money()
attack_add(48, zergling)
attack_add(5, defiler)
attack_add(26, hydralisk)
attack_add(8, ultralisk)
attack_prepare()
attack_do()
attack_clear()
clear_combatdata()
expand(5, ZMCx 0000)
build(1, overlord, 40)
clear_combatdata()
give_money()
defensebuild_gg(8, zergling)
defensebuild_gg(6, hydralisk)
wait(1000)

goto(block1)


--ZMCx 0000--
start_town()
build(1, hatchery, 80)
wait_build(1, hatchery)
build(1, creep_colony, 80)
wait_buildstart(1, creep_colony)
build(1, sunken_colony, 80)
wait_buildstart(1, sunken_colony)
build(2, creep_colony, 80)
wait_buildstart(2, creep_colony)
build(2, sunken_colony, 80)
wait_buildstart(2, sunken_colony)
build(1, overlord, 40)
build(1, drone, 40)
build(2, drone, 40)
build(3, drone, 40)
defensebuild_gg(6, zergling)
build(4, drone, 40)
build(5, drone, 40)
build(6, drone, 40)
place_guard(ultralisk, 1)
stop()


--ZMCx 0001--
upgrade(1, z_missile_attack, 70)
wait(900)

upgrade(1, z_melee_attack, 70)
stop()


--ZMCx 0002--
train(4, zergling)
upgrade(1, z_carapace, 70)
wait(900)

upgrade(2, z_missile_attack, 70)
stop()


--ZMCx 0003--
train(4, zergling)
train(2, ultralisk)
upgrade(1, ultralisk_armor, 70)
wait(500)

upgrade(1, ultralisk_speed, 70)
upgrade(2, z_melee_attack, 70)
stop()


--ZMCx 0004--
train(4, hydralisk)
train(2, defiler)
upgrade(3, z_missile_attack, 70)
upgrade(3, z_melee_attack, 70)
stop()
User avatar
Myk
Posts: 257
Joined: Sat Jun 13, 2009 12:56 pm

Postby Myk » Fri Aug 07, 2009 5:30 am

Hi.

A question: Where's the tech buildings at? Is this for some UMS map or something?
User avatar
pandut
Posts: 26
Joined: Tue Jul 03, 2007 6:17 am

Postby pandut » Fri Aug 07, 2009 6:31 pm

I have no idea what you mean by the first part of the question.

But as for the second part, no, this script is for a mod.
User avatar
pandut
Posts: 26
Joined: Tue Jul 03, 2007 6:17 am

Postby pandut » Thu Aug 13, 2009 9:27 pm

I still need some help...
User avatar
Myk
Posts: 257
Joined: Sat Jun 13, 2009 12:56 pm

Postby Myk » Fri Aug 14, 2009 5:30 am

[quote name='Pandut' post='7312' date='Aug 7 2009, 11:31 AM']I have no idea what you mean by the first part of the question.

But as for the second part, no, this script is for a mod.[/quote]

Sorry. I got really lazy lately.

Here's some that I saw:

-The computer doesn't really build drones/probes/scv past number 30 for whatever reason. I wouldn't include more than that at each town.
- give_money() can be placed in a loop that will probably work a bit smoother than placing it every so often.
- There aren't any scripted tech buildings(No Spawning Pool, Hydralisk Den, etc)

If you're building on a map that has those things placed already, try this at the start of your script

Code: Select all

extdef C:/Program Files/Starcraft/Mods stuff/Modding Pack/PyMSwinEXE/PyMSwinEXE/unitdef.txt


# stat_txt.tbl entry 1344: Zerg Expansion Custom Level<0>
ZMCx(1344, 111, aiscript):
   start_campaign()
   wait(1)

   start_town()
   defaultbuild_off()
   default_min(0)
   wait(1)


The "Insane" AI scripts use this and you can basically build a town on whatever map and they will pick it up and use it pretty well.
User avatar
pandut
Posts: 26
Joined: Tue Jul 03, 2007 6:17 am

Postby pandut » Fri Aug 14, 2009 5:49 pm

I tried that Baja, now the AI doesn't build so many hydralisks as before, but it seems to be the unit they prefer most.

And Myk, the script is for a mod, not campaign. I won't reveal the details about the mod, so please, just humor me :)

EDIT: Also, how would you put give_money() in a loop? Thought it'd be like multirun(), but then I'd still have to place every often.
User avatar
Myk
Posts: 257
Joined: Sat Jun 13, 2009 12:56 pm

Postby Myk » Fri Aug 14, 2009 7:34 pm

[quote name='Pandut' post='7356' date='Aug 14 2009, 10:49 AM']I tried that Baja, now the AI doesn't build so many hydralisks as before, but it seems to be the unit they prefer most.

And Myk, the script is for a mod, not campaign. I won't reveal the details about the mod, so please, just humor me :)

EDIT: Also, how would you put give_money() in a loop? Thought it'd be like multirun(), but then I'd still have to place every often.[/quote]

Okay, then, I don't have a clue. Haha!

Money loop:

Code: Select all

multirun(moneyloop)
etc
etc.

 --moneyloop--
give_money()
wait(100)
goto(moneyloop)


Adjust the wait time to your liking.
Scourge_Splitter
Posts: 36
Joined: Fri May 11, 2007 12:56 pm

Postby Scourge_Splitter » Mon Aug 17, 2009 9:55 pm

[quote name='bajadulce' post='7351' date='Aug 14 2009, 04:07 AM']15-100 hydras? That's a big range. Which end of that figure?

Your script has some unusual code such as:
build(4, drone, 40)
train(1, zergling)
train(1, zergling)
train(1, zergling)
train(1, zergling)
train(1, zergling)
train(1, zergling)
build(5, drone, 40)
build(6, drone, 40)
build(7, drone, 40)
build(8, drone, 40)

why not just
train(6, zergling)
*train doesn't work similar to attack_add. The AI reads your script as train 1 zergling not 6.
build(8, drone, 40)

also the following defense are a bit unusual as well:
defensebuild_gg(8, zergling)
defensebuild_gg(6, hydralisk)

not sure what that number really represents. typically this is defensebuild_gg(1, zergling) or (1, hydralisk). Blizzard uses 2 for zealots. dunno. Make a smaller script; test and build from there would be my advice for finding what you need.[/quote]
I also spot there is nott any tech building order (Spawning Pool), If you say it's for a mod, then I read this not as UMS....
If this is the situation, then you'll be needing them. It can also be the reason for them to build Hydralisk en masse, because they can (a UMS based map which gives them instant tech.)
the number in the defensebuild_gg represents the amount of units build when they are attacked.

i.e.
Defensebuild_gg(2, zealot) --> means that 2 zealots are build once the ai is attacked, in other words, they try to fend of the attack with the army they got allready + that they build 2 zealots as reinforcements.


[quote name='Pandut' post='7356' date='Aug 14 2009, 06:49 PM']I tried that Baja, now the AI doesn't build so many hydralisks as before, but it seems to be the unit they prefer most.[/quote]
This is probably because it is recognized as the prime assault unit.
Not sure wether you've seen it before, but if you mess up the Terran ai they also start mass producing Marines till full supply.

maybe part of this tier 1 unit combination
(Marine, Zealot, Hydralisk)


[quote name='bajadulce' post='7360' date='Aug 15 2009, 06:40 AM']cool a mod with a custom ai script! Gluck those are always fun.[/quote]
Not to brag, but that's not really much news for me.

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 1 guest