添加被动技能


技能效果:增加周围单位10%速度(技能只是一个摆设,在tactics定义效果)。

方法:



1.把单位的tactics文件提取出来,如果这个tactics有多个单位使用,那么建议你把那个单位的tactics改掉。

在提取单位tactics的时候顺便把这句加上(作用是显示技能按钮): <Command page ='11' column ='0'>Abilities</Command>
  protoy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<Unit id ='866' name ='SPCXPWashington'>		<!-- SPCXPWashington:酋长战役的华盛顿将军 -->
		<DBID>1274</DBID>
		<DisplayNameID>47256</DisplayNameID>
		<EditorNameID>47257</EditorNameID>
		<ObstructionRadiusX>0.4900</ObstructionRadiusX>
		<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
		<FormationCategory>Body</FormationCategory>
		<MaxVelocity>5.0000</MaxVelocity>
		<MaxRunVelocity>7.0000</MaxRunVelocity>
		<MovementType>land</MovementType>
		<TurnRate>18.0000</TurnRate>
		<AnimFile>units\spc\george_washington_x\spc_george_washington.xml</AnimFile>
		<ImpactType>Flesh</ImpactType>
		<Icon>units\spc\george_washington_x\washington_portrait</Icon>
		<PortraitIcon>units\spc\george_washington_x\washington_portrait</PortraitIcon>
		<RolloverTextID>47255</RolloverTextID>
		<ShortRolloverTextID>47254</ShortRolloverTextID>
		<InitialHitpoints>1200.0000</InitialHitpoints>
		<MaxHitpoints>1200.0000</MaxHitpoints>
		<LOS>24.0000</LOS>
		<AutoAttackRange>16.0000</AutoAttackRange>
		<UnitAIType>RangedCombative</UnitAIType>
		<Bounty>40.0000</Bounty>
		<AllowedAge>0</AllowedAge>
		<Armor type ='Hand' value ='0.4000'></Armor>
		<UnitType>LogicalTypeHealed</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>Hero</UnitType>
		<UnitType>AbstractInfantry</UnitType>
		<UnitType>AbstractHeavyInfantry</UnitType>
		<UnitType>Unit</UnitType>
		<UnitType>Military</UnitType>
		<UnitType>UnitClass</UnitType>
		<UnitType>Ranged</UnitType>
		<UnitType>HasBountyValue</UnitType>
		<UnitType>AbstractCavalryInfantry</UnitType>
		<UnitType>ConvertsHerds</UnitType>
		<UnitType>AbstractHandInfantry</UnitType>
		<Flag>CollidesWithProjectiles</Flag>
		<Flag>ApplyHandicapTraining</Flag>
		<Flag>CorpseDecays</Flag>
		<Flag>ShowGarrisonButton</Flag>
		<Flag>DontRotateObstruction</Flag>
		<Flag>ObscuredByUnits</Flag>
		<Flag>NotDeleteable</Flag>
		<Flag>KnockoutDeath</Flag>
		<Flag>RotateInPlace</Flag>
		<Flag>Tracked</Flag>
		<Command page ='10' column ='4'>Delete</Command>
		<Command page ='10' column ='0'>Garrison</Command>
		<Command page ='10' column ='1'>Stop</Command>
		<Command page ='10' column ='7'>SetHomeCityGatherPoint</Command>
		<Command page ='11' column ='0'>Abilities</Command>
<!--		<Tactics>SPCHeroHand.tactics</Tactics>	很明显,这个tactics被多个单位使用,所以提取出来改名字重新定义吧	-->
		<Tactics>Washington.tactics</Tactics>
		<ProtoAction>
			<Name>BuildingAttack</Name>
			<Damage>28.000000</Damage>
			<DamageType>Siege</DamageType>
			<ROF>3.000000</ROF>
		</ProtoAction>
		<ProtoAction>
			<Name>HandAttack</Name>
			<Damage>28.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>1.500000</ROF>
		</ProtoAction>
	</Unit>



2.在tactics文件添加速度光环

<action> <name stringid="00500">Speed</name> <type>AutoRangedModify</type> <active>0</active> <!-- 我设定为需要改良科技才能开启该技能,所以tactics也应该要关闭这个action --> <maxrange>12</maxrange> <!-- 影响范围12 --> <modifyexclusive>1</modifyexclusive> <!-- 不可叠加 --> <persistent>1</persistent> <modifytype>speed</modifytype> <!-- 影响效果:速度 --> <modifymultiplier>1.1</modifymultiplier> <!-- 1.1倍速度 --> <modelattachment>effects\ypack_auras\daimyopower.xml</modelattachment> <modelattachmentbone>bonethatdoesntexist</modelattachmentbone> <modifyabstracttype>Unit</modifyabstracttype> <!--作用对象:所有单位。 --> <targetenemy>0</targetenemy> <!--不对敌人生效 --> </action>
  Washington.tactics - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
