自动生产单位





自动生产单位有两种办法,一种是<type>Maintain</type>,另一种是<type>DanceBonus</type>(自己参考7-0,或者参考颐和园)。

第一种办法:打开tactics文件,按照格式添加
<action>
<name stringid="68982">Spawn</name>
<type>Maintain</type>
<rate type="ypMercIronTroop">1</rate><!-- 生产铁军,只能指定单位要生产多个请改成旗军,或者添加多个Action -->
<persistent>1</persistent>
<active>1</active><!-- 默认开启 -->
<singleuse>0</singleuse><!-- 关闭只生产一次 -->
</action>
第二种办法:按照格式添加
<action>
<name stringid="68982">SpawnUnit</name>
<type>DanceBonus</type>
<active>0</active><!-- 默认关闭需要用科技开启,如需默认开启请改为1,在下面我会说明怎样用科技开启的 -->
<persistent>1</persistent>
<dancebonustype>UnitSpawn</dancebonustype>
<modifyprotoid>ypTreeYellowRiver</modifyprotoid><!-- 生产黄河树木 -->
<modifymultiplier>0.065</modifymultiplier>
<modifyexponent>1.03</modifyexponent>
<modifybase>0.0</modifybase>
</action>
tactic部分添加:
<action>Spawn</action>
<action>SpawnUnit</action>
village.tactics是中国村庄的tactics文件。 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  village.tactics - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
<!-- converted from XMB to XML -->
<tactics>
<action>
<name stringid="68982">Spawn</name>
<type>Maintain</type>
<rate type="ypMercIronTroop">1</rate>
<persistent>1</persistent>
<active>1</active>
<singleuse>0</singleuse>
</action>
<action>
<name stringid="68982">SpawnUnit</name>
<type>DanceBonus</type>
<active>0</active>
<persistent>1</persistent>
<dancebonustype>UnitSpawn</dancebonustype>
<modifyprotoid>ypTreeYellowRiver</modifyprotoid>
<modifymultiplier>0.065</modifymultiplier>
<modifyexponent>1.03</modifyexponent>
<modifybase>0.0</modifybase>
</action>

<action>
<name stringid="38133">RangedAttack</name>
<type>Attack</type>
<attackaction>1</attackaction>
<rangedlogic>1</rangedlogic>
<activeifcontainsunits>1</activeifcontainsunits>
<damagefactorcap>10</damagefactorcap>
<scalebycontainedunits>1</scalebycontainedunits>
<anim>RangedAttack</anim>
<maxheight>0</maxheight>
<accuracy>1.0</accuracy>
<aimbonus>0</aimbonus>
<maxspread>5</maxspread>
<spreadfactor>0.25</spreadfactor>
<trackrating>12</trackrating>
<unintentionaldamagemultiplier>0.7</unintentionaldamagemultiplier>
<projectile>InvisibleProjectile</projectile>
<impacteffect>effects\impacts\gun</impacteffect>
<rate type="Unit">1.0 </rate>
<instantballistics>1</instantballistics>
<active>0</active>
</action>
<action>
<name stringid="38121">AntiShipAttack</name>
<type>Attack</type>
<attackaction>1</attackaction>
<rangedlogic>1</rangedlogic>
<anim>RangedAttackShip</anim>
<maxheight>0</maxheight>
<accuracy>1.0</accuracy>
<aimbonus>0</aimbonus>
<maxspread>5</maxspread>
<spreadfactor>0.25</spreadfactor>
<trackrating>12</trackrating>
<unintentionaldamagemultiplier>0.7</unintentionaldamagemultiplier>
<projectile>Cannonball</projectile>
<impacteffect>effects\impacts\cannon</impacteffect>
<perfectaccuracy>1</perfectaccuracy>
<rate type="Ship">1.0 </rate>
<active>0</active>
</action>
<action>
<name stringid="68972">SpawnSaiga</name>
<type>Maintain</type>
<rate type="ypSaiga">4</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68971">SpawnRefugees1</name>
<type>Maintain</type>
<rate type="ypMigrantArmySmall">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68971">SpawnRefugees2</name>
<type>Maintain</type>
<rate type="ypMigrantArmySmall">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68973">SpawnLivestock1</name>
<type>Maintain</type>
<rate type="ypMigrantGoats">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68973">SpawnLivestock2</name>
<type>Maintain</type>
<rate type="ypMigrantOx">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68973">SpawnLivestock3</name>
<type>Maintain</type>
<rate type="ypMigrantGoats">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68971">SpawnMigrants3</name>
<type>Maintain</type>
<rate type="ypMigrantArmyLarge">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<tactic>
Normal
<attacktype>LogicalTypeRangedUnitsAttack</attacktype>
<autoattacktype>LogicalTypeRangedUnitsAutoAttack</autoattacktype>
<attackresponsetype>LogicalTypeRangedUnitsAttack</attackresponsetype>
<action priority="100">AntiShipAttack</action>
<action>Spawn</action>
<action>SpawnUnit</action>

