添加新建筑


这个教程与上面2-2教程一模一样,不过只能由有建造能力的单位建造建筑,不能通过卡片运送。






我这次复制了大报恩寺作为模板,依然是像2-1那样,从<Unit id =......一直复制到</unit>

属性之类的还是自己调整,有两点需要注意:
1.因为这个建筑有按钮,所以必须要添加下面这个语句才能显示按钮。(为什么原来的没有也能显示按钮?原来的是通过主程序指定调用名显示按钮的,改了调用名当然没有按钮)

		<Flag>ShowTactics</Flag>
2.因为这个建筑是奇观,所以必须删除<UnitType>AbstractPoliticalWonder</UnitType>与<UnitType>AbstractWonder</UnitType>,否则可能会影响到升级科技。



修改如下(添加蓝色语句,删除红色语句,或者将红色语句修改成xml注释<!-- -->的形式):
  protoy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<Unit id ='1217' name ='ypWCPorcelainTower'>
		<DBID>1801</DBID>
		<DisplayNameID>99997</DisplayNameID>
		<EditorNameID>99996</EditorNameID>
		<ObstructionRadiusX>4.0000</ObstructionRadiusX>
		<ObstructionRadiusZ>4.0000</ObstructionRadiusZ>
		<MaxVelocity>0.0000</MaxVelocity>
		<MovementType>land</MovementType>
		<AnimFile>buildings\wonders\porcelain_tower\porcelain_tower.xml</AnimFile>
		<DeadReplacement>BuildingRubble4x4</DeadReplacement>
		<DeadReplacementLifespan>15</DeadReplacementLifespan>
		<ImpactType>Wood</ImpactType>
		<PhysicsInfo>barracks</PhysicsInfo>
		<PlacementFile>buildinglarge.xml</PlacementFile>
		<Icon>buildings\wonders\porcelain_tower\porcelain_tower_icon_64</Icon>
		<MinimapIcon>ui\minimap\wonder_16x16</MinimapIcon>
		<PortraitIcon>buildings\wonders\porcelain_tower\porcelain_tower_icon_portrait</PortraitIcon>
		<RolloverTextID>99994</RolloverTextID>
		<ShortRolloverTextID>99995</ShortRolloverTextID>
		<InitialHitpoints>5000.0000</InitialHitpoints>
		<MaxHitpoints>5000.0000</MaxHitpoints>
		<LOS>12.0000</LOS>
		<BuildPoints>120.0000</BuildPoints>
		<BuildLimit>1</BuildLimit>
		<Bounty>240.0000</Bounty>
		<Cost resourcetype ='Food'>800.0000</Cost>
		<BuildingWorkRate>1.0000</BuildingWorkRate>
		<AllowedAge>0</AllowedAge>
		<Armor type ='Siege' value ='0.0000'></Armor>
		<BuilderLimit>8</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>AbstractWonder</UnitType>		-->
		<UnitType>ConvertsHerds</UnitType>
<!--		<UnitType>AbstractPoliticalWonder</UnitType>		-->
		<Tech row ='0' page ='1' column ='1'>SaloonWildWest</Tech>
		<Flag>ShowTactics</Flag>
		<Flag>CollidesWithProjectiles</Flag>
		<Flag>StartsAtFullEfficiency</Flag>
		<Flag>Immoveable</Flag>
		<Flag>NoBloodOnDeath</Flag>
		<Flag>ObscuresUnits</Flag>
		<Flag>NoIdleActions</Flag>
		<Flag>NonAutoFormedUnit</Flag>
		<Flag>Doppled</Flag>
		<Flag>SelectWithObstruction</Flag>
		<Flag>PaintTextureWhenPlacing</Flag>
		<Flag>FlattenGround</Flag>
		<Flag>HasGatherPoint</Flag>
		<Flag>InitialGarrisonOnly</Flag>
		<Flag>EnterHotkeyContext</Flag>
		<Flag>Tracked</Flag>
		<Command page ='9' column ='3'>WonderCoin</Command>
		<Command page ='9' column ='1'>WonderFood</Command>
		<Command page ='9' column ='2'>WonderWood</Command>
		<Command page ='10' column ='0'>SetGatherPointEconomy</Command>
		<Command page ='9' column ='0'>TacticTrade</Command>
		<Command page ='10' column ='1'>Delete</Command>
		<Tactics>porcelaintower.tactics</Tactics>
		<ProtoAction>
			<Name>AutoGatherCoin</Name>
			<Rate type ='Gold'>10.000000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>AutoGatherFood</Name>
			<Rate type ='Food'>10.500000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>AutoGatherWood</Name>
			<Rate type ='Wood'>10.000000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>RainbowCoin</Name>
			<Type>AutoGather</Type>
			<Rate type ='Gold'>5.500000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>RainbowFood</Name>
			<Type>AutoGather</Type>
			<Rate type ='Food'>7.500000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>RainbowTrade</Name>
			<Type>AutoGather</Type>
			<Rate type ='Trade'>2.00000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>RainbowWood</Name>
			<Type>AutoGather</Type>
			<Rate type ='Wood'>5.500000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>RainbowXP</Name>
			<Type>AutoGather</Type>
			<Rate type ='XP'>2.00000</Rate>
		</ProtoAction>
	</Unit>


  randommapstringsy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
