不让单位死亡


这个教程是让单位死亡后不会消失,而是像探险家那样倒下:

注:如果用这个方法,单位不会自动回血是不会复活的,即使你的单位在他附近,他还是倒下。添加自动回血参考4-2 自动回血





这次我要修改的单位为鄂图曼骑兵(这货调用名为Spahi,在土耳其会自动回血,这里就不介绍添加自动回血方法了)


方法:

1.在找到这个单位,按照格式添加
		<Flag>NotDeleteable</Flag>
		上面的语句作用是让单位不能被删除。

		<Flag>KnockoutDeath</Flag>
		上面的语句作用是让单位生命值为0后不会死亡,而是倒下。

2.删除这个语句
		<Command page ='10' column ='1'>Delete</Command>
		上面的语句是删除单位的按钮。
修改如下,添加蓝色语句,删除红色语句
protoy.xml - 记事本
	<Unit id ='339' name ='Spahi'>
		<DBID>105</DBID>
		<DisplayNameID>23733</DisplayNameID>
		<EditorNameID>25033</EditorNameID>
		<PopulationCount>3</PopulationCount>
		<ObstructionRadiusX>0.7900</ObstructionRadiusX>
		<ObstructionRadiusZ>0.7900</ObstructionRadiusZ>
		<FormationCategory>Mobile</FormationCategory>
		<MaxVelocity>6.5000</MaxVelocity>
		<MaxRunVelocity>8.5000</MaxRunVelocity>
		<MovementType>land</MovementType>
		<TurnRate>18.0000</TurnRate>
		<AnimFile>units\cavalry\spahi\spahi_horse.xml</AnimFile>
		<ImpactType>Flesh</ImpactType>
		<PhysicsInfo>cav</PhysicsInfo>
		<Icon>units\cavalry\spahi\spahi_icon</Icon>
		<PortraitIcon>units\cavalry\spahi\spahi_portrait</PortraitIcon>
		<RolloverTextID>23732</RolloverTextID>
		<ShortRolloverTextID>25713</ShortRolloverTextID>
		<InitialHitpoints>750.0000</InitialHitpoints>
		<MaxHitpoints>750.0000</MaxHitpoints>
		<LOS>15.0000</LOS>
		<UnitAIType>HandCombative</UnitAIType>
		<TrainPoints>40.0000</TrainPoints>
		<Bounty>28.0000</Bounty>
		<BuildBounty>28.0000</BuildBounty>
		<Cost resourcetype ='Food'>280.0000</Cost>
		<AllowedAge>2</AllowedAge>
		<Armor type ='Ranged' value ='0.1000'></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>HasBountyValue</UnitType>
		<UnitType>AbstractHeavyCavalry</UnitType>
		<UnitType>AbstractCavalryInfantry</UnitType>
		<UnitType>CountsTowardMilitaryScore</UnitType>
		<UnitType>ConvertsHerds</UnitType>
		<UnitType>AbstractHandCavalry</UnitType>
		<UnitType>Unit</UnitType>
		<UnitType>Military</UnitType>
		<UnitType>UnitClass</UnitType>
		<UnitType>AbstractCavalry</UnitType>
		<Flag>CollidesWithProjectiles</Flag>
		<Flag>ApplyHandicapTraining</Flag>
		<Flag>CorpseDecays</Flag>
		<Flag>ShowGarrisonButton</Flag>
		<Flag>DontRotateObstruction</Flag>
		<Flag>ObscuredByUnits</Flag>
		<Flag>ConstrainOrientation</Flag>
		<Flag>OrientUnitWithGround</Flag>
		<Flag>Tracked</Flag>
		<Flag>NotDeleteable</Flag>
		<Flag>KnockoutDeath</Flag>
		<Command page ='10' column ='1'>Stop</Command>
		<Command page ='10' column ='0'>Garrison</Command>
