收起左侧

[求助] 求问~怎么延迟启动"自动生产单位"

[复制链接]
沉默的lsp发表于 2023-12-2 17:20:14
已经实现了az在时代3从TC自动生产骷髅武士,但是如果直接从时代3及更高的时代开始对局,这将会导致游戏极不平衡;现在想设定"游戏开始十分钟后TC才开启自动生产",但这个新逻辑完全脱离了之前的修改范畴,一点修改头绪都没有……求问大家有没有办法- -
こはね发表于 2023-12-3 13:58:14
有办法,决定版不可以,但旧版本可以,使用神话时代残留功能,可以判断单位数量;使用方法请参考https://www.aoebbs.net/tutorial-12-6.html
當設定的單位數量>X時才會顯示本科技
<typecount unit="Protoname" count="X.00" state="noneState aliveState buildingState" operator="lt"/>
當設定的單位數量=X時才會顯示本科技
<typecount unit="Protoname" count="X.00" state="noneState aliveState buildingState" operator="gte"/>
當設定的單位數量<X時才會顯示本科技
<typecount unit="Protoname" count="X.00" state="noneState aliveState buildingState" operator="gt"/>
可以把state换成deadState
當設定的單位死亡数量>X時才會顯示本科技
<typecount unit="Protoname" count="X.00" state="deadState" operator="lt"/>
如果把state换成anyState,印象中是包括了已死亡的单位,
<typecount unit="Protoname" count="X.00" state="anyState" operator="lt"/>



回到正题,civs.xml设定开局后赠送一个看不见的单位,然后在protoy用<DeadReplacement>600</DeadReplacement>让其在10分钟后死亡,最后设定一个隐藏的0秒科技,用上面的判断式判断死亡单位数量是否达到1.
<typecount unit="A" count="X.00" state="deadState" operator="lt"/>当单位A死亡数量<X时开启本科技
<typecount unit="A" count="X.00" state="deadState" operator="lte"/>当单位A死亡数量<=X时开启本科技
<typecount unit="A" count="X.00" state="deadState" operator="gte"/>当单位A死亡数量>=X时开启本科技
<typecount unit="A" count="X.00" state="deadStatee" operator="gt"/>当单位A死亡数量>X时开启本科技
<typecount unit="A" count="X.00" state="deadState" operator="eq"/>当单位A死亡数量=X时开启本科技
<typecount unit="A" count="X.00" state="deadState" operator="neq"/>当单位A死亡数量=X时开启本科技,备注:经过实际测试,neq在帝国3里面的确为等于,而不是不等于。

如果不想手动指定国家启用科技的话,UNOBTAINABLE修改成OBTAINABLE,默认所有国家都处于启用状态。
<Tech name ='Techname' type ='Normal'>
<DBID>9999</DBID>
<ResearchPoints>0.0000</ResearchPoints>
<Status>UNOBTAINABLE</Status>
<Prereqs>
<typecount unit="xxxxxx" count="1.00" state="deadState" operator="gte"/>
</Prereqs>
<Effects>
效果自己设定
可以加入一句string文字输出,显示“您已开启自动生产xxxxxx”
<Effect type ='TextOutput'>90001</Effect>
</Effects>
</Tech>

  • 沉默的lsp : 牛的!但是怪我没说清楚,我本来是想问有没有同时满足这两种条件后才启动科技的方法。所以是不是只要在<Prereqs></Prereqs>里再添加一句<TechStatus status ='Active'>Fortressize</TechStatus>就行了。
  • こはね 回复 沉默的lsp : 理论上是这样,实际上我没有试过
  • こはね : 当时我好像没有测试deadstate是否有效果,最近测试无效,所以请勿使用deadstate,然后换成6楼的方法,单位死亡后变成其他单位,然后判断新单位数量
沉默的lsp发表于 2023-12-7 18:02:05
こはね 发表于 2023-12-3 13:58
有办法,决定版不可以,但旧版本可以,使用神话时代残留功能,可以判断单位数量;使用方法请参考https://ww ...

