[BTS Python/XML] MachuPicchu Mod

GIR, you've got very creative mods, I really like them! Good work!:goodjob:

thx :D

Hi, GIR. I´m sorry, I can see how many work you have...
I have a little request. Can you merge for my mod Maximus, Petra and Machu Picchu only, please. I will be modify names and models in my mod but python code is for me closed :blush: :( :please:

OK, do you use other python mod components in your mod or will this be the only python stuff?
 
I want use these your 3 mods - only I in my mod have buildings for them I wanted very similar functions. It is not disrespekt. Only tendency use very very good code for my intention.

For your Machu Picchu I have model Meteora (mountain monastery) I´m not programmer but I wanted in the order to do similar function for Meteora.

Not easy make treaty here with coders for unique code and I can not remade code for my purpose.

Your mods will be as are - - new models only and names which I have for these models. I will happy if you will can merge it for me.
Thanks
I appreciate your work :worship:
Sory for my bad English
Hroch
 
If you don’t use any other python mod it will be very easy to merge my mods.
I will write a little how to.
If it’s not working for you I will upload the merged files but try the how to get familiar with the Gillmer J. Derge Event Manager.

I don’t think you need help with xml merging. Here is the python part:

Spoiler :
How to merge CircusMaximus mod with MachuPicchu mod:

Copy all the MachuPicchu Python Files in your mod.
Now copy CircusMaximus.py and CvCircusMaximusEventManager.py in your mod folder (…assets\Python)

Now you have to merge the two mods:
Part1:
Open the CvCustomEventManager.py in the CircusMaximus mod.
Go to line 25 and 26:
Copy the two lines:
Code:
# --------- CircusMaximus -------------
import CvCircusMaximusEventManager

Now open the CvCustomEventManager.py in your mod folder (it’s the one from MachuPicchu mod).
Go to line 27 and past the two lines from the CircusMaximus mod.
Now it should look like this:

Code:
# --------- MachuPicchu -------------
import CvMachuPicchuEventManager
# --------- CircusMaximus -------------
import CvCircusMaximusEventManager

(Save and Close.)

Part2:
Open the CvCustomEventManager.py in the CircusMaximus mod.
Go to line 71 and 72:
Copy the two lines:
Code:
        # --------- CircusMaximus -------------
	CvCircusMaximusEventManager.CvCircusMaximusEventManager(self)

Now open the CvCustomEventManager.py in your mod folder.
Go to line 75 and past the two lines from the CircusMaximus mod.
Now it should look like this:

Code:
        # --------- MachuPicchu -------------
	CvMachuPicchuEventManager.CvMachuPicchuEventManager(self)
        # --------- CircusMaximus -------------
	CvCircusMaximusEventManager.CvCircusMaximusEventManager(self)

Save and Close.
That’s all. Python files for MachuPicchu mod and CircusMaximus mod are merged!​



Part3:

Now merge the Petra Wonder:

Copy Petra.py and CvPetraEventManager.py in your mod folder (…assets\Python)

Add the Petra lines in your CvCustomEventManager.py file like you did it above.

Code:
# --------- MachuPicchu -------------
import CvMachuPicchuEventManager
# --------- CircusMaximus -------------
import CvCircusMaximusEventManager
# --------- Petra -------------
import CvPetraEventManager

and:

Code:
        # --------- MachuPicchu -------------
	CvMachuPicchuEventManager.CvMachuPicchuEventManager(self)
        # --------- CircusMaximus -------------
	CvCircusMaximusEventManager.CvCircusMaximusEventManager(self)
        # --------- Petra -------------
	CvPetraEventManager.CvPetraEventManager(self)[/INDENT]



After this you also have to merge the CvGameUtils.py file.

Open the CvGameUtils.py file in the Petra mod and go to line 188:
Copy this lines:
Code:
		### Petra Mod begins ###
		###  Note: the code identifies the first building of a certain buildingclass in the CIV4BuildingInfos.xml file to be the default building
		###########################################################################################

		### find buildings with the same buildingClassType ###
		lgleicheBC = []
		buildingClassType = gc.getBuildingInfo(eBuilding).getBuildingClassType()
		for i in range(gc.getNumBuildingInfos()):
			if ( buildingClassType == gc.getBuildingInfo(i).getBuildingClassType() ):
				lgleicheBC.append(i)

		if ( len(lgleicheBC) >= 2 ):
			### is eBuilding the normal building? ###
			if ( eBuilding == lgleicheBC[0] ):
				### do you have a "foreign" UB in the city? ###
				for i in range(len(lgleicheBC)-1):
					if ( pCity.getNumActiveBuilding(lgleicheBC[i +1])==true ):
						return True

		###########################################################################################
		### Petra Mod ends ###

Now open the CvGameUtils.py file in your mod folder.

Go to line 210 and past the lines from the Petra mod.
Now it should look like this:

Code:
	def cannotConstruct(self,argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]

		### MachuPicchu Mod begins ###
		###########################################################################################

		if ( eBuilding == gc.getInfoTypeForString("BUILDING_MACHU_PICCHU") ):

			### find peaks within the city radius controlled by your team ###
			pPlayer = gc.getPlayer(pCity.plot().getOwner())
			iPID = pPlayer.getID()
			iTID = pPlayer.getTeam()
			iX = pCity.getX()
			iY = pCity.getY()
			for iXLoop in range(iX - 2, iX + 3, 1):
				for iYLoop in range(iY - 2, iY + 3, 1):
					pPlot = CyMap().plot(iXLoop, iYLoop)
					if ( pPlot.isPlayerCityRadius(iPID)==true ):
						if ( pPlot.getTeam()==iTID ):
							if ( pPlot.isPeak()==true  ):
								return False
			return True

		###########################################################################################
		### MachuPicchu Mod ends ###

		### Petra Mod begins ###
		###  Note: the code identifies the first building of a certain buildingclass in the CIV4BuildingInfos.xml file to be the default building
		###########################################################################################

		### find buildings with the same buildingClassType ###
		lgleicheBC = []
		buildingClassType = gc.getBuildingInfo(eBuilding).getBuildingClassType()
		for i in range(gc.getNumBuildingInfos()):
			if ( buildingClassType == gc.getBuildingInfo(i).getBuildingClassType() ):
				lgleicheBC.append(i)

		if ( len(lgleicheBC) >= 2 ):
			### is eBuilding the normal building? ###
			if ( eBuilding == lgleicheBC[0] ):
				### do you have a "foreign" UB in the city? ###
				for i in range(len(lgleicheBC)-1):
					if ( pCity.getNumActiveBuilding(lgleicheBC[i +1])==true ):
						return True

		###########################################################################################
		### Petra Mod ends ###

		return False

Save and Close.​

That’s all. After you merged all the xml files you should be abel to use the CircusMaximus mod, MachuPicchu mod and Petra mod.​
 
Many thanks, GIR. I will abide by your instructions and I hope so I take it to the good end. :)

