给单位设定命中率




3.5版本补充:

之前的版本未查明<accuracyreductionfactor>1.5</accuracyreductionfactor>的实际作用,所以是随便弄了个0.5,现在已经知道这个语句为命中衰减率,数值越大距离越远越打不中,本教程仍然是继续使用旧教程的0.5数值,你可以根据你的实际需求进行修改。



在帝国3中99%的单位都是百发百中,只有诸葛弩在防御模式与站岗模式有50%几率是会射偏。也许聪明的人已经知道怎样做了,但修改后是发现弓箭、近战攻击都能添加命中率,火枪炮弹却无论如何都还是百发百中,解决办法与命中率修改教程如下:

1.先把火枪手的tactics提取出来musketBayonet.tactics,然后放到游戏目录\data\tcatics文件夹里面。 2.把各个战术的语句
<accuracy>1.0</accuracy> 百分比数值,1是100%命中率,0.1是10%命中率
<accuracyreductionfactor>1.5</accuracyreductionfactor> 命中衰减率,数值越大距离越远越打不中
<instantballistics>1</instantballistics> 这句的作用为无视命中率,强制百发百中。 上述语句修改成:
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<accuracy>0.4</accuracy>为40%命中率,像近战攻击这种没有的,可以自己添加上去。 3.删除(或者改成0)
<instantballistics>1</instantballistics>
4.这样火枪手就攻击的命中率就只有40%了。 5.将修改好的文件放到游戏目录\data\tactics文件夹里面。
  musketBayonet.tactics - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
<!-- converted from XMB to XML -->
<tactics>
<action>
<name stringid="38127">VolleyRangedAttack</name>
<type>Attack</type>
<attackaction>1</attackaction>
<rangedlogic>1</rangedlogic>
<anim>Volley_standing_attack</anim>
<reloadanim>Volley_standing_reload</reloadanim>
<idleanim>Volley_standing_idle</idleanim>
<maxheight>0</maxheight>
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>

<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>
<minrange>2</minrange>
<rate type="Unit">1.0 </rate>
<throw>1</throw>
<damage>13.000000</damage>
<maxrange>12.000000</maxrange>
<rof>2.000000</rof>
<!-- 记得删除这句,或者将1改成0 <instantballistics>1</instantballistics> -->
</action>
<action>
<name stringid="38130">VolleyHandAttack</name>
<type>Attack</type>
<maxrange>1.75</maxrange>
<rate type="Unit">1.0 </rate>
<attackaction>1</attackaction>
<handlogic>1</handlogic>
<speedboost>1</speedboost>
<anim>charge_attack</anim>
<idleanim>charge_idle</idleanim>
<impacteffect>effects\impacts\melee</impacteffect>
<targetspeedboost>1</targetspeedboost>
<!-- 没有就自己添加上去 (近战攻击的命中率为90%)-->
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>

</action>
<action>
<name stringid="38136">DefendRangedAttack</name>
<type>Attack</type>
<attackaction>1</attackaction>
<rangedlogic>1</rangedlogic>
<anim>Volley_standing_attack</anim>
<reloadanim>Volley_standing_reload</reloadanim>
<idleanim>Volley_standing_idle</idleanim>
<maxheight>0</maxheight>
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>

<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>
<minrange>2</minrange>
<rate type="Unit">1.0 </rate>
<throw>1</throw>
<damage>13.000000</damage>
<maxrange>12.000000</maxrange>
<rof>2.000000</rof>
</action>
<action>
<name stringid="38137">DefendHandAttack</name>
<type>Attack</type>
<maxrange>1.75</maxrange>
<rate type="Unit">1.0 </rate>
<attackaction>1</attackaction>
<handlogic>1</handlogic>
<speedboost>1</speedboost>
<anim>charge_attack</anim>
<idleanim>charge_idle</idleanim>
<impacteffect>effects\impacts\melee</impacteffect>
<damage>6.5</damage>
<rof>1.0</rof>
<targetspeedboost>1</targetspeedboost>
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>

</action>
<action>
<name stringid="38129">StaggerRangedAttack</name>
<type>Attack</type>
<attackaction>1</attackaction>
<rangedlogic>1</rangedlogic>
<anim>Volley_standing_attack</anim>
<reloadanim>Volley_standing_reload</reloadanim>
<idleanim>Volley_standing_idle</idleanim>
<maxheight>0</maxheight>
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>

