[BTS] Mongol Camp

I have a problem. In plain GEM map, the camp works fine. Now, when I but camps on the 1500AD scenario, I hoped the same would happen but it did not. So i looked into your python code and found out this is may be the reason:

In 1500AD, there are two civs using the 'CIVILIZATION_MONGOL' as there civ type, now at the beginning, you have:

Code:
        for iPlayer in range(gc.getMAX_PLAYERS()):
            player = gc.getPlayer(iPlayer)
            if (player.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MONGOL')):
                self.iMongolsID = iPlayer

which 'I think' the second mongol civ would override the first mongol civ assignment. Hence, only the second mongol civ would get the sprawn effect. The first won't.

I wish you could confirm my understanding, and if possible, suggest ways to overcome this problem. thanks!
 
I think your type for civilization should be a unique identifier, to prevent all kinds of problems. I'm surprised you can actually use CIVILIZATION_MONGOL twice...

Anyway, confirmed. The Python loop overwrites the self.iMongolsID in the last iteration that matches. For a possible solution you have to add a second if statement (as an example I use CIVILIZATION_MONGOL2):

Code:
if (player.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MONGOL2')):
                self.iMongols2ID = iPlayer

In the other loop you should also match this second civ, so that its camp(s) get the unit spawn too.
 
I think your type for civilization should be a unique identifier, to prevent all kinds of problems. I'm surprised you can actually use CIVILIZATION_MONGOL twice...

Anyway, confirmed. The Python loop overwrites the self.iMongolsID in the last iteration that matches. For a possible solution you have to add a second if statement (as an example I use CIVILIZATION_MONGOL2):

Code:
if (player.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MONGOL2')):
                self.iMongols2ID = iPlayer
In the other loop you should also match this second civ, so that its camp(s) get the unit spawn too.

Thanks for the confirmation. My simplest solution might be to just change one of the two mongol civs to use another civ type.

P.S. One can actually declare all the players on a map to be of the same civilization type.
 
here is a silly question, what does that line of code do?

Just wondering because, If one wanted to have multiple Civs, (say the Huns or Sioux), would one simply replace the CIVILIZATION_MONGOLS with CIVILIZATION_HUNS and add a 2nd line with CIVILIZATION_SIOUX?

or could that line simply be left as is, and give the respective civilizations the Camp via the XML?
 
here is a silly question, what does that line of code do?

Just wondering because, If one wanted to have multiple Civs, (say the Huns or Sioux), would one simply replace the CIVILIZATION_MONGOLS with CIVILIZATION_HUNS and add a 2nd line with CIVILIZATION_SIOUX?

or could that line simply be left as is, and give the respective civilizations the Camp via the XML?

That particular line gets the ID for CIVILIZATION_MONGOL which is used further on in the script to match the civ which can have camps. If you want other civs to also have the camp functionality, you have to make some more changes to the Python.
 
Another problem, would the python function 'OnGameStart' works if the game is saved, and reloaded? I just had a game and have the camp working perfectly but then it doesn't work after the game is reloaded.
 
curious. i wonder about this unit. i remember reading about it in warlords (?), but i never played the scenario. but my main concern is how this accurately reflects the mongol invasions. i understand it'd be great for nomadic tribes, but i don't think the mongol empire founded by genghis khan really worked anything remotely similar to the mongol camp. still, i might consider using this unit for an upcoming modcomp i have planned around the Mongol Hordes.
 
Another problem, would the python function 'OnGameStart' works if the game is saved, and reloaded? I just had a game and have the camp working perfectly but then it doesn't work after the game is reloaded.

Hmmm, not sure. Need to investigate that. I'm under the assumption 'OnGameStart' means when you start OR load a game...
 
Fierabras,

For a new version of a mod that I have been working on, I am contemplating using something like the mongol camp as a "buddhist complex" to symbolize the occasional uprisings of Buddhist monks (I don't want cities). The unit would likely be given 0 movement. This faction would also have cities, but crushing a complex doesn't give the same benefit as taking over a city. It's sort of like a super fortress in a sense. If you burn it, then no more uprisings, but you don't gain the ability to produce anything.

Would you recommend using this unit that you have modded? Also, how would I go about changing certain specifics---units produced, frequency.

My editing abilities: Mainly just XML editing. For example, if a Keshik could be built, I could take a Keshik unit, and edit the XML portion to rename it/change graphics. In other words, I would not be touching anything related to Python.

thanks,
-Zen Blade
 
I would suggest taking a look at the MongolCamp.py file. If you can edit CIV XML, you should be able to modify that file to what you want. It will mainly be changing references like UNIT_CAMP, CIVILIZATION_MONGOL to something else from the XML in your mod (like UNIT_BUDDHIST_COMPLEX and CIVILIZATION_BUDDHIST). Same for the units that get produced. The number for chance and frequency can also be modded easily.

This little mod was one of the first things I made in Python. I used to mod XML only. Don't fear the Python. It can be daunting to create something new when you have never done Python before, but modifying something existing (or adapting like I did) is a good way to get you started.
 
How do I edit the file? Just open in microsoft word? or is there any particular program(s) that the file must be opened in?

I do my XML editing largely in the newest version of MS word.
 
Use a plain text editor like Notepad. You have to be careful with tabs in Python, otherwise you might end up tracking bugs due to whitespace problems.
 
Nice job, I'll have to update the Sioux Camp unit in my mod now :) It works great, thanks
 
I suggest getting Notepad++.

Notepad++ is an excellent choice for xml and python editing. It can also even be used to open .h and .cpp files, the type used in the .dll

Best part is that it's free.
 
Fierabras,

I noticed that mongol camp includes a "modules" folder, and that there are numerous XML files and other files within the custom Civs and units subfolders.

Is this structure (modules folder) compatible with mods that do not already contain a modules folder, but instead have an entire modpack with various files overwritten?

Or, do I need to copy and paste all of the information into my already existing XML files for civs and units?

thanks,
-Zen Blade
 
Numerous? There's only 7 and 3 of them are XML schemas (only needed for modular XML).

Modules/Custom Civilizations/Mongol/Mongol_CIV4CivilizationInfos.xml contains 1 change and that is that the Mongols start with the camp unit instead of a settler.

Modules/Custom Units/Camp/ contains XML files to add the camp unit (info, art and text)

It could be compatible with an existing non-modular mod, but chances are unlikely. Better is to copy my changes into the existing XML.
 
could you tell me in which file did you add the onGameLoad event so i don't have to troll through it all. please
 
MongolCamp.py in the Python/MongolCamp folder. I created a new function initValues which is called in onGameStart and onLoadGame. I moved stuff there what used to be only in onGameStart and led to the "load saved game" bug.
 
Back
Top Bottom