Quick question

It lets the unit explore rival territory? Look it up yourself here.
 
It says 'Can explore rival territory'... Not much info.
It means that this unit can explore rival territory without the need for open borders and without causing it to declare war (a caravel, for example).
 
It means that this unit can explore rival territory without the need for open borders and without causing it to declare war (a caravel, for example).
Searching for a tag in use (without the closing slash) can provide clues, like with the Caravel unit entry.
 
It could probably by scripted in Python...
 
If you will be waiting a while I - or someone else - would be able to do this for you. Because there is no reason to learn how to program for one measly feature, right?

What is the unit and could you post its XML entry from the unit info file? Or does this new rule apply to the whole class? In that case, you could post the class entry instead.
 
If you will be waiting a while I - or someone else - would be able to do this for you.
Thanks Baldyr. Here is the unit info for one of the Civ's, each Civ has a similar ship unit. Below this is the UnitClassInfo as all the Civs units are based off of the FF units. This one being the Invasion Ship. Really hopeing you can help.
Code:
		<UnitInfo><!-- Liandra Frigate -->
			<Class>UNITCLASS_LIANDRA</Class>
			<Type>UNIT_LIANDRA</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_FRIGATE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_LIANDRA</Description>
			<Civilopedia>TXT_KEY_UNIT_LIANDRA_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_LIANDRA_STRATEGY</Strategy>
			<Help/>
			<Advisor>ADVISOR_MILITARY</Advisor>
			<bAnimal>0</bAnimal>
			<bFood>0</bFood>
			<bNoBadGoodies>0</bNoBadGoodies>
			<bOnlyDefensive>0</bOnlyDefensive>
			<bNoCapture>0</bNoCapture>
			<bQuickCombat>0</bQuickCombat>
			<bRivalTerritory>0</bRivalTerritory>
			<bMilitaryHappiness>1</bMilitaryHappiness>
			<bMilitarySupport>1</bMilitarySupport>
			<bMilitaryProduction>1</bMilitaryProduction>
			<bPillage>1</bPillage>
			<bSpy>0</bSpy>
			<bSabotage>0</bSabotage>
			<bDestroy>0</bDestroy>
			<bStealPlans>0</bStealPlans>
			<bInvestigate>0</bInvestigate>
			<bCounterSpy>0</bCounterSpy>
			<bFound>0</bFound>
			<bGoldenAge>0</bGoldenAge>
			<bInvisible>0</bInvisible>
			<bFirstStrikeImmune>0</bFirstStrikeImmune>
			<bNoDefensiveBonus>0</bNoDefensiveBonus>
			<bIgnoreBuildingDefense>0</bIgnoreBuildingDefense>
			<bCanMoveImpassable>0</bCanMoveImpassable>
			<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>0</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>1</bMechanized>
			<bSuicide>0</bSuicide>
			<bHiddenNationality>0</bHiddenNationality>
			<bAlwaysHostile>0</bAlwaysHostile>
			<UnitClassUpgrades/>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<FlankingStrikes/>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_ATTACK</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
				<UnitAI>
					<UnitAIType>UNITAI_RESERVE</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
				<UnitAI>
					<UnitAIType>UNITAI_COUNTER</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</UnitAIs>
			<NotUnitAIs/>
			<Builds/>
			<ReligionSpreads/>
			<CorporationSpreads/>
			<GreatPeoples/>
			<Buildings/>
			<ForceBuildings/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<PrereqBuilding>NONE</PrereqBuilding>
			<PrereqTech>TECH_B5_EARLY_SPACE_CRAFT</PrereqTech>
			<TechTypes>
				<PrereqTech>TECH_B5_LASER_WEAPONS</PrereqTech>
				<PrereqTech>TECH_B5_PLASMA_WEAPONS</PrereqTech>
			</TechTypes>
			<BonusType>NONE</BonusType>
			<PrereqBonuses/>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>150</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>15</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>1</iMoves>
			<bNoRevealMap>0</bNoRevealMap>
			<iAirRange>0</iAirRange>
			<iAirUnitCap>0</iAirUnitCap>
			<iDropRange>5</iDropRange>
			<iNukeRange>-1</iNukeRange>
			<iWorkRate>0</iWorkRate>
			<iBaseDiscover>0</iBaseDiscover>
			<iDiscoverMultiplier>0</iDiscoverMultiplier>
			<iBaseHurry>0</iBaseHurry>
			<iHurryMultiplier>0</iHurryMultiplier>
			<iBaseTrade>0</iBaseTrade>
			<iTradeMultiplier>0</iTradeMultiplier>
			<iGreatWorkCulture>0</iGreatWorkCulture>
			<iEspionagePoints>0</iEspionagePoints>
			<TerrainImpassables/>
			<FeatureImpassables/>
			<TerrainPassableTechs/>
			<FeaturePassableTechs/>
			<iCombat>10</iCombat>
			<iCombatLimit>100</iCombatLimit>
			<iAirCombat>0</iAirCombat>
			<iAirCombatLimit>0</iAirCombatLimit>
			<iXPValueAttack>4</iXPValueAttack>
			<iXPValueDefense>2</iXPValueDefense>
			<iFirstStrikes>0</iFirstStrikes>
			<iChanceFirstStrikes>0</iChanceFirstStrikes>
			<iInterceptionProbability>5</iInterceptionProbability>
			<iEvasionProbability>0</iEvasionProbability>
			<iWithdrawalProb>5</iWithdrawalProb>
			<iCollateralDamage>0</iCollateralDamage>
			<iCollateralDamageLimit>0</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iAnimalCombat>0</iAnimalCombat>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<TerrainNatives/>
			<FeatureNatives/>
			<TerrainAttacks/>
			<TerrainDefenses/>
			<FeatureAttacks/>
			<FeatureDefenses/>
			<UnitClassAttackMods/>
			<UnitClassDefenseMods/>
			<UnitCombatMods>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_SQUADRON</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_FRIGATE</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_DESTROYER</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_CRUISER</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_CAPITAL_SHIP</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_CARRIER_SHIP</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_STARBASE</UnitCombatType>
					<iUnitCombatMod>0</iUnitCombatMod>
				</UnitCombatMod>
			</UnitCombatMods>
			<UnitCombatCollateralImmunes/>
			<DomainMods/>
			<BonusProductionModifiers>
				<BonusProductionModifier>
					<BonusType>BONUS_ALUMINIUM</BonusType>
					<iProductonModifier>5</iProductonModifier>
				</BonusProductionModifier>
				<BonusProductionModifier>
					<BonusType>BONUS_TITANIUM</BonusType>
					<iProductonModifier>5</iProductonModifier>
				</BonusProductionModifier>
				<BonusProductionModifier>
					<BonusType>BONUS_IRON</BonusType>
					<iProductonModifier>5</iProductonModifier>
				</BonusProductionModifier>
				<BonusProductionModifier>
					<BonusType>BONUS_OXYGEN</BonusType>
					<iProductonModifier>5</iProductonModifier>
				</BonusProductionModifier>
				<BonusProductionModifier>
					<BonusType>BONUS_URANIUM</BonusType>
					<iProductonModifier>5</iProductonModifier>
				</BonusProductionModifier>
				<BonusProductionModifier>
					<BonusType>BONUS_HYDROGEN</BonusType>
					<iProductonModifier>5</iProductonModifier>
				</BonusProductionModifier>
			</BonusProductionModifiers>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			<SpecialCargo>SPECIALUNIT_MISSILE</SpecialCargo>
			<DomainCargo>DOMAIN_AIR</DomainCargo>
			<iCargo>2</iCargo>
			<iConscription>7</iConscription>
			<iCultureGarrison>16</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>6</iAsset>
			<iPower>4</iPower>
			<UnitMeshGroups>
				<iGroupSize>1</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>1</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>1</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_LIANDRA</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<FormationType>FORMATION_TYPE_MACHINE</FormationType>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions>
				<FreePromotion>
					<PromotionType>PROMOTION_ARMOR_I</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
			</FreePromotions>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
			<MovementSound>AS3D_UN_INVASION_SHIP_RUN</MovementSound>
		</UnitInfo>