EDIT: Now I with my bad English after some time make sense of your instruction. I will manage it, I think :) You made it well-arranged for all.

Instructions here will be good for all who need help as I:)

Thanks GIR

HROCHland
 
hello
works fine now thanks (some idea: roads from via appia, take a look at medieval roads demo on graphics section and the python from visa mod)
 
hi, i merged the phyton code the way explained here, and i moduled the xml
now i got a MultyPlayer issue.. each time i select any of the wonders to build the game gets a sync problem.. can this be a mod problem or are sync problems only with version diferences related? (both players should have the same version since i sent all the files.. but there could be some issue :S)
tnks
 
hello
works fine now thanks (some idea: roads from via appia, take a look at medieval roads demo on graphics section and the python from visa mod)

actually the via appia / roman roads wonder + movie in the ViSa mod was from my SevoMod add on ;)
but yes, i was thinking to make a update on this wonder (gives only a road to all cities (not roads in all the the city radius plots) but give that road a +1 movement and the grey color like the roads in the charlemagne mod)
the only problem is that i dont have enough time at the moment :(
 
hi, i merged the phyton code the way explained here, and i moduled the xml
now i got a MultyPlayer issue.. each time i select any of the wonders to build the game gets a sync problem.. can this be a mod problem or are sync problems only with version diferences related? (both players should have the same version since i sent all the files.. but there could be some issue :S)
tnks

i dont play multiplayer games.
(actually i hardly have time to play single player games :()
and i dont have any experience with multi player errors.
maybe something in the python code causes the problem, but i really have no idea.
sorry!
maybe some1 else can help
 
Great ideas Gir..keep them coming..


Any thoughts on making these modular (if its even possible with python)

Also, can you please make romenstrassen (roman roads) a separate download/module...that was probably my favorite wonder.
 
How did you make it so that a city can work peaks? When I tried increasing peaks base production I found that it was pointless because impassible terrain tiles couldn't be worked anyway.

(I was also trying to allow special workers that could move through impassible terrain to build improvements there, at least mines to harvest the iron, copper, and gold that I made common on peaks and roads to connect the resources. Do you know why they couldn't build anything there?)
 
How did you make it so that a city can work peaks? When I tried increasing peaks base production I found that it was pointless because impassible terrain tiles couldn't be worked anyway.

(I was also trying to allow special workers that could move through impassible terrain to build improvements there, at least mines to harvest the iron, copper, and gold that I made common on peaks and roads to connect the resources. Do you know why they couldn't build anything there?)

i add the extra food/gold/production with a python code. and then cities can work the plot...

if you want a city to use a mine on a peak you could add a python code that adds the extra production on the plot when your worker finished the improvement.
 
I get the same error, and I would really like you to re-post this mod, if possible.

I can't seem to download the Macchu Picchu wonder by itself, and I'd really like it as a stand-alone mod, separate from your other modcomps in your collection. I really want the code you've used that allows for a building to give extra yields from mountains, since I've always thought that that's what the Incan Terrace should do (food from peaks), in the same way that the Dutch Levee gives production from water tiles. I'm kind of python-impaired, so I don't think sifting through code of your mod collection would work for me. :p

Thanks. :)
 
Top Bottom