Modder's Guide to Star Trek

deanej

Deity
Joined
Apr 8, 2006
Messages
4,859
Location
New York State
A lot of this comes from the Modder's Guide to Final Fronter Plus. Special thanks to TC01 for putting that together! I've added/modified it with Star Trek specific stuff.

This mod, and all files in it, can be freely used by modders so long as credit is given.

XML Reference:
The tags that come from Final Frontier Plus are added at the end of the entry. The ones with Star Trek are typically at the end of the tag's group - for example, bNoCloaking is found after all the BtS booleans in Civ4UnitInfos. Check the schema files for exact placement. Note: most of these tags are exposed to python, even if not listed as such. Many of the tags also require help text to show up in the civilopedia.

CIV4BuildingClassInfo:
bUnique: Boolean indicating the buildingclass is unique and requires a declaration in Civ4CivilizationInfos as a civ's building type to be built.

CIV4BuildingInfo:
bNeverCapture, iConquestProb: These tags in vanilla Civ were not used in Final Frontier. They now can be used- to set either the probability of a building being destroyed or that the building will always be destroyed on the conquest of a city.

BuildingClassNeededs: This array in Final Frontier was used to require certain buildingclasses to be on the building planet. Now it merely requires the buildingclasses to be in the same system- the original functionality has been passed to a new array, PlanetBuildingClassNeededs.

bOnePerSystem: Boolean tag indicating that the building can only be built once per system. Accessed by CvBuildingInfo().isOnePerSystem().

iCostModIncrease: Integer tag indicating the increase in building cost for multiple buildings in a system (Works like it did in the python- "2" is normal, "3" is a higher cost). Accessed by CvBuildingInfo().getCostModIncrease().

PlanetYieldChanges: An array that lets you change the yields of the planet that the building was built on. The example below adds one food to the planet (like the Nutrition Facility). Accessed by CvBuildingInfo().getPlanetYieldChanges(int).

Code:
			<PlanetYieldChanges>
				<iYield>1</iYield>
				<iYield>0</iYield>
				<iYield>0</iYield>
			</PlanetYieldChanges>

iPlanetPopCapIncrease: Integer that specifies how much the building increases the population cap of the planet it is built on. Accessed by CvBuildingInfo().getPlanetPopCapIncrease().

SystemArtTag: String that points to the "Feature Model Tag" for buildings that have art visible in the game when built (like the Shipyards). Accessed by CvBuildingInfo().getSystemArtTag().

bMoon: Boolean saying that the building requires the current building planet to have a moon for the building to be constructed. Accessed by CvBuildingInfo().isMoon().

bRings: Boolean saying that the building requires the current building planet to have rings for the building to be constructed. Accessed by CvBuildingInfo().isRings().

PlanetBuildingClassNeededs: Array similar to BuildingClassNeededs, but the buildings listed here must be on the current building planet for the building to be constructed. Accessed by CvBuildingInfo().isBuildingClassNeededOnPlanet(iBuildingClass).

iSingleRingBuildingLocation: Integer used to define exceptions to the single building ring location system, used for building art orbiting the solar system. If not set to -1, a building will use the FEATURE_DUMMY_TAG_BUILDING_x where x is this value. Accessed by CvBuildingInfo().getSingleRingBuildingLocation().

TraitPlanetYieldChanges: Array for traits that, in combination with the building, cause yields to change on the planet the building is built on. The example is for the Forge and the Mining Facility. Accessed by CvBuildingInfo().getTraitPlanetYieldChanges(iTrait, iYield).

Code:
			<TraitPlanetYieldChanges>
				<TraitPlanetYieldChange>
					<TraitType>TRAIT_THE_FORGE</TraitType>
					<PlanetYieldChanges>
						<iYield>0</iYield>
						<iYield>1</iYield>
						<iYield>0</iYield>
					</PlanetYieldChanges>
				</TraitPlanetYieldChange>
			</TraitPlanetYieldChanges>

CIV4CivilizationInfo:
bAlien: Boolean tag that, in theory, this flags a civ as one of the "alien" civs that a goody flagged with "bNewCiv" can spawn. Accesse by CvCivilizationInfo().isAlien(). Note: this code is a little buggy and doesn't really work, but the tag can be used for other things. In Star Trek, it is set for all non-mirror universe, non-Borg civs.

