1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Getting the AI to use worker units without all worker jobs enabled

Discussion in 'Civ3 - Tutorials, Reference, & Guides' started by AvalancheMaster, Dec 4, 2013.

  1. AvalancheMaster

    AvalancheMaster Not the face of mercy.

    Joined:
    Jun 27, 2012
    Messages:
    190
    Location:
    Yubaba's Bath House
    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:

    • 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.
     

    Attached Files:

    • 01.png
      01.png
      File size:
      6.1 KB
      Views:
      299
    • 02.png
      02.png
      File size:
      7.7 KB
      Views:
      165
    • 03.png
      03.png
      File size:
      3.2 KB
      Views:
      213
    • 04.png
      04.png
      File size:
      21.9 KB
      Views:
      281
    • 05.png
      05.png
      File size:
      17.6 KB
      Views:
      263
    • 06.png
      06.png
      File size:
      17.5 KB
      Views:
      177
    • 07.png
      07.png
      File size:
      17.6 KB
      Views:
      166
  2. Yoda Power

    Yoda Power ✫✫✫✫✫✫✫

    Joined:
    Sep 24, 2002
    Messages:
    13,869
    Very good find. :goodjob:
     
  3. AvalancheMaster

    AvalancheMaster Not the face of mercy.

    Joined:
    Jun 27, 2012
    Messages:
    190
    Location:
    Yubaba's Bath House
    It got me started thinking of an event script for Conquest. We'll see how the idea will develop - and if it's possible at all.
     
  4. Virote_Considon

    Virote_Considon The Great Dictator

    Joined:
    Jul 7, 2004
    Messages:
    9,338
    Location:
    Skaville UK Reputation: 1
    You can also do this in Steph's editor, and possibly Quintillus' editor too, if you're not keen on hex editing :)
     
  5. AvalancheMaster

    AvalancheMaster Not the face of mercy.

    Joined:
    Jun 27, 2012
    Messages:
    190
    Location:
    Yubaba's Bath House
  6. Virote_Considon

    Virote_Considon The Great Dictator

    Joined:
    Jul 7, 2004
    Messages:
    9,338
    Location:
    Skaville UK Reputation: 1
    I think it's more of a case that no-one knew if the AI would be able to use them or not until now - you've provided us with the answer to that :)
     
  7. Ozymandias

    Ozymandias I saw the Great Library burn.

    Joined:
    Nov 5, 2001
    Messages:
    9,348
    Gender:
    Male
    Location:
    The lone and level sands
    Do understand that desires along these lines have been shouted to the Heavens for over a decade. Regardless of the tools used, you are the one who made it happen!

    :xmascheers: ,

    :)z
     
  8. AvalancheMaster

    AvalancheMaster Not the face of mercy.

    Joined:
    Jun 27, 2012
    Messages:
    190
    Location:
    Yubaba's Bath House
    Checked it with Quintillus' editor, it works there. Ah, the tutorial will get so short when I redo it...

    I'll keep the previous one as well just for the sake of archiving. Will do it tonight.

    Your reaction amuses me. :D Your overjoy reminds me of Tiger from Winnie the Pooh, seriously.

    Thank you! :)
     
  9. Ozymandias

    Ozymandias I saw the Great Library burn.

    Joined:
    Nov 5, 2001
    Messages:
    9,348
    Gender:
    Male
    Location:
    The lone and level sands
    :lol: My girlfriend generally compares me to Eeyore.
     
  10. Balthasar

    Balthasar Wise Man

    Joined:
    Mar 11, 2005
    Messages:
    3,293
    AvalancheMaster, thank you for finding a fix to exactly the problem I've been trying to fix. Following your instructions, I've think I've found the hexes you describe, but they don't look like the ones in your example. Moreover, my scenario has several worker units: do they all have to have their hexes changed? Find enclosed a screenshot from my hex editor.
     

    Attached Files:

  11. AvalancheMaster

    AvalancheMaster Not the face of mercy.

    Joined:
    Jun 27, 2012
    Messages:
    190
    Location:
    Yubaba's Bath House
    Yes, they all need to be changed.

    As far as I can see, the hexes don't look any different, besides the names. However that doesn't matter, as Virote pointed out that I've found a method to do this, but apparently the tools to do it more easily already exist. I will rewrite the tutorial this week (and it will get summed up to 2 lines), but basically you need to download the Cross-Platform editor, and check the "Terraforming" flags of those worker units of yours. ;)
     
  12. Ozymandias

    Ozymandias I saw the Great Library burn.

    Joined:
    Nov 5, 2001
    Messages:
    9,348
    Gender:
    Male
    Location:
    The lone and level sands
    Okay, I just checked the Conquest "Fall Of Rome" scenario, and the Legion unit has the "Worker/Engineer Actions" "Build Road" & "Build Fort" boxes checked; of course the "Terraform" AI Strategy box is greyed-out.

    I've not played this one myself, but WTF?? Anyone have any clues??

    -:confused:z
     
  13. AvalancheMaster

    AvalancheMaster Not the face of mercy.

    Joined:
    Jun 27, 2012
    Messages:
    190
    Location:
    Yubaba's Bath House
    My guess is that they made it with tools, unavailable to the public, and the main reason why they disabled the "AI" checkbox is due to unpredictability of the AI (as in my case - making a special unit for Build Colony - who knows how this'll work).
     
  14. Balthasar

    Balthasar Wise Man

    Joined:
    Mar 11, 2005
    Messages:
    3,293
    Or use Steph's editor, which I've been using all along, if I understand Virote correctly. Okay, thanks. Problem solved, I guess. I've been having trouble getting the AI to build them, but Vuldacon would tell me to automate that part anyway.
     
  15. Kirejara

    Kirejara King

    Joined:
    Jun 21, 2012
    Messages:
    805
    Location:
    Northern Germany
    I have tried Avalances tip with Quintillus Editor on my combat engineers (roadbuilding and clear swamp, forest and pollution). And I have successfully observed the KI using the ancient version of it. So I guess it works. :thumbsup:

    However as soon as you change the scenario in the Firaxis Editor it will remove the AI Strategie checkbox. :gripe:

    I also removed the "Disband Order" from the regular worker orders as the KI allways disband their workers when low on money befor reducing its military forces. Since I did this I see a lot more KI workers on the map (and they still can join a city ;) ).
     
  16. jagdgeschwader

    jagdgeschwader Chieftain

    Joined:
    Nov 12, 2014
    Messages:
    15
    I just want to say thanks for this! This was super easy and quick, and it helps me out a lot with the scenario I've been working on.
     
  17. Lionic

    Lionic King

    Joined:
    Feb 3, 2010
    Messages:
    665
    Thanks a lot!
     

Share This Page