9916897 发表于 2021-3-28 23:17:56

怎么通过修改取消专家级默认的让分

帝国3老版,专家级电脑没有勾选让分,但是升级时代也巨快,听说有默认就让分的,怎么通过修改来取消专家级电脑的让分。只想慢慢玩不让分但是又节奏很快的人机对战,特意下了几个人机AI。@小羽,帮帮忙解答一下。顶你{:4_118:}

こはね 发表于 2021-3-29 01:03:12

先让我查下命令{:8_302:}

こはね 发表于 2021-3-29 01:29:20

先查命令表,根据我以前的修改经验,难度是用level显示的


查到[(int   )] aiGetWorldDifficulty( void ): Returns the world difficulty level.

在AI文件查找这个命令aiGetWorldDifficulty(根据前人留下的经验,AI文件在AI3/aiMain.xs

找到float difficulty = aiGetWorldDifficulty();
intDifficulty = difficulty;

然后{:8_302:}





算了,不装逼了我没学过c++也没研究过switch循环;



直觉告诉我,下面那几句就是让分(cDifficultyExpert是变量,对应switch循环)

   int intDifficulty = -1;
   float difficulty = aiGetWorldDifficulty();
   float diffRemainder = -1.0;
   intDifficulty = difficulty;
   diffRemainder = difficulty - intDifficulty;

   // Call the rule once as a function, to get all the pop limits set up.
      popManager();   

   aiEcho("I see "+kbUnitCount(cMyID, cUnitTypeHomeCityWaterSpawnFlag)+" water flags.");

   //-- setup the handicaps.
   // baseLineHandicap is a global multiplier that we can use to adjust all up or down.Probably will remain at 1.0.
   // startingHandicap is the handicap set at game launch in the UI, i.e. boost this player 10% == 1.10.That needs to be
   // multiplied by the appropriate difficulty for each level.
   float startingHandicap = kbGetPlayerHandicap(cMyID);
      switch(intDifficulty)
   {
                case cDifficultySandbox: // Sandbox
                {
                        kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 0.3 );    // Set handicap to a small fraction of baseline, i.e. minus 70%.
         gDelayAttacks = true;      // Prevent attacks...actually stays that way, never turns true.
         cvOkToBuildForts = false;
                         break;
                }
                case cDifficultyEasy: // Easiest
                {
         if (gSPC == true)
            kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 0.5 ); // minus 50 percent for scenarios
         else
            kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 0.4 ); // minus 60 percent

         gDelayAttacks = true;
         cvOkToBuildForts = false;
         xsEnableRule("delayAttackMonitor");    // Wait until I am attacked, then let slip the hounds of war.
                        break;
                }
                case cDifficultyModerate: // Moderate
                {
         if (gSPC == true)
            kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 0.75 ); // minus 25% for scenarios
         else
            kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 0.65 ); // minus 35%
                        break;
                }
                case cDifficultyHard: // Hard
                {
                        kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 1.0 );    // 1.0 handicap at hard, i.e. no bonus
                        break;
                }
                case cDifficultyExpert: // Expert
                {
                        kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 1.5 );    // +50% boost.
                        break;
                }
   }



Expert就是专家级,把1.5倍改成1.0就是

                case cDifficultyExpert: // Expert
                {
                        kbSetPlayerHandicap( cMyID, startingHandicap * baselineHandicap * 1.0 );    // +50% boost.
                        break;
                }





こはね 发表于 2021-3-29 01:42:20

最后在AI3/aiMain.xs修改测试一下,随便改个100000测试一下





确定AI让分命令就是[(void)] kbSetPlayerHandicap( int playerID, float handicap ): Sets the indicated player's handicap multiplier (ie., 1.0 = no handicap).
1.0就是100%,不让分,1.5就是让分50%,1.5倍加速训练、资源采集

9916897 发表于 2021-3-29 12:22:48

谢谢小羽!我这就去和电脑玩单机了!{:4_118:}{:4_118:}{:4_118:}{:4_118:}{:4_118:}
页: [1]
查看完整版本: 怎么通过修改取消专家级默认的让分