收起左侧

如何通过改良科技直接产生单位

[复制链接]
mrf发表于 2021-7-8 21:52:47
我希望实现的效果就是:有一个无限改良的科技(就比如在码头改良吧),每改良一次都在码头旁产生一个拓荒者(岸上)和一个渔船(海上),需要怎么做到呢?FreeHomeCityUnit只能在船运点生成。
tactics的Spawn指令,同一个科技只能开启or关闭同一个战术,改良一次就没效果了(应该),不能做到改良一次生成一次(大概);另外Spawn是强制生产,而我希望在达到人口上限之后就不能生产。
Maintain有训练时间,而我希望改良完成立即运送,且同样存在只能active一次的问题。
如果不设置<singleuse>1</singleuse>那就成不停运送了,同样不行。
捆绑训练,也做不到捆绑两个不同的单位一次训练,所以还是得从techtreey方面入手,可是我想不到了QaQ
跪求大佬!!
こはね发表于 2021-7-8 22:05:35
科技可以无限改良,此处参考外挂漏洞
こはね发表于 2021-7-11 11:20:43
总结一下语句,改良科技后,spawn一次单位	


以下语句能在圣典1-2找到(但是这个不是最好的办法,最好的办法是直接照抄中国赛加羚羊的卡片)
单位开启单位战术、光环,(Actionname为Tactics的定义)
<Effect type ='Data' action ='Actionname' amount ='1.0' subtype ='ActionEnable' relativity ='Absolute'>
<Target type ='ProtoUnit'>Protoname</Target>

</Effect>
激活一次战术(例如中国难民卡片,用的就是这个语句,Actionname为Tactics的定义)
<Effect type ='Data' action ='Actionname' amount ='1.00' subtype ='ActionAdd' unittype ='Protoname' relativity ='Absolute'>
<Target type ='Player'></Target>

</Effect>

以下语句能在圣典7-0找到
<action> <action>
<name stringid="StringID">XXXX</name>
<type>Maintain</type>
<rate type="XXXXXX">X</rate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>1</persistent>
</action>
<name stringid="StringID">XXXX</name>定义tactics的Action名及其名称
<type>Maintain</type>类型。自动生产单位
<rate type="XXXXXX">X</rate>XXXXXX单位调用名,X为自动生产单位数量。3.2版本补充:10个单位会变成10倍训练时间,例如某单位训练时间为30秒,用Maintain一次性训练10个需要用300秒。
<active>1</active>1为启用,0为未启用(需要借助科技激活),没有则默认启用
<singleuse>1</singleuse>该战术只能生产一次单位。
<persistent>1</persistent>1为无限次生产单位,0为不能自动生产单位,0一般与<singleuse>1</singleuse>配合使用,来生产一次单位,例如中国难民卡片。(如果建筑在建造中,并且带有语句<singleuse>1</singleuse> , 使用该战术生产单位时, 若为0,建造好建筑后不会生产单位,若为1,建造好建筑后会追加生产单位)
</action>

强制生产单位(无视人口限制,无视训练时间,建议使用<singleuse>1</singleuse>语句,使其只能生产一次。):
<action>
<action>
<name stringid="StringID">XXXX</name>
<type>Spawn</type>
<rate type="XXXXXX">X</rate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>1</persistent>
</action>
<name stringid="StringID">XXXX</name>定义tactics的Action名及其名称
<type>Spawn</type>类型。强制生产单位
<rate type="XXXXXX">X</rate>XXXXXX单位调用名,X为强制生产单位数量。
<active>1</active>1为启用,0为未启用(需要借助科技激活),没有则默认启用
<singleuse>1</singleuse>该战术只能生产一次单位。
<persistent>1</persistent>1为无限次强制生产单位,0为不能生产单位,0一般与<singleuse>1</singleuse>配合使用,来生产一次单位,例如中国难民卡片。(如果建筑在建造中,并且带有语句<singleuse>1</singleuse> , 使用该战术生产单位时, 若为0,建造好建筑后不会生产单位,若为1,建造好建筑后会追加生产单位)
</action>



这是一个测试科技:
techtreey.xml
	<Tech name="test152" type="Normal">
<DBID>5290</DBID>
<ResearchPoints>10.0000</ResearchPoints>
<Status>OBTAINABLE</Status>
<Icon>ui\units\ironclad_icon</Icon>
<Flag>YPInfiniteTech</Flag>
<Effects>
<Effect type ='Data' action ='spawn' amount ='1.00' subtype ='ActionAdd' unittype ='XXX' relativity ='Absolute'>
<Target type ='Player'></Target>
</Effect>
</Effects>
</Tech>


这是一个测试单位:
protoy.xml
	<Unit id ='534' name ='XXX'>
