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: 0 Size: 4.73kb
(2)Eye of the Storm extreme_base.scx
Hits: 0 Size: 6563.45kb

Post has been edited 2 time(s), last time on Feb 23 2021, 8:44 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?

Yesterday, 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


  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:33 am]
MTiger156 -- Holy shit, this "Maporino! 2021" event that just got announced... this is something that takes place every year? Damn I wish I knew about it sooner, this can be my huge breakthrough in motivation :0_0:
[07:23 am]
C(a)HeK -- thank you!
[2021-2-26. : 5:14 am]
C(a)HeK -- hello all, test 6 is complete - :)
[2021-2-26. : 3:09 am]
RdeRenato -- yes
[2021-2-25. : 2:55 pm]
MTiger156 -- General Kenobi
[2021-2-25. : 2:54 pm]
Voyager7456 -- hello there
[2021-2-25. : 2:41 pm]
lil-Inferno -- hi
[2021-2-25. : 11:18 am]
Soul-farm -- Hi everyone
[2021-2-25. : 10:04 am]
UndeadStar -- :wob:
[2021-2-24. : 7:32 pm]
MTiger156 -- u
Please log in to shout.

Members Online: genfiligga35, Roy, C(a)HeK, feicabingse75