Can't start a new game with a mod in development.

lordrj15

Manx Modder
Joined
Oct 14, 2014
Messages
831
Location
Lancaster University
Hi all,

I am currently working on a mod for the Palatinate, however I'm having issues actually loading the mod in the game. When I install it, it shows up in the playable civ list, yay, but when I start a game, Civ V just freezes, the music gets cutoff, and though the icon is still spinning, nothing happens and I am forced to exit the game.

I've been searching for awhile, but I can't find any issues at all within the code, the XML is basically all clean, and I tried it without Lua, but it still wouldn't load. I think it might be the UU and UB, which are merchant and oxford uni replacements respectively, as I've never coded a national wonder or merchant replacement before, here is the XML

Spoiler :
<GameData>

-<Buildings>


-<Row>

<Type>BUILDING_HEIDELBERG_UNIVERSITY</Type>

<Description>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY</Description>

<Civilopedia>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_PEDIA</Civilopedia>

<Strategy>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_STRATEGY</Strategy>

<Help>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_HELP</Help>

<MutuallyExclusiveGroup>-1</MutuallyExclusiveGroup>

<NeverCapture>1</NeverCapture>

<NukeImmune>1</NukeImmune>

<Cost>200</Cost>

<HurryCostModifier>-1</HurryCostModifier>

<MinAreaSize>-1</MinAreaSize>

<FreeTechs>1</FreeTechs>

<BuildingClass>BUILDINGCLASS_HEIDELBERG_UNIVERSITY</BuildingClass>

<ArtDefineTag>ART_DEF_BUILDING_HEIDELBERG_UNIVERSITY</ArtDefineTag>

<PrereqTech>TECH_EDUCATION</PrereqTech>

<PortraitIndex>44</PortraitIndex>

<WonderSplashAnchor>R,T</WonderSplashAnchor>

<IconAtlas>BW_ATLAS_2</IconAtlas>

<FreeBuildingThisCity>BUILDINGCLASS_UNIVERSITY</FreeBuildingThisCity>

<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>

<SpecialistCount>3</SpecialistCount>
</Row>

<Row>
<Type>BUILDING_PALATINATE_FAITH_1</Type>
<BuildingClass>BUILDINGCLASS_PALATINATE_FAITH_1</BuildingClass>
<Cost>-1</Cost>
<FaithCost>-1</FaithCost>
<PrereqTech>NULL</PrereqTech>
<GreatWorkCount>-1</GreatWorkCount>
<ArtDefineTag>NONE</ArtDefineTag>
<MinAreaSize>-1</MinAreaSize>
<NeverCapture>true</NeverCapture>
<HurryCostModifier>-1</HurryCostModifier>
<PortraitIndex>0</PortraitIndex>
<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
</Row>


<Row>
<Type>BUILDING_PALATINATE_FAITH_2</Type>
<BuildingClass>BUILDINGCLASS_PALATINATE_FAITH_2</BuildingClass>
<Cost>-1</Cost>
<FaithCost>-1</FaithCost>
<PrereqTech>NULL</PrereqTech>
<GreatWorkCount>-1</GreatWorkCount>
<ArtDefineTag>NONE</ArtDefineTag>
<MinAreaSize>-1</MinAreaSize>
<NeverCapture>true</NeverCapture>
<HurryCostModifier>-1</HurryCostModifier>
<PortraitIndex>0</PortraitIndex>
<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
</Row>

<Row>
<Type>BUILDING_PALATINATE_FAITH_3</Type>
<BuildingClass>BUILDINGCLASS_PALATINATE_FAITH_3</BuildingClass>
<Cost>-1</Cost>
<FaithCost>-1</FaithCost>
<PrereqTech>NULL</PrereqTech>
<GreatWorkCount>-1</GreatWorkCount>
<ArtDefineTag>NONE</ArtDefineTag>
<MinAreaSize>-1</MinAreaSize>
<NeverCapture>true</NeverCapture>
<HurryCostModifier>-1</HurryCostModifier>
<PortraitIndex>0</PortraitIndex>
<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
</Row>

