Final Frontier Plus

OK, here's the basics for traits - if you have any that should duplicate the effects you should just change the TRAIT_WHATEVER instead of removing the section(s) of code for that trait.

Keep in mind that I am not actually trying any of this, but it should remove the references to traits that don't exist for you and also remove the code for the effects the traits are supposed to have. (It looks like the reason you are getting all of the effect for everybody is that the check to get the integer value for the traits are returning -1 when it can't find it and then checking to see if a player has that "-1" trait seems to always return True which causes all of the trait specific code to be run.)

In CvFinalFrontierEvents.py, in the onGameStart function:
Code:
			if (pPlayer.isAlive()):
				
				# XXX - This only works because at the start of the game we know player's starting city exists
				pCity = pPlayer.getCity(0)
				pSystem = self.getSystemAt(pCity.getX(), pCity.getY())
				
				[COLOR="Red"]# New Earth gets extra population when city built
				iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_NEW_EARTH')
				if (pPlayer.hasTrait(iTrait)):
					if not ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):		#Added to stop New Earth from getting 3 population when loading a scenario, pop is stored there anyway
						pCity.changePopulation(1)
				
				# Paradise gets free Mag-Lev on every planet
				iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_PARADISE')
				if (pPlayer.hasTrait(iTrait)):
					
					iBuildingMagLev = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationBuildings(CvUtil.findInfoTypeNum(gc.getBuildingClassInfo, gc.getNumBuildingClassInfos(), "BUILDINGCLASS_MAG_LEV_NETWORK")) # this civ's mag lev network
					for iPlanetLoop in range(pSystem.getNumPlanets()):
						pPlanet = pSystem.getPlanetByIndex(iPlanetLoop)
						pPlanet.setHasBuilding(iBuildingMagLev, true)
						
					pCity.setNumRealBuilding(iBuildingMagLev, pSystem.getNumPlanets())
				
				# Red Syndicate gets 1 free trade routes when city built
				iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_SYNDICATE')
				if (pPlayer.hasTrait(iTrait)):
					pCity.changeExtraTradeRoutes(1)

				# Halis's unique unit is of the unitclass that the free starting ship is, so swap out
				# the starting planetary defense ship for a system defense boat
				iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_HALIS')
				if (pPlayer.hasTrait(iTrait)):
					iPlanetDefShip = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_PLANETARY_DEFENSE_I')
					iSysDefBoat = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_SYSTEM_DEFENSE_BOAT_I')
					pyPlayer = PyPlayer(iPlayerLoop)
					apUnitList = pyPlayer.getUnitList()
					pUnitToKill = -1
					for pUnitLoop in apUnitList:
						if (pUnitLoop.getUnitType() == iPlanetDefShip):
							# flag the unit for removal (don't modify the list when we are looping through it)
							pUnitToKill = pUnitLoop
							printd("Found unit to kill, id = %d" %(pUnitToKill.getID()))
					# kill the unit that was flagged (if one was) and add the replacement unit
					if (pUnitToKill != -1):
						pUnitToKill.kill(false, -1)
						#add a system defense boat
						pPlayer.initUnit(iSysDefBoat, pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)[/COLOR]
		
		# Set up Player stuff: Star Systems & Gold
		for iPlayerLoop in range(gc.getMAX_CIV_PLAYERS()):
If you have no civs with UUs that should replace the starting unit(s) supplied by the map script and will never add any you can just remove all the stuff that is in red.

