Disabling specific units and technologies

CivFart

Warlord
Joined
Dec 3, 2010
Messages
137
Is there a way to turn off specific units in single player games (Gods and Kings) without having to do scripting? I have managed to turn off nukes by setting AllowNukes to false in Civ5Projects.xml in assets/gameplay/XML/GameInfo

I'd like to turn off these units: (Prevent AI from building them and/or prevent myself from building it as well)

1. Modern Armor
2. Jet fighter
3. Stealth bomber
4. Death Robot
5. Mechanized Infantry

and play the game using the remaining units available. I hope I don't have to script.
 
First--not a big deal--but this is the wrong forum for asking a question, so I've alerted the moderators to move it. EDIT: Moved back.

There's no simple switch for what you want, so it would have to be a mod. You could just use a mod like End in WWII.

...

However, it wouldn't be very difficult to make your own that does exactly what you're asking for.

This particular mod is pretty easy; it would actually be a great way to get your feet wet, without using the SDK.

Just Subscribe to Example - Removing Giant Death Robot on Steam, and open the game's mods menu to download it.
[Or just download it from post #10 below.]

Quit the game, go to your mods directory,
Code:
%userprofile%\Documents\My Games\Sid Meier's Civilization 5\Mods
Now we'll just edit the example mod to make it do what we want it to.

...

  1. Make a copy of the folder "Example - Removing Giant Death Robot (v 1)".
  2. Rename the copied folder to something like "Example - Removing Modern Units (v 1)".
  3. Now go to your new folder and open the XML file in a text editor. This is what it will look like:
    Spoiler Example_RemovingGDR.xml :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created by ModBuddy on 9/4/2010 12:18:41 PM -->
    <GameData>
    	<!-- Remove the Giant Death Robot from the Units table.		-->
    	<!-- This pains me very much :(								-->
    	<Units>
    		<Delete Type="UNIT_MECH" />
    	</Units>
    
    	<!-- Remove any entries that reference the mech in Units.	-->
    	<UnitClasses>
    		<Delete Type="UNITCLASS_MECH" />
    	</UnitClasses>
    
    	<Unit_AITypes>
    		<Delete UnitType="UNIT_MECH" />
    	</Unit_AITypes>
    
    	<Unit_FreePromotions>
    		<Delete UnitType="UNIT_MECH" />
    	</Unit_FreePromotions>
    
    	<Unit_Flavors>
    		<Delete UnitType="UNIT_MECH" />
    	</Unit_Flavors>
    
    	<Unit_ResourceQuantityREquirements>
    		<Delete UnitType="UNIT_MECH" />
    	</Unit_ResourceQuantityREquirements>
    
    	<UnitGameplay2DScripts>
    		<Delete UnitType="UNIT_MECH" />
    	</UnitGameplay2DScripts>  
    </GameData>
    Note: UNIT_MECH is the internal name for the GDR.
  4. It's easy enough to add a few more units in there: Just make 4 copies of each of the <Delete> lines and change the _MECH suffix to _MODERN_ARMOR, _JET_FIGHTER, _STEALTH_BOMBER, and _MECHANIZED_INFANTRY respectively for both UNIT_ and UNITCLASS_ prefixes so that the 6th-12th lines will look like this:
    Code:
    	<Units>
    		<Delete Type="UNIT_MECH" />
    		<Delete Type="UNIT_MODERN_ARMOR" />
    		<Delete Type="UNIT_JET_FIGHTER" />
    		<Delete Type="UNIT_STEALTH_BOMBER" />
    		<Delete Type="UNIT_MECHANIZED_INFANTRY" />
    	</Units>
  5. Continue adding to the other sections of the file, then save your changes.
  6. Then rename the other file in that folder, the .modinfo file to whatever you named your folder (it doesn't actually have to be the same). Don't bother renaming the .XML file.
  7. Now edit the .modinfo file. It's just another XML with an odd extension. This is what it will look like:
    Spoiler Example - Removing Giant Death Robot (v 1).modinfo :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="04b9e0c9-3943-4b89-8699-55c4975b07ef" version="1">
      <Properties>
        <Name>Example - Removing Giant Death Robot</Name>
        <Teaser>This example removes the Giant Death Robot unit from the game.  It completely deletes the GDR entry rather than simply making i</Teaser>
        <Description>This example removes the Giant Death Robot unit from the game.  It completely deletes the GDR entry rather than simply making it not playable.</Description>
        <Authors>sseckman</Authors>
        <SpecialThanks>Firaxis</SpecialThanks>
        <HideSetupGame>0</HideSetupGame>
        <Homepage>http://www.civilization5.com</Homepage>
        <AffectsSavedGames>1</AffectsSavedGames>
        <MinCompatibleSaveVersion>0</MinCompatibleSaveVersion>
        <SupportsSinglePlayer>1</SupportsSinglePlayer>
        <SupportsMultiplayer>1</SupportsMultiplayer>
        <SupportsHotSeat>1</SupportsHotSeat>
        <SupportsMac>1</SupportsMac>
        <ReloadLandmarkSystem>0</ReloadLandmarkSystem>
        <ReloadStrategicViewSystem>0</ReloadStrategicViewSystem>
        <ReloadUnitSystem>0</ReloadUnitSystem>
      </Properties>
      <Dependencies />
      <References />
      <Blocks />
      <Files>
        <File md5="059F6FDC3A1ECA4911CE39C0A6B34ACA" import="0">Example_RemovingGDR.xml</File>
      </Files>
      <Actions>
        <OnModActivated>
          <UpdateDatabase>Example_RemovingGDR.xml</UpdateDatabase>
        </OnModActivated>
      </Actions>
    </Mod>
  8. First, change any one of the characters in the 2nd line:
    Code:
    <Mod id="04b9e0c9-3943-4b89-8699-55c4975b07ef" version="1">
    to another hexadecimal character (0-9 or a-f). For instance, change that first 0 to a 1. This is important so it doesn't conflict with the Removing GDR mod.
  9. Now change the part between the <Name></Name> tags to whatever you'd like your mod to be called in the mods menu.
  10. If you like, change the Teaser, Description, Authors, etc. as well.
  11. Save... and boom! You've made your first mod!

EDIT: If you really can't be bothered to do it, I'd be happy to post the mod for you, but if you can edit the Civ5Projects.xml file, you can do this.
 
First--not a big deal--but this is the wrong forum for asking a question, so I've alerted the moderators to move it.
Moderator Action: thread moved to main Creation & Customization forum :)
 
ho, humm, well, yes it does.

Moderator Action: Moved back to tutorial section because of post #2
 
Nutty, I switched off these units by disabling the technologies that made these units possible and removing required dependencies to these tech's in other tech's. It worked very nicely, but I suppose removing the units in your way is a more elegant way to do it. I managed to completely remove the units by removing the tech's without any unwanted side effects, the tech's had nothing else I needed so it works perfectly. But I will look into your example because it allows for more detail control.

If I change values in an xml file and reload a saved game, will these new values apply or do I need to start a new game?

I have two more questions:

1: How can I add the range promotion to a unit that doesn't have that promotion?
2: How can make it possible to buy the Khan unit (which replaces the general) ?

Last comment, I really do miss the general from civ 3 where you could stack 4-5 units in it and move it in a single click, I also do miss the airfield you could build on any land tile. :)
 
As for changing values in the middle of a game, the unhelpful answer is "it depends," but if the game is expecting to find something in a specific place in the database and finds something else instead, odd results can occur. I've learned the hard way not to get too attached to a specific game that I'm playing between versions of a mod I'm working on.

As for the numbered questions, it appears the modding bug has bitten you after all!

#1: That's easy. Just add something like this to your XML file (make sure it's between the <GameData> and </GameData> tags):
Code:
	<Unit_FreePromotions>
		<Row>
				<UnitType>UNIT_whatever</UnitType>
				<PromotionType>PROMOTION_RANGE</PromotionType>
		</Row>
	</Unit_FreePromotions>

#2: I'm a little confused how you're going to make it work from a gameplay standpoint. I've never tried to get Great People to be buildable, but at the very least you're going to need to assign a Cost to UNIT_MONGOLIAN_KHAN in the Units table. If what you want to do is to add a new unit that uses the Khan model, then it's easy enough to create a brand new unit that reuses the art define, but I believe it's going to be missing all of the attack animations.

In any event, now's the time for you to read some tutorials and download the SDK.

As for your last comment, see the Airfield mod. Something similar could be done to make a Civ3 style Army, though I think it would take quite a bit of work to get the UI to work properly. EDIT: Note that LuvToBuild just brought this up. See the Transport Armor Tank mod.

Note that now this has become a tutorial, you want to bring up unrelated questions like these in a new thread.
 
In any event, now's the time for you to read some tutorials and download the SDK.

On the side of the point, if you come down to the point of modding, to extend the lifespan of a game, there is a lack of other things to do in life. If something is not fun anymore, what else could be. :)
 