Code:
		<UnitClassInfo><!-- Liandra Frigate -->
			<Type>UNITCLASS_LIANDRA</Type>
			<Description>TXT_KEY_UNIT_LIANDRA</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
			<iInstanceCostModifier>0</iInstanceCostModifier>
			<DefaultUnit>UNIT_INVASION_SHIP_II</DefaultUnit>
		</UnitClassInfo>
 
I'll look into this once I get the chance. Someone else might get the job done before then, however. :lo: Just remind me if I manage to forget about it. :D

By the way, is the mod you're mod-modding in turn based on the BUG mod? Because then it requires a somewhat different approach. (Is the Python for the mod available for download somewhere? A link would be helpful.)
 
By the way, is the mod you're mod-modding in turn based on the BUG mod? Because then it requires a somewhat different approach. (Is the Python for the mod available for download somewhere? A link would be helpful.)
The Python for the Mod is available in Final Frontier if you haven't deleted it. As far as i'm aware we didn't use BUG but i am thinking of merging it with Final Frontier Plus that does use BUG. That won't happen for a while yet though.
 
Correct me if I'm wrong but isn't it true that workboats can't leave national waters in the extremely early stages? Or was this part of a mod that I was using way back... can't remember... perhaps there was some sort of tag in there that could be used for such a purpose.
 
