收起左侧

建筑物攻击敌人时自动生产军事单位

[复制链接]
见习沉默发表于 2022-9-2 12:10:50
我想实现的效果是,中国的村落每攻击一次敌人,就会自动生产一个哨兵。然后我的思路是,复制一个子弹,然后给子弹加一个强制生产,再把村落的发射物设置成这个子弹,结果我试了好几遍了都无效果?请问问题出在哪呢
见习沉默发表于 2022-9-2 12:11:51
<Unit id ='925' name ='ypVillage'>
<DBID>1353</DBID>
<DisplayNameID>60227</DisplayNameID>
<EditorNameID>60228</EditorNameID>
<PopulationCapAddition>20</PopulationCapAddition>
<ObstructionRadiusX>4.0000</ObstructionRadiusX>
<ObstructionRadiusZ>4.0000</ObstructionRadiusZ>
<MaxVelocity>0.0000</MaxVelocity>
<MaxRunVelocity>0.0000</MaxRunVelocity>
<MovementType>land</MovementType>
<AnimFile>buildings\asian_civs\village\village.xml</AnimFile>
<DeadReplacement>BuildingRubble4x4</DeadReplacement>
<DeadReplacementLifespan>15</DeadReplacementLifespan>
<ImpactType>Wood</ImpactType>
<PhysicsInfo>blockhouse</PhysicsInfo>
<PlacementFile>buildingsmall.xml</PlacementFile>
<Icon>buildings\asian_civs\village\chinese_village_icon_64</Icon>
<PortraitIcon>buildings\asian_civs\village\chinese_village_icon_portrait</PortraitIcon>
<RolloverTextID>60226</RolloverTextID>
<ShortRolloverTextID>60225</ShortRolloverTextID>
<InitialHitpoints>2500.0000</InitialHitpoints>
<MaxHitpoints>2500.0000</MaxHitpoints>
<LOS>32.0000</LOS>
<ProjectileProtoUnit>InvisibleProjectile23</ProjectileProtoUnit>
<UnitAIType>RangedCombative</UnitAIType>
<BuildPoints>20.0000</BuildPoints>
<BuildLimit>6</BuildLimit>
<Bounty>80.0000</Bounty>
<BuildBounty>40.0000</BuildBounty>
<Cost resourcetype ='Wood'>200.0000</Cost>
<CarryCapacity resourcetype ='Food'>100.0000</CarryCapacity>
<InitialResource resourcetype ='Food'>999.0000</InitialResource>
<BuildingWorkRate>1.0000</BuildingWorkRate>
<MaxContained>20</MaxContained>
<AllowedAge>0</AllowedAge>
<Armor type ='Siege' value ='0.0000'></Armor>
<GathererLimit>5</GathererLimit>
<BuilderLimit>8</BuilderLimit>
<UnitType>LogicalTypeValidSabotage</UnitType>
<UnitType>LogicalTypeMinimapFilterEconomic</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>AbstractTownCenter</UnitType>
<UnitType>ConvertsHerds</UnitType>
<UnitType>AbstractTypeHerdableMagnet</UnitType>
<UnitType>HasBountyValue</UnitType>
<UnitType>CountsTowardEconomicScore</UnitType>
<UnitType>Resource</UnitType>
<UnitType>Building</UnitType>
<UnitType>AbstractFarm</UnitType>
<UnitType>AbstractHouse</UnitType>
<UnitType>ColonyBuilding</UnitType>
<UnitType>Economic</UnitType>
<UnitType>BuildingClass</UnitType>
<UnitType>Food</UnitType>
<Train row ='0' page ='0' column ='0'>ypWokouArmy</Train>
<Train row ='0' page ='0' column ='0'>xpAenna</Train>
<Train row ='0' page ='0' column ='2'>xpMusketWarrior</Train>
<Train row ='0' page ='0' column ='1'>xpTomahawk</Train>
<Train row ='0' page ='0' column ='0'>xpCoyoteMan</Train>
<Train row ='0' page ='0' column ='1'>xpMacehualtin</Train>
<Train row ='0' page ='0' column ='2'>xpPumaMan</Train>
<Train row ='0' page ='0' column ='0'>xpColonialMilitia</Train>
<Train row ='0' page ='0' column ='0'>xpWarBow</Train>
<Train row ='0' page ='0' column ='1'>xpWarClub</Train>
<Train row ='0' page ='0' column ='2'>xpWarRifle</Train>
<Train row ='0' page ='0' column ='0'>xpSPCColonialMilitia</Train>
<Train row ='0' page ='0' column ='0'>Musketeer</Train>
<Train row ='0' page ='0' column ='1'>Skirmisher</Train>
<Train row ='0' page ='0' column ='5'>ypMandarinArmy</Train>
<Train row ='0' page ='0' column ='0'>ypGoat1</Train>
<Tech row ='0' page ='1' column ='1'>ypVillagePopCapIncrease3</Tech>
<Tech row ='0' page ='1' column ='1'>ypVillagePopCapIncrease</Tech>
<Tech row ='0' page ='2' column ='0'>BigWarHutLacrosse</Tech>
<Tech row ='0' page ='1' column ='0'>ChampionWarBows</Tech>
<Tech row ='0' page ='1' column ='2'>ChampionWarRifles</Tech>
<Tech row ='0' page ='1' column ='0'>EliteCoyotemen</Tech>
<Tech row ='0' page ='1' column ='0'>EliteWarBows</Tech>
<Tech row ='0' page ='1' column ='1'>ChampionWarClubs</Tech>
<Tech row ='0' page ='1' column ='0'>ChampionCoyotemen</Tech>
<Tech row ='0' page ='1' column ='0'>EliteAennas</Tech>
<Tech row ='0' page ='1' column ='1'>EliteTomahawks</Tech>
<Tech row ='0' page ='1' column ='1'>ChampionTomahawk</Tech>
<Tech row ='0' page ='2' column ='0'>BigWarHutBarometz</Tech>
<Tech row ='0' page ='1' column ='1'>ChampionMacehualtins</Tech>
<Tech row ='0' page ='1' column ='1'>EliteWarClubs</Tech>
<Tech row ='0' page ='1' column ='2'>ElitePumaMen</Tech>
<Tech row ='0' page ='1' column ='2'>ChampionMusketWarriors</Tech>
<Tech row ='0' page ='2' column ='0'>BigWarHutWarDrums</Tech>
<Tech row ='0' page ='1' column ='2'>ChampionPumaMen</Tech>
<Tech row ='0' page ='1' column ='0'>ChampionAennas</Tech>
<Tech row ='0' page ='1' column ='1'>EliteMacehualtins</Tech>
<Tech row ='0' page ='1' column ='5'>SelectiveBreeding</Tech>
<Tech row ='0' page ='1' column ='1'>ypVillagePopCapIncrease2</Tech>
<Tech row ='0' page ='1' column ='1'>ypVillagePopCapIncrease4</Tech>
<Flag>AllowAutoGarrison</Flag>
<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>UnlimitedSupply</Flag>
<Flag>Tracked</Flag>
<Contain>xpMedicineManAztec</Contain>
<Contain>ypDaimyoRegicide</Contain>
<Contain>xpMedicineMan</Contain>
<Contain>Surgeon</Contain>
<Contain>Priest</Contain>
<Contain>AbstractVillager</Contain>
<Contain>Missionary</Contain>
<Contain>NatMedicineMan</Contain>
<Contain>Imam</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 ='6'>SetUnitAsHomeCityGatherPoint</Command>
<Command page ='0' column ='4'>ypIrregulars</Command>
<Command page ='0' column ='3'>ypPeasants</Command>
<Tactics>village.tactics</Tactics>
<ProtoAction>
<Name>AntiShipAttack</Name>
<Damage>70.000000</Damage>
<DamageType>Siege</DamageType>
<MaxRange>30.000000</MaxRange>
<ROF>3.000000</ROF>
<DamageBonus type ='AbstractSiegeTrooper'>0.500000</DamageBonus>
</ProtoAction>
<ProtoAction>
<Name>Heal</Name>
<Rate type ='LogicalTypeHealed'>5.000000</Rate>
</ProtoAction>
<ProtoAction>
<Name>RangedAttack</Name>
<Damage>80.000000</Damage>
<DamageType>Ranged</DamageType>
<MaxRange>24.000000</MaxRange>
<ROF>3.000000</ROF>
<DamageArea>2</DamageArea>
<DamageBonus type ='AbstractCavalry'>1.500000</DamageBonus>
<DamageBonus type ='AbstractVillager'>2.000000</DamageBonus>
<DamageBonus type ='AbstractLightInfantry'>1.500000</DamageBonus>
</ProtoAction>
见习沉默发表于 2022-9-2 12:12:27
 本帖最后由 见习沉默 于 2022-9-2 12:13 编辑 

