灵活使用tactics优先级可以弄出较好的效果,例如给城堡添加添加上像城镇中心的攻击,驻守人数越多,攻击越高,但是没人驻守时任然能攻击。
可以这样说,在这个教程出来之前(或者有类似这样的单位被制作出来),95%的人都是想不出可以这样做的。
tactics文件最底部的tactic中的action语句是可以增加优先顺序的,只需要在action后面添加上priority="X",X值越大,优先级越高。
举个例子:远程单位的齐射攻击分别设定了远距离攻击、近战攻击与攻城攻击的action,远距离攻击的priority值为100,近战攻击的priority值为25,攻城攻击的priority值为75。
这个齐射攻击设定了三种攻击,那么为什么一般情况下只会远距离射击,而不会使用近战或攻城?
因为远距离攻击的priority为100是几个设定中最高的,所以这个单位的齐射攻击会优先采用远距离攻击。
但是为什么攻击建筑不是远距离攻击呢?
因为远距离攻击的对象只定义了"Unit",只能攻击单位,所以远距离无法攻击建筑物,当需要攻击建筑物的时候,会采用下一个优先等级较高的攻击,(如果不能攻击建筑的话则继续判断),因此单位攻击建筑物的时候会主动切换到攻城动作。
齐射攻击有时候会自动转换成近战攻击,原因也是与攻城攻击一样的:
因为远距离射击有最短射击距离2,当距离小于2的时候会才采用攻城攻击,但是攻城攻击不能攻击单位,所以最后采用了可以攻击单位的近战攻击。
还有一点是如果在齐射模式打船是远距离攻击的,在近战则是攻城攻击的,这是因为船只单位标签有unit,所以远距离攻击能攻击船只;而近战攻击在tactics并没有添加远距离攻击的action,所以只能采用攻城攻击(这句话看不懂的话,我补充一点:攻城攻击的对象是LogicalTypeShipsAndBuildings;VolleyAttack的优先级比BuildingAttack要高。)。
不说那么多了,来直接看例子吧:给城堡添加“当有单位驻守后,额外增加攻击”的功能。
需要用上这几个语句:
<activeifcontainsunits>1</activeifcontainsunits> |
当有单位驻守的时候,才开启攻击 |
<damagefactorcap>X</damagefactorcap> |
当驻守单位达到X后,停止增加伤害 |
<scalebycontainedunits>1</scalebycontainedunits> |
驻守一个单位增加一次伤害(单位攻击力),该数值只能为1 |
如果只是把几个语句加上去的确是可以增加攻击,但是只能在有单位驻守时才能攻击,那么怎样让不驻守单位也能攻击?这时候就要用上优先级了。 首先在城堡的tactics文件复制粘贴一个action,然后改名,再把那三个语句加上去。 例如:
<action> <name stringid="38133">ContainRangedAttack</name> <type>Attack</type> <attackaction>1</attackaction> <rangedlogic>1</rangedlogic> <anim>RangedAttack</anim> <maxheight>0</maxheight> <activeifcontainsunits>1</activeifcontainsunits> <damagefactorcap>10</damagefactorcap> <scalebycontainedunits>1</scalebycontainedunits> <accuracy>1.0</accuracy> <accuracyreductionfactor>0.01</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> <rate type="Unit">1.0 </rate> <instantballistics>1</instantballistics> </action>
castle.tactics - 记事本 | ____ | □ | X | ||
文件(F) 编辑(E) 格式(O) 查看(V) 帮助(H) | |||||
<!-- converted from XMB to XML --> <tactics> <action> <name stringid="38133">ContainRangedAttack</name> <type>Attack</type> <attackaction>1</attackaction> <rangedlogic>1</rangedlogic> <anim>RangedAttack</anim> <maxheight>0</maxheight> <activeifcontainsunits>1</activeifcontainsunits> <damagefactorcap>10</damagefactorcap> <scalebycontainedunits>1</scalebycontainedunits> <accuracy>1.0</accuracy> <accuracyreductionfactor>0.01</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> <rate type="Unit">1.0 </rate> <instantballistics>1</instantballistics> </action> <action> <name stringid="38133">RangedAttack</name> <type>Attack</type> <attackaction>1</attackaction> <rangedlogic>1</rangedlogic> <anim>RangedAttack</anim> <maxheight>0</maxheight> <accuracy>1.0</accuracy> <accuracyreductionfactor>0.01</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> <rate type="Unit">1.0 </rate> <instantballistics>1</instantballistics> </action> <action> <name stringid="38119">CannonAttack</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> <rate type="Unit">1.0 </rate> <active>0</active> <throw>1</throw> <outerdamageareadistance>.25</outerdamageareadistance> <outerdamageareafactor>.20</outerdamageareafactor> <areasortmode>Directional</areasortmode> <perfectaccuracy>1</perfectaccuracy> <targetground>1</targetground> <numberbounces>1</numberbounces> <basedamagecap>1</basedamagecap> </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="AbstractWarship">1.0 </rate> </action> <action> <name stringid="69776">SpawnSamurai</name> <type>Maintain</type> <rate type="ypKensei">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 priority="75">CannonAttack</action> <action priority="50">ContainRangedAttack</action> <action priority="25">RangedAttack</action> <action>Spawn</action> </tactic> </tactics> |
|||||
然后在底部的tactic语句把action写上去,priority要比原来的远距攻击设定要高,这样的话城堡会先优先采用有驻守单位的攻击,当没有人驻守在城堡,新添加的攻击会自动关闭,接着根据优先级顺序切换回原本的远距攻击。另外新攻击的priority值要比炮轰攻击的设定要低,才不会把炮轰攻击给覆盖掉。
最后在protoy把新添加远距攻击的攻击力写上去,就完成了,进入游戏看结果吧。
<ProtoAction> <Name>ContainRangedAttack</Name> <Damage>30.000000</Damage> <DamageType>Ranged</DamageType> <MinRange>0.000000</MinRange> <MaxRange>24.000000</MaxRange> <ROF>3.000000</ROF> <DamageBonus type ='AbstractVillager'>0.250000</DamageBonus> <DamageBonus type ='AbstractCavalry'>1.500000</DamageBonus> <DamageBonus type ='AbstractSiegeTrooper'>0.500000</DamageBonus> <DamageBonus type ='AbstractLightInfantry'>1.500000</DamageBonus> </ProtoAction>
protoy.xml - 记事本 | ____ | □ | X | ||
文件(F) 编辑(E) 格式(O) 查看(V) 帮助(H) | |||||
<Unit id ='1043' name ='ypCastle'>
<DBID>1560</DBID>
<DisplayNameID>62979</DisplayNameID>
<ObstructionRadiusX>4.0000</ObstructionRadiusX>
<ObstructionRadiusZ>4.0000</ObstructionRadiusZ>
<MaxVelocity>0.0000</MaxVelocity>
<MaxRunVelocity>0.0000</MaxRunVelocity>
<MovementType>land</MovementType>
<AnimFile>buildings\asian_civs\castle\castle.xml</AnimFile>
<DeadReplacement>BuildingRubble4x4</DeadReplacement>
<DeadReplacementLifespan>15</DeadReplacementLifespan>
<ImpactType>Wood</ImpactType>
<PhysicsInfo>blockhouse</PhysicsInfo>
<PlacementFile>buildingsmall.xml</PlacementFile>
<Icon>buildings\asian_civs\castle\China\chinese_castle_icon</Icon>
<PortraitIcon>buildings\asian_civs\castle\China\chinese_castle_icon_portrait</PortraitIcon>
<RolloverTextID>62978</RolloverTextID>
<ShortRolloverTextID>62977</ShortRolloverTextID>
<InitialHitpoints>3000.0000</InitialHitpoints>
<MaxHitpoints>3000.0000</MaxHitpoints>
<LOS>32.0000</LOS>
<ProjectileProtoUnit>Arrow</ProjectileProtoUnit>
<UnitAIType>RangedCombative</UnitAIType>
<BuildPoints>60.0000</BuildPoints>
<BuildLimit>5</BuildLimit>
<Bounty>140.0000</Bounty>
<BuildBounty>70.0000</BuildBounty>
<Cost resourcetype ='Wood'>250.0000</Cost>
<Cost resourcetype ='Gold'>100.0000</Cost>
<BuildingWorkRate>1.0000</BuildingWorkRate>
<MaxContained>20</MaxContained>
<AllowedAge>0</AllowedAge>
<Armor type ='Siege' value ='0.0000'></Armor>
<BuilderLimit>4</BuilderLimit>
<UnitType>LogicalTypeValidSabotage</UnitType>
<UnitType>LogicalTypeHandUnitsAutoAttack</UnitType>
<UnitType>LogicalTypeBuildingsNotWalls</UnitType>
<UnitType>LogicalTypeRangedUnitsAutoAttack</UnitType>
<UnitType>LogicalTypeVillagersAttack</UnitType>
<UnitType>LogicalTypeHandUnitsAttack</UnitType>
<UnitType>LogicalTypeShipsAndBuildings</UnitType>
<UnitType>LogicalTypeRangedUnitsAttack</UnitType>
<UnitType>LogicalTypeBuildingsNotWallsOrGroves</UnitType>
<UnitType>LogicalTypeMinimapFilterMilitary</UnitType>
<UnitType>BuildingClass</UnitType>
<UnitType>MilitaryBuilding</UnitType>
<UnitType>Building</UnitType>
<UnitType>CountsTowardMilitaryScore</UnitType>
<UnitType>HasBountyValue</UnitType>
<UnitType>AbstractFoundry</UnitType>
<UnitType>ConvertsHerds</UnitType>
<Train row ='0' page ='0' column ='0'>ypFlameThrower</Train>
<Train row ='0' page ='0' column ='0'>ypFlamingArrow</Train>
<Train row ='0' page ='0' column ='1'>ypHandMortar</Train>
<Train row ='0' page ='0' column ='1'>ypMorutaru</Train>
<Train row ='0' page ='0' column ='0'>ypMercFlailiphant</Train>
<Train row ='0' page ='0' column ='3'>ypSiegeElephant</Train>
<Train row ='0' page ='0' column ='0'>xpArrowKnight</Train>
<Train row ='0' page ='0' column ='1'>xpEagleKnight</Train>
<Train row ='0' page ='0' column ='2'>xpJaguarKnight</Train>
<Train row ='0' page ='0' column ='4'>ypMongolianArmy</Train>
<Train row ='0' page ='0' column ='3'>ypBlackFlagArmy</Train>
<Tech row ='0' page ='1' column ='1'>YPHonoredMorutaru</Tech>
<Tech row ='0' page ='1' column ='0'>YPExaltedFlailElephant</Tech>
<Tech row ='0' page ='1' column ='1'>YPExaltedMorutaru</Tech>
<Tech row ='0' page ='1' column ='0'>YPDisciplinedFlameThrower</Tech>
<Tech row ='0' page ='1' column ='0'>YPExaltedFlameThrower</Tech>
<Tech row ='0' page ='1' column ='1'>YPExaltedSiegeElephant</Tech>
<Tech row ='0' page ='1' column ='0'>YPHonoredFlameThrower</Tech>
<Tech row ='0' page ='1' column ='0'>YPExaltedFlamingArrow</Tech>
<Tech row ='0' page ='1' column ='3'>ypFortifiedCastle</Tech>
<Tech row ='0' page ='1' column ='3'>ypFrontierCastle</Tech>
<Tech row ='0' page ='1' column ='0'>YPHonoredFlamingArrow</Tech>
<Tech row ='0' page ='1' column ='1'>YPExaltedHandMortar</Tech>
<Tech row ='0' page ='1' column ='0'>YPHonoredFlailElephant</Tech>
<Tech row ='0' page ='1' column ='1'>YPHonoredHandMortar</Tech>
<Tech row ='0' page ='1' column ='0'>YPDisciplinedFlailElephant</Tech>
<Tech row ='0' page ='1' column ='1'>YPHonoredSiegeElephant</Tech>
<Flag>CollidesWithProjectiles</Flag>
<Flag>StartsAtFullEfficiency</Flag>
<Flag>Immoveable</Flag>
<Flag>NoBloodOnDeath</Flag>
<Flag>ObscuresUnits</Flag>
<Flag>NonAutoFormedUnit</Flag>
<Flag>Doppled</Flag>
<Flag>SelectWithObstruction</Flag>
<Flag>PaintTextureWhenPlacing</Flag>
<Flag>FlattenGround</Flag>
<Flag>HasGatherPoint</Flag>
<Flag>AllowAutoGarrison</Flag>
<Flag>Tracked</Flag>
<Contain>AbstractVillager</Contain>
<Contain>Imam</Contain>
<Contain>Missionary</Contain>
<Contain>NatMedicineMan</Contain>
<Contain>xpMedicineMan</Contain>
<Contain>Surgeon</Contain>
<Contain>Priest</Contain>
<Contain>xpMedicineManAztec</Contain>
<Contain>ypDaimyoRegicide</Contain>
<Command page ='10' column ='0'>SetGatherPointMilitary</Command>
<Command page ='10' column ='2'>Eject</Command>
<Command page ='10' column ='3'>Delete</Command>
<Command page ='10' column ='1'>SetGatherPointEconomy</Command>
<Command page ='1' column ='5'>StartNativeDance</Command>
<Command page ='1' column ='5'>CancelNativeDance</Command>
<Command page ='1' column ='9'>SetUnitAsHomeCityGatherPoint</Command>
<Tactics>castle.tactics</Tactics>
<ProtoAction>
<Name>AntiShipAttack</Name>
<Damage>100.000000</Damage>
<DamageType>Siege</DamageType>
<MinRange>0.000000</MinRange>
<MaxRange>40.000000</MaxRange>
<ROF>3.000000</ROF>
<DamageBonus type ='AbstractSiegeTrooper'>0.500000</DamageBonus>
</ProtoAction>
<ProtoAction>
<Name>CannonAttack</Name>
<Damage>60.000000</Damage>
<DamageType>Siege</DamageType>
<MinRange>0.000000</MinRange>
<MaxRange>24.000000</MaxRange>
<ROF>3.000000</ROF>
<DamageCap>120.000000</DamageCap>
<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
<DamageArea>3.000000</DamageArea>
<DamageFlags>GAIAEnemy</DamageFlags>
<DamageBonus type ='AbstractCavalry'>1.500000</DamageBonus>
<DamageBonus type ='AbstractSiegeTrooper'>0.500000</DamageBonus>
</ProtoAction>
<ProtoAction>
<Name>RangedAttack</Name>
<Damage>30.000000</Damage>
<DamageType>Ranged</DamageType>
<MinRange>0.000000</MinRange>
<MaxRange>24.000000</MaxRange>
<ROF>3.000000</ROF>
<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
<DamageBonus type ='AbstractCavalry'>1.500000</DamageBonus>
<DamageBonus type ='AbstractSiegeTrooper'>0.500000</DamageBonus>
<DamageBonus type ='AbstractLightInfantry'>1.500000</DamageBonus>
</ProtoAction>
<ProtoAction>
<Name>ContainRangedAttack</Name>
<Damage>30.000000</Damage>
<DamageType>Ranged</DamageType>
<MinRange>0.000000</MinRange>
<MaxRange>24.000000</MaxRange>
<ROF>3.000000</ROF>
<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
<DamageBonus type ='AbstractCavalry'>1.500000</DamageBonus>
<DamageBonus type ='AbstractSiegeTrooper'>0.500000</DamageBonus>
<DamageBonus type ='AbstractLightInfantry'>1.500000</DamageBonus>
</ProtoAction>
</Unit> |
|||||
不知道你留意到没,为了方便我是直接改良了两张卡片,一张给城堡增加10%攻击力,另一张设定坚固城堡的科技状态为作用中,都给城堡添加了攻击力,但是techtreey.xml这几个卡片(科技)都没有给定义增加新的远距攻击的攻击力,所以新的远距攻击依然是30*X不变。
techtreey.xml - 记事本 | ____ | □ | X | ||
文件(F) 编辑(E) 格式(O) 查看(V) 帮助(H) | |||||
<Tech name ='ypFrontierCastle' type ='Normal'>
<DBID>4799</DBID>
<DisplayNameID>66027</DisplayNameID>
<Cost resourcetype ='Wood'>400.0000</Cost>
<Cost resourcetype ='Gold'>200.0000</Cost>
<ResearchPoints>60.0000</ResearchPoints>
<Status>UNOBTAINABLE</Status>
<Icon>ui\techs\asians\tech_frontier_castle</Icon>
<RolloverTextID>66026</RolloverTextID>
<Flag>CountsTowardMilitaryScore</Flag>
<Prereqs>
<TechStatus status ='Active'>Fortressize</TechStatus></Prereqs>
<Effects>
<Effect type ='SetName' proto ='ypCastle' culture ='none' newName ='66386'></Effect>
<Effect type ='Data' action ='RangedAttack' amount ='1.50' subtype ='Damage' relativity ='BasePercent'>
<Target type ='ProtoUnit'>ypCastle</Target></Effect>
<Effect type ='Data' action ='ContainRangedAttack' amount ='1.50' subtype ='Damage' relativity ='BasePercent'>
<Target type ='ProtoUnit'>ypCastle</Target></Effect>
<Effect type ='Data' amount ='0.00' subtype ='UpdateVisual' unittype ='ypCastle' relativity ='Absolute'>
<Target type ='Player'></Target></Effect>
</Effects>
</Tech>
<Tech name ='ypFortifiedCastle' type ='Normal'>
<DBID>4800</DBID>
<DisplayNameID>66032</DisplayNameID>
<Cost resourcetype ='Wood'>800.0000</Cost>
<Cost resourcetype ='Gold'>400.0000</Cost>
<ResearchPoints>60.0000</ResearchPoints>
<Status>UNOBTAINABLE</Status>
<Icon>ui\techs\asians\tech_fortified_castle</Icon>
<RolloverTextID>66031</RolloverTextID>
<Flag>CountsTowardMilitaryScore</Flag>
<Prereqs>
<TechStatus status ='Active'>ypFrontierCastle</TechStatus>
<TechStatus status ='Active'>Industrialize</TechStatus>
</Prereqs>
<Effects>
<Effect type ='Data' amount ='1.50' subtype ='Hitpoints' relativity ='BasePercent'>
<Target type ='ProtoUnit'>ypCastle</Target></Effect>
<Effect type ='SetName' proto ='ypCastle' culture ='none' newName ='66387'></Effect>
<Effect type ='Data' action ='CannonAttack' amount ='1.00' subtype ='ActionEnable' relativity ='Absolute'>
<Target type ='ProtoUnit'>ypCastle</Target></Effect>
<Effect type ='Data' action ='AntiShipAttack' amount ='2.00' subtype ='Damage' relativity ='BasePercent'>
<Target type ='ProtoUnit'>ypCastle</Target></Effect>
<Effect type ='Data' amount ='0.00' subtype ='UpdateVisual' unittype ='ypCastle' relativity ='Absolute'>
<Target type ='Player'></Target></Effect>
</Effects>
</Tech> |
|||||