<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>
<minrange>2</minrange>
<rate type="Unit">1.0 </rate>
<throw>1</throw>
<damage>13.000000</damage>
<maxrange>12.000000</maxrange>
<rof>2.000000</rof>
</action>
<action>
<name stringid="38132">StaggerHandAttack</name>
<type>Attack</type>
<maxrange>1.75</maxrange>
<rate type="Unit">1.0 </rate>
<attackaction>1</attackaction>
<handlogic>1</handlogic>
<speedboost>1</speedboost>
<anim>charge_attack</anim>
<idleanim>charge_idle</idleanim>
<impacteffect>effects\impacts\melee</impacteffect>
<damage>6.5</damage>
<rof>1.0</rof>
<targetspeedboost>1</targetspeedboost>
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>

</action>
<action>
<name stringid="38135">MeleeHandAttack</name>
<type>Attack</type>
<maxrange>1.75</maxrange>
<rate type="Unit">1.0 </rate>
<attackaction>1</attackaction>
<handlogic>1</handlogic>
<speedboost>1</speedboost>
<anim>Charge_attack</anim>
<idleanim>Charge_idle</idleanim>
<impacteffect>effects\impacts\melee</impacteffect>
<damage>6.5</damage>
<rof>1.0</rof>
<targetspeedboost>1</targetspeedboost>
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>

</action>
<action>
<name stringid="38118">BuildingAttack</name>
<type>Attack</type>
<rangedlogic>1</rangedlogic>
<maxrange>6</maxrange>
<rate type="LogicalTypeShipsAndBuildings">1.0 </rate>
<attackaction>1</attackaction>
<speedboost>1</speedboost>
<anim>Raze_attack</anim>
<idleanim>Raze_idle</idleanim>
<impacteffect>effects\impacts\torch</impacteffect>
<projectile>TorchProjectile</projectile>
</action>
<action>
<name stringid="69147">Build</name>
<type>Build</type>
<anim>Build</anim>
<active>0</active>
<maxrange>0.2</maxrange>
<rate type="Barracks">2.0</rate>
<rate type="Stable">2.0</rate>
<rate type="ArtilleryDepot">2.0</rate>
<rate type="Warhut">2.0</rate>
<rate type="Corral">2.0</rate>
<rate type="FortFrontier">2.0</rate>
<rate type="ypBarracksIndian">2.0</rate>
<rate type="ypCaravanserai">2.0</rate>
<rate type="ypCastle">2.0</rate>
</action>
<tactic>
Volley
<action priority="100">VolleyRangedAttack</action>
<action priority="75">BuildingAttack</action>
<action priority="25">VolleyHandAttack</action>
<action>Build</action>
<attacktype>LogicalTypeRangedUnitsAttack</attacktype>
<autoattacktype>LogicalTypeRangedUnitsAutoAttack</autoattacktype>
<attackresponsetype>LogicalTypeRangedUnitsAttack</attackresponsetype>
<runaway>1</runaway>
<autoretarget>1</autoretarget>
<idleanim>Volley_standing_idle</idleanim>
<boredanim>Volley_standing_bored</boredanim>
<deathanim>Death_by_melee</deathanim>
<walkanim>Volley_walk</walkanim>
<joganim>Volley_jog</joganim>
<runanim>Volley_run</runanim>
</tactic>
<tactic>
Defend
<action priority="100">DefendRangedAttack</action>
<action priority="75">BuildingAttack</action>
<action priority="25">DefendHandAttack</action>
<action>Build</action>
<attacktype>LogicalTypeRangedUnitsAttack</attacktype>
<autoattacktype>LogicalTypeRangedUnitsAutoAttack</autoattacktype>
<attackresponsetype>LogicalTypeRangedUnitsAttack</attackresponsetype>
<runaway>0</runaway>
<autoretarget>1</autoretarget>
<idleanim>Defend_idle</idleanim>
<boredanim>Defend_bored</boredanim>
<deathanim>Death_by_melee</deathanim>
<walkanim>Cover_walk</walkanim>
<joganim>Cover_jog</joganim>
<runanim>Cover_run</runanim>
</tactic>
<tactic>
Stagger
<action priority="100">StaggerRangedAttack</action>
<action priority="75">BuildingAttack</action>
<action priority="25">StaggerHandAttack</action>
<action>Build</action>
<attacktype>LogicalTypeRangedUnitsAttack</attacktype>
<autoattacktype>LogicalTypeRangedUnitsAutoAttack</autoattacktype>
<attackresponsetype>LogicalTypeRangedUnitsAttack</attackresponsetype>
<runaway>0</runaway>
<autoretarget>1</autoretarget>
<idleanim>Cover_ranged_idle</idleanim>
<boredanim>Cover_bored</boredanim>
<deathanim>Death_by_melee</deathanim>
<walkanim>Cover_walk</walkanim>
<joganim>Cover_jog</joganim>
<runanim>Cover_run</runanim>
</tactic>
<tactic>
Melee
<action priority="100">BuildingAttack</action>
<action priority="75">MeleeHandAttack</action>
<action>Build</action>
<attacktype>LogicalTypeRangedUnitsAttack</attacktype>
<autoattacktype>LogicalTypeRangedUnitsAutoAttack</autoattacktype>
<attackresponsetype>LogicalTypeRangedUnitsAttack</attackresponsetype>
<runaway>0</runaway>
<autoretarget>1</autoretarget>
<idleanim>Charge_idle</idleanim>
<boredanim>Charge_bored</boredanim>
<deathanim>Death_by_melee</deathanim>
<walkanim>Charge_walk</walkanim>
<joganim>Charge_jog</joganim>
<runanim>Charge_run</runanim>
</tactic>
</tactics>