</Buildings>

<BuildingClasses>

<Row>
<Type>BUILDINGCLASS_PALATINATE_FAITH_1</Type>
<DefaultBuilding>BUILDING_PALATINATE_FAITH_1</DefaultBuilding>
</Row>

<Row>
<Type>BUILDINGCLASS_PALATINATE_FAITH_2</Type>
<DefaultBuilding>BUILDING_PALATINATE_FAITH_2</DefaultBuilding>
</Row>

<Row>
<Type>BUILDINGCLASS_PALATINATE_FAITH_3</Type>
<DefaultBuilding>BUILDING_PALATINATE_FAITH_3</DefaultBuilding>
</Row>

</BuildingClasses>

<Building_YieldModifiers>

<Row>
<BuildingType>BUILDING_HEIDELBERG_UNIVERSITY</BuildingType>
<YieldType>YIELD_SCIENCE</YieldType>
<Yield>25</Yield>
</Row>

</Building_YieldModifiers>

-<Building_Flavors>


-<Row>

<BuildingType>BUILDING_HEIDELBERG_UNIVERSITY</BuildingType>

<FlavorType>FLAVOR_SCIENCE</FlavorType>

<Flavor>50</Flavor>

</Row>


-<Row>

<BuildingType>BUILDING_HEIDELBERG_UNIVERSITY</BuildingType>

<FlavorType>FLAVOR_WONDER</FlavorType>

<Flavor>20</Flavor>

</Row>

</Building_Flavors>

<Building_YieldChanges>

<Row>

<BuildingType>BUILDING_PALATINATE_FAITH_1</BuildingType>

<YieldType>YIELD_FAITH</YieldType>

<Yield>1</Yield>

</Row>

<Row>

<BuildingType>BUILDING_PALATINATE_FAITH_2</BuildingType>

<YieldType>YIELD_FAITH</YieldType>

<Yield>1</Yield>

</Row>

<Row>

<BuildingType>BUILDING_PALATINATE_FAITH_3</BuildingType>

<YieldType>YIELD_FAITH</YieldType>

<Yield>2</Yield>

</Row>

</Building_YieldChanges>



-<Language_en_US>


-<Row Tag="TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY">

<Text>Heidelberg University</Text>

<Gender>neuter:the</Gender>

</Row>


-<Row Tag="TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_PEDIA">


-<Text>

Test


</Text>

</Row>


-<Row Tag="TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_STRATEGY">

<Text>The Oxford University National Wonder provides 1 free technology and +1 [ICON_CULTURE] Culture. The civilization must have a university in all cities before it can construct Oxford University.</Text>

</Row>


-<Row Tag="TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_HELP">

<Text>1 Free Technology. Contains 2 slots for Great Works of Writing.[NEWLINE][NEWLINE]Must have built a University in all Cities. The cost goes up the more cities there are in the empire.</Text>

</Row>


-<Row Tag="TXT_KEY_HEIDELBERG_UNIVERSITY_THEMING_BONUS_HELP">

<Text>To maximize your bonus, make sure the Great Work Slots are all filled with Writings from different Eras and from Civilizations other than the city owner.</Text>

</Row>

</Language_en_US>





</GameData>

Spoiler :
<GameData>

<units>