<!--		<Command page ='10' column ='2'>Delete</Command>		-->
		<Tactics>handCavalry.tactics</Tactics>
		<ProtoAction>
			<Name>BuildingAttack</Name>
			<Damage>28.000000</Damage>
			<DamageType>Siege</DamageType>
			<ROF>3.000000</ROF>
		</ProtoAction>
		<ProtoAction>
			<Name>DefendHandAttack</Name>
			<Damage>35.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>1.500000</ROF>
			<DamageCap>70.000000</DamageCap>
			<DamageArea>3.000000</DamageArea>
			<DamageFlags>Enemy</DamageFlags>
		</ProtoAction>
		<ProtoAction>
			<Name>GuardianAttack</Name>
			<Damage>35.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>1.500000</ROF>
			<DamageCap>70.000000</DamageCap>
		</ProtoAction>
		<ProtoAction>
			<Name>MeleeHandAttack</Name>
			<Damage>35.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>1.500000</ROF>
			<DamageCap>70.000000</DamageCap>
			<DamageArea>3.000000</DamageArea>
			<DamageFlags>Enemy</DamageFlags>
		</ProtoAction>
		<ProtoAction>
			<Name>TrampleHandAttack</Name>
			<Damage>23.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>2.000000</ROF>
			<DamageCap>93.000000</DamageCap>
			<DamageArea>3.000000</DamageArea>
			<DamageFlags>Enemy</DamageFlags>
		</ProtoAction>
	</Unit>







还可以反过来为探险家添加死亡:



找到探险家删除这两句。
		<Flag>NotDeleteable</Flag>
		<Flag>KnockoutDeath</Flag>

添加
		<Command page ='10' column ='1'>Delete</Command>