<DBID>704</DBID>
<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\delgado\spc_delgado.xml</AnimFile>
<ImpactType>Flesh</ImpactType>
<Icon>units\spc\delgado\delgado_icon_64x64</Icon>
<PortraitIcon>units\spc\delgado\delgado_igc_icon</PortraitIcon>
<RolloverTextID>32439</RolloverTextID>
<ShortRolloverTextID>32438</ShortRolloverTextID>
<InitialHitpoints>1200.0000</InitialHitpoints>
<MaxHitpoints>1200.0000</MaxHitpoints>
<LOS>24.0000</LOS>
<AutoAttackRange>16.0000</AutoAttackRange>
<UnitAIType>Hero</UnitAIType>
<Bounty>40.0000</Bounty>
<AllowedAge>0</AllowedAge>
<Armor type ='Hand' 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>AbstractHandInfantry</UnitType>
<UnitType>ConvertsHerds</UnitType>
<UnitType>HasBountyValue</UnitType>
<Flag>CollidesWithProjectiles</Flag>
<Flag>ApplyHandicapTraining</Flag>
<Flag>CorpseDecays</Flag>
<Flag>ShowGarrisonButton</Flag>
<Flag>DontRotateObstruction</Flag>
<Flag>ObscuredByUnits</Flag>
<Flag>NotDeleteable</Flag>
<Flag>Tracked</Flag>
<Tech row ='0' page ='1' column ='0'>test152</Tech>
<Command page ='10' column ='0'>Garrison</Command>
<Command page ='11' column ='0'>Abilities</Command>
<Command page ='10' column ='1'>Stop</Command>
<Tactics>xxx.tactics</Tactics>
<ProtoAction>
<Name>BuildingAttack</Name>
<Damage>200.000000</Damage>
<DamageType>Siege</DamageType>
<ROF>3.000000</ROF>
</ProtoAction>
<ProtoAction>
<Name>HandAttack</Name>
<Damage>500.000000</Damage>
<DamageType>Hand</DamageType>
<ROF>1.500000</ROF>
</ProtoAction>
</Unit>


这个是测试单位的tactics
<?xml version="1.0" encoding="utf-8"?>

<tactics>
<action>
<name>spawn</name>
<type>Spawn</type>
<rate type="settler">1.0</rate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>0</persistent>
</action>
<action>
<name>spawn2</name>
<type>Spawn</type>
<rate type="Crossbowman">1.0</rate>
<rate type="settler">1.0</rate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>0</persistent>
</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>
<action>
<name stringid="38124">Throwbobmod</name>
<type>Attack</type>
<attackaction>1</attackaction>
<rangedlogic>1</rangedlogic>
<anim>Raze_Attack</anim>
<idleanim>Raze_Idle</idleanim>
<maxheight>0</maxheight>
<accuracy>1.0</accuracy>
<accuracyreductionfactor>0.001</accuracyreductionfactor>
<aimbonus>5</aimbonus>
<trackrating>12</trackrating>
<rate type="unit">1.0 </rate>
<impacteffect>effects\impacts\torch</impacteffect>
<projectile>TorchProjectile</projectile>
<rof>1.000000</rof>
<instantballistics>1</instantballistics>
</action>
<tactic>
Melee
<action priority="100">BuildingAttack</action>
<action priority="75">HandAttack</action>
<action>Throwbobmod</action>
<action>Build</action>
<action>Discover</action>
<action>spawn</action>
<action>spawn2</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>Throwbobmod</action>
<action>Build</action>
<action>Discover</action>
<action>spawn</action>
<action>spawn2</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>Throwbobmod</action>
<action>Build</action>
<action>Discover</action>
<action>spawn</action>
<action>spawn2</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>


使用以上语句就能达成改良科技spawn一次单位

然后问题又出现了,然后一次性出现多个单位?
经过测试,如果科技同时存在两个ActionAdd,那么只会执行最后面那一句,前面的一句不执行,例如下面的例子, action ='spawn' 是不执行的, action ='spawn2' 是执行的。
	<Tech name="test152" type="Normal">
<DBID>5290</DBID>
<ResearchPoints>10.0000</ResearchPoints>
<Status>OBTAINABLE</Status>
<Icon>ui\units\ironclad_icon</Icon>
<Flag>YPInfiniteTech</Flag>
<Effects>
<Effect type ='Data' action ='spawn' amount ='1.00' subtype ='ActionAdd' unittype ='XXX' relativity ='Absolute'>
<Target type ='Player'></Target>
</Effect>
<Effect type ='Data' action ='spawn2' amount ='1.00' subtype ='ActionAdd' unittype ='XXX' relativity ='Absolute'>
<Target type ='Player'></Target>
</Effect>
</Effects>
</Tech>


我在这里给出两个解决办法:
1.两个科技联用,利用一个科技直接active两个科技
2.tactics的action可以添加多个rate,例如下面
	<action>
<name>spawn2</name>
<type>Spawn</type>
<rate type="Crossbowman">1.0</rate>
<rate type="settler">1.0</rate>
<active>1</active>
<singleuse>1</singleuse>
<persistent>0</persistent>
</action>


mrf发表于 2021-7-11 11:38:36
感谢小羽大佬!有劳了!
跳转到