Help needed for Alternate Leader mod!

RFormica

Imperator Silvae
Joined
May 27, 2017
Messages
473
Location
Pennsylvania, USA
:help:I am making a mod that adds King Edward IV as an alternate leader to England. The game keeps crashing when I start a new game as Edward IV's England. I know it is a code issue that may be involving the leader trait, but I am not sure. Help!:help:

---Attached is the zipped file and logs---

---Leader art is a WIP. If anyone who sees this is a good artist and would like to help, please tell me!:thumbsup:---

:thanx:
 

Attachments

Last edited:
:help:I am making a mod that adds King Edward IV as an alternate leader to England. The game keeps crashing when I start a new game as Edward IV's England. I know it is a code issue that may be involving the leader trait, but I am not sure. Help!:help:

---Attached is the zipped file---

---Leader art is a WIP. If anyone who sees this is a good artist and would like to help, please tell me!:thumbsup:---

:thanx:
Gut tells me you didn't change playable leader and it's still jasper kitty. It will crash the game directly. Let me download and see if that's the case.
 
Gut tells me you didn't change playable leader and it's still jasper kitty. It will crash the game directly. Let me download and see if that's the case.
I was right.
Open your modinfo and find this:
Code:
<ActionCriteria>
    <Criteria id="LeaderCriteria">
      <LeaderPlayable>StandardPlayers::LEADER_JASPER_KITTY</LeaderPlayable>
    </Criteria>
  </ActionCriteria>
Change LEADER_JASPER_KITTY to your Leader type.
Good luck!
 
  1. This information already exists in the game's base files:
    Code:
    <GameData>
    	<IconDefinitions>
    		<Row Name="ICON_CIVILIZATION_ENGLAND" Atlas="ICON_ATLAS_CIVILIZATIONS" Index="6"/>
    You cannot repeat information the game already has. Doing so causes a unique constraint error (see spoiler) and causes the game to stop reading anything from the file where the violation occurs.
    Spoiler :
    Code:
    [873645.928] [Database] ERROR: UNIQUE constraint failed: AtlasIcons.Name, AtlasIcons.Atlas
    [873645.929] [Database]: While executing - 'insert into IconDefinitions('Name', 'Atlas', 'Index') values (?, ?, ?);'
    [873645.929] [Database]: In XMLSerializer while inserting row into table insert into IconDefinitions('Name', 'Atlas', 'Index') with  values (ICON_CIVILIZATION_ENGLAND, ICON_ATLAS_CIVILIZATIONS, 6, ).
    [873645.929] [Database]: In XMLSerializer while updating table IconDefinitions from file C:/Users/Webmaster/Documents/My Games/Sid Meier's Civilization VI/Mods/Edward IV/RFEdwardIVEngland_Icons.xml
    [873645.929] [Database] ERROR: UNIQUE constraint failed: AtlasIcons.Name, AtlasIcons.Atlas
  2. This set of error messages is reporting a fatal syntax error
    Code:
    [873720.699] [Gameplay] ERROR: Database::XMLSerializer (RFEdwardIVEngland_Gameplay.xml): 'Row' or 'Delete' expected, got 'Traits'.
    [873720.699] [Gameplay]: In XMLSerializer while updating table FavoredReligions from file RFEdwardIVEngland_Gameplay.xml.
    The issue is here
    Code:
    <FavoredReligions>
    	<Row LeaderType="LEADER_RF_EDWARD_IV" ReligionType="RELIGION_CATHOLICISM"/>
    <Traits>
    	<Row TraitType="TRAIT_LEADER_RF_IN_ALL_CHRISTENDOM" Name="LOC_TRAIT_LEADER_RF_IN_ALL_CHRISTENDOM" Description="LOC_TRAIT_LEADER_RF_IN_ALL_CHRISTENDOM_DESCRIPTION"/>
    	<Row TraitType="TRAIT_AGENDA_RF_METHOD_AND_ORDER" Name="LOC_TRAIT_AGENDA_RF_METHOD_AND_ORDER_NAME" Description="LOC_TRAIT_AGENDA_RF_METHOD_AND_ORDER_DESCRIPTION"/>
    </Traits>
    You've not closed table <FavoredReligions> before opening table <Traits>. Everything after this fatal error is therefore discarded and not used by the game, which leads to the reason why you keep getting shunted back to the main menu: the error in the code creates a situation where part of your code is added into the game and part is not, which leads to the following error messages.
  3. You are getting an invalid reference error from the portion of your code that succeeds in getting added to the game. It is referencing a trait with the "name" of "TRAIT_LEADER_RF_IN_ALL_CHRISTENDOM", but that thrait has never successfully been registered into the game because of the fatal syntax error noted in previous point:
    Code:
    [873720.712] [Gameplay] ERROR: Invalid Reference on LeaderTraits.TraitType - "TRAIT_LEADER_RF_IN_ALL_CHRISTENDOM" does not exist in Traits
    Invalid Reference errors always cause the game to return to the main menu.
  4. The game cannot read successfully your file called RFEdwardIVEngland_Text.xml:
    Code:
    [Localization] ERROR: Database::XMLSerializer (RFEdwardIVEngland_Text.xml): Cannot parse file.
    This is caused by the following row statement:
    Code:
    <Row Tag="LOC_PEDIA_LEADERS_PAGE_LEADER_RF_EDWARD_IV_CHAPTER_HISTORY_PARA_6" Language="en_US"
    You are missing the needed ">" after Language="en_US". It is possible you have similar missing syntax symbols.
 
