Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Absolute noob guide to modifying SC AI (no mods)
Absolute noob guide to modifying SC AI (no mods)
Feb 12 2021, 7:13 pm
By: Fruitdispenser  

Feb 12 2021, 7:13 pm Fruitdispenser Post #1

I created this guide because as a noob, I expent like 6 hours asking someone to explain me how to make certain units to start with 100% energy and 100% hangar. I someone helped me, I have to give something back. We all help eachother

After I finished the campaigns I thought that some missions could have been a little harder. I started reading on how to modify AI's, and everywhere I went, people said you needed mods. How could I play with friends or upload maps if everyone needed to download stuff. BUT, this guy
discovered that you don't need to. He converted the ai scripts file, aptly named aiscript.bin, to triggers.

The trick is using EUD's. We don't need to know too much about it, but in short, Set Deaths trigger action allows you access parts of the runtime game memory so we can modify it. However, because Windows and Mac SC versions use different memory addresses, this won't work on Mac. Unless in the future, someone manages to find the Mac AIScript pointer

As the following scripts will apply to player one, player one needs to be present. It can be Computer, Neutral, Rescuable or Human. Doesn't matter, but it needs to be present. So, remember to place a Starting position for player 1.

First thing, first. Wee need tools to modify the AI.
The tool we are gonna use is the PyAI module of the PyMS modding suite. You can download PyMS here
Press on Code and select 'Download ZIP'.

To run PyMS you need to have installed python 2.7.x (download here) and PIL [download here(remember to download PIL compatible with python 2.7)]

For people who has Python >3.x installed, python 2to3 doesn't work translating it and I found out that the faster way to proceed was to install a Windows XP virtual machine and install Python 2.7.9 there. Why 2.7.9? Because it's the latest version able to run on XP
I suggest Oracle Virtual box, because it allows you to copy-and-paste AND drag-and-drop to and from guest to host

So, we have already installed PyMS. We open PyAI and it should look like this

We open the default scripts.

What script should we modify?. How about purple Zerg in SC Protoss last mission, 'Eye of the Storm'? I have prepared a two player version, so you can play with friends.

Looking trought the triggers, we see that purple uses 'Protoss 10 - Overmind defenders'

We open it and start modifying it.

For example, we can add more ultralisk to defense, so instead of
    defensebuild_gg(1, Zerg Ultralisk)
    defenseuse_gg(1, Zerg Ultralisk)

we can change it to
    defensebuild_gg(3, Zerg Ultralisk)
    defenseuse_gg(3, Zerg Ultralisk)

If we move down a little bit, we can see we can research techs
    tech(Plague, 30)
    tech(Spawn Broodling, 30)

The basis of an attack is
    attack_add(24, Zerg Zergling)


We add units to an attack, we prepare, we wait a little bit, we do the attack and we clear the attack, so we can prepare the next one

Now, if we want to cycle attacks, we can do the following
        --P10o 0000--
//place your attacks here
    goto(P10o 0000)

That will cycle forever.

This is a list of all AI functions

Now that we are done, we save and overwrite the script

And save the aiscript bin files to desktop or wherever you want.

Now is where the magic begins. We need to transform this aiscript.bin files to triggers.

We extract the attached jncraton-tool files to the same folder in which the AI bin file exist and we run the 'eud_gen_trigs' file. If we had modified a BW script, we should have run the 'eud_gen_trigs_bw file'.

A 'trigs.txt' (or 'trigs_bw.txt') file will be created. If you open it, it has a lot of triggers.

Because there are so many triggers, I suggest only modifying vanilla AI (aiscript.bin) files or only BW AI (bwscript.bin) files. It seems that aiscript.bin scripts are unable to train/research/upgrade BW stuff, which makes sense. In the same vein, because there are so many triggers to run, 'Run AI' triggers should run after a few seconds

Now, copy all the contents of the recently generated 'trigs.txt' file and paste it. But where?

Assuming you already have SCMDraft 2, you need to install TrigEditPlus. Donwload that, and place the 'TrigEditPlus.sdp' file in the plugins folder of your SCMDraft 2 folder.

Open SCMDraft, go to the Triggers tab and BEFORE opening TrigEdit++, open 'Trigger Editor' and compile. Why? Sometimes there are syntax errors that will prevent us from compiling the triggers we will be pasting in TrigEdit++.

So, spoiler, we need to paste the contents of 'trigs.txt' to TrigEdit++ and well see something like this
Before pasting

After pasting

We'll press F5 to compile, we save and we are done.

However, wanna do something a little bit cooler? Let's say we want to make red player train Hunter Killers instead of Hydras? You'll need EUD 3 and to run that, you'll also need euddraft
As of 12-Feb-2021, for latest version of EUD 3, euddraft is the recommended version.

Now, let's go back to our aiscript.bin file and modify 'Protoss 10 - Mini-Town Master'

Note: the <0> and the following words are automatically written once you save and quit the script. You only need to write Hunter Killer. The same for every unit that has a parenthesis in the 'Units' file in jncraton-tool.

We again, save the script, save the file, run eud_gen_trigs, open trigs.txt, copy, paste in TrigEdit++.
PRESERVE THE SCENARIO TRIGGERS (defeat conditions, initial resources, dialogs, even the Run AI script triggers), DELETE THE aiscript.bin RELATED TRIGGERS.

Do this everytime you modify the relevant scripts of the scenario file you are working.