<Row>
<Class>UNITCLASS_MERCHANT</Class>
<Type>UNIT_ELECTOR</Type>
<Cost>-1</Cost>
<Moves>3</Moves>
<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_HIGH</CivilianAttackPriority>
<Special>SPECIALUNIT_PEOPLE</Special>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_ELECTOR</DefaultUnitAI>
<Description>TXT_KEY_UNIT_ELECTOR</Description>
<Civilopedia>TXT_KEY_CIV5_ELECTOR_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_ELECTOR_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_ELECTOR</Help>
<AdvancedStartCost>-1</AdvancedStartCost>
<WorkRate>1</WorkRate>
<CombatLimit>0</CombatLimit>
<BaseGold>300</BaseGold>
<NumGoldPerEra>100</NumGoldPerEra>
<UnitArtInfo>ART_DEF_UNIT_U_VENETIAN_MERCHANT</UnitArtInfo>
<UnitFlagIconOffset>12</UnitFlagIconOffset>
<IconAtlas>EXPANSION2_UNIT_ATLAS</IconAtlas>
<PortraitIndex>12</PortraitIndex>
<MoveRate>GREAT_PERSON</MoveRate>
<SpreadReligion>true</SpreadReligion>
<ReligionSpreads>2</ReligionSpreads>
<ReligiousStrength>1000</ReligiousStrength>
<BaseCultureTurnsToCount>8</BaseCultureTurnsToCount>
</Row>

</units>



-<Unit_AITypes>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UnitAIType>UNITAI_ELECTOR</UnitAIType>

</Row>

</Unit_AITypes>





-<Unit_Builds>

<Delete>
<UnitType>UNIT_ELECTOR</UnitType>
<BuildType>BUILD_CUSTOMS_HOUSE</BuildType>
</Delete>

-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<BuildType>BUILD_CUSTOMS_HOUSE</BuildType>

</Row>

<Delete>
<UnitType>UNIT_ELECTOR</UnitType>
<BuildType>BUILD_HOLY_SITE</BuildType>
</Delete>
<Row>
<UnitType>UNIT_ELECTOR</UnitType>
<BuildType>BUILD_HOLY_SITE</BuildType>
</Row>

</Unit_Builds>





-<Unit_Flavors>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<FlavorType>FLAVOR_GOLD</FlavorType>

<Flavor>1</Flavor>

</Row>

</Unit_Flavors>





-<Unit_UniqueNames>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR1</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR2</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR3</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR4</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR5</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR6</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR7</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR8</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR9</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR10</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR11</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR12</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR13</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR14</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR15</UniqueName>

<GreatWorkType/>

</Row>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<UniqueName>TXT_KEY_GREAT_PERSON_ELECTOR16</UniqueName>

<GreatWorkType/>

</Row>



</Unit_UniqueNames>


-<UnitGameplay2DScripts>


-<Row>

<UnitType>UNIT_ELECTOR</UnitType>

<SelectionSound>AS2D_BUILD_UNIT</SelectionSound>

<FirstSelectionSound>AS2D_BUILD_UNIT</FirstSelectionSound>

</Row>

</UnitGameplay2DScripts>


-<Language_en_US>


-<Row Tag="TXT_KEY_UNIT_ELECTOR">

<Text>Elector</Text>

</Row>


-<Row Tag="TXT_KEY_CIV5_ELECTOR_TEXT">


-<Text>

Test

</Text>

</Row>


-<Row Tag="TXT_KEY_UNIT_GREAT_ELECTOR_STRATEGY">

<Text>Test</Text>

</Row>

-<Row Tag="TXT_KEY_UNIT_HELP_ELECTOR">

<Text>This Venetian unique Great Person replaces the Great Merchant. Aside from the ability to Conduct a Trade Mission, the Merchant of Venice can purchase City-States outright, bringing them under Venetian control as a Puppet.</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR1">

<Text>Ruprecht II</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR2">

<Text>Ruprecht III</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR3">

<Text>Ludwig III</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR4">

<Text>Ludwig IV</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR5">

<Text>Philipp the Righteous</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR6">

<Text>Ludwig VI</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR7">

<Text>Frederick the Victorious</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR8">

<Text>Ludwig the Peaceful</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR9">

<Text>Frederick the Wise</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR10">

<Text>Frederick IV</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR11">

<Text>Karl</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR12">

<Text>Karl II</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR13">

<Text>Philipp Wilhelm</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR14">