emm开局附赠一个隐身单位?是protoy里随便复制一个,然后不给模型和人口数那样吗?
  • こはね : 差不多吧,如果不给模型单位则不存在,我通常是用子弹的anim文件作为隐藏单位的模型
  • 沉默的lsp 回复 こはね : 不知道隐身单位哪里设定出错,开局好像秒死了。我先是做了一个单位叫none1,anim用的是arrow的,没找到你说的子弹是哪个;设定死亡时间是60秒。但是开局后直接就启动了自动生产,而没有等60秒。下面是该单位代码的一部分,在长矛兵基础上修改的。小羽大佬不然你把你开局附赠的隐身单位代码给我一份。<Unit id ='3691' name ='none1'><DBID>9988</DBID><DisplayNameID>22807</DisplayNameID><EditorNameID>25026</EditorNameID><PopulationCount>0</PopulationCount><ObstructionRadiusX>0.1000</ObstructionRadiusX><ObstructionRadiusZ>0.1000</ObstructionRadiusZ><FormationCategory>Body</FormationCategory><MaxVelocity>5.0000</MaxVelocity><MaxRunVelocity>7.0000</MaxRunVelocity><MovementType>land</MovementType><TurnRate>18.0000</TurnRate><AnimFile>effects\projectiles\arrow.xml</AnimFile><DeadReplacement>60</DeadReplacement>这是在civs.xml文件中给阿兹特克开局送的代码<townstartingunit>none1</townstartingunit>这是检验死亡个数的代码<Tech name ='Maintain1' type ='Normal'><DBID>9997</DBID><ResearchPoints>0.0000</ResearchPoints><Status>UNOBTAINABLE</Status><Prereqs><typecount unit="none1" count=$s
沉默的lsp发表于 2023-12-10 20:27:40
@こはね 
不知道隐身单位哪里设定出错,开局好像秒死了。我先是做了一个单位叫none1,anim用的是arrow的,没找到你说的子弹是哪个;设定死亡时间是60秒。但是开局后直接就启动了自动生产,而没有等60秒。难道用arrow的anim不行吗。。下面是该单位代码的一部分,在长矛兵基础上修改的。小羽大佬要不你把你开局附赠的隐身单位代码给我一份。
<Unit id ='3691' name ='none1'>
<DBID>9988</DBID>
<DisplayNameID>22807</DisplayNameID>
<EditorNameID>25026</EditorNameID>
<PopulationCount>0</PopulationCount>
<ObstructionRadiusX>0.1000</ObstructionRadiusX>
<ObstructionRadiusZ>0.1000</ObstructionRadiusZ>
<FormationCategory>Body</FormationCategory>
<MaxVelocity>5.0000</MaxVelocity>
<MaxRunVelocity>7.0000</MaxRunVelocity>
<MovementType>land</MovementType>
<TurnRate>18.0000</TurnRate>
<AnimFile>effects\projectiles\arrow.xml</AnimFile>
<DeadReplacement>60</DeadReplacement>

这是在civs.xml文件中给阿兹特克开局送的代码
<townstartingunit>none1</townstartingunit>

这是检验死亡个数的代码
<Tech name ='Maintain1' type ='Normal'>
<DBID>9997</DBID>
<ResearchPoints>0.0000</ResearchPoints>
<Status>UNOBTAINABLE</Status>
<Prereqs>
<typecount unit="none1" count="1.00" state="deadState" operator="gte"/>
</Prereqs>
<Effects>
<Effect type ='Data' action ='MaintainxpSkullKnight2' amount ='1.00' subtype ='ActionEnable' relativity ='Absolute'>
<Target type ='ProtoUnit'>TownCenter</Target></Effect>
</Effects>

</Tech>

这是时代3阿兹特克的科技<Effect type ='TechStatus' status ='active'>Maintain1</Effect>

其他都运行正确,唯一的问题是开局没有等60秒- -
  • こはね : <DeadReplacement>60</DeadReplacement>用错了,罚抄<DeadReplacement>protoname</DeadReplacement>与<Lifespan>X.0000</Lifespan>100遍
こはね发表于 2023-12-16 14:26:11
奇怪,我用deadstate测试好像没效果,跟anystate一样,一放置单位,还未死亡就已经执行了