protoy.xml - 记事本
		<Unit id ='288' name ='Explorer'>
			<DBID>9</DBID>
			<DisplayNameID>22824</DisplayNameID>
			<ObstructionRadiusX>0.4900</ObstructionRadiusX>
			<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
			<FormationCategory>Body</FormationCategory>
			<MaxVelocity>4.5000</MaxVelocity>
			<MaxRunVelocity>6.5000</MaxRunVelocity>
			<MovementType>land</MovementType>
			<TurnRate>18.0000</TurnRate>
			<AnimFile>units\explorers\explorer.xml</AnimFile>
			<ImpactType>Flesh</ImpactType>
			<Icon>units\explorers\explorer_portrait</Icon>
			<MinimapIcon>ui\minimap\hero</MinimapIcon>
			<PortraitIcon>units\explorers\explorer_portrait</PortraitIcon>
			<SelectionPriority>5</SelectionPriority>
			<RolloverTextID>22823</RolloverTextID>
			<ShortRolloverTextID>25633</ShortRolloverTextID>
			<InitialHitpoints>400.0000</InitialHitpoints>
			<MaxHitpoints>400.0000</MaxHitpoints>
			<LOS>18.0000</LOS>
			<ProjectileProtoUnit>InvisibleProjectile</ProjectileProtoUnit>
			<AutoAttackRange>16.0000</AutoAttackRange>
			<UnitAIType>RangedCombative</UnitAIType>
			<Bounty>45.0000</Bounty>
			<AllowedAge>0</AllowedAge>
			<Armor type ='Ranged' value ='0.1000'></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>Unit</UnitType>
			<UnitType>UnitClass</UnitType>
			<UnitType>Military</UnitType>
			<UnitType>Hero</UnitType>
			<UnitType>AbstractInfantry</UnitType>
			<UnitType>HasBountyValue</UnitType>
			<UnitType>Ranged</UnitType>
			<UnitType>AbstractGunpowderTrooper</UnitType>
			<UnitType>AbstractCavalryInfantry</UnitType>
			<UnitType>ConvertsHerds</UnitType>
			<UnitType>AbstractRangedInfantry</UnitType>
			<UnitType>AbstractCanSeeStealth</UnitType>
			<Train row ='0' page ='6' column ='1'>TradingPost</Train>
			<Train row ='0' page ='6' column ='0'>TownCenter</Train>
			<Train row ='0' page ='6' column ='3'>NatBlowgunAmbusher</Train>
			<Train row ='0' page ='6' column ='2'>WarDog</Train>
			<Train row ='0' page ='6' column ='4'>NatClubmanLoyal</Train>
			<Flag>HeroName2</Flag>
			<Flag>CollidesWithProjectiles</Flag>
			<Flag>ApplyHandicapTraining</Flag>
			<Flag>CorpseDecays</Flag>
			<Flag>ShowGarrisonButton</Flag>
			<Flag>DontRotateObstruction</Flag>
			<Flag>ObscuredByUnits</Flag>
	<!--		<Flag>KnockoutDeath</Flag>		-->
			<Flag>RotateInPlace</Flag>
	<!--		<Flag>NotDeleteable</Flag>		-->
			<Flag>ForceBuildingData</Flag>
			<Flag>Tracked</Flag>
			<Command page ='10' column ='0'>Garrison</Command>
			<Command page ='10' column ='1'>Delete</Command>
			<Command page ='10' column ='2'>Stop</Command>
			<Command page ='11' column ='0'>Abilities</Command>
			<Tactics>explorer.tactics</Tactics>
			<ProtoAction>
				<Name>Build</Name>
				<Rate type ='TradingPost'>3.000000</Rate>
				<Rate type ='TownCenter'>1.000000</Rate>
			</ProtoAction>
			<ProtoAction>
				<Name>BuildingAttack</Name>
				<Damage>15.000000</Damage>
				<DamageType>Siege</DamageType>
				<ROF>3.000000</ROF>
				<DamageBonus type ='Building'>1.000000</DamageBonus>
			</ProtoAction>
			<ProtoAction>
				<Name>CrackshotAttack</Name>
				<Damage>5000.000000</Damage>
				<DamageType>Ranged</DamageType>
				<MaxRange>16.000000</MaxRange>
				<ROF>3.000000</ROF>
				<DamageBonus type ='MercType2'>0.010000</DamageBonus>
			</ProtoAction>
			<ProtoAction>
				<Name>HandAttack</Name>
				<Damage>6.000000</Damage>
				<DamageType>Hand</DamageType>
				<ROF>1.500000</ROF>
				<DamageBonus type ='Guardian'>3.000000</DamageBonus>
				<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
			</ProtoAction>
			<ProtoAction>
				<Name>Heal</Name>
				<Rate type ='LogicalTypeHealed'>50.000000</Rate>
			</ProtoAction>
			<ProtoAction>
				<Name>SharpshooterAttack</Name>
				<Damage>750.000000</Damage>
				<DamageType>Ranged</DamageType>
				<MaxRange>16.000000</MaxRange>
				<ROF>3.000000</ROF>
			</ProtoAction>
			<ProtoAction>
				<Name>SwashbucklerAttack</Name>
				<Damage>100.000000</Damage>
				<DamageType>Hand</DamageType>
				<ROF>2.000000</ROF>
				<DamageCap>200.000000</DamageCap>
				<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
				<DamageArea>3.000000</DamageArea>
				<DamageFlags>GAIAEnemy</DamageFlags>
				<DamageBonus type ='MercType2'>0.250000</DamageBonus>
			</ProtoAction>
			<ProtoAction>
				<Name>VolleyRangedAttack</Name>
				<Damage>12.000000</Damage>
				<DamageType>Ranged</DamageType>
				<MaxRange>16.000000</MaxRange>
				<ROF>3.000000</ROF>
				<DamageBonus type ='Guardian'>3.000000</DamageBonus>
				<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
			</ProtoAction>
		</Unit>






