驻守单位




在protoy.xml中,城镇中心、堡垒、哨所等建筑都有这样几个语句:
<Contain>XXX</Contain>XXX是可驻守单位类型(可以用单位调用名或标签)
<MaxContained>X</MaxContained>这个是驻守单位数量上限
<Flag>AllowAutoGarrison</Flag>这个是允许单位按右键自动驻守
<Command page ='10' column ='x'>Eject</Command>放出驻守单位
<Command page ='10' column ='x'>SetGatherPointMilitary</Command>设定集合点

模板:
<Contain>XXX</Contain>
<MaxContained>X</MaxContained>
<Flag>AllowAutoGarrison</Flag>
<Command page ='10' column ='x'>Eject</Command>
<Command page ='10' column ='x'>SetGatherPointMilitary</Command>

实际上渔船也能驻守单位,不过因为没有<Flag>AllowAutoGarrison</Flag>所以不能通过右键驻守,只能通过右下角的才能让单位驻守进去。




让所有单位可以驻守在堡垒


搜索FortFrontier,然后按照格式添加

<Contain>Unit</Contain>
Unit指所有单位(实际上是所有带有unit标签的单位)。
  protoy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<Unit id ='391' name ='FortFrontier'>
<DBID>212</DBID>
<DisplayNameID>25270</DisplayNameID>
<ObstructionRadiusX>6.0000</ObstructionRadiusX>
<ObstructionRadiusZ>6.0000</ObstructionRadiusZ>
<MaxVelocity>0.0000</MaxVelocity>
<MovementType>land</MovementType>
<AnimFile>buildings\fort\fort.xml</AnimFile>
<DeadReplacement>BuildingRubble6x6</DeadReplacement>
<ImpactType>Stone</ImpactType>
<PhysicsInfo>house</PhysicsInfo>
<PlacementFile>buildinglarge.xml</PlacementFile>
<Icon>buildings\fort\fort_icon</Icon>
<MinimapIcon>ui\minimap\fort_star_16x16</MinimapIcon>
<PortraitIcon>buildings\fort\fort_portrait</PortraitIcon>
<RolloverTextID>25269</RolloverTextID>
<ShortRolloverTextID>25639</ShortRolloverTextID>
<InitialHitpoints>8500.0000</InitialHitpoints>
<MaxHitpoints>8500.0000</MaxHitpoints>
<LOS>26.0000</LOS>
<ProjectileProtoUnit>Cannonball</ProjectileProtoUnit>
<UnitAIType>RangedCombative</UnitAIType>
<BuildPoints>150.0000</BuildPoints>
<BuildLimit>1</BuildLimit>
<Bounty>440.0000</Bounty>
<BuildBounty>0.0000</BuildBounty>
<Cost resourcetype ='Wood'>600.0000</Cost>
<Cost resourcetype ='Gold'>500.0000</Cost>
<BuildingWorkRate>1.0000</BuildingWorkRate>
<MaxContained>50</MaxContained>
<AllowedAge>2</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>Building</UnitType>
<UnitType>MilitaryBuilding</UnitType>
<UnitType>BuildingClass</UnitType>
<UnitType>ConvertsHerds</UnitType>
<UnitType>AbstractCanSeeStealth</UnitType>
<UnitType>CountsTowardMilitaryScore</UnitType>
<UnitType>HasBountyValue</UnitType>
<UnitType>AbstractFort</UnitType>
<Train row ='0' page ='0' column ='3'>Skirmisher</Train>
<Train row ='0' page ='0' column ='3'>Skirmisher</Train>
<Train row ='0' page ='0' column ='3'>Cacadore</Train>
<Train row ='0' page ='0' column ='3'>Cacadore</Train>
<Train row ='0' page ='0' column ='5'>Hussar</Train>
<Train row ='0' page ='0' column ='6'>Ruyter</Train>
<Train row ='0' page ='0' column ='6'>Lancer</Train>
<Train row ='0' page ='0' column ='6'>Cuirassier</Train>
<Train row ='0' page ='0' column ='6'>Oprichnik</Train>
<Train row ='0' page ='0' column ='7'>WarWagon</Train>
<Train row ='0' page ='0' column ='3'>Strelet</Train>
<Train row ='0' page ='0' column ='3'>Strelet</Train>
<Train row ='0' page ='0' column ='2'>Janissary</Train>
<Train row ='0' page ='0' column ='2'>Janissary</Train>
<Train row ='0' page ='0' column ='2'>Janissary</Train>
<Train row ='0' page ='0' column ='2'>Janissary</Train>
<Train row ='0' page ='0' column ='2'>Musketeer</Train>
<Train row ='0' page ='0' column ='2'>Musketeer</Train>
<Train row ='0' page ='0' column ='2'>Musketeer</Train>
<Train row ='0' page ='0' column ='2'>Musketeer</Train>
<Train row ='0' page ='0' column ='1'>Pikeman</Train>
<Train row ='0' page ='0' column ='1'>Pikeman</Train>
<Train row ='0' page ='0' column ='1'>Pikeman</Train>
<Train row ='0' page ='0' column ='1'>Pikeman</Train>
<Train row ='0' page ='0' column ='5'>Cossack</Train>
<Train row ='0' page ='0' column ='5'>Cossack</Train>
<Train row ='0' page ='0' column ='5'>Uhlan</Train>
<Train row ='0' page ='0' column ='5'>Uhlan</Train>
<Train row ='0' page ='0' column ='7'>CavalryArcher</Train>
<Train row ='0' page ='0' column ='7'>CavalryArcher</Train>
<Train row ='0' page ='0' column ='7'>Dragoon</Train>
<Train row ='0' page ='0' column ='7'>Dragoon</Train>
<Train row ='0' page ='0' column ='8'>Grenadier</Train>
<Train row ='0' page ='0' column ='8'>Grenadier</Train>
<Train row ='0' page ='0' column ='8'>Grenadier</Train>
<Train row ='0' page ='0' column ='8'>Grenadier</Train>
<Train row ='0' page ='0' column ='9'>AbusGun</Train>
<Train row ='0' page ='0' column ='9'>AbusGun</Train>
<Train row ='0' page ='0' column ='0'>Crossbowman</Train>
<Train row ='0' page ='0' column ='0'>Crossbowman</Train>
<Train row ='0' page ='0' column ='0'>Crossbowman</Train>
<Train row ='0' page ='0' column ='0'>Crossbowman</Train>
<Train row ='0' page ='0' column ='0'>Longbowman</Train>
<Train row ='0' page ='0' column ='0'>Longbowman</Train>
<Train row ='0' page ='0' column ='0'>Longbowman</Train>
<Train row ='0' page ='0' column ='0'>Longbowman</Train>
<Train row ='0' page ='0' column ='4'>Halberdier</Train>
<Train row ='0' page ='0' column ='4'>Halberdier</Train>
<Train row ='0' page ='0' column ='4'>Halberdier</Train>
<Train row ='0' page ='0' column ='4'>Halberdier</Train>
<Train row ='0' page ='0' column ='4'>Rodelero</Train>
<Train row ='0' page ='0' column ='4'>Rodelero</Train>
<Train row ='0' page ='0' column ='4'>Rodelero</Train>
<Train row ='0' page ='0' column ='4'>Rodelero</Train>
<Train row ='0' page ='0' column ='4'>Dopplesoldner</Train>
<Train row ='0' page ='0' column ='4'>Dopplesoldner</Train>
<Train row ='0' page ='0' column ='4'>Dopplesoldner</Train>
<Train row ='0' page ='0' column ='4'>Dopplesoldner</Train>
<Train row ='0' page ='0' column ='0'>ypOldHanArmy</Train>
<Train row ='0' page ='0' column ='1'>ypStandardArmy</Train>
<Train row ='0' page ='0' column ='2'>ypMingArmy</Train>
<Train row ='0' page ='0' column ='3'>ypTerritorialArmy</Train>
<Train row ='0' page ='0' column ='4'>ypForbiddenArmy</Train>
<Train row ='0' page ='0' column ='5'>ypImperialArmy</Train>
<Train row ='0' page ='0' column ='0'>ypRajput</Train>
<Train row ='0' page ='0' column ='1'>ypSepoy</Train>
<Train row ='0' page ='0' column ='2'>ypNatMercGurkha</Train>
<Train row ='0' page ='0' column ='3'>ypSowar</Train>
<Train row ='0' page ='0' column ='4'>ypZamburak</Train>
<Train row ='0' page ='0' column ='5'>ypMahout</Train>
<Train row ='0' page ='0' column ='6'>ypHowdah</Train>
<Tech row ='0' page ='1' column ='0'>Revetment</Tech>
<Tech row ='0' page ='1' column ='1'>StarFort</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>HeroName2</Flag>
<Flag>AllowAutoGarrison</Flag>
<Flag>Tracked</Flag>
<Contain>Unit</Contain>
<Contain>Imam</Contain>
<Contain>NatMedicineMan</Contain>
<Contain>AbstractVillager</Contain>
<Contain>Missionary</Contain>
<Contain>Priest</Contain>
<Contain>xpMedicineMan</Contain>
<Contain>Surgeon</Contain>
<Contain>xpMedicineManAztec</Contain>
<Contain>ypDaimyoRegicide</Contain>
<Command page ='10' column ='2'>Delete</Command>
<Command page ='1' column ='2'>SetUnitAsHomeCityGatherPoint</Command>
<Command page ='10' column ='1'>SetGatherPointEconomy</Command>
<Command page ='10' column ='1'>Eject</Command>
<Command page ='10' column ='0'>SetGatherPointMilitary</Command>
<Tactics>fort.tactics</Tactics>
<ProtoAction>
<Name>AntiShipAttack</Name>
<Damage>300.000000</Damage>
<DamageType>Siege</DamageType>
<MaxRange>40.000000</MaxRange>
<ROF>3.000000</ROF>
<Projectile>Cannonball</Projectile>
</ProtoAction>
<ProtoAction>
<Name>CannonAttack</Name>
<Damage>150.000000</Damage>
<DamageType>Ranged</DamageType>
<MaxRange>26.000000</MaxRange>
<ROF>3.000000</ROF>
<DamageCap>300.000000</DamageCap>
<DamageBonus type ='AbstractSiegeTrooper'>0.500000</DamageBonus>
<DamageArea>3.000000</DamageArea>
<DamageFlags>GAIAEnemy</DamageFlags>
<Projectile>Cannonball</Projectile>
<DamageBonus type ='AbstractArtillery'>0.750000</DamageBonus>
</ProtoAction>
</Unit>