<Tech name ='Deadstate1' type ='Normal'>
<DBID>5271</DBID>
<Status>OBTAINABLE</Status>
<ResearchPoints>0.0000</ResearchPoints>
<Flag>Shadow</Flag>
<Flag>CountsTowardEconomicScore</Flag>
<Prereqs>
<typecount unit="DeadStateTool1" count="0.00" state="DeadState" operator="gt"/>
<TechStatus status ='Active'>Fortressize</TechStatus>
</Prereqs>
<Effects>
<Effect type ='TextOutput'>999700</Effect>
</Effects>
</Tech>

<String _locID="999700">Deadstate1</String>

<Unit id ='1590' name ='DeadStateTool1'>
<ObstructionRadiusX>0.4900</ObstructionRadiusX>
<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
<FormationCategory>Body</FormationCategory>
<MaxVelocity>4.5000</MaxVelocity>
<MaxRunVelocity>6.0000</MaxRunVelocity>
<MovementType>air</MovementType>
<Lifespan>10.0</Lifespan>
<TurnRate>18.0000</TurnRate>
<InitialHitpoints>90.0000</InitialHitpoints>
<MaxHitpoints>90.0000</MaxHitpoints>
<LOS>16.0000</LOS>
<UnitAIType>HandCombative</UnitAIType>
<TrainPoints>30.0000</TrainPoints>
<Bounty>0.0000</Bounty>
<BuildBounty>0.0000</BuildBounty>
<AnimFile>effects\projectiles\musket_ball.xml</AnimFile>
<Icon>MOD\flag\setting\flag_icon_64</Icon>
<PortraitIcon>MOD\flag\setting\flag_portrait</PortraitIcon>
<UnitType>EmbellishmentClass</UnitType>
<UnitType>TestClass</UnitType>
<UnitType>Unit</UnitType>
<UnitType>Unattackable</UnitType>
<Flag>CollidesWithProjectiles</Flag>
<Flag>ApplyHandicapTraining</Flag>
<Flag>CorpseDecays</Flag>
<Flag>ShowGarrisonButton</Flag>
<Flag>DontRotateObstruction</Flag>
<Flag>ObscuredByUnits</Flag>
<Flag>Tracked</Flag>
<Flag>Wanders</Flag>
<Flag>Invulnerable</Flag>
<Flag>NotSelectable</Flag>
<Flag>DoNotShowOnMiniMap</Flag>
<Command page ='10' column ='1'>Stop</Command>
<Command page ='10' column ='0'>Garrison</Command>
<Command page ='10' column ='2'>Delete</Command>
</Unit>

こはね发表于 2023-12-16 14:37:41
如果deadstate失败的话考虑换种方法:单位死亡后生成另一个单位<DeadReplacement>xxx</DeadReplacement>
techtreey.xml
该科技只需在techtreey.xml存在1次即可,因为1秒钟会运行500次
<Tech name="LoopTech" type="Normal">
<ResearchPoints>0.0000</ResearchPoints>
<Status>OBTAINABLE</Status>
<Icon>ui\units\ironclad_icon</Icon>
<Flag>Volatile</Flag>
<Flag>YPInfiniteTech</Flag>
<Effects>
<Effect type ='TechStatus' status ='unobtainable'>LoopTech</Effect>
</Effects>
</Tech>



下面是判断单位数量的科技,开局生成一个DeadStateTool1;10秒后死亡,然后变成DeadStateTool2;判断DeadStateTool2数量>=1;

<Tech name ='Deadstate1' type ='Normal'>
<DBID>5271</DBID>
<Status>OBTAINABLE</Status>
<ResearchPoints>0.0000</ResearchPoints>
<Flag>Shadow</Flag>
<Flag>CountsTowardEconomicScore</Flag>
<Prereqs>
<typecount unit="DeadStateTool2" count="1.00" state="anyState" operator="gte"/>
<TechStatus status ='Active'>Fortressize</TechStatus>
</Prereqs>
<Effects>
<Effect type ='TextOutput'>999700</Effect>
</Effects>
</Tech>


stringtabley.xml提示
<String _locID="999700">Deadstate1</String>