由于是因为改Tactics文件,所以使用这个Tactics的单位都会一起改变命中率。

另一种方法是直接在protoy.xml修改:
Tactics文件的语句是可以作用在的Protoy.xml的XXXX,同理Protoy.xml的XXXX语句可以搬到tactics使用。优先级是先执行Protoy.xml,只要读取了Protoy.xml的语句,就不会在Tactics中读取与protoy.xml相同的语句。


方法:在Protoy.xml的XXXX按照格式添加
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>
tactics大部分语句改成0会失效,同理<instantballistics>0</instantballistics>改成0,百发百中就会失效了。
  protoy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)

<Unit id ='286' name ='Musketeer'>
<DBID>3</DBID>
<DisplayNameID>22805</DisplayNameID>
<EditorNameID>25023</EditorNameID>
<PopulationCount>1</PopulationCount>
<ObstructionRadiusX>0.4900</ObstructionRadiusX>
<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
<FormationCategory>Ranged</FormationCategory>
<MaxVelocity>4.0000</MaxVelocity>
<MaxRunVelocity>6.0000</MaxRunVelocity>
<MovementType>land</MovementType>
<TurnRate>18.0000</TurnRate>
<AnimFile>units\infantry_ranged\musketeer\musketeer.xml</AnimFile>
<ImpactType>Flesh</ImpactType>
<PhysicsInfo>dude</PhysicsInfo>
<Icon>units\infantry_ranged\musketeer\musketeer_icon_64x64</Icon>
<PortraitIcon>units\infantry_ranged\musketeer\musketeer_portrait</PortraitIcon>
<RolloverTextID>22812</RolloverTextID>
<ShortRolloverTextID>25669</ShortRolloverTextID>
<InitialHitpoints>150.0000</InitialHitpoints>
<MaxHitpoints>150.0000</MaxHitpoints>
<LOS>16.0000</LOS>
<ProjectileProtoUnit>InvisibleProjectile</ProjectileProtoUnit>
<UnitAIType>RangedCombative</UnitAIType>
<TrainPoints>30.0000</TrainPoints>
<Bounty>10.0000</Bounty>
<BuildBounty>10.0000</BuildBounty>
<Cost resourcetype ='Food'>75.0000</Cost>
<Cost resourcetype ='Gold'>25.0000</Cost>
<AllowedAge>1</AllowedAge>
<Armor type ='Hand' value ='0.2000'></Armor>
<UnitType>LogicalTypeHealed</UnitType>
<UnitType>LogicalTypeValidSharpshoot</UnitType>
<UnitType>LogicalTypeNeededForVictory</UnitType>
<UnitType>LogicalTypeHandUnitsAutoAttack</UnitType>
<UnitType>LogicalTypeLandMilitary</UnitType>
<UnitType>LogicalTypeScout</UnitType>
<UnitType>LogicalTypeValidSPCUnitsDeadCondition</UnitType>
<UnitType>LogicalTypeGarrisonInShips</UnitType>
<UnitType>LogicalTypeRangedUnitsAutoAttack</UnitType>
<UnitType>LogicalTypeVillagersAttack</UnitType>
<UnitType>LogicalTypeHandUnitsAttack</UnitType>
<UnitType>LogicalTypeRangedUnitsAttack</UnitType>
<UnitType>LogicalTypeMinimapFilterMilitary</UnitType>
<UnitType>Unit</UnitType>
<UnitType>Military</UnitType>
<UnitType>UnitClass</UnitType>
<UnitType>AbstractInfantry</UnitType>
<UnitType>AbstractHeavyInfantry</UnitType>
<UnitType>HasBountyValue</UnitType>
<UnitType>AbstractGunpowderTrooper</UnitType>
<UnitType>Ranged</UnitType>
<UnitType>CountsTowardMilitaryScore</UnitType>
<UnitType>AbstractCavalryInfantry</UnitType>
<UnitType>ConvertsHerds</UnitType>
<UnitType>AbstractRangedInfantry</UnitType>
<Flag>CollidesWithProjectiles</Flag>
<Flag>ApplyHandicapTraining</Flag>
<Flag>CorpseDecays</Flag>
<Flag>ShowGarrisonButton</Flag>
<Flag>DontRotateObstruction</Flag>
<Flag>ObscuredByUnits</Flag>
<Flag>Tracked</Flag>
<Command page ='10' column ='1'>Stop</Command>
<Command page ='10' column ='0'>Garrison</Command>
<Command page ='10' column ='2'>Delete</Command>
<Tactics>musketBayonet.tactics</Tactics>
<ProtoAction>
<Name>BuildingAttack</Name>
<Damage>20.000000</Damage>
<DamageType>Siege</DamageType>
<ROF>3.000000</ROF>
</ProtoAction>
<ProtoAction>
<Name>DefendHandAttack</Name>
<Damage>13.000000</Damage>
<DamageType>Hand</DamageType>
<ROF>1.500000</ROF>
<DamageBonus type ='AbstractCavalry'>3.000000</DamageBonus>
<DamageBonus type ='AbstractLightInfantry'>2.250000</DamageBonus>
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>