Correct me if I'm wrong but isn't it true that workboats can't leave national waters in the extremely early stages? Or was this part of a mod that I was using way back... can't remember... perhaps there was some sort of tag in there that could be used for such a purpose.
You might be thinking about the latest RFC patch. I suspect that was achieved in the SDK, but I don't know for sure. I think I'll actually try to look it up.
 
I whipped up some code for you. Try adding this code to CvGameUtils.py located in your mods Python folder:
Code:
	def unitCannotMoveInto(self,argsList):
		ePlayer = argsList[0]		
		iUnitId = argsList[1]
		iPlotX = argsList[2]
		iPlotY = argsList[3]

[B]		# start Liandra movement restriction
		eLiandraClass = gc.getInfoTypeForString("UNITCLASS_LIANDRA")
		pUnit = gc.getPlayer(ePlayer).getUnit(iUnitID)
		eUnitType = pUnit.getUnitType()
		eUnitClass = gc.getUnitInfo(eUnitType).getUnitClassType()
		if eUnitClass == eLindraClass:
			pPlot = gc.getMap().plot(iPlotX, iPlotY)
			return pPlot.getOwner() != ePlayer
		# end Liandra movement restriction[/B]

		return False
Also, add these lines to \Assets\XML\PythonCallbackDefines.xml:
Code:
	<Define>
		<DefineName>USE_UNIT_CANNOT_MOVE_INTO_CALLBACK</DefineName>
		<iDefineIntVal>1</iDefineIntVal>
	</Define>
Now, I don't have access to your actual mod so I haven't tested if this works. So you'll have to do the testing yourself. :p You need to enable Python exceptions and logging in CivilizationIV.ini however, otherswise you don't even get potential error messages and it will be that much harder to debug. (I'd basically have to download and install you mod and do it myself.) Error messages are printed in \My Games\Beyond the Sword\Logs\PythonErr.log (and possibly PythonErr2.log). So keep an eye on that.
 
Thanks Baldyr, i'll give it a go and see what happens. Ok, tried it with a unit in its home territory trying to move into neutral and got the error message shown in first screenie, then just to see if there was any difference placed a unit in neutral territory and tried to move it and got the same error message as shown in the second screenie. Please advise.
 
I didn't notice your edit there, so I thought I'd ask how the testing went. :p

This exception (error message) is just a stupid typo:
Code:
		# start Liandra movement restriction
		eLiandraClass = gc.getInfoTypeForString("UNITCLASS_LIANDRA")
		pUnit = gc.getPlayer(ePlayer).getUnit(iUnitI[COLOR="Red"]d[/COLOR])
		eUnitType = pUnit.getUnitType()
		eUnitClass = gc.getUnitInfo(eUnitType).getUnitClassType()
		if eUnitClass == eLindraClass:
			pPlot = gc.getMap().plot(iPlotX, iPlotY)
			return pPlot.getOwner() != ePlayer
		# end Liandra movement restriction
Hopefully I didn't mess anything else up. :blush: The good news is that the callback itself fired - otherwise there wouldn't have been an exception. :goodjob:
 
Hopefully I didn't mess anything else up.
Don't worry if you did, i'll let you know;).

