1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Problem: Loading and playing wbsave

Discussion in 'Civ4 - MOO2Civ' started by Love Joy, Apr 27, 2010.

  1. Love Joy

    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 ^^>
     
  2. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    16,048
    Location:
    In orbit
    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...
     
  3. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    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.
     
  4. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    16,048
    Location:
    In orbit
    Cool! :D Alright,will try, thanks. :goodjob:
     
  5. Love Joy

    Love Joy Chieftain

    Joined:
    Apr 18, 2010
    Messages:
    9
    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!
     
  6. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    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).
     
  7. Love Joy

    Love Joy Chieftain

    Joined:
    Apr 18, 2010
    Messages:
    9
    It works!!!

    You are a genious :D :king:
     
  8. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online

Share This Page