<!-- converted from XMB to XML -->

<tactics>
	<action>
		<name stringid="00500">Speed</name>
		<type>AutoRangedModify</type>
		<active>0</active>		
		<maxrange>12</maxrange>
		<modifyexclusive>1</modifyexclusive>
		<persistent>1</persistent>
		<modifytype>speed</modifytype>
		<modifymultiplier>1.1</modifymultiplier>
		<modelattachment>effects\ypack_auras\daimyopower.xml</modelattachment>
		<modelattachmentbone>bonethatdoesntexist</modelattachmentbone>
		<modifyabstracttype>Unit</modifyabstracttype>
		<targetenemy>0</targetenemy>
	</action>
	<action>
		<name stringid="69148">Discover</name>
		<type>Discover</type>
		<anim>Pickup</anim>
		<maxrange>0.2</maxrange>
		<rate type="AbstractNugget">1.0</rate>
	</action>
	<action>
		<name stringid="69147">Build</name>
		<type>Build</type>
		<anim>Build</anim>
		<maxrange>0.2</maxrange>
		<rate type="Building">1.0</rate>
	</action>
	<action>
		<name stringid="38134">HandAttack</name>
		<type>Attack</type>
		<attackaction>1</attackaction>
		<handlogic>1</handlogic>
		<anim>HandAttack</anim>
		<idleanim>CombatIdle</idleanim>
		<maxrange>1.75</maxrange>
		<impacteffect>effects\impacts\melee</impacteffect>
		<rate type="Unit">1.0 </rate>
	</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>
	<tactic>
		Melee
		<action priority="100">BuildingAttack</action>
		<action priority="75">HandAttack</action>
		<action>Speed</action>
		<action>Build</action>
		<action>Discover</action>
		<speedmodifier>1.0</speedmodifier>
		<attacktype>LogicalTypeHandUnitsAttack</attacktype>
		<autoattacktype>LogicalTypeHandUnitsAutoAttack</autoattacktype>
		<attackresponsetype>LogicalTypeHandUnitsAttack</attackresponsetype>
		<runaway>1</runaway>
		<autoretarget>1</autoretarget>
		<idleanim>Idle</idleanim>
		<boredanim>Bored</boredanim>
		<deathanim>Death</deathanim>
		<walkanim>Walk</walkanim>
		<joganim>Jog</joganim>
		<runanim>Run</runanim>
	</tactic>
	<tactic>
		Defend
		<action priority="100">BuildingAttack</action>
		<action priority="25">HandAttack</action>
		<action>Speed</action>
		<action>Build</action>
		<action>Discover</action>
		<attacktype>LogicalTypeHandUnitsAttack</attacktype>
		<autoattacktype>LogicalTypeHandUnitsAutoAttack</autoattacktype>
		<attackresponsetype>LogicalTypeHandUnitsAttack</attackresponsetype>
		<runaway>0</runaway>
		<autoretarget>1</autoretarget>
		<idleanim>Idle</idleanim>
		<boredanim>Bored</boredanim>
		<deathanim>Death</deathanim>
		<walkanim>Walk</walkanim>
		<joganim>Jog</joganim>
		<runanim>Run</runanim>
	</tactic>
	<tactic>
		Cover
		<speedmodifier>0.5</speedmodifier>
		<action priority="100">BuildingAttack</action>
		<action priority="25">HandAttack</action>
		<action>Speed</action>
		<action>Build</action>
		<action>Discover</action>
		<attacktype>LogicalTypeHandUnitsAttack</attacktype>
		<autoattacktype>LogicalTypeHandUnitsAutoAttack</autoattacktype>
		<attackresponsetype>LogicalTypeHandUnitsAttack</attackresponsetype>
		<runaway>0</runaway>
		<autoretarget>1</autoretarget>
		<idleanim>Idle</idleanim>
		<boredanim>Bored</boredanim>
		<deathanim>Death</deathanim>
		<walkanim>Walk</walkanim>
		<joganim>Jog</joganim>
		<runanim>Run</runanim>
	</tactic>
</tactics>