<Unit id ='0' name ='InvisibleProjectile23'>
<DBID>20</DBID>
<DisplayNameID>22885</DisplayNameID>
<EditorNameID>22890</EditorNameID>
<ObstructionRadiusX>0.1000</ObstructionRadiusX>
<ObstructionRadiusZ>0.1000</ObstructionRadiusZ>
<MaxVelocity>60.0000</MaxVelocity>
<MovementType>air</MovementType>
<AnimFile>effects\projectiles\musket_ball.xml</AnimFile>
<Lifespan>15.0000</Lifespan>
<LOS>0.0000</LOS>
<UnitType>EmbellishmentClass</UnitType>
<UnitType>Projectile</UnitType>
<Flag>NonCollideable</Flag>
<Flag>DestroyProjectile</Flag>
<Flag>DoNotCreateUnitGroupAutomatically</Flag>
<Flag>NoBloodOnDeath</Flag>
<Flag>NotSearchable</Flag>
<Flag>Projectile</Flag>
<Flag>NoTieToGround</Flag>
<Flag>DoNotShowOnMiniMap</Flag>
<Flag>NotSelectable</Flag>
<Flag>DoNotDieAtZeroHitpoints</Flag>
<Flag>NoHPBar</Flag>
<Flag>NonAutoFormedUnit</Flag>
<Flag>DontRotateObstruction</Flag>
<Flag>AdjustPositionOnTerrainCollision</Flag>
<Flag>NotPlayerPlaceable</Flag>
<Flag>Invulnerable</Flag>
<Flag>InvulnerableIfGaia</Flag>
<Tactics>test23.tactic</Tactics>
</Unit>
已经把<Flag>NoUnitAI</Flag>
<Flag>NoIdleActions</Flag> 这个两个标签删除了
见习沉默发表于 2022-9-2 12:14:46
<?xml version="1.0" encoding="utf-8"?>