<Text>Johann Wilhelm</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR15">

<Text>Karl III</Text>

</Row>


-<Row Tag="TXT_KEY_GREAT_PERSON_ELECTOR16">

<Text>Karl IV</Text>

</Row>



</Language_en_US>


</GameData>


Thanks
 
You're missing a building class - BUILDINGCLASS_HEIDELBERG_UNIVERSITY

This will be being reported in the logs (see 1st link in my sig for how to enable logging) and is also, I believe, on LeeS' list of common modder mistakes ;)
 
You're missing a building class - BUILDINGCLASS_HEIDELBERG_UNIVERSITY

This will be being reported in the logs (see 1st link in my sig for how to enable logging) and is also, I believe, on LeeS' list of common modder mistakes ;)

It's an Oxford replacement though, so it doesn't need a special building class for it.

I've enabled logging

However, you have actually high lighted something that might be causing the problem, thanks . . . (building class should be oxford)
 
Well, the issue has been fixed, but evidently it still doesn't work, when I begin a new game, after the DOM, it's just clouds, fog of war, and it says I've lost the game

Ugh

Still nothing in the logs, which are activated
 
Well, the issue has been fixed, but evidently it still doesn't work, when I begin a new game, after the DOM, it's just clouds, fog of war, and it says I've lost the game

Ugh

Still nothing in the logs, which are activated
Did you forget to give the Civ a starting settler, as in:
Code:
	<Civilization_FreeUnits>
		<Row>
			<CivilizationType>CIVILIZATION_X</CivilizationType>
			<UnitClassType>UNITCLASS_SETTLER</UnitClassType>
			<Count>1</Count>
			<UnitAIType>UNITAI_SETTLE</UnitAIType>
		</Row>
	</Civilization_FreeUnits>
But as whoward always says, without a copy of the mod to look at we're just guessing in the dark when trying to help you.
 
Did you forget to give the Civ a starting settler, as in:
Code:
	<Civilization_FreeUnits>
		<Row>
			<CivilizationType>CIVILIZATION_X</CivilizationType>
			<UnitClassType>UNITCLASS_SETTLER</UnitClassType>
			<Count>1</Count>
			<UnitAIType>UNITAI_SETTLE</UnitAIType>
		</Row>
	</Civilization_FreeUnits>
But as whoward always says, without a copy of the mod to look at we're just guessing in the dark when trying to help you.

It's definitely there, no spelling mistakes.

This is the part of the code I'm unsure about, the building/unit, so if people could look through that, then I'll upload a copy of the mod, just to save people downloading it to find it's some small detail I missed in the part of the code I am unsure about.
 
It's definitely there, no spelling mistakes.

This is the part of the code I'm unsure about, the building/unit, so if people could look through that, then I'll upload a copy of the mod, just to save people downloading it to find it's some small detail I missed in the part of the code I am unsure about.
Please do upload or provide a link. That way we can all be sure we're looking at the most recent version of the buildings/units. Plus, if the issue is elsewhere, it's easier to figure it out.
 
blurgh, ignore this
 
Please do upload or provide a link. That way we can all be sure we're looking at the most recent version of the buildings/units. Plus, if the issue is elsewhere, it's easier to figure it out.

Here is one
 
DataBase.log errors:
Code:
[526799.546][color="red"] Invalid Reference on Civilization_Start_Region_Priority.RegionType - "REGION_RIVER" does not exist in Regions[/color]
[526801.546] Invalid Reference on Units.DefaultUnitAI - "UNITAI_ELECTOR" does not exist in UnitAIInfos
[526801.671] Invalid Reference on Units.Strategy - "TXT_KEY_UNIT_ELECTOR_STRATEGY" does not exist in Language_en_US
[526801.796] Invalid Reference on Unit_AITypes.UnitAIType - "UNITAI_ELECTOR" does not exist in UnitAIInfos
This is the problem reported by the 1st error shown, and is causing your problem:
Code:
	-<Civilization_Start_Region_Priority>


		-<Row>

			<CivilizationType>CIVILIZATION_RPALATINATE</CivilizationType>

			<RegionType>REGION_RIVER</RegionType>

		</Row>

	</Civilization_Start_Region_Priority>