不过这样改的话,欧洲探险家删除后不能被赎回,你需要像亚洲国家那样添加建造单位按钮。还需要你给探险家添加建造1上限<BuildLimit>1</BuildLimit>与100黄金成本<Cost resourcetype ='Gold'>100.0000</Cost>。
protoy.xml - 记事本
	<Unit id ='288' name ='Explorer'>
		<DBID>9</DBID>
		<DisplayNameID>22824</DisplayNameID>
		<ObstructionRadiusX>0.4900</ObstructionRadiusX>
		<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
		<FormationCategory>Body</FormationCategory>
		<MaxVelocity>4.5000</MaxVelocity>
		<MaxRunVelocity>6.5000</MaxRunVelocity>
		<MovementType>land</MovementType>
		<TurnRate>18.0000</TurnRate>
		<AnimFile>units\explorers\explorer.xml</AnimFile>
		<ImpactType>Flesh</ImpactType>
		<Icon>units\explorers\explorer_portrait</Icon>
		<MinimapIcon>ui\minimap\hero</MinimapIcon>
		<PortraitIcon>units\explorers\explorer_portrait</PortraitIcon>
		<SelectionPriority>5</SelectionPriority>
		<RolloverTextID>22823</RolloverTextID>
		<ShortRolloverTextID>25633</ShortRolloverTextID>
		<InitialHitpoints>400.0000</InitialHitpoints>
		<MaxHitpoints>400.0000</MaxHitpoints>
		<LOS>18.0000</LOS>
		<ProjectileProtoUnit>InvisibleProjectile</ProjectileProtoUnit>
		<AutoAttackRange>16.0000</AutoAttackRange>
		<UnitAIType>RangedCombative</UnitAIType>
		<Bounty>45.0000</Bounty>
		<AllowedAge>0</AllowedAge>
		<BuildLimit>1</BuildLimit>
		<Cost resourcetype ='Gold'>100.0000</Cost>
		<Armor type ='Ranged' value ='0.1000'></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>Unit</UnitType>
		<UnitType>UnitClass</UnitType>
		<UnitType>Military</UnitType>
		<UnitType>Hero</UnitType>
		<UnitType>AbstractInfantry</UnitType>
		<UnitType>HasBountyValue</UnitType>
		<UnitType>Ranged</UnitType>
		<UnitType>AbstractGunpowderTrooper</UnitType>
		<UnitType>AbstractCavalryInfantry</UnitType>
		<UnitType>ConvertsHerds</UnitType>
		<UnitType>AbstractRangedInfantry</UnitType>
		<UnitType>AbstractCanSeeStealth</UnitType>
		<Train row ='0' page ='6' column ='1'>TradingPost</Train>
		<Train row ='0' page ='6' column ='0'>TownCenter</Train>
		<Train row ='0' page ='6' column ='3'>NatBlowgunAmbusher</Train>
		<Train row ='0' page ='6' column ='2'>WarDog</Train>
		<Train row ='0' page ='6' column ='4'>NatClubmanLoyal</Train>
		<Flag>HeroName2</Flag>
		<Flag>CollidesWithProjectiles</Flag>
		<Flag>ApplyHandicapTraining</Flag>
		<Flag>CorpseDecays</Flag>
		<Flag>ShowGarrisonButton</Flag>
		<Flag>DontRotateObstruction</Flag>
		<Flag>ObscuredByUnits</Flag>
<!--		<Flag>KnockoutDeath</Flag>		-->
		<Flag>RotateInPlace</Flag>
<!--		<Flag>NotDeleteable</Flag>		-->
		<Flag>ForceBuildingData</Flag>
		<Flag>Tracked</Flag>
		<Command page ='10' column ='0'>Garrison</Command>
		<Command page ='10' column ='1'>Delete</Command>
		<Command page ='10' column ='2'>Stop</Command>
		<Command page ='11' column ='0'>Abilities</Command>
		<Tactics>explorer.tactics</Tactics>
		<ProtoAction>
			<Name>Build</Name>
			<Rate type ='TradingPost'>3.000000</Rate>
			<Rate type ='TownCenter'>1.000000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>BuildingAttack</Name>
			<Damage>15.000000</Damage>
			<DamageType>Siege</DamageType>
			<ROF>3.000000</ROF>
			<DamageBonus type ='Building'>1.000000</DamageBonus>
		</ProtoAction>
		<ProtoAction>
			<Name>CrackshotAttack</Name>
			<Damage>5000.000000</Damage>
			<DamageType>Ranged</DamageType>
			<MaxRange>16.000000</MaxRange>
			<ROF>3.000000</ROF>
			<DamageBonus type ='MercType2'>0.010000</DamageBonus>
		</ProtoAction>
		<ProtoAction>
			<Name>HandAttack</Name>
			<Damage>6.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>1.500000</ROF>
			<DamageBonus type ='Guardian'>3.000000</DamageBonus>
			<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
		</ProtoAction>
		<ProtoAction>
			<Name>Heal</Name>
			<Rate type ='LogicalTypeHealed'>50.000000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>SharpshooterAttack</Name>
			<Damage>750.000000</Damage>
			<DamageType>Ranged</DamageType>
			<MaxRange>16.000000</MaxRange>
			<ROF>3.000000</ROF>
		</ProtoAction>
		<ProtoAction>
			<Name>SwashbucklerAttack</Name>
			<Damage>100.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>2.000000</ROF>
			<DamageCap>200.000000</DamageCap>
			<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
			<DamageArea>3.000000</DamageArea>
			<DamageFlags>GAIAEnemy</DamageFlags>
			<DamageBonus type ='MercType2'>0.250000</DamageBonus>
		</ProtoAction>
		<ProtoAction>
			<Name>VolleyRangedAttack</Name>
			<Damage>12.000000</Damage>
			<DamageType>Ranged</DamageType>
			<MaxRange>16.000000</MaxRange>
			<ROF>3.000000</ROF>
			<DamageBonus type ='Guardian'>3.000000</DamageBonus>
			<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
		</ProtoAction>
	</Unit>