军营添加驻守步兵(AbstractInfantry为所有带有AbstractInfantry标签的单位,即为所有步兵)


搜索Barracks,然后按照格式添加

<MaxContained>20</MaxContained>
<Flag>AllowAutoGarrison</Flag>
<Contain>AbstractInfantry</Contain>
<Command page ='10' column ='2'>Eject</Command>
  protoy.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
	<Unit id ='296' name ='Barracks'>
<DBID>18</DBID>
<DisplayNameID>22847</DisplayNameID>
<ObstructionRadiusX>4.0000</ObstructionRadiusX>
<ObstructionRadiusZ>4.0000</ObstructionRadiusZ>
<MaxVelocity>0.0000</MaxVelocity>
<MovementType>land</MovementType>
<AnimFile>buildings\barracks\barracks.xml</AnimFile>
<DeadReplacement>BuildingRubble4x4</DeadReplacement>
<DeadReplacementLifespan>15</DeadReplacementLifespan>
<ImpactType>Wood</ImpactType>
<PhysicsInfo>barracks</PhysicsInfo>
<PlacementFile>buildinglarge.xml</PlacementFile>
<Icon>buildings\barracks\barracks_icon</Icon>
<PortraitIcon>buildings\barracks\barracks_portraits</PortraitIcon>
<RolloverTextID>22846</RolloverTextID>
<ShortRolloverTextID>25610</ShortRolloverTextID>
<InitialHitpoints>2500.0000</InitialHitpoints>
<MaxHitpoints>2500.0000</MaxHitpoints>
<LOS>12.0000</LOS>
<BuildPoints>30.0000</BuildPoints>
<Bounty>40.0000</Bounty>
<BuildBounty>20.0000</BuildBounty>
<Cost resourcetype ='Food'>0.0000</Cost>
<Cost resourcetype ='Wood'>200.0000</Cost>
<BuildingWorkRate>1.0000</BuildingWorkRate>
<AllowedAge>1</AllowedAge>
<Armor type ='Siege' value ='0.0000'></Armor>
<BuilderLimit>8</BuilderLimit>
<MaxContained>20</MaxContained>
<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>Building</UnitType>
<UnitType>MilitaryBuilding</UnitType>
<UnitType>BuildingClass</UnitType>
<UnitType>ConvertsHerds</UnitType>
<UnitType>AbstractBarracks2</UnitType>
<UnitType>CountsTowardMilitaryScore</UnitType>
<UnitType>HasBountyValue</UnitType>
<Train row ='0' page ='0' column ='0'>Crossbowman</Train>
<Train row ='0' page ='0' column ='0'>Longbowman</Train>
<Train row ='0' page ='0' column ='4'>Musketeer</Train>
<Train row ='0' page ='0' column ='4'>Janissary</Train>
<Train row ='0' page ='0' column ='5'>Cacadore</Train>
<Train row ='0' page ='0' column ='5'>Skirmisher</Train>
<Train row ='0' page ='0' column ='1'>Pikeman</Train>
<Train row ='0' page ='0' column ='2'>Halberdier</Train>
<Train row ='0' page ='0' column ='2'>Rodelero</Train>
<Train row ='0' page ='0' column ='2'>Dopplesoldner</Train>
<Train row ='0' page ='0' column ='2'>Boneguard</Train>
<Train row ='0' page ='0' column ='2'>BoneguardAge2</Train>
<Tech row ='0' page ='1' column ='2'>ImperialNassauers</Tech>
<Tech row ='0' page ='1' column ='4'>ImperialRedcoat</Tech>
<Tech row ='0' page ='1' column ='4'>GuardMusketeers</Tech>
<Tech row ='0' page ='1' column ='0'>GuardLongbowmen</Tech>
<Tech row ='0' page ='1' column ='2'>VeteranDopplesoldners</Tech>
<Tech row ='0' page ='1' column ='4'>VeteranJanissaries</Tech>
<Tech row ='0' page ='1' column ='2'>VeteranRodeleros</Tech>
<Tech row ='0' page ='1' column ='1'>VeteranPikemen</Tech>
<Tech row ='0' page ='1' column ='2'>GuardHalberdiers</Tech>
<Tech row ='0' page ='1' column ='2'>ImperialEspada</Tech>
<Tech row ='0' page ='1' column ='4'>VeteranMusketeers</Tech>
<Tech row ='0' page ='1' column ='5'>ImperialNeedleGun</Tech>
<Tech row ='0' page ='1' column ='5'>GuardSkirmishers</Tech>
<Tech row ='0' page ='1' column ='0'>VeteranCrossbowmen</Tech>
<Tech row ='0' page ='1' column ='2'>RGNassausLinearTactics</Tech>
<Tech row ='0' page ='1' column ='5'>GuardCacadores</Tech>
<Tech row ='0' page ='1' column ='5'>RGVoltigeur</Tech>
<Tech row ='0' page ='1' column ='2'>GuardRodeleros</Tech>
<Tech row ='0' page ='1' column ='1'>RGTercio</Tech>
<Tech row ='0' page ='1' column ='4'>RGRedcoats</Tech>
<Tech row ='0' page ='1' column ='2'>ImperialDopplesoldner</Tech>
<Tech row ='0' page ='1' column ='2'>ImperialHalberdiers</Tech>
<Tech row ='0' page ='1' column ='4'>ImperialJanissaries</Tech>
<Tech row ='0' page ='1' column ='0'>ImperialLongbowmen</Tech>
<Tech row ='0' page ='1' column ='5'>ImperialSkirmishers</Tech>
<Tech row ='0' page ='1' column ='5'>ImperialVoltigeur</Tech>
<Tech row ='0' page ='1' column ='5'>RGPrussianNeedleGun</Tech>
<Tech row ='0' page ='1' column ='4'>GuardJanissaries</Tech>
<Tech row ='0' page ='1' column ='0'>VeteranLongbowmen</Tech>
<Tech row ='0' page ='1' column ='2'>RGEspadachins</Tech>
<Tech row ='0' page ='1' column ='1'>ImperialTercio</Tech>
<Tech row ='0' page ='1' column ='4'>RGGuerreiros</Tech>
<Tech row ='0' page ='1' column ='5'>ImperialCacadores</Tech>
<Tech row ='0' page ='1' column ='4'>ImperialMusketeers</Tech>
<Tech row ='0' page ='1' column ='2'>GuardDopplesoldners</Tech>
<Tech row ='0' page ='1' column ='4'>ImperialGuerreiros</Tech>
<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>Tracked</Flag>
<Flag>AllowAutoGarrison</Flag> <Contain>AbstractInfantry</Contain> <Command page ='10' column ='2'>Eject</Command>
<Command page ='10' column ='0'>SetGatherPointMilitary</Command>
<Command page ='10' column ='1'>Delete</Command>
<Tactics>barracks.tactics</Tactics>
</Unit>






如果有能力的话还可以像我这样做(将篷车制作一个新单位,固定为欧洲模型):