Natural Wonders Mod Comp

New Wonder




Notes:
Artwork and Button from History Rewritten mod.
Pedia updated to 2.19
First Team Benefit and Discovery Benefit both commented out.

Remaining benefits:
Plot Yield and Building

I believe those 2 are more than enough.
 
Updates
Removed all codes checking reveal status for placement, since there are no more reveal bonus involved.

Fix a rare bug that can cause a crash if Great Barrier Reef tries "very hard" to place and is totally impossible.

Pedia updated.
 
Removed all getSorenRandNum functions to fix OOS.

This includes the codes in CvGameUtils for Pillaging in BTS codes.
 
what did you replace the getSorenRandNum function with?
 
Just use python own random function...
 
Removed all getSorenRandNum functions to fix OOS.

This includes the codes in CvGameUtils for Pillaging in BTS codes.

So the problem with SorenRand is that it doesn't retain the same seed between sessions? Is that only with the "New Random Seed on Reload"?

what did you replace the getSorenRandNum function with?

Just use python own random function...

My understanding is that python's rand breaks multiplayer because the result is specific to each machine. And that's why we had to use SorenRand or MapRand. Unless you're calling python's rand via a modnetmessage or something?

MapRand is supposed to retain the seed between sessions. Why not use that?
 
Seriously, I can't fix something I can't test.
Pie noted that soren is definitely oos, so no point keeping it.
Whether the python own random works or maprand works, that will be for whoever is interested in MP to test, because I can't possibly test with one computer.

Thus, take the solution as a beta.
 
it won't work, the randnums on either side of the game must sync up, soren ensures this, pythons rand will not. bad bad bad. I would suggest leonvr's method, your mod is now non-multiplayer compatible.
 
If Soren is MP compatible, there is nothing to fix in the first place.
 
what is the problematic code? can you show it here?
 
Code:
	def placeWonderBuilding(self, pCity):
		for i in xrange(21):
			pPlot = pCity.getCityIndexPlot(i)
			iFeature = pPlot.getFeatureType()
			if iFeature == -1: continue
			sType = gc.getFeatureInfo(iFeature).getType()
			if sType.find("FEATURE_PLATY_") == -1: continue
			sNature = sType[sType.find("_PLATY_") + 7:]
			sBuildingType = "BUILDING_" + sNature
			iBuilding = gc.getInfoTypeForString(sBuildingType)
			if iBuilding == -1: continue
			if self.checkWonderBuilt(iBuilding): continue
			pCity.setNumRealBuilding(iBuilding, 1)
		return

	def checkWonderBuilt(self, iBuilding):
		iBuildingClass = gc.getBuildingInfo(iBuilding).getBuildingClassType()
		for iTeamX in xrange(gc.getMAX_TEAMS()):
			pTeamX = gc.getTeam(iTeamX)
			if pTeamX.getBuildingClassCount(iBuildingClass) > 0: return True
		return False
 
Yes definitely doesn't work in multi player. Been busy with some other projects but will take a look to see if I can fix it
 
Spotted what looks to be a minor bug in the Auyantepui building
PHP:
<iGlobalHurryModifier>25</iGlobalHurryModifier>
positive values of iGlobalHurryModifier increase the cost of hurrying so this is a disadvantage, which I presume was not the intent.
 
1) Fixed the above bug, thanks
2) Updated Pedia to 3.0
 
Hello . I do not know if it's possible . I did Eldorado cityset and I have in my mode Eldorado Natural Wonder . Is Possible in some way to make the city built near Eldorado NW will take Eldorado cityset ?
thanks
Hroch
 
You can test multiplayer on one pc by adding multiple in a shortcut for your mod as below and then run 2 instances on lan

"C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization IV Beyond the Sword\Beyond the Sword\Civ4BeyondSword.exe" multiple mod=/[modName here]

I will post a fix for the out of sync error in the next day or 2 it occurs when the placeWonderBuilding function is called

Sorry about delay but been busy with other stuff
 
To fix the out of sync

Firstly CyGame().getSorenRandNum must be used and not the python random number

in

def onCityBuild

NaturalWonders.NaturalWonders().placeWonderBuilding(city)

must be replaced by

Code:
iNaturalWonder = 5013 # make sure the id is not used for anything else
iPlayer = city.getOwner()
iCity = city.getID()
CyMessageControl( ).sendModNetMessage( iNaturalWonder, iPlayer , iCity, -1, -1 )

and then in

onModNetMessage

Code:
		if iData1 == 5013:
			pPlayer = gc.getPlayer(iData2)
			for i in xrange(21):
				pPlot = pPlayer.getCity(iData3).getCityIndexPlot(i)
				iFeature = pPlot.getFeatureType()
				if iFeature == -1: continue
				sType = gc.getFeatureInfo(iFeature).getType()
				if sType.find("FEATURE_PLATY_") == -1: continue
				sNature = sType[sType.find("_PLATY_") + 7:]
				sBuildingType = "BUILDING_" + sNature
				iBuilding = gc.getInfoTypeForString(sBuildingType)
				if iBuilding == -1: continue

				bBuilt = NaturalWonders.NaturalWonders().checkWonderBuilt(pPlot, pPlayer.getCity(iData3))
				if sType in NaturalWonders.NaturalWonders().lBigWonder and not bBuilt:
					bFound = False
					iX = pPlot.getX()
					iY = pPlot.getY()
					for x in xrange(iX - 1, iX + 2):
						for y in xrange(iY - 1, iY + 2):
							pAdjacentPlot = CyMap().plot(x, y)
							if x == iX and y == iY: continue
							if pAdjacentPlot.getFeatureType() == iFeature:
								bFound = True
								break
						if bFound: break
					bBuilt = NaturalWonders.NaturalWonders().checkWonderBuilt(pAdjacentPlot, pPlayer.getCity(iData3))
				if bBuilt: continue
				pPlayer.getCity(iData3).setNumRealBuilding(iBuilding, 1)

which is the code from the function placeWonderBuilding in NaturalWonders.py

You could possibly just call the NaturalWonders.NaturalWonders().placeWonderBuilding(pPlayer.getCity(iData3)) after
if iData1 == 5013:
pPlayer = gc.getPlayer(iData2)
[ call placeWonderBuilding here ]
but haven't tested it so not 100% sure if it works
 
Top Bottom