添加上限后也会影响到葡萄牙的黄金探险队卡片,卡片会检测单位建造上限,然后不能运送,需要把那个卡片拆分成2个科技,卡片的效果是增加2探险家建造上限,然后用active改良科技运送2个探险家。

如果思维跟不上就慢慢理解.............

黄金探险队的卡片调用名为HCShipBandeirantes

techtreey.xml - 记事本
	<Tech name ='HCShipBandeirantes' type ='Normal'>
		<DBID>2657</DBID>
		<DisplayNameID>41554</DisplayNameID>
		<Cost resourcetype ='Ships'>1.0000</Cost>
		<ResearchPoints>40.0000</ResearchPoints>
		<Status>UNOBTAINABLE</Status>
		<Icon>units\explorers\explorer_icon</Icon>
		<RolloverTextID>41553</RolloverTextID>
		<Flag>HomeCity</Flag>
		<Effects>
			<Effect type ='Data' amount ='2.00' subtype ='FreeHomeCityUnit' unittype ='Explorer' relativity ='Absolute'>
				<Target type ='Player'></Target></Effect></Effects>
	</Tech>
复制上面的语句,在techtreey底部粘贴1份,改名;然后回去,将原有的HCShipBandeirantes(黄金探险队)卡片效果修改成添加2探险家上限语句、直接改良新粘贴的科技。修改如下:
techtreey.xml - 记事本
	<Tech name ='HCShipBandeirantes' type ='Normal'>
		<DBID>2657</DBID>
		<DisplayNameID>41554</DisplayNameID>
		<Cost resourcetype ='Ships'>1.0000</Cost>
		<ResearchPoints>40.0000</ResearchPoints>
		<Status>UNOBTAINABLE</Status>
		<Icon>units\explorers\explorer_icon</Icon>
		<RolloverTextID>41553</RolloverTextID>
		<Flag>HomeCity</Flag>
		<Effects>
			<Effect type ='TechStatus' status ='active'>HCShipBandeirantes2</Effect>
			<Effect type ='Data' amount ='2.00' subtype ='BuildLimit' relativity ='Absolute'>
				<Target type ='ProtoUnit'>Explorer</Target></Effect>
		</Effects>
	</Tech>

粘贴在techtreey.xml底部:
techtreey.xml - 记事本
	<Tech name ='HCShipBandeirantes2' type ='Normal'>
		<DBID>2657</DBID>
		<DisplayNameID>41554</DisplayNameID>
		<Cost resourcetype ='Ships'>1.0000</Cost>
		<ResearchPoints>40.0000</ResearchPoints>
		<Status>UNOBTAINABLE</Status>
		<Icon>units\explorers\explorer_icon</Icon>
		<RolloverTextID>41553</RolloverTextID>
		<Flag>HomeCity</Flag>
		<Effects>
			<Effect type ='Data' amount ='2.00' subtype ='FreeHomeCityUnit' unittype ='Explorer' relativity ='Absolute'>
				<Target type ='Player'></Target></Effect></Effects>
	</Tech>
</TechTree><!-- 这个是Techtreey的结尾,请将语句复制在</TechTree>上面-->