1、【教程】【红警2】AI强化 电脑多造兵营 、空指部等生产类建筑教程By meiyousuowei我看没有人发过类似的教程,就自己写了一个。如有雷同,纯属巧合。本人手打的,言语切词若有不当,敬请谅解。这个教程是教大家,如何在只修改rule.ini(rulemd.ini)和ai.ini(aimd.ini)的情况下,实现电脑AI多造【生产类建筑】兵营、战车工厂、空指部、造船厂,电脑在数个【生产类建筑】的情况下,会同时生产多个战斗单位,从而某程度上提升电脑的战斗力和基地的丰富性。必备的工具:XCC Mixer、记事本(呵呵)准备工作:用XCC Mixer提取rule.ini(rulemd.ini)i和
2、ai.ini(aimd.ini),提取路径为:rad2.mix(rad2md.mix)-local.mix(localmd.mix)-rule.ini(rulemd.ini)和ai.ini(aimd.ini)PS:括号中带“md”的为尤里的复仇很多人认为:只需修改rule.ini(rulemd.ini)里面的AI,就可以实现电脑多造【生产类建筑】。其实不然,我们先来看看AI小结的部分内容:AttackInterval=0.5 ; average delay between computer attacks ; gs obsolete (since forever) use TeamDelays
3、 insteadAttackDelay=0.5 ; average delay time before computer begins first attackPatrolScan=.016 ; minute interval between scanning for enemys while patrolling.CreditReserve=100 ; Structure repair will not begin if available cash falls below this amount.PathDelay=.01 ; Delay (minutes) between retryin
4、g when path is blocked.BlockagePathDelay=60 ; delay (frames) before unit paths around all blockageAutocreateTime=1 ; average minutes between creating an autocreate teamInfantryReserve=50000 ; always build infantry if cash reserve is greater than thisInfantryBaseMult=1 ; build infantry if building co
5、unt times this number is less than current infantry quantityPowerSurplus=50 ; build power plants until power surplus is at least this amountBaseSizeAdd=3 ; computer base size can be no larger than the largest human opponent, plus this quantityRefineryRatio=.16 ; ratio of base that should be composed
6、 of refineriesRefineryLimit=4 ; never build more than this many refineriesBarracksRatio=.16 ; ratio of base that should be composed of barracksBarracksLimit=2 ; never build more than this many barracksWarRatio=.1 ; ratio of base that should be composed of war factoriesWarLimit=2 ; never build more t
7、han this many war factoriesDefenseRatio=.4 ; ratio of base that should be defensive structuresDefenseLimit=40 ; maximum number of defensive buildings to buildAARatio=.14 ; ratio of base that should be anti-aircraft defenseAALimit=10 ; maximum number of anti-aircraft buildings to buildTeslaRatio=.16
8、; ratio of base that should be telsa coilsTeslaLimit=10 ; maximum number of tesla coils to buildHelipadRatio=.1 ; ratio of base that should be composed of helipadsHelipadLimit=2 ; maximum number of helipads to buildAirstripRatio=.12 ; ratio of base that should be composed of airstripsAirstripLimit=0
9、 ; maximum number of airstrips to buildCompEasyBonus=no ; When more than one human in game, computer player goes to easy mode?Paranoid=yes ; Will computer players ally with each other if the situation looks bleak?PowerEmergency=75% ; sell buildings to raise power level if it falls below this percent
10、ageAIBaseSpacing=1 ; spacing between buildings when AI is building a base举个例子,如果想让电脑多造兵营,大家就会去修改“BarracksRatio=”和“BarracksLimit=”,但是修改完之后会发现,无论等号后面填入多大的数值,电脑还是无动于衷,只造1个兵营。所以,以上这个方法我们必须摒弃。下面,我将介绍我的方法。方法分为两大类 (以下所有MCV指的是基地,即价值3000的建造厂):单MCV,多【生产类建筑】和多MCV,多【生产类建筑】A.单MCV,多【生产类建筑】本帖隐藏的内容以盟军兵营(GAPILE)为例子,
11、假设我想让电脑一共造3个GAPILE,也就是说,在原来的基础上要增加2个。我所用到的方法是“新增单位”。也就是说,创造出2个和GAPILE一模一样的建筑。将他们分别命名代码为“GAPILE1”“GAPILE2”。以尤里的复仇为例:第一步,注册。打开rulemd.ini,找到BuildingTypes,即游戏中所有建筑的注册栏,在BuildingTypes最下方注册这2个新盟军兵营的代码。即:395=CALA11396=CALA12397=CALA13398=CAPARK04399=CAPARK05400=CAPARK06401=CALA14402=CALA15403=CABUNK03404=C
12、ABUNK04405=CALUNR01406=CALUNR02407=GAPILE1408=GAPILE2第二步,调整AI。找到AI,在“BuildBarracks=”后面加上2个新盟军兵营,即:BuildConst=GACNST,NACNST,YACNSTBuildPower=NAPOWR,GAPOWR,YAPOWR ;DB NANRCT;gsNAAPWR ; buildings to build to generate powerBuildRefinery=NAREFN,GAREFN,YAREFN;gs ; refinery ratio based on these buildingsBu
13、ildBarracks=NAHAND,GAPILE,YABRCK,GAPILE1,GAPILE2 ; barracks ratio based on these buildings第三步,创建新单位。找到GAPILE,复制全部代码,在下方粘贴2份,分别改名为GAPILE1和GAPILE2,修改TechLevel数值为-1,把Cost弄便宜些,并各增加一行代码“Image=GAPILE”。也就是说,要造的新单位想跟谁长得一摸一样,就加入“Image=XXX”就可以了。即:GAPILE1UIName=Name:GAPILEName=Allied Barracks ;needs different
14、Given Name to avoid editor confusionBuildCat=TechImage=GAPILEPrerequisite=POWER,GACNSTStrength=500Armor=steelFactory=InfantryTypeAdjacent=2TechLevel=-1Sight=5Owner=British,French,Germans,Americans,Alliance,Russians,Confederation,Africans,Arabs,YuriCountryAIBasePlanningSide=0 ;gs 0 for Good, 1 for Ev
15、ilCost=1Points=30Power=-10Crewed=yesCapturable=trueExplosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60;DestroyAnim=GAPILEDMMaxDebris=15MinDebris=5DebrisAnims=DBRIS1LG,DBRIS1SM,DBRIS4LG,DBRIS4SM,DBRIS5LG,DBRIS5SMThreatPosed=0 ; This value MUST be 0 for all building addonsExitCoord=-64,64,0GDIBarrac
16、ks=yesDamageParticleSystems=SparkSys,SmallGreySSys,BigGreySmokeSysDamageSmokeOffset=215,395,200AIBuildThis=yesSpyable=yes;WantsExtraSpace=yes ; gs This will look for a space AIBaseSpacing+1 when the computer places, but will settle for AIBasSpacingImmuneToPsionics=no ; defaults to yes for buildings,
17、 no for othersGAPILE2UIName=Name:GAPILEName=Allied Barracks ;needs different Given Name to avoid editor confusionBuildCat=TechImage=GAPILEPrerequisite=POWER,GACNSTStrength=500Armor=steelFactory=InfantryTypeAdjacent=2TechLevel=-1Sight=5Owner=British,French,Germans,Americans,Alliance,Russians,Confeder
18、ation,Africans,Arabs,YuriCountryAIBasePlanningSide=0 ;gs 0 for Good, 1 for EvilCost=1Points=30Power=-10Crewed=yesCapturable=trueExplosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60;DestroyAnim=GAPILEDMMaxDebris=15MinDebris=5DebrisAnims=DBRIS1LG,DBRIS1SM,DBRIS4LG,DBRIS4SM,DBRIS5LG,DBRIS5SMThreatPose
19、d=0 ; This value MUST be 0 for all building addonsExitCoord=-64,64,0GDIBarracks=yesDamageParticleSystems=SparkSys,SmallGreySSys,BigGreySmokeSysDamageSmokeOffset=215,395,200AIBuildThis=yesSpyable=yes;WantsExtraSpace=yes ; gs This will look for a space AIBaseSpacing+1 when the computer places, but wil
20、l settle for AIBasSpacingImmuneToPsionics=no ; defaults to yes for buildings, no for others大功告成。PS:1.以上这个方法适用于任何能够直接建造的建筑。(MCV是基地车展开建造的,不属于直接建造。)2.修改TechLevel=-1的原因是,让人类玩家不能建造,避免重复。3.修改Cost=1的原因是,不让这些重复建筑拖慢电脑的发展速度。4.想弄几个建筑,就注册几个,调整AI几个,创建新单位几个。也就是复制粘贴的琐事。5.如果想要弄多个空指部(GAAIRC),除了上述方法外, 还要记得修改入侵者(ORCA)
21、、黑鹰(BEAG)的Dock,即在“Dock=”后面添加新的空指部代码。B.多MCV,多【生产类建筑】本帖隐藏的内容这个方法是利用红警的程序规划,即电脑有多少个MCV,就会同时生产多少份建筑。举个例子,我制作的几幅地图里面,比如【自由港】,我给了玩家8两个MCV,以玩家8为例,加上一开始的MCV,玩家8就有3个MCV,如果让电脑掌控玩家8,那么玩家8的建筑生产就是3份。若为盟军,你会看到3个光棱塔同时从地面冒出来的情景。有了这个前提,我们的目标就很明确了。即:“如何让电脑在平时,而不单只是在没有MCV的情况下,就生产基地车并展开基地。”接下来,以盟军基地车为例子,说明方法。以尤里的复仇为例:第
22、一步,认识基地车AI触发命令。打开aimd.ini,找到AITriggerTypes,搜索MCV,就可以看到三行关于MCV的命令(盟军,苏联,尤里的MCV命令)。其中盟军MCV的是:043F874C-G=Allied MCV - H,043F29AC-G,10,1,GACNST,0000000002000000000000000000000000000000000000000000000000000000,70.000000,60.000000,70.000000,1,0,1,0,0,0,1这一行看名字就可以知道,是盟军基地车的AI触发命令。这个命令是什么意思,我来简单讲讲。若懂得看AI触发命
23、令的朋友可以无视。从左到右根据逗号,把这段命令拆分8个部分:1.“043F874C-G=”:AI触发代码。2.“Allied MCV - H”:AI触发名称,只起注释作用。3.“043F29AC-G”:AI触发所使用的作战小队名称。4.“”:AI触发所属国家,表示所有国家均可执行此触发。5.“10”:AI触发科技等级6.“1”:触发条件(这个是关键):“0”: 敌人拥有XX单位“1”: 自己拥有XX单位其中,“敌人”是指“此AI触发执行者”的敌人;“自己”是指“此AI触发执行者”自己。7.“GACNST”:指上文的XX单位代码。8.“00000000”、“02000000”、“00000000
24、0000000000000000000000000000000000000000”要分开看“00000000”和“02000000”只需看开头两个数字“00”和“02”,后面0和第三段一大串0那段都不用管。“00”表示XX单位个数,16进制。00就是0个,09就是9个,0a就是10个;“02”表示取值范围条件,可以输入“00”到“05”,所代表意义分别是“(00)小于”,“(01)小于等于”,“(02)等于”,“(03)大于等于”,“(04)大于”,“(05)不等于”。剩下的代码70.000000,60.000000,70.000000,1,0,1,0,0,0,1放着,直接复制不要修改,对于新
25、增MCV来说用不着改。所以,整个AI触发命令可以翻译为:“043F874C-G=Allied MCV - H,当我方拥有的GACNST数量等于0时,AI将会生产043F29AC-G作战小队”也就是当自己没有了MCV之后,就会生产043F29AC-G。搜索得知,043F29AC-G为盟军基地车的作战小队。(作战小队是什么下一步再讲)第二步,增加基地车AI触发命令。043F29AC-G作战小队,是原本程序设计好的,指的是生产一辆盟军基地车后,执行展开命令。在这里,我们不用深究具体作用,只需直接利用043F29AC-G作战小队小队就可以了。上一步讲到,盟军建造MCV的AI触发指令翻译过来,可以看出触
26、发条件是“当我方拥有的GACNST数量等于0时”。因此,我们只需要新增一条AI触发指令,将触发条件改掉就可以了。例如改成“当我方拥有GACNST数量等于1时”。这样新命令就是:“当我方拥有GACNST数量等于1时,AI将会生产043F29AC-G作战小队”因此,在AITriggerTypes中增加一行:043F874C-G=Allied MCV - H,043F29AC-G,10,1,GACNST,0100000002000000000000000000000000000000000000000000000000000000,70.000000,60.000000,70.000000,1,0,
27、1,0,0,0,1可以看到,与原来相比,我将“00”改成了“01”,也就是拥有GACNST的数量为1也可以执行AI触发命令。这样一来,电脑在有一个MCV的情况下也会再造一辆基地车,展开变成MCV。此为双MCV。大功告成。PS:如果想要三MCV,则在双MCV的基础上,再增加一条AI触发指令,条件为;“当我方拥有GACNST数量等于2时”。只需把“01”改成“02”即可。这样一来,电脑只要满足了拥有2个MCV的条件,就会再造一辆基地车,执行展开命令。再说一句,电脑拥有了多个【生产类建筑】,就会同时生产多个单位。你会看到有若干个相同种类坦克同时从不同战车工厂同时跑出来。不过,即便电脑拥有了很多坦克,派遣攻击的数量还是一样的。例如冷酷敌人的3架基洛夫,即便电脑造了6个战车工厂,同时生产了6架基洛夫,但一波攻击只会派3架基洛夫,另外的3架只会在基地干等着下一波。如果想改成6架,则需再学一样东西,那就是修改ai.ini(aimd.ini)。网上有很多关于ai.ini的教程,我就不重复发了。最后再次提醒上面有XCC Mixer的下载链接,祝大家改得愉快!