So, we already told the AI to build Hunter Killers. We now need to tell the game that Hunter Killers is a perfectly breasonable unit to train.
EUD 3 does a lot of stuff under the hood. It inyects from an scenario A to an empty scenario B. But it needs a favor from us. It needs we create an empty scenario file to inyect all the stuff we'll do. I just copied and pasted the scenario, though. It doesn't matter.

Anyway, we open the dat editor.

Search for Hydralisk.

Select Zerg Hydralisk, go to Requirements, select User Custom, right click over a Requirement and select Copy

go to Hunter Killer, go to Requirements, select User Custom

right-click on the white window

and paste

We do that again with the other requirements. PRESERVE THE ORDER OF THE REQUIREMENTS.For terran units that require add-ons is important. We can drag the requirements inside the white panel.

We'll also modify the Hunter Killer AI order section to be the same as the Hydralisk,
Hydra AI order

Stock Hunter Killer AI order

Modified Hunter Killer AI order

and the required supply, in the Default tab.
Hydra supply

Stock Hunter Killer supply

Modified HK supply

Otherwise, the AI will train like 40 Hunter Killers, even when we told it to train just a few. We save the proyect

and build.

Everything should be allright now. Now, when you go over the internet, you create a game using the Inyected scenario, not the base one.

Hits: 1 Size: 4.73kb
(2)Eye of the Storm extreme_base.scx
Hits: 1 Size: 6563.45kb

Post has been edited 3 time(s), last time on Feb 27 2021, 2:07 pm by Fruitdispenser.

Feb 12 2021, 11:24 pm Nekron Post #2

This is a pretty nice & succinct guide, I'm sure it'll be useful in all sorts of EUD maps :)

Feb 19 2021, 1:54 pm Fruitdispenser Post #3

Quote from Nekron
This is a pretty nice & succinct guide, I'm sure it'll be useful in all sorts of EUD maps :)

I'm glad you thing is nice. It's my very first tutorial ever, so if you or anyone who reads this posts has comments on it, they are more than welcome (welcomer?)


Feb 25 2021, 2:38 pm IlyaSnopchenko Post #4

The Curious

Am I the only one who is seeing it so that the majority of the screenshots are really the same? (Basic unit properties sheet).

Who am I, and why should I care?

Feb 26 2021, 5:02 pm Fruitdispenser Post #5

Quote from IlyaSnopchenko
Am I the only one who is seeing it so that the majority of the screenshots are really the same? (Basic unit properties sheet).
Yes. You are right. I'll fix that as soon as I can. Thanks for noticing

Edit: fixed. For some reason, image url codes were wrong. It's weird because I just copied and pasted. Whatever.

Post has been edited 1 time(s), last time on Feb 27 2021, 2:10 pm by Fruitdispenser.


  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2021-7-29. : 6:54 pm]
RdeRenato -- xd
[2021-7-29. : 5:10 pm]
IlyaSnopchenko -- that, or they should've instead made the probes to fly somehow, so all the workers were equally capable :)
[2021-7-29. : 5:09 pm]
IlyaSnopchenko -- Maybe they'll get around to fix flying drones after they've fixed the flying SCVs
[2021-7-29. : 4:06 am]
Dem0n -- and hope they never touch it again
[2021-7-29. : 12:34 am]
Oh_Man -- Look every1 blizz updated SC without breaking everything. Let's give them a round of applause!
[2021-7-28. : 9:53 am]
NudeRaider -- MTiger156
MTiger156 shouted: The management is pure evil, yes. BUT there is still some good left in the employees. They are starting a massive on-site protest tomorrow (7/28), the number of participants is supposedly in the thousands. CHANGE WILL COME!
That's not what I meant. I can see internal company culture changing, but I have zero hopes that Blizzard will go back to caring about their customers. A good rep just isn't as profitable as milking. I would say once a company becomes a stock company they cannot be the humble good guys anymore they have a duty to make as much money as possible.
[2021-7-28. : 8:39 am]
NudeRaider -- Vrael
Vrael shouted: NudeRaider whoaoaoaoaoaoaoaoa what? is this just in germany? I'm sure the U.S. has some equally asinine rules too but
I'm only aware of Germany, but I would be very surprised if they didn't try this shit in other countries too. Disclaimer: I actually have no idea how responsibly that agency is using their right to veto. Maybe they do it fine but I don't trust them. They are supposed to regulate the market and keep net neutrality. But in the past they failed to prevent shit like Stream On. It's an option for phone flatrates where Youtube etc. are making contracts with Telekom that you can continue using it even if you used up all the GBs of your volume flatrate. And even if that agency does it properly, it's just not right they can do it without a court.
[2021-7-28. : 4:11 am]
O)FaRTy1billion[MM] -- Oh_Man
Oh_Man shouted: sweet jaysus... i remember attending the midnight launch at King George Square. Some dude dressed up as a pylon XD
"Some dude dressed up as a pylon" :megathink:
[2021-7-28. : 12:55 am]
Vrael -- NudeRaider
NudeRaider shouted: Oh_Man idd. I had switched a long time ago out of privacy concerns. Only by chance I realized that with that I also circumvented their website bans. I find that disgusting as well. I mean I have no problem with them banning sites when court decided they are illegal and police can't take them down because server is somewhere they have no jurisdiction at. But recently they went a step further. No court needed anymore. A collection of a few dozen copyright owners, the providers decided. And some federal agency can veto, but they most likely wave it all through. And nobody is talking about it. Private firms censoring the Internet. :( It's a shame. And yes, I'm not affected. Still mad.
whoaoaoaoaoaoaoaoa what? is this just in germany? I'm sure the U.S. has some equally asinine rules too but
Please log in to shout.

Members Online: TheHappy115