Modder's Guide to Final Frontier Plus

Nope, here is the code for the three UnitClassInfos.
Code:
		<UnitClassInfo> <!-- O.D.S. -->
			<Type>UNITCLASS_ORBITAL_DEFENSE_SATELLITE</Type>
			<Description>TXT_KEY_UNIT_ORBITAL_DEFENSE_SATELLITE</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
			<iInstanceCostModifier>0</iInstanceCostModifier>
			<DefaultUnit>UNIT_SPACE_BOMBER_I</DefaultUnit>
		</UnitClassInfo>
		<UnitClassInfo> <!-- P.D.S. -->
			<Type>UNITCLASS_PLANETARY_DEFENSE_SATELLITE</Type>
			<Description>TXT_KEY_UNIT_PLANETARY_DEFENSE_SATELLITE</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
			<iInstanceCostModifier>0</iInstanceCostModifier>
			<DefaultUnit>UNIT_SPACE_BOMBER_II</DefaultUnit>
		</UnitClassInfo>
		<UnitClassInfo> <!-- O.D.P. -->
			<Type>UNITCLASS_ORBITAL_DEFENSE_PLATFORM</Type>
			<Description>TXT_KEY_UNIT_ORBITAL_DEFENSE_PLATFORM</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
			<iInstanceCostModifier>0</iInstanceCostModifier>
			<DefaultUnit>UNIT_SPACE_BOMBER_III</DefaultUnit>
		</UnitClassInfo>
So, fairly sure it's not that.
 
I need to amend my previous request for help slightly. The Comm Array is based on the Starbase and so isn't a new unit at all, just a variation. What i want to do is add a totally new type of unit/unitclass to FF/FFP but my original question stands, how do i add a new unit/unitclass to the mod and get the ai to build it, as well as the player(s).

Edit: Further to this, i've gone through everything i can think of, i found that there was a uit i hadn't based a B5 unit off. So, i have now used the Space Bomber as the base unit for the O.D.S., unfortunately this has still not enabled the unit to be built by any of the Civ's. As before you can see the unit in the Civilopedia but it doesn't appear in the Tech tree where/when the civilopedia says the units should be available. Really stuck with this now as it is the only thing holding up release of the latest version.
 
I think i may have to use the option i didn't want to pursue, which is to add the O.D.S. as another UU for each race. I wanted to keep them as a generic unit as they are the same for all races with the B5 mod. If you know of a way to add the unit without it being a UU then i would love to hear it.
 
Did you check the XML fields in Civ4UnitInfos, particularly iCost? If iCost is set to -1, you can't build the unit. You might also want to check the CivilizationInfos files to make sure you didn't set the unit type to NONE for the relevant unitclass. Blocked units do not show up in the pedia as blocked and appear normally (and for good reason: Firaxis only used these abilities to prevent players from building animals and to prevent the barbs from having missionaries and great people). There could also be some other "hidden" requirement set in the XML that you aren't aware of (such as MinAreaSize, which is used to prevent non-coastal cities from building naval units).
 
Does your version of B5 even have a UNIT_SPACE_BOMBER_I, II, or III?
The released v2.0 does not. If not then this is functionally equivalent to just specifying NONE.
 
Wait, I just noticed something. Your DefualtUnit for all those unitclasses is the space bomber. Since the build queue is based on unitclasses and buildingclasses (not units and buildings), you probably have multiple options for building the space bomber.
Actually, i don't, now. The only unit i have that appears more than once is the construction ship and i think i know why that is so i shall be testing something out to see if i can remove that little flaw.
Because there doesn't seem to be any way of adding in a unit that isn't based off of an existing FF unit i've had to use (and keep in) the original base units.
Does your version of B5 even have a UNIT_SPACE_BOMBER_I, II, or III?
The released v2.0 does not. If not then this is functionally equivalent to just specifying NONE.
The version i'm currently working on has all of the original FF units in it and the O.D.S. now works when used as a UU for each of the Civs. The AI still won't build them even when you put a weight of 500 in. At the moment the Mod would play best if played as a multiplayer, the AI doesn't seem to be able to grasp the principle of using the O.D.S. as the defense unit and the rest of the units as the Combat Fleet, this could well be down to the fact it is an immobile unit instead of a mobile one. Don't know what else to try to resolve that.
 
There should be nothing stopping you from adding a new unit or unit class. THe Star Trek mod, for example, is based on FFP now and does not have most of the units in FFP but has a bunch of different units and unit classes that don't exist in FFP - like it has a UNITCLASS_EXP_I that has 4 different units of the class (UNIT_EXP_I, UNIT_ORION, UNIT_SPHERE_I, and UNIT_FF).

As for an immobile unit, I have an idea...

You might be able to force it to be immobile if it was DOMAIN_LAND but had the space terrain (TERRAIN_TUNDRA - every plot on the map is this terrain type, everything that shows up on it is a feature) set in its TerrainImpassables for it. Since features override terrain for this and a star system has a feature, they would be allowed on the star system but not any surrounding empty space. As I recall, all of the map generators that come with FFP won't allow any features next to a star system when the map is generated. However, you'd also need to disallow the radiation cloud feature (via FeatureImpassables for FEATURE_FALLOUT) too since a nuke can spread that next to the star system. You might also want to disallow all the others except star systems too, to account for world builder generated scenario maps with things right next to a star system.
 
Actually, i don't, now. The only unit i have that appears more than once is the construction ship and i think i know why that is so i shall be testing something out to see if i can remove that little flaw.

