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
https://github.com/jncraton/BWMetaAI
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
Code
defensebuild_gg(1, Zerg Ultralisk)
defenseuse_gg(1, Zerg Ultralisk)
defenseuse_gg(1, Zerg Ultralisk)
we can change it to
Code
defensebuild_gg(3, Zerg Ultralisk)
defenseuse_gg(3, Zerg Ultralisk)
defenseuse_gg(3, Zerg Ultralisk)
If we move down a little bit, we can see we can research techs
Code
tech(Plague, 30)
tech(Spawn Broodling, 30)
tech(Spawn Broodling, 30)
The basis of an attack is
Code
attack_add(24, Zerg Zergling)
attack_prepare()
wait(500)
attack_do()
attack_clear()
attack_prepare()
wait(500)
attack_do()
attack_clear()
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
Code
--P10o 0000--
//place your attacks here
goto(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 0.9.0.9 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++.
IT'S SUPER IMPORTANT YOU DELETE ALL THE PREVIOUS TRIGGERS RELATED TO THE PREVIOUS AISCRIPT.BIN ITERATION.
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.
Attachments:
Post has been edited 3 time(s), last time on Feb 27 2021, 2:07 pm by Fruitdispenser.