There's already a "minor civ" in Civ4, i guess you can use this one as base and add your changes to it.

There's already a "minor civ" in Civ4, i guess you can use this one as base and add your changes to it.
Hi Voyhkah.UPDATE: I have successfully added our first new XML tag, <PrereqBorderTerrain>! This tag makes the given terrain necessary as a border to the city that wants to construct the building. Got that? I will now assault the Array <NoTerrains>, which declared which terrains the building CAN'T be build on.
EDIT: Sorry about accidentally pluralizing <PrereqBorderTerrain>. It is not an array.
To make it work with features what would I need to change? I presume I would just substitute the word terrain for feature wherever I see it in this code?Of course it doesn't work with features, although it should be easy enough to make it do so. And yes, <PrereqBorderTerrain>
If I was to take this code and drop it into the corresponding python files for the Cavemen to Cosmos Mod and substitute all occurances of "terrain" for "feature" would I then just add the following code in the BuldingInfos file (for the correct buildings of course)?Not sure if this would work, haven't tested it yet due to not enough framework to run the mod, but this is my code.
In CvCity.cpp, under the method canConstruct:
Code:CvBuildingInfo& building = GC.getBuildingInfo(eBuilding); int terrainInt = building.getPrereqBorderTerrain(); TerrainTypes terrain = (TerrainTypes)terrainInt; bool border = true; if (terrainInt != -1) { if (!isBorderTerrain(terrain)) { return false; } }
Also in CvCity.cpp:
Code:bool CvCity::isBorderTerrain(TerrainTypes terrain) const { int xCoord = getX(); int yCoord = getY(); for(int x = -1; x < 2; x++) { for(int y = -1; y < 2; y++) { int relXCoord = xCoord + x; int relYCoord = yCoord + y; CvPlot* plot = GC.getMap().plot(relXCoord,relYCoord); if(plot->getTerrainType() == terrain) { return true; } } } return false; }
In CvGameTextMgr.cpp:
Code:if (kBuilding.getPrereqBorderTerrain() != NULL) { CvTerrainInfo& terrain = GC.getTerrainInfo((TerrainTypes)kBuilding.getPrereqBorderTerrain()); szBuffer.append(NEWLINE); szBuffer.append(gDLL->getText("TXT_KEY_DLL_PREREQTERRAIN", terrain.getDescription())); }
I just realized that in my post, I had accidentally made <PrereqBorderTerrain> plural. It is not plural. Sorry, but there can be only one PrereqBorderTerrain per building.
This code is C++, not Python, so you can't use it in the Python files.
The core mechanics of the game and some other things - such as reading and parsing the XML - is written in C++ and compiled to the DLL file.
Asaf's right, you can't use C++ in Python. What you're doing is very different from what I did, because you want it to be necessary in the city radius, as opposed to what I have, which requires a border.
Anyway, I have a few things to recommend.
1. Take the time to learn Python. It's really easy, and unlocks a lot more stuff. Once you know python pretty well, you can try your hand at SDK (I actually find SDK easier, because Visual Studio has all sorts of useful tools and you can see the definition for all of the stuff. But enough of that). To start out at Python, I recommend reading Head First Programming, and then try one of the numerous Python tutorials.
But for now, I can easily write some code to change PrereqBorderTerrain to PrereqBorderFeature. But to merge this with the C++ code of Caveman2Cosmos, you would need some SDK capability. If you don't want to learn this now, xienwolf wrote a great tutorial (http://forums.civfanatics.com/showthread.php?t=314201). Otherwise, there might be a dirty Python fix, but I'm not all that great at Python, so you'd have to ask someone, or, because it's easier in the long run (And because Baldyr would never stop annoying you about it
), learn programming using the instructions above.
EDIT: A few things? Make that 1 thing.
Also, it seems you want multiple or-type PrereqBorderFeatures. That would be harder, but I could do it. Still, the problem of merging the two C++ projects (The custom one I would make and the one from Caveman2Cosmos) would still be a big problem, and that's a bit too much to ask of someone. If you have any questions, comments, concerns, etc., feel free to ask.
The problem is solved. I forgot to rebuild, as opposed to just build. Rebuild is nessecary to recheck the .h files.
Wait, the attacher is saying it isn't a valid image file. Somebody know what's going on?
<!-- WARNING: It is not recommended that you remove Bonuses due to complications with the LSystem -->