This information already exists in the game's base files:
Code:
<GameData>
<IconDefinitions>
<Row Name="ICON_CIVILIZATION_ENGLAND" Atlas="ICON_ATLAS_CIVILIZATIONS" Index="6"/>
You cannot repeat information the game already has. Doing so causes a unique constraint error (see spoiler) and causes the game to stop reading anything from the file where the violation occurs.

Thank you so much!
Do you mean that I should just have <ICON_CIVILIZATION_ENGLAND/> for the civ icon, or just do away with it entirely?
 
Since "ICON_CIVILIZATION_ENGLAND" already is registered with the game, you do not re-define it in your mod. So long as you assign your new leader as a variant for the existing England, when a player selects to play as Edward, they will still be playing as England and using England's existing icons.

So you want to delete the entire row from your file's code and only retain the row for Edward's Leader Icon.
 
Alright, I tested it again. It still crashed. I looked at the Logs files and it seems like it's a problem with the agenda.
Spoiler :

[920827.257] [Gameplay]: In XMLSerializer while inserting row into table insert into ModifierArguments('ModifierId', 'Name', 'Value') with values (MODIFIER_AGENDA_RF_METHOD_AND_ORDER_LARGE_ARMY, SimpleModifierDescription, LOC_DIPLO_MODIFIER_RF_METHOD_AND_ORDER_LARGE_ARMY, ).
[920827.257] [Gameplay]: In XMLSerializer while updating table ModifierArguments from file RFEdwardIVEngland_Gameplay.xml.
[920827.257] [Gameplay] ERROR: UNIQUE constraint failed: ModifierArguments.ModifierId, ModifierArguments.Name
[920827.257] [Gameplay] ERROR: FOREIGN KEY constraint failed
[920827.257] [Gameplay] ERROR: FOREIGN KEY constraint failed
[920827.257] [Gameplay]: Validating Foreign Key Constraints...
[920827.269] [Gameplay] ERROR: Invalid Reference on Modifiers.SubjectRequirementSetId - "PLAYER_HAS_HIGH_AMENITIES" does not exist in RequirementSets
[920827.269] [Gameplay] ERROR: Invalid Reference on Modifiers.SubjectRequirementSetId - "PLAYER_HAS_LARGE_ARMY" does not exist in RequirementSets

I am not sure where the file that lists RequirementSets is, as it is not where the Modifiers file is located.
The new logs and mod file have been posted at the top.
 