Ok, trying to remove the GDR, can't get it to work from me trying to remake the mod using Nutty's spoilers. I'm a mac non-steam version so can't just outright download the mod off of steam either. Is there more than the 2 files in it or something? My game doesn't even see it as an option for a mod to load, I have successfully loaded other mods downloaded off of here.
 
Sorry, Tebec, I didn't notice your post!

No, there are just 2 files. You can zip up what you did and I can try to figure out what the problem is.

If you don't care to figure it out and are just trying to get a working copy of sseckman's original example mod, I'll post it here.
 

Attachments

  • Example - Removing Giant Death Robot (v 1).zip
    1.7 KB · Views: 312
Sorry for jumping on this late, but is there anyway to delete a unit for a specific civilization? For example, I dont want my Civ to generate Great Prophets but I still want Shrines.
 
For normal units, there's a few ways you might approach that, but Great People work quite a bit differently.

It'd definitely take some LUA. It'd take me some time to figure it out, but I'm sure someone who's good at it could do it fairly quickly. You should open a new thread in the main Creation & Customization forum.

But I'm curious what good faith buildings do (other than the Ancestor Worship belief) since you can never transition from Pantheon to Religion without a Prophet? Or did you mean no GPs after the first one?
 
I've created a new type of Great Prophet, that spawns its own way (not through faith, but I still want to use faith to buy things), and I want the old prophet to go away :p

Thanks tho, I'll create a new thread.
 
Top Bottom