protoy.xml单位
<Unit id ='1590' name ='DeadStateTool1'>
<ObstructionRadiusX>0.4900</ObstructionRadiusX>
<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
<FormationCategory>Body</FormationCategory>
<MaxVelocity>4.5000</MaxVelocity>
<MaxRunVelocity>6.0000</MaxRunVelocity>
<MovementType>air</MovementType>
<Lifespan>10.0</Lifespan>
<TurnRate>18.0000</TurnRate>
<InitialHitpoints>90.0000</InitialHitpoints>
<MaxHitpoints>90.0000</MaxHitpoints>
<LOS>16.0000</LOS>
<UnitAIType>HandCombative</UnitAIType>
<TrainPoints>30.0000</TrainPoints>
<DeadReplacement>DeadStateTool2</DeadReplacement>
<Bounty>0.0000</Bounty>
<BuildBounty>0.0000</BuildBounty>
<AnimFile>effects\projectiles\musket_ball.xml</AnimFile>
<Icon>MOD\flag\setting\flag_icon_64</Icon>
<PortraitIcon>MOD\flag\setting\flag_portrait</PortraitIcon>
<UnitType>EmbellishmentClass</UnitType>
<UnitType>TestClass</UnitType>
<UnitType>Unit</UnitType>
<UnitType>Unattackable</UnitType>
<Flag>CollidesWithProjectiles</Flag>
<Flag>ApplyHandicapTraining</Flag>
<Flag>CorpseDecays</Flag>
<Flag>ShowGarrisonButton</Flag>
<Flag>DontRotateObstruction</Flag>
<Flag>ObscuredByUnits</Flag>
<Flag>Tracked</Flag>
<Flag>Wanders</Flag>
<Flag>Invulnerable</Flag>
<Flag>NotSelectable</Flag>
<Flag>DoNotShowOnMiniMap</Flag>
<Command page ='10' column ='1'>Stop</Command>
<Command page ='10' column ='0'>Garrison</Command>
<Command page ='10' column ='2'>Delete</Command>
</Unit>

<Unit id ='1590' name ='DeadStateTool2'>
<ObstructionRadiusX>0.4900</ObstructionRadiusX>
<ObstructionRadiusZ>0.4900</ObstructionRadiusZ>
<FormationCategory>Body</FormationCategory>
<MaxVelocity>4.5000</MaxVelocity>
<MaxRunVelocity>6.0000</MaxRunVelocity>
<MovementType>air</MovementType>
<Lifespan>2000.0</Lifespan>
<TurnRate>18.0000</TurnRate>
<InitialHitpoints>90.0000</InitialHitpoints>
<MaxHitpoints>90.0000</MaxHitpoints>
<LOS>16.0000</LOS>
<UnitAIType>HandCombative</UnitAIType>
<TrainPoints>30.0000</TrainPoints>
<Bounty>0.0000</Bounty>
<BuildBounty>0.0000</BuildBounty>
<AnimFile>effects\projectiles\musket_ball.xml</AnimFile>
<Icon>MOD\flag\setting\flag_icon_64</Icon>
<PortraitIcon>MOD\flag\setting\flag_portrait</PortraitIcon>
<UnitType>EmbellishmentClass</UnitType>
<UnitType>TestClass</UnitType>
<UnitType>Unit</UnitType>
<UnitType>Unattackable</UnitType>
<Flag>CollidesWithProjectiles</Flag>
<Flag>ApplyHandicapTraining</Flag>
<Flag>CorpseDecays</Flag>
<Flag>ShowGarrisonButton</Flag>
<Flag>DontRotateObstruction</Flag>
<Flag>ObscuredByUnits</Flag>
<Flag>Tracked</Flag>
<Flag>Wanders</Flag>
<Flag>Invulnerable</Flag>
<Flag>NotSelectable</Flag>
<Flag>DoNotShowOnMiniMap</Flag>
<Command page ='10' column ='1'>Stop</Command>
<Command page ='10' column ='0'>Garrison</Command>
<Command page ='10' column ='2'>Delete</Command>
</Unit>

2023-12-16 143542.jpg
沉默的lsp发表于 2024-5-10 20:19:12
こはね 发表于 2023-12-16 14:37
如果deadstate失败的话考虑换种方法:单位死亡后生成另一个单位xxx
techtreey.xml
该科技只需在techtreey.x ...

成功了大佬!但那个“只需要存在一次,因为一秒钟运行500次”是什么意思,这会导致无限循环引起电脑宕机吗?
  • こはね : 不会,但不建议添加多个;因为判断单位的bug解决方法就是建造带人口建筑或者改良科技,所以只需要一个无限循环科技就足够了
跳转到