Problem: Loading and playing wbsave

Love Joy

Chieftain
Joined
Apr 18, 2010
Messages
9
Good Afternoon.

I really love this mod.
I have one problem. How can I load and play a worldbuildersave?

The problem is that everytime I save it and want to start a new game from a wbsave it tell me that I have been defeated.
It would not be a problem, but I always want "SOL" to look like our solar system. I edit the wbsave file, but when I want to play it, after loading it states that I have been defeated...
Of course it doesnot happen only after notepad altering but it never works. I just cant start of with a worldbuildersave at all.

What can I do to make it work? :)

<Its very funny, because wbsave files on load work fine in the StarTrek mod, but then again on star trek you cant change the solar systems via worldbuilder, because they come with no planets ^^>
 
On behalf of all contributors so far, thx. ;)

Worldbuilder doesn't work properly with FF and even TC01's FF Worldbuilder I haven't gotten to work properly with MOO2Civ. (The main reason I haven't been able to create proper scenarios for MOO2Civ; the current basic scenarios in v. 5.0 are actually Savegames, not WB files.)

So for now I can only refer you to TC01...
 
Okay... I finally decided to look through the MOO2Civ files to see what's wrong with FF Worldbuilder.

First, in CvFinalFrontierEvents.py (Assets\Python), line 78 "def onGameStart(self, argsList):"

There are a couple of things that need to be done with this function. First, on line 86, you must delete the "initMembers()" call. You can just put a "#" in front of it to comment it out, like this:

Code:
	def onGameStart(self, argsList):
		'Called at the start of the game'
		self.parent.onGameStart(self, argsList)
		
		self.iWinningTeam = -1
		self.iTimeLeft = 0
		
		self.initValues()
	#	self.initMembers()

Second, later in that function and starting on line 104 there is a huge block of code (seen in spoiler 1). This is Jon Shafer's Final Frontier code for Worldbuilder. It needs to be replaced with the code in spoiler 2).

Spoiler Code Fragment 1 :
Code:
		# Is this a scenario file?
		if ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):
			
			import CvWBInterface
			
			# Search through all plots on the map for Solar Systems to add content for
			for pWBPlotLoop in CvWBInterface.WBDesc.plotDesc:
				
				iX = pWBPlotLoop.iX
				iY = pWBPlotLoop.iY
				
				pPlot = CyMap().plot(iX, iY)
				
				if (pPlot.getFeatureType() == self.iFeatureIDSolarSystem):
					
					iStarType = getStarIndexFromTag(pWBPlotLoop.szStarType)
					
					pSystem = CvSystem(iX,iY,iStarType)
					
					for iPlanetLoop in range(pWBPlotLoop.iNumPlanets):
						iPlanetType = getPlanetIndexFromTag(pWBPlotLoop.aszPlanetType[iPlanetLoop])
						iOrbitRing = pWBPlotLoop.aiOrbitRing[iPlanetLoop]
						iPlanetSize = pWBPlotLoop.aiPlanetSize[iPlanetLoop]
						bMoon = pWBPlotLoop.aiMoon[iPlanetLoop]
						bRings = pWBPlotLoop.aiRings[iPlanetLoop]
						
						pSystem.addPlanet(iPlanetType, iPlanetSize, iOrbitRing, bMoon, bRings)
						
					self.addSystem(pSystem)
			
			# Add Buildings in WBS to Home Planet of Star System
			for iPlayerLoop in range(gc.getMAX_CIV_PLAYERS()):
				pPlayer = gc.getPlayer(iPlayerLoop)
				for iCityLoop in range(pPlayer.getNumCities()):
					pCity = pPlayer.getCity(iCityLoop)
					
					pSystem = self.getSystemAt(pCity.getX(), pCity.getY())
					iBestPlanet = getBestPlanetInSystem(pSystem)
					pPlanet = pSystem.getPlanetByIndex(iBestPlanet)
					
					for iBuildingLoop in range(gc.getNumBuildingInfos()):
						
						if (pCity.isHasBuilding(iBuildingLoop)):
							pPlanet.setHasBuilding(iBuildingLoop, true)
			
		else:
			
			# Loop through all plots, find the Solar Systems and give them randomized starting junk
			for iPlotLoop in range(CyMap().numPlots()):
				pPlot = CyMap().plotByIndex(iPlotLoop)
				
				if (pPlot.getFeatureType() == self.iFeatureIDSolarSystem):
					iYield = -1 #No preference
					pSystem = createRandomSystem(pPlot.getX(), pPlot.getY(), iYield, iPlanetQuantityTypePoor)	# Called from CvSolarSystem
					self.addSystem(pSystem)

Spoiler Code Fragment 2 :
Code:
		# Is this not a scenario file?
		if not ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):
			
			self.initMembers()
			
			# Loop through all plots, find the Solar Systems and give them randomized starting junk
			for iPlotLoop in range(CyMap().numPlots()):
				pPlot = CyMap().plotByIndex(iPlotLoop)
				
				if (pPlot.getFeatureType() == self.iFeatureIDSolarSystem):
					iYield = -1 #No preference
					pSystem = createRandomSystem(pPlot.getX(), pPlot.getY(), iYield, iPlanetQuantityTypePoor)	# Called from CvSolarSystem
					self.addSystem(pSystem)

I think that should fix it.
 
It still doesn't work for me :(
I still get the message "you have been defeated" when I load a wbsave file.

May be I did not do it properly. If it works for you then could you upload the python file. That would be marvelous :) Thanks anyway!
 
Aha!

The function "getStarIndexFromTag" and "getPlanetIndexFromTag" are missing in CvSolarSystem.py. The first should go on line 1219, the second on 1288.

Code:
aszSunTypes = [		"FEATURE_MODEL_TAG_SUN_YELLOW",
							"FEATURE_MODEL_TAG_SUN_ORANGE",
							"FEATURE_MODEL_TAG_SUN_WHITE",
							"FEATURE_MODEL_TAG_SUN_RED",
							"FEATURE_MODEL_TAG_SUN_BLUE"
						]

[COLOR="Red"]def getStarIndexFromTag(szTag):
	iIndex = 0
	for szTagLoop in aszSunTypeNames:
		if (szTag == szTagLoop):
			return iIndex
		iIndex += 1[/COLOR]

aszSunTypeNames = [		"Yellow Sun",
									"Orange Sun",
									"White Sun",
									"Red Sun",
									"Blue Sun"
								]

Code:
aszPlanetTypeNames= [	"Blue Planet",
									"Gray Planet",
									"Green Planet",
									"Orange Planet",
									"Red Planet",
									"Yellow Planet",
									"White Planet"
								]
[COLOR="red"]def getPlanetIndexFromTag(szTag):
	iIndex = 0
	for szTagLoop in aszPlanetTypeNames:
		if (szTag == szTagLoop):
			return iIndex
		iIndex += 1[/COLOR]

aaiPlanetYields = 		[	[0,2,5],
								[0,3,3],
								[3,1,2],
								[2,2,1],
								[1,2,3],
								[1,1,6],
								[2,0,3]
							]

I think I'll add these fixes to MOO2Civ Wormholes. (My version of CvFinalFrontierEvents.py has the Wormholes code in it anyway).
 
Top Bottom