Change to this:
Code:
	<Civilization_Start_Along_River>
		<Row>
			<CivilizationType>CIVILIZATION_RPALATINATE</CivilizationType>
			<StartAlongRiver>true</StartAlongRiver>
		</Row>
	</Civilization_Start_Along_River>
Getting the 'You are Defeated' screen as soon as you start the game is no longer occuring. The game has been told to give priority to a start region-type that doesn't exist, so is unable to resolve the issue, and defaults to just not giving you a start at all.

You will need to address the other bad reference issues, but none of them are serious enough to cause file or mod load failures.
 
DataBase.log errors:
Code:
[526799.546][color="red"] Invalid Reference on Civilization_Start_Region_Priority.RegionType - "REGION_RIVER" does not exist in Regions[/color]
[526801.546] Invalid Reference on Units.DefaultUnitAI - "UNITAI_ELECTOR" does not exist in UnitAIInfos
[526801.671] Invalid Reference on Units.Strategy - "TXT_KEY_UNIT_ELECTOR_STRATEGY" does not exist in Language_en_US
[526801.796] Invalid Reference on Unit_AITypes.UnitAIType - "UNITAI_ELECTOR" does not exist in UnitAIInfos
This is the problem reported by the 1st error shown, and is causing your problem:
Code:
	-<Civilization_Start_Region_Priority>


		-<Row>

			<CivilizationType>CIVILIZATION_RPALATINATE</CivilizationType>

			<RegionType>REGION_RIVER</RegionType>

		</Row>

	</Civilization_Start_Region_Priority>
Change to this:
Code:
	<Civilization_Start_Along_River>
		<Row>
			<CivilizationType>CIVILIZATION_RPALATINATE</CivilizationType>
			<StartAlongRiver>true</StartAlongRiver>
		</Row>
	</Civilization_Start_Along_River>
Getting the 'You are Defeated' screen as soon as you start the game is no longer occuring. The game has been told to give priority to a start region-type that doesn't exist, so is unable to resolve the issue, and defaults to just not giving you a start at all.

You will need to address the other bad reference issues, but none of them are serious enough to cause file or mod load failures.

Yeah, I was talking to someone about it and they suggested that, it seems to work now.