bBorg: Boolean tag indicating that the civ cannot research technologies normally (but can still get them via goody huts). Civs with this tag set gain a tech when they conqueror a city.

CIV4TraitInfo:
bNoResistance: Boolean indicating that players with this trait will not have resistance in conquered cities.

iFreePopulation: Integer that defines the free population that will be added to all cities a player with this trait has. Accessed by CvTraitInfo().getFreePopulation().

iFreeTradeRoutes: Integer that defines extra trade routes that will be added to all cities a player with this trait has. Accessed by CvTraitInfo().getFreeTradeRoutes().

iStartingGoldMultiplier: Integer that is multiplied by the default amount of starting gold a player with this trait starts with. Accessed by CvTraitInfo().getStartingGoldMultiplier().

YieldChanges: Array for yield changes (throughout the entire city, not just a specific planet) caused by the trait. Accessed by CvTraitInfo().getYieldChanges(iYield)

FreePlanetBuildingClass: String defining a building class that will be added to all planets in all solar systems founded by a player with the trait. Accessed by CvTraitInfo().getFreePlanetBuildingClass().

TradeRouteYieldChanges: Array for yield changes throughout the entire city per each trade route in the city. Accessed by CvTraitInfo().getTradeRouteYieldChanges(iYield).

CIV4CivicInfo:
UnitCombatCostMods: An array that lets you modify a given unit combat's cost under a civic. For instance, the array in the example makes light ships cost -10% less. Accessed by CvCivicInfo().getUnitCombatCostMods(int).

PlanetYieldChanges: An array that lets you change planet yields in the same style of other YieldChanges arrays. The example below adds one food to all planets (like the Utopia civic). Accessed by CvCivicInfo().getPlanetYieldChanges(int).

Code:
			<UnitCombatCostMods>
				<UnitCombatCostMod>
					<UnitCombat>UNITCOMBAT_LIGHT_SHIP</UnitCombat>
					<iCostMod>-10</iCostMod>
				</UnitCombatCostMod>
			</UnitCombatCostMods>
			<PlanetYieldChanges>
				<iYield>1</iYield>
				<iYield>0</iYield>
				<iYield>0</iYield>
			</PlanetYieldChanges>

CIV4GoodyInfo:
RequiredImprovement: String that lets you make the goody require a particular improvement. If left blank or not used, the goody can be received from any improvement. Accesed by CvGoodyInfo().getRequiredimprovement().

bDamageUnit: Boolean that says that the goody's effects will damage the unit that triggered it. Accessed by CvGoodyInfo().isDamage().

bNewCiv: Boolean that in theory creates a new civ flagged with "bAlien". Untested as no alien civs have been added (no enabled goody uses this). Accessed by CvGoodyInfo.isNewCiv().

CIV4FeatureInfo:
bNoBarbarianSpawn: Boolean that means barbarian units will not be allowed to spawn on this feature. Accessed by CvFeatureInfo().isNoBarbarianSpawn().

iMovePathExtraCost: Integer defining the extra "movement path cost" for this feature (used in calculating movement paths). Accessed by CvFeatureInfo().getExtraMovePathCost().

BlackHoleFeatureType: String defining the "Black Hole" matched with this gravity field feature- gravity field features will only pull units in if this is defined. Accessed by CvFeatureinfo().getBlackHoleFeatureType().

iGravityFieldForce: Integer defining the force of this gravity field feature. Dependent on BlackHoleFeatureType. Accessed by CvFeatureInfo().getGravityFieldForce().

iBlackHoleInArea: Integer defining the range of plots around a grav field that the game will look for it's BlackHoleFeatureType. Accessed by CvFeatureInfo().getBlackHoleInArea().

TargetWormholeType: String defining a feature that units moving onto this feature will be teleported to. Can be the same or different feature- so FEATURE_WORMHOLE's TargetWormholeType is FEATURE_WORMHOLE. Accessed by CvFeatureInfo().getTargetWormholeType().