<?xml version="1.0" encoding="utf-8"?>

<StringTable version="130">
	<Language name="English">
		<String _locID="130015">Ozarks</String>
		<String _locID="130016">Ozarks: Dense thickets filled with wildlife dot this rolling terrain.</String>
		<String _locID="130017">Hilltop trading posts sit beside a trade route that crosses the map from East to West. Teams are split across the trade route.</String>
		<String _locID="130018">Plymouth</String>
		<String _locID="130019">Plymouth: A bountiful land of natural treasures and grateful Pilgrims.</String>
		<String _locID="130020">Each colony can use intrepid Pilgrims and Scout Turkeys to explore the bountiful wilderness for Native Settlements and unique treasures.</String>
		<String _locID ='99999'>独角兽骑士</String>
		<String _locID ='99998'>CAV独角兽骑士</String>
		<String _locID ='99997'>琉璃塔</String>
		<String _locID ='99996'>BUI 琉璃塔</String>
		<String _locID ='99995'>中国极高GDP之谜?</String>
		<String _locID ='99994'>可自动生产资源的琉璃塔。</String>
		<!-- 输入双引号与单引号都是可行的 -->
	</Language>
</StringTable>







这个建筑我让少林大师建造,这次在techtreey搜索的是YPAge0Chinese,然后按照格式添加启用单位的语句。
  techtreey.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<Tech name ='YPAge0Chinese' type ='Normal'>
		<DBID>3529</DBID>
		<Status>UNOBTAINABLE</Status>
		<Flag>Shadow</Flag>
		<Effects>
			<Effect type ='Data' amount ='1.00' subtype ='Enable' relativity ='Absolute'>
				<Target type ='ProtoUnit'>ypWCPorcelainTower</Effect>
			<Effect type ='TechStatus' status ='active'>YPAAAsianStartingTechs</Effect>
			<Effect type ='TechStatus' status ='active'>YPAge0ChineseSpecialTechs</Effect>
			<Effect type ='TechStatus' status ='active'>YPAge0ChineseTechs</Effect>
			<Effect type ='TechStatus' status ='active'>YPAge0ChineseConsulate</Effect>
			<Effect type ='TechStatus' status ='active'>YPAge0ChineseMonks</Effect>
			<Effect type ='TechStatus' status ='active'>YPAge0ChineseUnits</Effect>
			<Effect type ='TechStatus' status ='active'>YPAge0ChineseBuildings</Effect>
			<Effect type ='TechStatus' status ='active'>YPAge0ChineseWonders</Effect>
		</Effects>
	</Tech>
	<Tech name ='YPAge0Indians' type ='Normal'>
		<DBID>3530</DBID>
		<Status>UNOBTAINABLE</Status>
		<Flag>Shadow</Flag>
		<Effects>
			<Effect type ='TechStatus' status ='active'>YPAAAsianStartingTechs</Effect>
			<Effect type ='TechStatus' status ='active'>ypAge0IndiansBuildings</Effect>
			<Effect type ='TechStatus' status ='active'>ypAge0IndiansUnits</Effect>
			<Effect type ='TechStatus' status ='active'>ypAge0IndiansWonders</Effect>
			<Effect type ='TechStatus' status ='active'>ypAge0IndiansTechs</Effect>
			<Effect type ='TechStatus' status ='active'>ypAge0IndiansSpecialTechs</Effect>
			<Effect type ='TechStatus' status ='active'>ypAge0IndiansMonks</Effect>
			<Effect type ='TechStatus' status ='active'>ypAge0IndiansConsulate</Effect>
		</Effects>
	</Tech>