3.在power.xml添加一个(没卵用、用来摆设的)新被动技能

  powers.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<power name="PowerSpeed" type="UnitAction">
		<displaynameid>00500</displaynameid>
		<rolloverid>00501</rolloverid>
		<icon>art\ui\abilities\ability_speed</icon>
		<allowduringnorush>1</allowduringnorush>
	</power>
	<power name="PowerBeam" type="UnitAction">
		<displaynameid>09973</displaynameid>
		<rolloverid>09971</rolloverid>
		<icon>art\Chino\ability_icon\Beam</icon>
		<minimapeventtime sendalertto="all">1</minimapeventtime>
		<rangeindicatorprotoid radius="5.0" indicatorcount="8" speed="0.6">PowerRanger</rangeindicatorprotoid>
		<activetime>10</activetime>
		<radius>10.0</radius>
		<placement forceonmap="1">LOSDontCare</placement>
		<abstractattacktargettype>All</abstractattacktargettype>
		<unitaction>MagicBeamAttack</unitaction>
		<allowduringnorush>1</allowduringnorush>
	</power>
	<power name="PowerStun" type="Stun">
		<displaynameid>09976</displaynameid>
		<rolloverid>09961</rolloverid>
		<icon>art\Chino\ability_icon\stun</icon>
		<minimapeventtime sendalertto="all">1</minimapeventtime>
		<activetime>40</activetime>
		<radius>20.0</radius>
		<placement forceonmap="1">LOSDontCare</placement>
		<rangeindicatorprotoid radius="20.0" indicatorcount="32" speed="0.6">PowerRanger</rangeindicatorprotoid>
		<abstractattacktargettype>Unit</abstractattacktargettype>
		<explicitlyrestrictedattacktargettype>Ship</explicitlyrestrictedattacktargettype>
		<allowduringnorush>1</allowduringnorush>
		<startsoundset>PowerStun</startsoundset>
	</power>
	<power name="PowerHealUnit" type="UnitAction">
		<displaynameid>09959</displaynameid>
		<rolloverid>09960</rolloverid>
		<icon>art\ui\abilities\ability_heal</icon>
		<minimapeventtime sendalertto="player">1</minimapeventtime>
		<activetime>60</activetime>
		<radius>20.0</radius>
		<placement forceonmap="1" ally="">full</placement>
		<abstractattacktargettype>Unit</abstractattacktargettype>
		<rangeindicatorprotoid radius="20.0" indicatorcount="32" speed="0.6">PowerRanger</rangeindicatorprotoid>
		<unitaction>Heal</unitaction>
		<hitpointstoheal>10000</hitpointstoheal>
		<allowduringnorush>1</allowduringnorush>
		<startsoundset>ChinoHeal</startsoundset>
	</power>

  randommapstringsy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
		<String _locID="00500">速度光环</String>
		<String _locID="00501">增加附近单位10%移动速度。</String>

4.abilities.xml把技能添加进去。

<SPCXPWashington> <!-- 如果原本有这个单位调用名的,就添加在原有的那里,没有就自己创建 --> <ability> PowerSpeed <!-- 你刚才在powers.xml定义的技能调用名 --> <tech>ypVillagePopCapIncrease</tech> <!-- 前提科技,你必须改良该科技才能显示这个技能,ypVillagePopCapIncrease:中国村庄的“县”科技 --> <alwaysdisabledingrid>true</alwaysdisabledingrid> <!-- 被动技能要添加这句,使这个技能按钮不能按下去 --> </ability> </SPCXPWashington>
  abilities.xml.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<ypspctokugawa>
		<ability>
			ypPowerDivineRight
			<rof>45</rof>
			<castonself>true</castonself>
		</ability>
		<ability>
			ypPowerDivineBlow
			<alwaysdisabledingrid>true</alwaysdisabledingrid>
		</ability>
	</ypspctokugawa>
	<xpironclad2>
		<ability>
			PowerLongRange
			<rof>10</rof>
		</ability>
	</xpironclad2>
	<SPCXPWashington>
		<ability>
			PowerSpeed
			<alwaysdisabledingrid>true</alwaysdisabledingrid>
			<tech>ypVillagePopCapIncrease</tech>
		</ability>
	</SPCXPWashington>
	<KafuuChino>
		<ability>
			PowerBeam
			<rof>60</rof>
		</ability>
		<ability>
			PowerStun
			<rof>60</rof>
		</ability>
		<ability>
			PowerCovert
			<rof>60</rof>
		</ability>
		<ability>
			PowerHealUnit
			<rof>60</rof>
		</ability>
	</KafuuChino>
	<HotoCocoa>
		<ability>
			PowerBeam
			<rof>60</rof>
		</ability>
		<ability>
			PowerStun2
			<rof>60</rof>
		</ability>
		<ability>
			PowerCovert2
			<rof>60</rof>
		</ability>
		<ability>
			PowerHealUnit
			<rof>60</rof>
		</ability>
	</HotoCocoa>

5.启用光环语句:

这个教程简直就是Tactics的教程 <Effect type ='Data' action ='Actionname' amount ='1.0' subtype ='ActionEnable' relativity ='Absolute'> <Target type ='ProtoUnit'>Protoname</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 ='Speed' amount ='1.0' subtype ='ActionEnable' relativity ='Absolute'>
				<Target type ='ProtoUnit'>SPCXPWashington</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>