CIV4ImprovementInfo:
UnitClassBuilt: String indicating the unit class of a unit created when the improvement is built. The unit is given to the player who is building the improvement. Accessed by CvImprovementInfo().getUnitClassBuilt().

CIV4TerrainInfo:
bFoundFeature: Boolean tag indicating that a city can only be built on the plot if there is a feature as well. Overruled by bFound. Accessed by CvTerrainInfo().isFoundFeature().

CIV4BuildInfo:
bStarbase: Boolean tag indicating that the build will produce a unit (that the build is making a starbase). This causes the game to check whether other units are building other "starbases" or there are other "starbase units" on the plot before allowing construction. Accessed by CvBuildInfo().isStarbase().

CIV4PromotionInfo:
Invisible: String indicating what invisible type the unit has once acquiring the promotion. Note: this is a permanent affect and won't be removed with the promotion.

SeeInvisible: String indicating what invisible type the unit can see once acquiring the promotion. Note: this is a permanent affect and won't be removed with the promotion.

bOnlyDefensive: Boolean indicating if the unit cannot attack

bCloaked: Boolean indicating if the unit is cloaked (invisible to most units)

bSeeCloaked: Boolean indicating if the unit can see cloaked units in surrounding tiles

iGoldCost: Integer tag that specifies how much gold the promotion costs to get

iCombatCapturePercent: Integer tag that specifies the percent chance to capture an enemy unit when winning combat

bCaptureCounter: Boolean indicating that the unit resists capture

CIV4UnitClassInfo:
bUnique: Boolean indicating that the unitclass is unique, requiring a declaration in Civ4CivilizationInfos as a civ's unit type to be available

CIV4UnitInfo:
bAnimal: This tag has been modified in Star Trek - animals can enter cultural borders (and ignore the great wall effect) and will raze cities automatically.

bNoCloaking: Boolean tag indicating that the unit cannot cloak

bStarbase: Boolean tag indicating that the unit is a "starbase". Starbase builds can't be built when starbase units are on the plot. Accessed by CvUnitInfo().isStarbase(), or alternatively CyUnit().isStarbase().

iCultureRange: Integer tag indicating the range of culture that will be created around the unit when it is created. Normally set to 0, set to 2 for starbases. Accessed by CvUnitInfo().getCultureRange().

MinBarbarianSpawnEra: String defining the earliest game era required for the barbarians to spawn this unit. Game era is the average of player eras. Accessed by CvUnitInfo.getMinBarbarianSpawnEra().

MaxBarbarianSpawnEra: String defining the latest game era required for the barbarians to spawn this unit. Game era is the average of player eras. Accessed by CvUnitInfo.getMaxBarbarianSpawnEra().

iBarbarianChanceMultiplier: Integer that increases the chance of this unit spawning as a barbarian. It is multiplied by the randomly generated chance, so if set to 2, the chance doubles, if set to 3, it triples, etc. Accessed by CvUnitInfo().getBarbarianChanceMultiplier.

iUpgradePriceOverride: Integer that hardcodes an upgrading price for upgrading to this unit, ignored if the price is 0 or less. Accessed by CvUnitInfo().getUpgradePriceOverride().

bDelta: Boolean that defines a unit as a "delta" unit. Is not necessary for all Delta units and does nothing except influence upgrade prices (see below). Only used for Delta Starbase at present. Accessed by CvUnitInfo().isDelta().

bOmega: Boolean that defines a unit as an "omega" unit. Is not necessary for all Omega units. What it does is this: if a unit is upgrading to an omega unit and is a normal (non-delta) unit, than the upgrade price is doubled. Only used for Omega Starbase at present. Accessed by CvUnitInfo().isOmega().

bOtherStation: Boolean that defines a space station (declared by bStarbase) as an "other station", i.e. not a starbase and therefore not something that spawns missiles. Accessed by CvUnitInfo().isOtherStation().

MovementSound: String that defines a 3D audio script ran when the unit moves. Accessed by CvUnitInfo().getMovementSound().

bMissile: Boolean that defines a unit as a missile, and therefore spawnable by starbases. Accessed by CvUnitInfo().isMissile().

Global Defines:
TURN_BARBARIANS_APPEAR: Integer defining the first turn barbarian units will appear