You have another unique constraint violation:
Code:
<Row>
	<ModifierId>MODIFIER_AGENDA_RF_METHOD_AND_ORDER_LARGE_ARMY</ModifierId>
	<Name>SimpleModifierDescription</Name>
	<Value>LOC_DIPLO_MODIFIER_RF_METHOD_AND_ORDER_LARGE_ARMY</Value>
</Row>
<Row>
	<ModifierId>MODIFIER_AGENDA_RF_METHOD_AND_ORDER_LARGE_ARMY</ModifierId>
	<Name>InitialValue</Name>
	<Value>12</Value>
</Row>
<Row>
	<ModifierId>MODIFIER_AGENDA_RF_METHOD_AND_ORDER_LARGE_ARMY</ModifierId>
	<Name>StatementKey</Name>
	<Value>LOC_DIPLO_KUDO_LEADER_RF_EDWARD_IV_REASON_ANY</Value>
</Row>
<Row>
	<ModifierId>MODIFIER_AGENDA_RF_METHOD_AND_ORDER_LARGE_ARMY</ModifierId>
	<Name>SimpleModifierDescription</Name>
	<Value>LOC_DIPLO_MODIFIER_RF_METHOD_AND_ORDER_LARGE_ARMY</Value>
</Row>
The second occurance of the exact same values for <ModifierId> and <Name> creates a uniqueness violation. The Database.log file is telling you not only which file but what string of code is causing a unique constraint error. Open the file and do a search through it for the specified string. If it only exists once anywhere within your mod, then download a searching tool and do a search through all of the game's base xml-files so you know what the original game-code is. Sometimes you can just use what the game already provides. Other times you need to copy what the game already has and use that as a template that you alter to your own needs.

You have to create the <RequirementSets> if you are not re-using one Firaxis already created for something they needed:
Code:
<Modifiers>
	<Row>
		<ModifierId>FORESTRY_SERVICE_LRS_FOREST_CULTURE</ModifierId>
		<ModifierType>MODIFIER_ALL_CITIES_ATTACH_MODIFIER</ModifierType>
		<SubjectRequirementSetId>CITY_HAS_FORESTRY_SERVICE_LRS_REQUIREMENTS</SubjectRequirementSetId>
	</Row>
</Modifiers>
<Requirements>
	<Row>
		<RequirementId>REQUIRES_CITY_HAS_FORESTRY_SERVICE_LRS</RequirementId>
		<RequirementType>REQUIREMENT_CITY_HAS_BUILDING</RequirementType>
	</Row>
</Requirements>
<RequirementArguments>
	<Row>
		<RequirementId>REQUIRES_CITY_HAS_FORESTRY_SERVICE_LRS</RequirementId>
		<Name>BuildingType</Name>
		<Value>BUILDING_FORESTRY_SERVICE_LRS</Value>
	</Row>
</RequirementArguments>
<RequirementSets>
	<Row>
		<RequirementSetId>CITY_HAS_FORESTRY_SERVICE_LRS_REQUIREMENTS</RequirementSetId>
		<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
	</Row>
</RequirementSets>
<RequirementSetRequirements>
	<Row>
		<RequirementSetId>CITY_HAS_FORESTRY_SERVICE_LRS_REQUIREMENTS</RequirementSetId>
		<RequirementId>REQUIRES_CITY_HAS_FORESTRY_SERVICE_LRS</RequirementId>
	</Row>
</RequirementSetRequirements>
You won't find a file anywhere in the base game's files that lists all the RequirementSets that Firaxis used: they are generally located within the same file where they were needed.
 
Well, good news. I found existing modifiers for high happiness and large standing army that Firaxis already created, so I didn't have to mess around with the requirement sets. This also resolves the double citation issue because it eliminated the need for the specification. I will test soon. (However, my gut feel is that there still is one more problem to fix.)
 
did you read the error messages in the database.log file ?
did you fix the issue in the text file ?

are you running mods that are not 100% necessary to test out your mod?
 
After reading the database.log, I have figured out that, since I used modifiers from the agendas file, that I should remove the MODIFIER_ prefix. They aren't like that in the agenda file, so they shouldn't be like that in my mod.
 
Back
Top Bottom