Galactic Civilizations IV: Supernova Galactic Civilizations IV: Supernova Galactic Civilizations IV

XSL Transform of MasterTechDefs.xml

Published on Thursday, November 16, 2023 By Kylere In GalCiv IV Modding

Also posted on steam (227Steam over there)

I wanted longer paced games and the tech/manu sliders are limited even when you adjust them in the XML. I decided to add a multiplier to all the <ResearchCost>X</ResearchCost> values in MasterTechDefs.xml and while a global replace could add a 10x/100x etc value I wanted more fine adjustments and each patch updating the core required I do it again.

 

Since I hacked thru it, I thought I would share. The below shows adding a 1.5X modifier, and you can change it by altering the number in line 15 (1.5)

 

I recommend Notepad++ and the XML tools plugin, but your fav XML whatever should do the transforms.

 

example from MasterTechDefs.xml before

<FlavorDescription>Tech_AntiMatterPowerPlants_FlavorText_Description</FlavorDescription>

<ColorDef>TechOrange</ColorDef>

<Icon>Icon_Production.png</Icon>

<Image>event_slum_Small.png</Image>

<Rarity>Uncommon</Rarity>

<ResearchCost>180</ResearchCost>

 

example from MasterTechDefs.xml after

<FlavorDescription>Tech_AntiMatterPowerPlants_FlavorText_Description</FlavorDescription>

<ColorDef>TechOrange</ColorDef>

<Icon>Icon_Production.png</Icon>

<Image>event_slum_Small.png</Image>

<Rarity>Uncommon</Rarity>

<ResearchCost>270</ResearchCost>

--------------------

Code: xml
  1. <!--?xml version="1.0" encoding="UTF-8"?--></p><?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.  
  4.     <!-- Identity transform -->
  5.     <xsl:template match="@*|node()">
  6.         <xsl:copy>
  7.             <xsl:apply-templates select="@*|node()"/>
  8.         </xsl:copy>
  9.     </xsl:template>
  10.  
  11.     <!-- Template to transform ResearchCost element -->
  12.     <xsl:template match="ResearchCost">
  13.         <xsl:copy>
  14.             <xsl:value-of select="format-number(., '0.##') * 1.5"/>
  15.         </xsl:copy>
  16.     </xsl:template>
  17.  
  18. </xsl:stylesheet>
  19. <!-- Identity transform --> <!-- Template to transform ResearchCost element -->