Further to this, the unit i gave you as an example was a unique unit for one of the civs, nearly all the units are UU for the B5 mod. If i wanted to do the same restriction for the other civs would i need to add the same entry over and over but just change the UNITCLASS_LIANDRA to UNITCLASS_?????????? (enter ship class) or could i just add the units class and extend the entries on the original file entry?
 
Further to this, the unit i gave you as an example was a unique unit for one of the civs, nearly all the units are UU for the B5 mod. If i wanted to do the same restriction for the other civs would i need to add the same entry over and over but just change the UNITCLASS_LIANDRA to UNITCLASS_?????????? (enter ship class) or could i just add the units class and extend the entries on the original file entry?
I used the unit class instead of unit type, so the restriction extends to UNIT_LIANDRA and any other unit types derived from UNITCLASS_LIANDRA. These lines achieve this:
Code:
		[B]eLiandraClass[/B] = gc.getInfoTypeForString("[B]UNITCLASS_LIANDRA[/B]")
...
		if eUnitClass == [B]eLindraClass[/B]:
Or do you need to extend this restriction to other classes? Then you can replace the Liandra restriction with this:
Code:
		# start movement restriction
		tRestrictedUnitClasses = (
			gc.getInfoTypeForString("UNITCLASS_LIANDRA"),
			gc.getInfoTypeForString("UNITCLASS_[B]SAMPLE[/B]"),
			)
		pUnit = gc.getPlayer(ePlayer).getUnit(iUnitId)
		eUnitType = pUnit.getUnitType()
		eUnitClass = gc.getUnitInfo(eUnitType).getUnitClassType()
		if eUnitClass in tRestrictedUnitClasses:
			pPlot = gc.getMap().plot(iPlotX, iPlotY)
			return pPlot.getOwner() != ePlayer
		# end movement restriction
Change the word SAMPLE to some other valid unit class name. And you can simply add as many classes as you wish by adding lines to the array. Just don't forget to end each line with a comma.
 
Or do you need to extend this restriction to other classes? Then you can replace the Liandra restriction with this:

Code:
# start movement restriction
tRestrictedUnitClasses = (
gc.getInfoTypeForString("UNITCLASS_LIANDRA"),
gc.getInfoTypeForString("UNITCLASS_SAMPLE"),
)
pUnit = gc.getPlayer(ePlayer).getUnit(iUnitId)
eUnitType = pUnit.getUnitType()
eUnitClass = gc.getUnitInfo(eUnitType).getUnitClassType()
if eUnitClass in tRestrictedUnitClasses:
pPlot = gc.getMap().plot(iPlotX, iPlotY)
return pPlot.getOwner() != ePlayer
# end movement restrictionChange the word SAMPLE to some other valid unit class name. And you can simply add as many classes as you wish by adding lines to the array. Just don't forget to end each line with a comma.
That's perfect, exactly what i needed, thanks Baldyr, i'll get to work on making the additions i need.
 
I'm curious - is the code doing what its supposed to? Also, have you tested it in actual play because enabling the Python callback will add lag to your game. The only question is how much. :p (This is probably the reason it was disabled in the first place.)
 
Back
Top Bottom