<action priority="75">RangedAttack</action>
<action priority="15">SpawnSaiga</action>
<action priority="15">SpawnRefugees1</action>
<action priority="15">SpawnRefugees2</action>
<action priority="15">SpawnMigrants3</action>
<action priority="15">SpawnLivestock1</action>
<action priority="15">SpawnLivestock2</action>
<action priority="15">SpawnLivestock3</action>
</tactic>
</tactics>


我设定方法二的active为0,所以需要用科技启用:

在techtreey.xml添加
<Effect type ='Data' action ='SpawnUnit' amount ='1.0' subtype ='ActionEnable' relativity ='Absolute'>
<Target type ='ProtoUnit'>ypvillage</Target></Effect>

我是在中国村庄的“县”科技添加的:

  techtreey.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)

<Tech name ='ypVillagePopCapIncrease' type ='Normal'>
<DBID>4281</DBID>
<DisplayNameID>62991</DisplayNameID>
<Cost resourcetype ='Wood'>200.0000</Cost>
<ResearchPoints>12.0000</ResearchPoints>
<Status>UNOBTAINABLE</Status>
<Icon>ui\techs\asians\government_town_icon_64</Icon>
<RolloverTextID>62990</RolloverTextID>
<Flag>CountsTowardEconomicScore</Flag>
<Flag>UniqueTech</Flag>
<Effects>
<Effect type ='Data' amount ='5.00' subtype ='PopulationCapAddition' relativity ='Absolute'>
<Target type ='ProtoUnit'>ypVillage</Target></Effect>
<Effect type ='Data' amount ='1.10' subtype ='Hitpoints' relativity ='BasePercent'>
<Target type ='ProtoUnit'>ypVillage</Target></Effect>
<Effect type ='Data' action ='SpawnUnit' amount ='1.0' subtype ='ActionEnable' relativity ='Absolute'>
<Target type ='ProtoUnit'>ypvillage</Target></Effect>

</Effects>
</Tech>
<Tech name ='YPDisciplinedSamurai' type ='Normal'>
<DBID>4291</DBID>
<DisplayNameID>63576</DisplayNameID>
<Cost resourcetype ='Wood'>200.0000</Cost>
<Cost resourcetype ='Gold'>100.0000</Cost>
<ResearchPoints>30.0000</ResearchPoints>
<Status>UNOBTAINABLE</Status>
<Icon>ui\techs\asians\disciplined_infantry</Icon>
<RolloverTextID>63577</RolloverTextID>
<Flag>UpgradeTech</Flag>
<Flag>CountsTowardMilitaryScore</Flag>
<Prereqs>
<TechStatus status ='Active'>Fortressize</TechStatus></Prereqs>
<Effects>
<Effect type ='Data' amount ='1.20' subtype ='Damage' allactions ='1' relativity ='BasePercent'>
<Target type ='ProtoUnit'>ypKensei</Target></Effect>
<Effect type ='Data' amount ='1.20' subtype ='Hitpoints' relativity ='BasePercent'>
<Target type ='ProtoUnit'>ypKensei</Target></Effect>
<Effect type ='SetName' proto ='ypKensei' culture ='none' newName ='63085'></Effect>
</Effects>
</Tech>




改良“县”科技后












PS:根据一个叫Anime的人所说,亚洲国家自带一个不可见的跳舞农民,所以能使用<type>DanceBonus</type>自动生产单位,而欧洲国家则不能自动生产单位;我没有去试验过,不过按照他所说的,我推算酋长国家使用<type>DanceBonus</type>自动生产单位,需要有农民跳舞才可以自动生产。