附加式数据MOD



决定版于2022年4月新增附加数据MOD,当您使用附加数据MOD后,每次更新游戏不需要再修改一遍。
在旧的游戏数据修改系统中,修改者会获取游戏数据文件的副本并对其进行更改。然后,这个修改文件会覆盖基础版本的文件。当发布新补丁时,这将使得修改无效,需要更新以包含数据文件的新更改。此外,如果两个不同的修改同时更改了同一个数据文件,它们将不兼容,因此不能同时启用。
使用附加修改时,与其覆盖基础数据文件,修改文件会与基础数据合并,因此当基础数据在新补丁中更改时,修改文件会与新数据合并,因此应仍然有效,无需更新。
如何使用附加数据MOD?
将附加修改文件放置在您的修改的Data目录中。修改文件的名称显示在下面的表格中:
原文件 MOD文件 根节点元素
protoy.xml protomods.xml <protomods>
techtreey.xml techtreemods.xml <techtreemods>
civs.xml civmods.xml <civmods>
politiciandata.xml politicianmods.xml <politicianmods>
nuggets.xml nuggetmods.xml

<nuggetmods>

protounitcommands.xml protounitcommandmods.xml

<protounitcommandmods>

cultures.xml culturemods.xml

<culturemods>

maptypes.xml maptypemods.xml

<maptypemods>

mapspecifictechs.xml mapspecifictechmods.xml

<mapspecifictechmods>

attacktime.xml attacktimemods.xml

<attacktimemods>

abilities\abilities.xml abilities\abilitymods.xml

<abilitymods>

abilities\powers.xml abilities\powermods.xml

<powermods>

randomnames.xml randomnamemods.xml

<randomnamemods>

strings\<language>\*.xml strings\<language>\stringmods.xml

<stringmods>

economymode.xml economymodemods.xml

<economymodemods>

personalities.xml personalitiesmods.xml

<personalitiesmods>

homecity<civ>.xml homecity<civ>.mods.xml

<homecitymods>

tactics\<type>.tactics tactics\<type>.mods.tactics

<tacticsmods>

uitechtree\techtreedata_<civ>.xml uitechtree\techtreedata_<civ>.mods.xml

<uitechtreemods>

给根xml节点赋予表中显示的名称。 填写修改文件,包括要进行修改的更改。 每个xml节点(除了字符串修改)都支持一个新的mergeMode属性,用于确定它如何与基础数据合并。 mergeMode的有效值为:modify[在原有基础上修改]、add[在原有基础上增加]、remove[在原有基础上删除]和replace[在原有基础上替换]。如果mergeMode属性不存在,则如果可以在基础数据中找到匹配的节点,则默认为modify,否则为add。
示例:
protomods.xml:
<protomods>
	<!-- remove a proto unit -->
	<Unit mergeMode='remove' name='PropsPottedPlants'/>

	<!-- modify a proto unit (add a new flag) -->
	<Unit name='PropsPoles'>
		<Flag>NotPlayerPlaceable</Flag>
	</Unit>

	<!-- modify a proto unit (add a Train and remove an existing Train) -->
	<Unit name='Manor'>
		<Train row='0' page='1' column='2'>Longbowman</Train>
		<Train mergeMode='remove'>xpColonialMilitia</Train>
	</Unit>

	<!-- replace a proto unit -->
	<Unit mergeMode='replace' id="1797" name='deIconUSCowboy'>
		<DBID>2372</DBID>
		<Icon>resources\art\units\spc\outlaws\cowboy_icon2.png</Icon>
		<PortraitIcon>resources\art\units\spc\outlaws\cowboy_portrait2.png</PortraitIcon>
	</Unit>

	<!-- add a proto unit -->
	<Unit name='MyNewProtoUnit'>
		<DBID>2400</DBID>
		<!-- ... proto unit data ... -->
	</Unit>

</protomods>



techtreemods.xml:
<techtreemods>
	<!-- modify a tech (add effect - enable Pikeman for the Russians) -->
	<Tech name ='Age0Russian'>
		<Effects>
			<Effect mergeMode='add' type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
				 <Target type ='ProtoUnit'>Pikeman</Target>
			</Effect>
		</Effects>
	</Tech>
	<!-- modify a tech (modify an effect by adding and removing - Sacred Cows now cost 10 food instead of 125 food) -->
	<Tech name ='ypAge0IndiansSpecialTechs'>
		<Effects>
			<Effect mergeMode='remove' type ='Data' amount ='45.00' subtype ='Cost' resource ='Food' relativity ='Absolute'>
				<Target type ='ProtoUnit'>ypSacredCow</Target>
			</Effect>
			<Effect mergeMode='add' type ='Data' amount ='-70.00' subtype ='Cost' resource ='Food' relativity ='Absolute'>
				<Target type ='ProtoUnit'>ypSacredCow</Target>
			</Effect>
		</Effects>
	</Tech>
</techtreemods>



stringmods.xml:
<stringmods>
	<StringTable>
		<Language name='English'>
			<!-- change the text of the Continue button on the Main Menu -->
			<String _locID='20038'>ModContinue</String>
		</Language>
	</StringTable>
</stringmods>
提示和技巧
有一个名为DebugOutputGameData的配置变量。当定义了此变量时,游戏在加载游戏数据时,每次附加修改文件与基础数据文件合并后,都会将每个数据文件写出。
这可用于检查附加修改对数据产生了预期的影响。在未启用任何修改的情况下将数据文件写出,然后启用修改并比较文件以查看差异。
文件将写出到%TEMP%\Age of Empires 3 DE\Data(其中%TEMP%是您的临时文件夹的位置,例如C:\<user>\AppData\Local\Temp)。
要设置配置变量,将DebugOutputGameData添加到C:\<user>\Games\Age of Empires 3 DE\<id>\Startup文件夹中的user.cfg文件中(如果文件不存在,则创建它)。