</ProtoAction>
<ProtoAction>
<Name>DefendRangedAttack</Name>
<Damage>23.000000</Damage>
<DamageType>Ranged</DamageType>
<MaxRange>12.000000</MaxRange>
<ROF>3.000000</ROF>
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>

</ProtoAction>
<ProtoAction>
<Name>MeleeHandAttack</Name>
<Damage>13.000000</Damage>
<DamageType>Hand</DamageType>
<ROF>1.500000</ROF>
<DamageBonus type ='AbstractCavalry'>3.000000</DamageBonus>
<DamageBonus type ='AbstractLightInfantry'>2.250000</DamageBonus>
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>

</ProtoAction>
<ProtoAction>
<Name>StaggerHandAttack</Name>
<Damage>13.000000</Damage>
<DamageType>Hand</DamageType>
<ROF>1.500000</ROF>
<DamageBonus type ='AbstractCavalry'>3.000000</DamageBonus>
<DamageBonus type ='AbstractLightInfantry'>2.250000</DamageBonus>
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>

</ProtoAction>
<ProtoAction>
<Name>StaggerRangedAttack</Name>
<Damage>23.000000</Damage>
<DamageType>Ranged</DamageType>
<MaxRange>12.000000</MaxRange>
<ROF>3.000000</ROF>
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>

</ProtoAction>
<ProtoAction>
<Name>VolleyHandAttack</Name>
<Damage>13.000000</Damage>
<DamageType>Hand</DamageType>
<ROF>1.500000</ROF>
<DamageBonus type ='AbstractCavalry'>3.000000</DamageBonus>
<DamageBonus type ='AbstractLightInfantry'>2.250000</DamageBonus>
<accuracy>0.9</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>

</ProtoAction>
<ProtoAction>
<Name>VolleyRangedAttack</Name>
<Damage>23.000000</Damage>
<DamageType>Ranged</DamageType>
<MaxRange>12.000000</MaxRange>
<ROF>3.000000</ROF>
<accuracy>0.4</accuracy>
<accuracyreductionfactor>0.5</accuracyreductionfactor>
<instantballistics>0</instantballistics>

</ProtoAction>
</Unit>











如果想一次性修改所有单位命中率有两个方法,第一个是修改所有tactics文件,我估算了一下大概要修改150个文件。
第二个办法是在protoy使用全部替换,另外protoy原有的<accuracy>0.99</accuracy>要先删除,一般带攻击的建筑物都有这个语句。

注:谨慎使用全部替换,替换前先备份文件,不然稍有失误整个文件就废了,而且还有可能无法复原。




将你想改战术都仿照截图全部替换一次。

第一次替换:



第二次替换:




如果弄回美观性,用下高版本的Word文档,支持替换换行符。或者使用一些能格式化xml软件。