But there is another thing you could help me with, I want the trait, "converted city states gain 25 influence" but it doesn't, work it seems, what's wrong with this Lua? (it's ordered right in the modbuddy, just the way it pastes onto civ fanatics)

Spoiler :
function PalatineCSInfluence(iOwner, iX, iY, eOldReligion, eNewReligion, bFirstConversion)
local plot = Map.GetPlot(iX, iY);
local city = plot:GetPlotCity();

print(city:GetName() .. " has adopted a new religion. Yay.");

local pPlayer = Players[iOwner];

if ( pPlayer:IsMinorCiv() ) then
print "pPlayer is a Minor Civ";
for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local LoopPlayer = Players[iPlayerLoop];
if ( LoopPlayer:IsAlive() and LoopPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_RPALATINATE"] ) then
print ("LoopPlayer is alive and is Palatinate" );
local PalatineReligion = LoopPlayer:GetReligionCreatedByPlayer()
if PalatineReligion >= 1 then
print("Palatinate has a religion ");
if eNewReligion == PalatineReligion then
print("+++++ religions match +++++");
pPlayer:ChangeMinorCivFriendshipWithMajor(LoopPlayer, 25)
end
end
end
end
end
end
LuaEvents.CityAdoptsReligionEvent.Add(PalatineCSInfluence)


Also, what were the referencing issues?
 
Code:
LuaEvents.CityAdoptsReligionEvent(iOwner, iX, iY, eOldReligion, eNewReligion, bFirstConversion)
This is part of Machiavelli24's religions snippets for mod-makers, but you don't have the rest of the system active anywhere within your lua, so the game has no way to know when to run your function.​
Try using
Code:
GameEvents.CityConvertsReligion.Add(PalatineCSInfluence)
This is the Firaxis-supplied event used in the Medieval Scenario. The arguments are slightly different, however. You'd need to change to
Code:
function PalatineCSInfluence(iOwner, eReligion, iX, iY)

The referencing issues were because there is no UNITAI_ELECTOR within the UnitAIInfos so the game has no idea what to with that UNITAI_ designation. And you likely never stated TXT_KEY_UNIT_ELECTOR_STRATEGY as a Tag="x" anywhere within <Language_en_US>
 
Code:
LuaEvents.CityAdoptsReligionEvent(iOwner, iX, iY, eOldReligion, eNewReligion, bFirstConversion)
This is part of Machiavelli24's religions snippets for mod-makers, but you don't have the rest of the system active anywhere within your lua, so the game has no way to know when to run your function.​
Try using
Code:
GameEvents.CityConvertsReligion.Add(PalatineCSInfluence)
This is the Firaxis-supplied event used in the Medieval Scenario. The arguments are slightly different, however. You'd need to change to
Code:
function PalatineCSInfluence(iOwner, eReligion, iX, iY)

The referencing issues were because there is no UNITAI_ELECTOR within the UnitAIInfos so the game has no idea what to with that UNITAI_ designation. And you likely never stated TXT_KEY_UNIT_ELECTOR_STRATEGY as a Tag="x" anywhere within <Language_en_US>

I'm not that good with Lua, I basically copy and pasted all this, but, erm, this might sound presumptuous, but could you write me the code I need to fix the lua?
 
I'm not that good with Lua, I basically copy and pasted all this, but, erm, this might sound presumptuous, but could you write me the code I need to fix the lua?

Untested, but this should work:

Spoiler :
Code:
function PalatineCSInfluence(iOwner, eReligion, iX, iY)
	local pPlot = Map.GetPlot(iX, iY);
	local city = plot:GetPlotCity();
	local pPlayer = Players[iOwner];
	print(city:GetName() .. " has adopted a new religion. Yay.");
	if ( pPlayer:IsMinorCiv() ) then
		print "pPlayer is a Minor Civ";
		for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
			local LoopPlayer = Players[iPlayerLoop];
			if ( LoopPlayer:IsAlive() and LoopPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_RPALATINATE"] ) then
				print ("LoopPlayer is alive and is Palatinate" );
				local PalatineReligion = LoopPlayer:GetReligionCreatedByPlayer()
				if PalatineReligion >= 1 then
					print("Palatinate has a religion ");
						if eReligion == PalatineReligion then
							print("+++++ religions match +++++");
							pPlayer:ChangeMinorCivFriendshipWithMajor(LoopPlayer, 25)
						end
					end
				end
			end
		end
	end
end
GameEvents.CityConvertsReligion.Add(PalatineCSInfluence)
 
Untested, but this should work:

Spoiler :
Code:
function PalatineCSInfluence(iOwner, eReligion, iX, iY)
	local pPlot = Map.GetPlot(iX, iY);
	local city = plot:GetPlotCity();
	local pPlayer = Players[iOwner];
	print(city:GetName() .. " has adopted a new religion. Yay.");
	if ( pPlayer:IsMinorCiv() ) then
		print "pPlayer is a Minor Civ";
		for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
			local LoopPlayer = Players[iPlayerLoop];
			if ( LoopPlayer:IsAlive() and LoopPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_RPALATINATE"] ) then
				print ("LoopPlayer is alive and is Palatinate" );
				local PalatineReligion = LoopPlayer:GetReligionCreatedByPlayer()
				if PalatineReligion >= 1 then
					print("Palatinate has a religion ");
						if eReligion == PalatineReligion then
							print("+++++ religions match +++++");
							pPlayer:ChangeMinorCivFriendshipWithMajor(LoopPlayer, 25)
						end
					end
				end
			end
		end
	end
end
GameEvents.CityConvertsReligion.Add(PalatineCSInfluence)

Thanks so much!
 
Code:
The referencing issues were because there is no [COLOR="Red"]UNITAI_ELECTOR[/COLOR] within the [COLOR="Blue"]UnitAIInfos[/COLOR] so the game has no idea what to with that UNITAI_ designation. And you likely never stated [COLOR="Red"]TXT_KEY_UNIT_ELECTOR_STRATEGY[/COLOR] as a Tag="x" anywhere within [COLOR="Blue"]<Language_en_US>[/COLOR][/QUOTE]

Wait, I do have this though

[QUOTE]	-<Unit_AITypes>


		-<Row>

			<UnitType>UNIT_ELECTOR</UnitType>

			<UnitAIType>UNITAI_ELECTOR</UnitAIType>

		</Row>

	</Unit_AITypes>[/QUOTE]

So, isn't that what it's referring to?
 
The code still doesn't seem to be functioning . . .
 
Wait, I do have this though
Code:
-<Unit_AITypes>
	-<Row>
		<UnitType>UNIT_ELECTOR</UnitType>
		<UnitAIType>UNITAI_ELECTOR</UnitAIType>
	</Row>
</Unit_AITypes>
So, isn't that what it's referring to?
This error
Code:
[526801.546] Invalid Reference on Units.DefaultUnitAI - "UNITAI_ELECTOR" does not exist in UnitAIInfos
Is referring you to the mistake made within those lines. But what is meant by a 'reference' in your code is something else entirely.
In the code shown in the following spoiler there are several parts highlighted in blue text. Each of these is a reference to other already-defined elements within the game's database of XML. If I want to enter something into any of those 'fields' that is not already defined somewhere within the game's XML, I have to define that new thing before I can reference it.
Spoiler :
Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_HEIDELBERG_UNIVERSITY</Type>
			<Description>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY</Description>
			<Civilopedia>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_STRATEGY</Strategy>
			<Help>TXT_KEY_BUILDING_HEIDELBERG_UNIVERSITY_HELP</Help>
			<MutuallyExclusiveGroup>-1</MutuallyExclusiveGroup>
			<NeverCapture>1</NeverCapture>
			<NukeImmune>1</NukeImmune>
			<Cost>200</Cost>
			<HurryCostModifier>-1</HurryCostModifier>
			<MinAreaSize>-1</MinAreaSize>
			<FreeTechs>1</FreeTechs>
			<BuildingClass>[color="blue"]BUILDINGCLASS_OXFORD_UNIVERSITY[/color]</BuildingClass>
			<PrereqTech>[color="blue"]TECH_EDUCATION[/color]</PrereqTech>
			<PortraitIndex>44</PortraitIndex>
			<WonderSplashAnchor>R,T</WonderSplashAnchor>
			<IconAtlas>[color="blue"]BW_ATLAS_2[/color]</IconAtlas>
			<FreeBuildingThisCity>[color="blue"]BUILDINGCLASS_UNIVERSITY[/color]</FreeBuildingThisCity>
			<SpecialistType>[color="blue"]SPECIALIST_MERCHANT[/color]</SpecialistType>
			<SpecialistCount>3</SpecialistCount>
		</Row>
The error you are getting is saying that the game has no UNITAI_ELECTOR defined anywhere, so the game cannot make use of that reference.
 
And you can't just make up UNITAI_s, (well you can, but it won't do anything), you have to use one of the existing ones, as the game knows what to do with those. So, depending what an "Elector" does, you'll need to pick UNITAI_WORKER, UNITAI_ATTACK, UNITAI_DEFENSE, UNITAI_RANGED or whatever.
 
Top Bottom