AvalancheMaster
Not the face of mercy.
Introduction
It seems that one of the biggest frustrations to modders is the fact that while you are allowed to enable/disable what worker jobs a unit can do, the AI cannot use a worker unit unless all worker jobs have been enabled. Let's check which are those unit actions:
While there have been some solutions to this problem, they don't solve all problems caused by this issue. In my mod I want Build Colony to be available only to a specific Colonist unit that is acquired later on. I also want specialized worker units later on (e.g. road builders, farmers, etc.) that have more worker power (that is how quick does the worker finish the job). None of the solutions that are currently known allow this, and until now it was thought to be impossible.
I am going to teach you how to fix this problem in such a way, that disallowing worker jobs would not affect the AI. This does not mean that the AI will adapt to use different workers in different situations (e.g. use those new units in a complex and comprehensive way), due to the nature of the AI, but it will still use AND produce all of the worker units that are currently available to the AI civs.
And all that in 3 easy steps! Who would've known!
For the purpose of this mod you need basic understandings of hex editing, a hex editor (I recommend Hex Editor Neo), and some patience. Also recommended is this awesome guide to the BIQ file format, though it is not required. Still, it helps a lot.
So, without further ado, let's jump straight to the tutorial.
Step I: Create a new map with custom rules enabled
Create a new map with custom rules enabled. Go to the Units tab, select "Worker" from the top-down menu, and disable the worker jobs that you want to disable.
You'll see that the "Terraform" AI checkbox turns gray. This is due to the fact that some clever guy at Firaxis made the editor disable the Terraform option if not all worker jobs are selected - for no apparent reason. However, this is not hardcoded in the game, it's only in the editor. Can't say the same thing for the number of Eras, sadly, but that's a whole other topic.
Step II: Save the map with compress option disabled
Close the Edit Rules window. Go to View -> Options, and deselect "Compress BIC files". That is an important step, so do not miss it!
Step III: Open your map in a hex editing program
Now that's where we get our hands dirty with the nitty and gritty stuff.
Once you've opened the BIQ in the Hex Editing program, find the section that says "PRTO", and then find "Worker" under it. The big orange rectangle loosely represents all the data about the Worker unit we've edited in the Conquest editor. The smaller blue rectangular is where the AI flags are stored in binary, and the smallest of all shows where the "Terraform" and "Naval Carrier" flags are stored. Since we've edited the allowed worker actions, the editor automatically changed this from 10 to 00. Change the first digit of the sequence with 1, as shown on the screenshot, save, and open in Conquest.
And there you have it! Now the AI will still use worker units, regardless of whether or not all worker jobs are enabled. Best of all, if AI is able to build two Terraforming-AI units with different worker jobs enabled, it will build both regardless of worker strength or shield cost.
Credits
Credits go to Gramphos of Apolyton for the extremely useful guide to BIC/BIQ file format. Seriously, without it this wouldn't be possible.
Also, credits go to Sid Meier, Ozymandias for the nice chat that resulted in me checking if this will solve the problem, and Arvo Pärt, for making nice music that helps me stay awake to write this tutorial when my brain clearly screams "please shut me down for a long nap".
Also, you can credit me. I don't mind not being credited, though, as it's just a solution I found; nothing that I've actually created.
~Peter G.
It seems that one of the biggest frustrations to modders is the fact that while you are allowed to enable/disable what worker jobs a unit can do, the AI cannot use a worker unit unless all worker jobs have been enabled. Let's check which are those unit actions:
- Build Colony
- Build Road
- Build Railroad
- Build Mine
- Irrigate
- Automate
- Build Airfield
- Build Outpost
- Build Fort
- Build Barricade
- Chop Down Forest
- Clear Wetlands
- Plant Forest
- Clear Damage
- Join City
- Build Radar Tower
While there have been some solutions to this problem, they don't solve all problems caused by this issue. In my mod I want Build Colony to be available only to a specific Colonist unit that is acquired later on. I also want specialized worker units later on (e.g. road builders, farmers, etc.) that have more worker power (that is how quick does the worker finish the job). None of the solutions that are currently known allow this, and until now it was thought to be impossible.
I am going to teach you how to fix this problem in such a way, that disallowing worker jobs would not affect the AI. This does not mean that the AI will adapt to use different workers in different situations (e.g. use those new units in a complex and comprehensive way), due to the nature of the AI, but it will still use AND produce all of the worker units that are currently available to the AI civs.
And all that in 3 easy steps! Who would've known!
For the purpose of this mod you need basic understandings of hex editing, a hex editor (I recommend Hex Editor Neo), and some patience. Also recommended is this awesome guide to the BIQ file format, though it is not required. Still, it helps a lot.
So, without further ado, let's jump straight to the tutorial.
Step I: Create a new map with custom rules enabled
Create a new map with custom rules enabled. Go to the Units tab, select "Worker" from the top-down menu, and disable the worker jobs that you want to disable.
You'll see that the "Terraform" AI checkbox turns gray. This is due to the fact that some clever guy at Firaxis made the editor disable the Terraform option if not all worker jobs are selected - for no apparent reason. However, this is not hardcoded in the game, it's only in the editor. Can't say the same thing for the number of Eras, sadly, but that's a whole other topic.
Step II: Save the map with compress option disabled
Close the Edit Rules window. Go to View -> Options, and deselect "Compress BIC files". That is an important step, so do not miss it!
Step III: Open your map in a hex editing program
Now that's where we get our hands dirty with the nitty and gritty stuff.
Once you've opened the BIQ in the Hex Editing program, find the section that says "PRTO", and then find "Worker" under it. The big orange rectangle loosely represents all the data about the Worker unit we've edited in the Conquest editor. The smaller blue rectangular is where the AI flags are stored in binary, and the smallest of all shows where the "Terraform" and "Naval Carrier" flags are stored. Since we've edited the allowed worker actions, the editor automatically changed this from 10 to 00. Change the first digit of the sequence with 1, as shown on the screenshot, save, and open in Conquest.
And there you have it! Now the AI will still use worker units, regardless of whether or not all worker jobs are enabled. Best of all, if AI is able to build two Terraforming-AI units with different worker jobs enabled, it will build both regardless of worker strength or shield cost.
Credits
Credits go to Gramphos of Apolyton for the extremely useful guide to BIC/BIQ file format. Seriously, without it this wouldn't be possible.
Also, credits go to Sid Meier, Ozymandias for the nice chat that resulted in me checking if this will solve the problem, and Arvo Pärt, for making nice music that helps me stay awake to write this tutorial when my brain clearly screams "please shut me down for a long nap".
Also, you can credit me. I don't mind not being credited, though, as it's just a solution I found; nothing that I've actually created.
~Peter G.