<tactics>
<action>
<name stringid="69158">Spawn</name>
<type>Spawn</type>
<rate type="ypPeasant">1.0</rate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>1</persistent>
</action>
<tactic>
Normal
<action>Spawn</action>
</tactic>
</tactics>
见习沉默发表于 2022-9-2 12:51:13
这个是ypvillage的tactic
<?xml version="1.0" encoding="utf-8"?>

<tactics>
<action>
<name stringid="69158">Spawn1</name>
<type>Spawn</type>
<rate type="ypPeasant">4.0</rate>
<animationrate>1</animationrate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>1</persistent>
</action>
<action>
<name stringid="69158">Spawn2</name>
<type>Spawn</type>
<rate type="ypIrregular">4.0</rate>
<animationrate>1</animationrate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>1</persistent>
</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>
<aimbonus>0</aimbonus>
<maxspread>5</maxspread>
<spreadfactor>0.25</spreadfactor>
<trackrating>12</trackrating>
<unintentionaldamagemultiplier>0.7</unintentionaldamagemultiplier>
<projectile>InvisibleProjectile23</projectile>
<impacteffect>effects\impacts\gun</impacteffect>
<rate type="Unit">1.0</rate>
<instantballistics>1</instantballistics>
<active>1</active>
</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="Ship">1.0</rate>
<active>0</active>
</action>
<action>
<name stringid="68972">SpawnSaiga</name>
<type>Maintain</type>
<rate type="ypSaiga">4</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68971">SpawnRefugees1</name>
<type>Maintain</type>
<rate type="ypMigrantArmySmall">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68971">SpawnRefugees2</name>
<type>Maintain</type>
<rate type="ypMigrantArmySmall">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68973">SpawnLivestock1</name>
<type>Maintain</type>
<rate type="ypMigrantGoats">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68973">SpawnLivestock2</name>
<type>Maintain</type>
<rate type="ypMigrantOx">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68973">SpawnLivestock3</name>
<type>Maintain</type>
<rate type="ypMigrantGoats">1</rate>
<active>1</active>
<persistent>0</persistent>
<singleuse>1</singleuse>
</action>
<action>
<name stringid="68971">SpawnMigrants3</name>
<type>Maintain</type>
<rate type="ypMigrantArmyLarge">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">RangedAttack</action>
<action priority="15">SpawnSaiga</action>
<action priority="15">SpawnRefugees1</action>
<action priority="15">SpawnRefugees2</action>
<action priority="15">SpawnMigrants3</action>
<action priority="15">SpawnLivestock1</action>
<action priority="15">SpawnLivestock2</action>
<action priority="15">SpawnLivestock3</action>
<action>Spawn1</action>
<action>Spawn2</action>

</tactic>
</tactics>
こはね发表于 2022-9-2 22:32:21
子弹其他的flag也删掉试试看
  • 见习沉默 : 确认了一下,没效果
こはね发表于 2022-9-3 22:44:28
<?xml version="1.0" encoding="utf-8"?>


<tactics>
<action>
<name stringid="69158">Spawn</name>
<type>Spawn</type>
<rate type="ypPeasant">1.0</rate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>1</persistent>
</action>
<tactic>
Normal
<action>Spawn</action>
</tactic>
</tactics>




把singleuse去掉
  • 见习沉默 : 我昨晚试了一下,为什么删除了还没有效果
  • こはね 回复 见习沉默 : 理论上有效果的,今晚我把语句放上来
こはね发表于 2022-9-5 21:13:15
这是我改的文件data.rar
  • 见习沉默 : 哇塞,谢谢大佬!!
跳转到