How to disable a civ from random selection

Goody the Hutt

Chieftain
Joined
Aug 22, 2010
Messages
23
I'm trying to make a mod where each civilization has its own derivative civ for playing on continental maps where you have distant colonies (Spain = Mexico, Portugal = Brazil, France = Louisiana, etc.). It all seems fairly easy and straightforward except for the fact that you would then be unable to pick random opponents at the beginning of the game because some of these civilizations would inevitably be selected.

I've already tried disabling them in civilizationinfos, but unfortunately the derivative civs mechanic doesn't override this. The game instead picks a random civ from the list of enabled ones, or if all of the enabled ones are already in-game it will just give your cities to someone else.

So does anyone know if there's any way to make the random opponents mechanic pick some civs over others, or can anyone think of another work-around?
 
Depending on how advanced you're willing (or able) to go, you could always add an XML value to the CivilizationInfos file which could tell which civs were derivatives, and then prevent the derivative civs from being playable in the SDK (I'm not sure exactly where, but I'm sure it's possible).
 
Thanks, but I'm afraid the SDK is a bit (read: far) beyond me.

I thought of something else right after I posted this thread though. It's too ghetto to be a solution in itself but maybe it could lead to one. If you started the game with just the normal civs then saved and quit and added the derivatives through something easy and modular that you could just click and drag, then reloaded your game (so that the XML would recompile) you then should have the proper derivative civs in the game and ready to be used.

If there was a way to have that mod disabled by default and then have it be somehow activated during the loading of the map, that would do the same thing without having to reload. Can python do something like that? Is there any method that can activate certain parts of the XML only when you're playing on a map?
 
o_O that sounds ugly, and not sure if possible.

There'd be another way with python. It's possible to cycle directly after the game start through all civs, and replace them (BtS only) with other civs).
Do you have a defined list of what civs should be in and which out?
 
Awesome, thanks.

It would be nice to be able to add civs later for people that want to play with custom civs or alter the mod, but if that complicates things too much don't worry about it. For now just all of the civs from BTS except for England and America (because England already has one and America would fall into the derivative category itself) will suffice.

Most non-European civs that never came close to settling the Americas or don't have already-established alternate histories associated with them I'm just calling CIVILIZATION_NEW_(civ name here) and will change their names in the text files as I do more research/make it up, but I'll leave three that I've finished here as examples:

CIVILIZATION_NOVA_ROMA CIVILIZATION_VINLAND CIVILIZATION_ALASKA
 
Sounds interesting what you're going to do :).

Okay, i attached a small mod.
Problem here: I can't test it, i don't have Civ4 or a suitable computer here.
So it might not work and you have to help me to fix possible bugs.
The most important thing now: Enable python exceptions.
In your main Bts .ini file (My Documents\My Games\BtS\Civilization4.ini), please activate there python exceptions (search for "exception", and change the value from 0 to 1 or vice versa [don't know what the value is, but change it]).
This should give you error messages, if something is not working. Please copy them/save them and post them here if you get any.


So, the "mod": There are 2 files:
- CvEventManager.py
- ReplaceCivs.py
If you already have a CvEventmanager.py in your mod, then you have to copy 2 of the changes in the file (labeled "replaceCivs") to your mods CvEventManager. The second file just has to be in the same folder.


In the replaceCivs.py, there's a civ list at the top. The skript will try to kill these civs or all civs with "NEW_" in the name (if the civ is not a human) and to replace it with civs, which are also not in these lists and not already ingame. If such a civ is not anymore available, no other civ will be added.

Current problems:
- Civs which are earlier in the XML file will be added more often
- If such a civ has more than one leader, currently only the first one will ever be used.

Please try if the skript is working, then i'll take a look at the both issues.
 

Attachments

Back
Top Bottom