CONSTRUCT_SHIP: String defining the construction ship unitclass, for the AI's construction ship code.

FF_PALACE_BUILDINGCLASS: String defining the Palace/Capitol buildingclass. It is necessary because for some reason TC01 can't access the existing PALACE_BUILDINGCLASS tag in Python.

BORG_AI_TECH_COST_INCREASE: Integer defining the percent increase in cost the Borg AI has for technologies (4.18 and later).

BORG_COMBAT_WON_TECH_CHANCE: Integer defining the percent chance for the Borg to gain a technology when winning in combat (4.18 and later).

BORG_CITY_CAPTURE_TECH_CHANCE: Integer defining the percent chance for the Borg to gain a technology when capturing a system (4.27 and later).

Final Frontier Worldbuilder:

TC01's Final Frontier Worldbuilder project adds additional data to the WBS files created when loading and saving inside the in-game Worldbuilder. This new information iis documented below. Please note: the consequence of this is that third-party map editor programs such as MapView will create WBS files that do no work properly. The ProductionBuilding, ProductionUnit, ProductionProject, and ProductionProcess entries have been removed. The leader name is read from the XML for AI civs so changing it in the scenario file only affects human players. Also, most scenario maps use an older version of the worldbuilder code.

The planets of a solar system were stored under the "FeatureType=FEATURE_SOLAR_SYSTEM" line, as seen below:

Code:
PlanetType=ORANGE_PLANET, OrbitRing=4, PlanetSize=1, HasMoon=1, HasRings=0
PlanetType=RED_PLANET, OrbitRing=2, PlanetSize=2, HasMoon=0, HasRings=0
PlanetType=RED_PLANET, OrbitRing=1, PlanetSize=1, HasMoon=0, HasRings=0
PlanetType=BLUE_PLANET, OrbitRing=7, PlanetSize=2, HasMoon=0, HasRings=0
PlanetType=GREEN_PLANET, OrbitRing=3, PlanetSize=1, HasMoon=0, HasRings=0
PlanetType=RED_PLANET, OrbitRing=8, PlanetSize=0, HasMoon=0, HasRings=0

Now, two additional tags have been added to the end of this list. One is called "PlanetName=". It specifies what the name of the planet is. The second is called "PlanetBonusType=", and it specifies what the planet's resource is (if there is one). See below for an example:

Code:
PlanetType=ORANGE_PLANET, OrbitRing=4, PlanetSize=1, HasMoon=1, HasRings=0, PlanetName=Xi Horus, PlanetBonusType=NO_BONUS
PlanetType=RED_PLANET, OrbitRing=2, PlanetSize=2, HasMoon=0, HasRings=0, PlanetName=Zeus Cancer, PlanetBonusType=NO_BONUS
PlanetType=RED_PLANET, OrbitRing=1, PlanetSize=1, HasMoon=0, HasRings=0, PlanetName=Sigma Libra, PlanetBonusType=BONUS_FISH
PlanetType=BLUE_PLANET, OrbitRing=7, PlanetSize=2, HasMoon=0, HasRings=0, PlanetName=Gamma Hephaestus, PlanetBonusType=NO_BONUS
PlanetType=GREEN_PLANET, OrbitRing=3, PlanetSize=1, HasMoon=0, HasRings=0, PlanetName=Paradise, PlanetBonusType=NO_BONUS
PlanetType=RED_PLANET, OrbitRing=8, PlanetSize=0, HasMoon=0, HasRings=0, PlanetName=Pi Hermes, PlanetBonusType=NO_BONUSPlanetBonusType=NO_BONUS

The following lines of code can be added to any city define (below any "BeginCity"). They control the distribution of "CityPopulation=" among various planets in the solar system. The total of all the values of the planet population tags must equal the city population, and it should go under the "CityPopulation=" line.

Code:
Planet1Population=2
Planet2Population=1
Planet3Population=0
Planet4Population=1
Planet5Population=2
Planet6Population=1
Planet7Population=0
Planet8Population=1

The following lines of code can be added to any city define (below any "BeginCity"). They store buildings to a specific planet, so "Planet1BuildingType=" means that the listed building is added to Planet 1, and the same for all the others. They should be added under the last "BuildingType=" line)