Otherwise, remove all the stuff in red and put this in instead:
(OK, at this point I have to warn you that I have not actually tested this piece of code - it should be doing what the comments indicate. It is the same general idea as the existing code for TRAIT_HALIS at the end of the stuff-to-be-removed, but run as a check for everybody instead of being hardcoded for players with a specific trait.)
Code:
				# Check the player for unique units, swapping out the starting ship(s) for the player's UU if appropriate
				pCivilization = gc.getCivilizationInfo(pPlayer.getCivilizationType())
				pyPlayer = PyPlayer(iPlayerLoop)
				apUnitList = pyPlayer.getUnitList()
				for pUnitLoop in apUnitList :
					iUnitType = pUnitLoop.getUnitType() # this unit's unit type
					iUnitClass = pUnitLoop.getUnitClassType() # this unit's unit class
					iCivUnitType = pCivilization.getCivilizationUnits(iUnitClass) # this civ's unit type of this class
					if (iUnitType != iCivUnitType ):
						# existing unit's type does not match this civ's unit for the unit's class
						printd("Found unit to swap: id = %d, from type = %d to type = %d" %(pUnitLoop.getID(), iUnitType, iCivUnitType))
						# add new unit
						pNewUnit = pPlayer.initUnit(iCivUnitType, pCity.getX(), pCity.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
						# remove old unit
						pUnitLoop.kill(false, -1)

Shortly after that in the same function you should also remove all of this:
Code:
				# Paradise starts with 10x normal amount of gold
				iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_PARADISE')
				if (pPlayer.hasTrait(iTrait)):
					pPlayer.setGold(pPlayer.getGold() * 10)

In the same file, in updatePlotYield remove all of this:
Code:
				# The Forge get's 1 fewer food in all cities
				iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_THE_FORGE')
				if (pPlayer.hasTrait(iTrait)):
					aiSystemYield[0] -= 1
#					if (pCity.isCapital()):
#						aiSystemYield[1] += 1
#					else:
#						aiSystemYield[1] += 1
						
				# Red Syndicate gets +1 food and production for each Trade Route
				iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_SYNDICATE')
				if (pPlayer.hasTrait(iTrait)):
					for iTradeCity in range (pCity.getTradeRoutes()):
						pTradeCity = pCity.getTradeCity(iTradeCity)
#						printd("Trade city object:")
#						printd(pTradeCity)
						if (pTradeCity):
							if (pTradeCity.getName() != ""):
#								printd("entering trade route additions")
								aiSystemYield[0] += 1
								aiSystemYield[1] += 1

Still in the same file, in onCityBuilt remove all of this:
Code:
		# New Earth gets extra population when city built
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_NEW_EARTH')
		if (pPlayer.hasTrait(iTrait)):
			pCity.changePopulation(1)
		
		# Paradise gets free Mag-Lev on every planet
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_PARADISE')
		if (pPlayer.hasTrait(iTrait)):
			
			iBuildingMagLev = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationBuildings(CvUtil.findInfoTypeNum(gc.getBuildingClassInfo, gc.getNumBuildingClassInfos(), "BUILDINGCLASS_MAG_LEV_NETWORK")) # this civ's mag lev network
			
			for iPlanetLoop in range(pSystem.getNumPlanets()):
				pPlanet = pSystem.getPlanetByIndex(iPlanetLoop)
				pPlanet.setHasBuilding(iBuildingMagLev, true)
				
			pCity.setNumRealBuilding(iBuildingMagLev, pSystem.getNumPlanets())
		
		# Red Syndicate gets 1 free trade route when city built
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_SYNDICATE')
		if (pPlayer.hasTrait(iTrait)):
			pCity.changeExtraTradeRoutes(1)

Also in the same file, in onUnitBuilt remove this:
Code:
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_BROTHERHOOD')
		
		if (pPlayer.hasTrait(iTrait)):
			pUnit.changeExperience(4, 100, false, false, false)

And one more thing in the same file, in the onCityAcquired function remove this:
Code:
		# Red Syndicate gets 1 free trade route in captured cities
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_SYNDICATE')
		if (pPlayer.hasTrait(iTrait)):
			if (pCity.getExtraTradeRoutes() < 1):
				pCity.changeExtraTradeRoutes(1)
		
		# Paradise gets free Mag-Lev on every planet
		iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_PARADISE')
		if (pPlayer.hasTrait(iTrait)):
			
			iBuildingMagLev = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationBuildings(CvUtil.findInfoTypeNum(gc.getBuildingClassInfo, gc.getNumBuildingClassInfos(), "BUILDINGCLASS_MAG_LEV_NETWORK")) # this civ's mag lev network
			
			for iPlanetLoop in range(pSystem.getNumPlanets()):
				pPlanet = pSystem.getPlanetByIndex(iPlanetLoop)
				pPlanet.setHasBuilding(iBuildingMagLev, true)
				
			pCity.setNumRealBuilding(iBuildingMagLev, pSystem.getNumPlanets())

That should be everything in that file.

There is also one trait-specific thing in CvSolarSystem.py in the getExtraYield function remove the lines in red:
Code:
	def getExtraYield(self, iOwner, iYieldID):
		
		pPlayer = gc.getPlayer(iOwner)
		
		iExtraYield = 0
		
		[COLOR="Red"]iTrait = gc.getInfoTypeForString('TRAIT_THE_FORGE')
		iBuildingMiningFacility = gc.getInfoTypeForString('BUILDING_MINING_FACILITY')[/COLOR]
		
		#Yields from buildings (XML tags can be used, except for the Forge trait providing extra for the mining facility)
		for iBuildingLoop in range(gc.getNumBuildingInfos()):
			if (self.isHasBuilding(iBuildingLoop)):
				iYieldChange = gc.getBuildingInfo(iBuildingLoop).getPlanetYieldChanges(iYieldID)
				iExtraYield += iYieldChange
				
				[COLOR="Red"]# Production boost for the Forge's Mining Facilities & Capital
				if (iYieldID == 1):
					if (pPlayer.hasTrait(iTrait)):
						if (iBuildingLoop == iBuildingMiningFacility):
							iExtraYield += 1[/COLOR]
		
		#Yields from civics (again, XML tags can be used)
		for iCivicOption in range(gc.getNumCivicOptionInfos()):
			for iCivic in range(gc.getNumCivicInfos()):
				if pPlayer.getCivics(iCivicOption) == iCivic:
					iYieldChange = gc.getCivicInfo(iCivic).getPlanetYieldChanges(iYieldID)
					iExtraYield += iYieldChange
					
		# CP - add golden age effect, thanks for the idea of doing it here go to TC01
		if pPlayer.isGoldenAge():
			if (self.getBaseYield(iYieldID) + iExtraYield) >= gc.getYieldInfo(iYieldID).getGoldenAgeYieldThreshold() :
				iExtraYield += gc.getYieldInfo(iYieldID).getGoldenAgeYield()
			
		return iExtraYield

This should remove every effect caused by traits in the Python.

There are still references to buildings, units, and unit classes in a bunch of places.

:goodjob: Many thanks for this, i shall begin making the modifications to the B5 mod this weekend.
 
Hi all, i've gone through the B5 mod and made all of the changes shown above, i've also removed all XML references to the Star Fortress and the Art Defines XML reference to the same but when playing the game, the Star Fortress graphic still appears. As shown below. Any ideas on how to fix this issue please?
 
Hi all, i've gone through the B5 mod and made all of the changes shown above, i've also removed all XML references to the Star Fortress and the Art Defines XML reference to the same but when playing the game, the Star Fortress graphic still appears. As shown below. Any ideas on how to fix this issue please?

The code that actually adds the Star Fortress art is in CvSolarSystem.py, updateDisplay(), and it looks like this:

Code:
				if (pPlot.isCity()):
					
					pCity = pPlot.getPlotCity()
					
					# Star Fortress & Star Citadel (New Earth UB)
					iBuilding = gc.getInfoTypeForString('BUILDING_STAR_FORTRESS')
					iOtherBuilding = gc.getInfoTypeForString('BUILDING_STAR_CITADEL')
					if ((pCity.getNumRealBuilding(iBuilding) > 0) or (pCity.getNumRealBuilding(iOtherBuilding) > 0)):
						
						szBuilding = "FEATURE_MODEL_TAG_STAR_FORTRESS"
						szBuildingString = "FEATURE_DUMMY_TAG_BUILDING_0"
						pPlot.addFeatureDummyModel(szBuildingString, szBuilding)

I think removing this code should fix the issue, but I'm not positive.
 
v1.5 has been released. This version adds several new features, "inhabited planets" (solar systems that have aliens living on them and act as goody huts), Sensor Array stations (as implemented in deanej's Star Trek mod) that provide increased line of sight and are cheaper than starbases, as well as some new pedia text and a Final Frontier Plus Concepts section in the civilopedia.

-Added Inhabited Planets (systems acting as goody huts)
-Added "No Aliens" gameoption to turn off Inhabited Planets
-Added "No Starbase Missiles" gameoption (stops starbases from spawning Missiles)
-Added Sentry while Healing button
-Added Sensor Array unit (built like starbase) that spreads visibility
-Added trait tags for free population, bonus trade routes, and more starting gold
-Added building tag for on-map graphics
-Added new pedia/strategy text for some Finaler Frontier content
-Added some new buttons for some Finaler Frontier UBs
-The time for starbases to spawn missiles is modified by gamespeed
-AI now likes to build defensive starbases near its solar systems
-Fixed bug with iConquestProb on city capture
-Started civilopedia section for FF+ concepts
 
1) Yay! New version.

2) Argh! I didn't manage to do more text keys for Sunday like I thought I would - I did some yesterday and will do more today. I guess it'll be a "patch" for v1.5, ready for the next version. I hesitate to give a release date after the last try, but I'll probably post something tomorrow whether or not it is complete. At this point I still have 40 missing TXT_KEY values on my list, plus 12 that need to be changed from existing text keys to new ones (like how the Industrial Complex is currently using the Ironworks text for both pedia and strategy), and 3 duplicate Tech quotes which I may or may not change (they are currently the lowest priority).
 