我设定少林大师那里添加建造按钮:
  protoy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<Unit id ='918' name ='ypMonkChinese'>
		<DBID>1345</DBID>
		<DisplayNameID>60200</DisplayNameID>
		<EditorNameID>60201</EditorNameID>
		<ObstructionRadiusX>0.4900</ObstructionRadiusX>
		<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
		<FormationCategory>Mobile</FormationCategory>
		<MaxVelocity>4.5000</MaxVelocity>
		<MaxRunVelocity>6.5000</MaxRunVelocity>
		<MovementType>land</MovementType>
		<TurnRate>18.0000</TurnRate>
		<AnimFile>units\asians\chinese\monk\monk.xml</AnimFile>
		<ImpactType>Flesh</ImpactType>
		<Icon>units\asians\chinese\shaolin_disciple\shaolin_master_icon_64</Icon>
		<MinimapIcon>ui\minimap\hero</MinimapIcon>
		<PortraitIcon>units\asians\chinese\shaolin_disciple\shaolin_master_icon_portrait</PortraitIcon>
		<SelectionPriority>5</SelectionPriority>
		<RolloverTextID>60199</RolloverTextID>
		<ShortRolloverTextID>69907</ShortRolloverTextID>
		<InitialHitpoints>450.0000</InitialHitpoints>
		<MaxHitpoints>450.0000</MaxHitpoints>
		<LOS>18.0000</LOS>
		<ProjectileProtoUnit>ypShuriken</ProjectileProtoUnit>
		<AutoAttackRange>16.0000</AutoAttackRange>
		<UnitAIType>RangedCombative</UnitAIType>
		<TrainPoints>30.0000</TrainPoints>
		<BuildLimit>1</BuildLimit>
		<Bounty>90.0000</Bounty>
		<Cost resourcetype ='Gold'>300.0000</Cost>
		<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>AbstractInfantry</UnitType>
		<UnitType>Hero</UnitType>
		<UnitType>Unit</UnitType>
		<UnitType>Military</UnitType>
		<UnitType>UnitClass</UnitType>
		<UnitType>AbstractCavalryInfantry</UnitType>
		<UnitType>HasBountyValue</UnitType>
		<UnitType>ConvertsHerds</UnitType>
		<UnitType>AbstractCanSeeStealth</UnitType>
		<UnitType>AbstractHandInfantry</UnitType>
		<UnitType>AbstractChineseMonk</UnitType>
		<UnitType>AbstractMonk</UnitType>
		<Train row ='0' page ='6' column ='1'>TradingPost</Train>
		<Train row ='0' page ='6' column ='1'>ypWCPorcelainTower</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>
		<Train row ='0' page ='6' column ='2'>PetJaguar</Train>
		<Train row ='0' page ='6' column ='0'>YPPetPanda</Train>
		<Train row ='0' page ='6' column ='2'>ypMonkDisciple</Train>
		<Tech row ='0' page ='11' column ='5'>ypMonkMakeDisciple</Tech>
		<Flag>CollidesWithProjectiles</Flag>
		<Flag>ApplyHandicapTraining</Flag>
		<Flag>CorpseDecays</Flag>
		<Flag>ShowGarrisonButton</Flag>
		<Flag>DontRotateObstruction</Flag>
		<Flag>ObscuredByUnits</Flag>
		<Flag>HeroName2</Flag>
		<Flag>RotateInPlace</Flag>
		<Flag>ForceBuildingData</Flag>
		<Flag>KnockoutDeath</Flag>
		<Flag>NotDeleteable</Flag>
		<Flag>CanAutoHeal</Flag>
		<Flag>Tracked</Flag>
		<Command page ='10' column ='0'>Garrison</Command>
		<Command page ='10' column ='2'>Stop</Command>
		<Command page ='11' column ='0'>Abilities</Command>
		<Tactics>ypchinesemonk.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>CoverBuildingAttack</Name>
			<Damage>8.000000</Damage>
			<DamageType>Siege</DamageType>
			<ROF>3.000000</ROF>
			<DamageBonus type ='Building'>1.000000</DamageBonus>
		</ProtoAction>
		<ProtoAction>
			<Name>CoverHandAttack</Name>
			<Damage>4.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>1.500000</ROF>
			<DamageBonus type ='Guardian'>3.000000</DamageBonus>
			<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
			<DamageBonus type ='Hero'>0.750000</DamageBonus>
		</ProtoAction>
		<ProtoAction>
			<Name>HandAttack</Name>
			<Damage>7.000000</Damage>
			<DamageType>Hand</DamageType>
			<ROF>1.500000</ROF>
			<DamageBonus type ='Guardian'>3.000000</DamageBonus>
			<HitPercent>20.000000</HitPercent>
			<DamageMultiplier>2.000000</DamageMultiplier>
			<HitPercentType>CriticalAttack</HitPercentType>
			<DamageBonus type ='AbstractVillager'>0.250000</DamageBonus>
			<DamageBonus type ='Hero'>0.750000</DamageBonus>
		</ProtoAction>
		<ProtoAction>
			<Name>Heal</Name>
			<Type>Heal</Type>
			<Rate type ='LogicalTypeHealed'>6.000000</Rate>
		</ProtoAction>
		<ProtoAction>
			<Name>RoundhouseAttack</Name>
			<Damage>170.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>Stun</Name>
			<Damage>30.000000</Damage>
			<DamageType>Ranged</DamageType>
			<MinRange>0.000000</MinRange>
			<MaxRange>16.000000</MaxRange>
			<ROF>3.000000</ROF>
		</ProtoAction>
		<ProtoAction>
			<Name>Stun2</Name>
			<Damage>30.000000</Damage>
			<DamageType>Hand</DamageType>
			<MinRange>4.000000</MinRange>
			<MaxRange>6.000000</MaxRange>
			<ROF>3.000000</ROF>
		</ProtoAction>
	</Unit>