Code:
Planet1BuildingType=BUILDING_CAPITOL
Planet2BuildingType=BUILDING_NUTRITION_FACILITY
Planet3BuildingType=BUILDING_MINING_FACILITY
Planet4BuildingType=BUILDING_RECYCLING_CENTER
Planet5BuildingType=BUILDING_NUTRITION_FACILITY
Planet6BuildingType=BUILDING_MINING_FACILITY
Planet7BuildingType=BUILDING_RECYCLING_CENTER
Planet8BuildingType=BUILDING_CAPITOL

The following lines of code can be added to any city define (under BeginCity). They specify the selected planet and the building planet ring for each city- the planet that is selected in the city screen and the planet that buildings will be created on.

Code:
SelectedPlanet= 2
BuildingPlanetRing = 2

Miscellaneous:

AI Auto-Play:

You can also use AI Auto Play in this mod. To turn on AI Auto Play, you need to first enable the console- turn on "cheats" by opening up the BTS .ini file, searching for "CheatCode = 0", and changing the "0" to "chipotle". The .ini file can be found in your Beyond the Sword directory (there should be a shortcut titled _Civ4Config). Then you must open up the console by typing "Shift + ~" in game.

Once in the python console, enter the following to activate AI Auto Play, where "x" is the number of turns AI Auto Play should last.

Code:
CyGame().setAIAutoPlay(x)

Final Frontier Debugger:

Jon Shafer built some debugging functionality into Final Frontier. Specifically, throughout the mod's python files there are lots of printd() statements which output text to the PythonDbg.log file. These statements are normally disabled. However, you can activate them if you need more information.

If you open CvSolarSystem.py, at the top you should see this code:

Code:
#########################################
#########################################
g_bPrintDebugText = false
#########################################
#########################################

def printd(szText):
	if (g_bPrintDebugText):
		print(szText)

If you change the value of g_bPrintDebugText to True, the debug text will be printed.
 
Solving Star Trek Dependencies:

There are two references to Star Trek in the mod's files. The first is in CIV4ArtDefines_Misc.xml. It reads as follows in Star Trek:

Code:
		<MiscArtInfo>
			<Type>DEFAULT_THEME_NAME</Type>
			<Path>Mods/Star Trek/Resource/Civ4.thm</Path>
			<fScale>0.0</fScale>
			<NIF>None</NIF>
			<KFM>None</KFM>
		</MiscArtInfo>

Likewise, you will need to edit the Civ4.thm file located in the Resource folder. That is actually a text file, and reads as follows:

Code:
// *** Control Bitmap Theme file

// Set the resource 
resource_path	"Mods/Star Trek/Resource";

// Setup common properties
include			"Mods/Star Trek/Resource/Themes/Civ4/Civ4Theme.thm";

If these errors are not made, GFC errors will occur when a user tries to run the mod who does not have Star Trek installed.

You can merge the .fpk files and the Star Trek sounds into the main mod folder if you are making an independent modmod. Put the STArt0.fpk, STArt1.fpk, STArt2.fpk, and STArt3.fpk files in the Assets folder. In the BtS sounds folder, copy the Star Trek folder into Star Trek's sounds folder.

The intro movie and victory movies also need their paths changed. The tags that need updating are ART_DEF_MOVIE_ST_INTRO, ART_DEF_MOVIE_VICTORY_CONQUEST, ART_DEF_MOVIE_VICTORY_DOMINATION, ART_DEF_MOVIE_VICTORY_VALUE, ART_DEF_MOVIE_VICTORY_TIME, and ART_DEF_MOVIE_VICTORY_CULTURAL located in Civ4ArtDefines_Misc.xml.

Other Important Notes:

  • For some reason, wonders that are buildable by great people can be built multiple times. For this reason, wonders should not be able to be built by great people unless there is only one possible city on the map they can be built in (such as with the shrines).
  • Use PakBuild to unpack the .fpk files.
  • Don't remove the solar systems! They are integral to the mod's functionality and require a lot of effort to remove.
  • The SDK source and a debug DLL can be found in the Beyond the Sword\Mods\Star Trek folder.
 
Back
Top Bottom