The game is probably smart enough to detect that there are multiple unitclasses for the space bomber. The DefaultUnit is the unit that is used for a unitclass in the absence of an override for a specific civ.
 
As for an immobile unit, I have an idea...

You might be able to force it to be immobile if it was DOMAIN_LAND but had the space terrain (TERRAIN_TUNDRA - every plot on the map is this terrain type, everything that shows up on it is a feature) set in its TerrainImpassables for it. Since features override terrain for this and a star system has a feature, they would be allowed on the star system but not any surrounding empty space. As I recall, all of the map generators that come with FFP won't allow any features next to a star system when the map is generated. However, you'd also need to disallow the radiation cloud feature (via FeatureImpassables for FEATURE_FALLOUT) too since a nuke can spread that next to the star system. You might also want to disallow all the others except star systems too, to account for world builder generated scenario maps with things right next to a star system.
I understand what you're saying with regards to the unit and it's Domains. Disallowing the radiation feature is something i would like to do but don't know how to. I had thought about giving the Construction unit the ability to clean them up but without the radiation this wouldn't be needed. Whilst we still have the Doomsday weapon in the B5 mod, it is something i will be removing as i get more used to editing the files.
 
I'm not suggesting disallowing the existence of radiation clouds, just the ability of the unit that should be immobile to move into them.

Disallowing movement into the radiation clouds would be via the FeatureImpassables, just like it is done for the colony ship and construction ship in FFP. You could just copy the entire entry, which lists all of them except the asteroids and star systems and then add in the asteroids (which is actually FEATURE_FOREST). In conjunction with disallowing movement on empty space terrain via TerrainImpassables this should force the unit to be immobile without actually having to make it DOMAIN_IMMOBILE. That might encourage the AI to actually build them.
 
I'm not suggesting disallowing the existence of radiation clouds, just the ability of the unit that should be immobile to move into them.

Disallowing movement into the radiation clouds would be via the FeatureImpassables, just like it is done for the colony ship and construction ship in FFP. You could just copy the entire entry, which lists all of them except the asteroids and star systems and then add in the asteroids (which is actually FEATURE_FOREST). In conjunction with disallowing movement on empty space terrain via TerrainImpassables this should force the unit to be immobile without actually having to make it DOMAIN_IMMOBILE. That might encourage the AI to actually build them.
Got it, i'll investigate that possibility today, thanks for the suggestion.
 
I added in the information you suggested but i now get an xml error for the Feature shown below.
Code:
				<FeatureImpassable>
					<FeatureType>FEATURE_TUNDRA</FeatureType>
					<bFeatureImpassable>1</bFeatureImpassable>
				</FeatureImpassable>
The error appears 3 times (once for each unit) and the files then continue to load normally. The game boots up ok but the unit can still move in space. Baldyr created some code for Python to stop units moving outside of their Civs borders so i'm going to use that to stop the units moving too far out from the star system for the time being. Hopefully there will be some other way to keep them from moving without using the domain immobile.
 
The reason you get an XML error is because the "FEATURE_TUNDRA" does not in fact exist ;).

If you want to block a unit from moving in space tiles at all, you need a TerrainImpassable, because Space (Tundra) is a terrain.

To block a unit from moving on specific features you'd use a FeatureImpassable.
 
The reason you get an XML error is because the "FEATURE_TUNDRA" does not in fact exist ;).

If you want to block a unit from moving in space tiles at all, you need a TerrainImpassable, because Space (Tundra) is a terrain.

To block a unit from moving on specific features you'd use a FeatureImpassable.
That explains a lot. I also remembered why we made the unit domain immobile., We wanted the unit to be reliant on a transport unit to be moved around. The only other way i can see of doing this now would be to make it a DOMAIN_AIR unit instead.
 
Hi all, i've gone through many of the threads here and have found no mention of this error. When double clicking on an uninhabited star system there is a Python exception which, when cancelled, reappers again and does so for each planet in the star system. Another Python exception is experienced in WB when adding resources to the map. I've attached screenshots of both error messages.

Any ideas on how to fix/resolve these?

Edit: God_Emperor has alredy posted a fix for the first part of the issue on the B5 thread. (Thanks)
 
It looks like the WB is assuming the plot where you are placing a bonus has a star system in it. I'm thinking it should check for FEATURE_SOLAR_SYSTEM before doing the planet related placement.

Current code:
Code:
#Added in Final Frontier Worldbuilder: TC01
			FinalFrontier = CvEventInterface.getEventManager()
			pSystem = FinalFrontier.getSystemAt(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY())
			for iPlanet in range(pSystem.getNumPlanets()):
				pPlanet = pSystem.getPlanetByIndex(iPlanet)
				pPlanet.setBonusType(-1)
			pBuildingPlanet = pSystem.getPlanet(pSystem.getBuildingPlanetRing())
			pBuildingPlanet.setBonusType(iBonusType)
#End of Final Frontier Worldbuilder

Modifed code:
Code:
#Added in Final Frontier Worldbuilder: TC01
			if self.m_pCurrentPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_SOLAR_SYSTEM'):
				FinalFrontier = CvEventInterface.getEventManager()
				pSystem = FinalFrontier.getSystemAt(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY())
				for iPlanet in range(pSystem.getNumPlanets()):
					pPlanet = pSystem.getPlanetByIndex(iPlanet)
					pPlanet.setBonusType(-1)
				pBuildingPlanet = pSystem.getPlanet(pSystem.getBuildingPlanetRing())
				pBuildingPlanet.setBonusType(iBonusType)
#End of Final Frontier Worldbuilder
 
Top Bottom