Attached is a zip file that can be applied as a patch to 1.42. It includes a text file listing the changes.

Looks like a lot of great work here (although admittedly, I know nothing about how the insides of the mod stuff works LOL)

Just wanted to ask (regarding my earlier Mac question) whether this patch is also for the Mac version? Or this was work related to the TC01 version for the PC FFP?

Thanks and can't wait to try this out!
 
Looks like a lot of great work here (although admittedly, I know nothing about how the insides of the mod stuff works LOL)

Just wanted to ask (regarding my earlier Mac question) whether this patch is also for the Mac version? Or this was work related to the TC01 version for the PC FFP?

Thanks and can't wait to try this out!

The FFP-1-42a.zip file has only XML changes to 4 files and two art files for building buttons/icons (which are just the non-UB button with an overlay in the upper right of their civ's flags with a possibly too high transparency).

Everything that is done to the XML files is compatible with my Finaler Frontier mod, however two out of the four XML files that are supplied are not directly compatible as they are based on the FFP files which have extra tags in them and are missing the production benefits for buildings of the secondary traits (which are not in FFP).

The new FinalerFrontierTextInfosPedia.xml can replace the existing one, as can CIV4ArtDefines_Building.xml.

The CIV4BuildingInfos.xml (two changes) and CIV4UnitInfos.xml (also two changes) files are not directly compatible. You could manually apply the two changes changes to each of these to the existing files. It is only changing the values on two lines in the CIV4BuildingInfos.xml, one for each of two buildings to use the new art defines for the new buttons, and two lines in CIV4UnitInfos.xml for one unit to point to new text used in the civilopedia. The specific changes are given in the included FFP-1-42a Changes.txt file in the zip file.

If you only use the new FinalerFrontierTextInfosPedia.xml file, and just ignore the other three and the two art files, the difference is that the Technical Institute and Research Institute UBs will not use the new buttons and the Long-Range Q-Squadron UU will use the same text in the civilopedia as the regular Q-Squadron unit instead of its own. The other 19 new text values will still be used (replacing some of the various "TXT_KEY_whatever" strings that now appear with some actual text).

Once I get all of the text key changes done, I could release a new version of Finaler Frontier that includes all of them, as well as all Python bug fixes found between the least release and then (there is only the AI starbase ranged attack improvements so far), if it would be useful on the Mac.

Have you actually run Finaler Frontier on the Mac? Does it actually work? I have assumed so, but never heard anything to verify it.
 
I downloaded and installed v1.5, but now the game is crashing to desktop during map generation. Anyone else seeing this?

ETA: This is happening with all mapscripts, and ticking the box for aliens isn't making a difference.
 
I downloaded and installed v1.5, but now the game is crashing to desktop during map generation. Anyone else seeing this?

ETA: This is happening with all mapscripts, and ticking the box for aliens isn't making a difference.

It's not happening for me.

First, do you have BTS patch 3.19 installed?

Second, from which source (CFC or WPC) did you download?
 
I have 3.19, downloaded the mod from CFC.

Okay... did you for some reason delete your "Final Frontier" mod folder?

Oh, and did you download 3.19 from CFC as well, or did you use the in-game updater (which doesn't work)?
 
Okay... did you for some reason delete your "Final Frontier" mod folder?

Oh, and did you download 3.19 from CFC as well, or did you use the in-game updater (which doesn't work)?

No, to the first question. As for the second, I've no idea, but the game claims to be version 3.1.9.0, and v1.42a of Final Frontier Plus worked fine.
 
I have run into some crashing with 1.5 as well. (In fact, this has reminded me that I saw a crash in 1.42 too, and forgot about it until now. I didn't spend much time looking into it and just started another game to see if it kept happening. When it didn't, I just continued on.)

Playing along, when clicking to end turn 27 or 28 I had a crash. Trying to load the last autosave caused a crash after the FFP splash screen during the map loading phase.
Backing up, the previous one wouldn't load either, or the one before that. The one three back from the last did load. I have played that to turn 27 and made a save. I think I may have moved my recon ship slightly different than last time so it actually crashes while playing turn 28.

Attached is a savegame. After loading this, click on the end turn button. Then select the northern recon ship and move directly to the right. Doing this causes it to crash for me on the second move to the right. This is the move that would expose the star system to the right. Alternatively, trying to go into Worldbuilder will also cause a crash. There is nothing unexpected in any of the log files, and PythonErr.log is completely empty (it doesn't pop up a python error message, just directly to the "do you want to report this to Microsoft" dialog).
 

Attachments

  • FFP1.5-PreCrash-turn27.CivBeyondSwordSave
    41.2 KB · Views: 54
Aha.

In CIV4ImprovementInfos.xml the new IMPROVEMENT_ALIEN has an ArtDefineTag of ART_DEF_IMPROVEMENT_ALIENS.

In CIV4ArtDefines_Improvement.xml there is no such Type.

The version of CIV4ArtDefines_Improvement.xml that is installed with FFP v1.5 is identical to the one that comes with Final Frontier. (I used the "requires FF" install from here, not the other one.)

Bad ArtDefine = crash pretty much every time.

I changed the IMPROVEMENT_ALIEN to use ART_DEF_IMPROVEMENT_GOODY_HUT and was able to play some more.

On turn 35 I hit an unending (I click through several dozen identical errors and then killed it via the task manager) stream of Python errors that all look like this:
Code:
Traceback (most recent call last):

  File "CvScreensInterface", line 713, in forceScreenRedraw

  File "CvMainInterface", line 810, in redraw

  File "CvMainInterface", line 1554, in updateSelectionButtons

RuntimeError: unidentifiable C++ exception
ERR: Python function forceScreenRedraw failed, module CvScreensInterface

This is where the interface is looping over all actions for a unit to show all the currently available actions' buttons.

I did manage to reload and play past this without seeing it again. In between, I poked around a bit and didn't see anything that was obviously wrong. The case used for the new Sensor Array's button file was different than what was given in the ArtDefines so I changed it from "commarray.dds" to "CommArray.dds", but that may not actually matter. I also noticed that the folder the model is in has a space in the name, "Comm Array", which might be bad - I'm not sure. I haven't fiddled with that.

Reloading the last save game was problematic - directly clicking on it caused crashes twice. Loading the mod (via a shortcut that directly loads it), I looked at the Civilopedia (and remembered that doing it before had no icon show for the Inhabited entry on the Improvements page - I had thought that might be deliberate - but after changing the art define it does show the same image and model as the Wreckage). After that, loading the auto save worked. I have now played through turn 37. In turn 37 I attacked a pirate planetary defense ship with a destroyer (which I got from an inhabited planet) as the last thing in my turn and immediately after the attack finished I saw a one-time Python error:
Code:
Traceback (most recent call last):

  File "CvScreensInterface", line 713, in forceScreenRedraw

  File "CvMainInterface", line 810, in redraw

  File "CvMainInterface", line 1554, in updateSelectionButtons

MemoryError
ERR: Python function forceScreenRedraw failed, module CvScreensInterface
This is on the same line as the previous error, but the "MemoryError" is different than the unending stream of errors' "RuntimeError: unidentifiable C++ exception".

It would seem that there is a problem with the new action(s) still - the only one that I know of is presumably (because I have yet to build a construction ship and havn't seen the list) the ability to build the sensor array. I have not looked into this any further.

By the way - I have completed filling in all the missing TXT_KEY values for buildings, and made definitions that override the ones from BtS that don't match FFP. I was going to merge them into v1.5 when these problems came up, so that hasn't been done yet. Currently they are merged into my copy of v1.42.
 
The new action that's causing the problem is "Sentry Until Healed"- if you took damage fighting a Pirate Ship this button should be showed.

The ArtDefines_Improvements... I had used WinMerge to merge my changes from the main folder of Final Frontier Plus with the folder that contains only the edited files. I guess I forgot to copy over files I edited for the first time.

If anyone's interested in testing, could you download FF+ from WePlayCiv (the full download linked in the first post) and see if that fixes the crashes? Because then I know if the problem is an actual bug in the code or if I just forgot to copy over certain files.


I also realize I didn't update the SDK source code. Will do that for the first patch.
 
Ok, I downloaded and installed the light version and made it all of 30 turns in game before the black screen of death hit me. It was great; however, so fast and zippy that I doubt I'll return to star trek mod (my fav) until they can make some similar modifications to it. I read through these replies and it seems as if others are having this problem with 1.5 as well, so I'm going to try the last suggestion and install the full version and try again. I'll let you know the results shortly.

-Josh
 
Works great! Don't know why light version isn't working, but the full version works without a glitch, can even enter map maker on it, which was a big no no in the light version. Anyway, I'm going to try a full game on a huge map with full enemies and let you know how it plays out. Should probably be done by the end of the day.

-Josh
 
The new action that's causing the problem is "Sentry Until Healed"- if you took damage fighting a Pirate Ship this button should be showed.

The ArtDefines_Improvements... I had used WinMerge to merge my changes from the main folder of Final Frontier Plus with the folder that contains only the edited files. I guess I forgot to copy over files I edited for the first time.

If anyone's interested in testing, could you download FF+ from WePlayCiv (the full download linked in the first post) and see if that fixes the crashes? Because then I know if the problem is an actual bug in the code or if I just forgot to copy over certain files.


I also realize I didn't update the SDK source code. Will do that for the first patch.

The full download version works like a charm.
 
Top Bottom