Project1

标题: 如何平分经验? [打印本页]

作者: 沈大师    时间: 前天 19:29
标题: 如何平分经验?
RPG Maker MZ 的战后经验平分似乎是谁打死了怪谁获得经验,所以游戏进行到后面会导致主C的等级特别高,而辅助等级几乎只能停留在初始等级,
请问有没有能让战后经验平分的方法,十分感谢!
作者: 小秋橙    时间: 前天 22:37
不对啊,MZ默认好像是所有人获得同样多经验呀,就在 rmmz_managers.js 第 3000 行左右。楼主是不是用了别的插件导致的?
  1. BattleManager.processVictory = function() {
  2.     $gameParty.removeBattleStates();
  3.     $gameParty.performVictory();
  4.     this.playVictoryMe();
  5.     this.replayBgmAndBgs();
  6.     this.makeRewards();
  7.     this.displayVictoryMessage();
  8.     this.displayRewards();
  9.     this.gainRewards();
  10.     this.endBattle(0);
  11. };
  12. BattleManager.makeRewards = function() {
  13.     this._rewards = {
  14.         gold: $gameTroop.goldTotal(),
  15.         exp: $gameTroop.expTotal(),
  16.         items: $gameTroop.makeDropItems()
  17.     };
  18. };
  19. BattleManager.displayVictoryMessage = function() {
  20.     $gameMessage.add(TextManager.victory.format($gameParty.name()));
  21. };
  22. BattleManager.displayRewards = function() {
  23.     this.displayExp();
  24.     this.displayGold();
  25.     this.displayDropItems();
  26. };
  27. BattleManager.displayExp = function() {
  28.     const exp = this._rewards.exp;
  29.     if (exp > 0) {
  30.         const text = TextManager.obtainExp.format(exp, TextManager.exp);
  31.         $gameMessage.add("\\." + text);
  32.     }
  33. };
  34. BattleManager.displayGold = function() {
  35.     const gold = this._rewards.gold;
  36.     if (gold > 0) {
  37.         $gameMessage.add("\\." + TextManager.obtainGold.format(gold));
  38.     }
  39. };
  40. BattleManager.displayDropItems = function() {
  41.     const items = this._rewards.items;
  42.     if (items.length > 0) {
  43.         $gameMessage.newPage();
  44.         for (const item of items) {
  45.             $gameMessage.add(TextManager.obtainItem.format(item.name));
  46.         }
  47.     }
  48. };
  49. BattleManager.gainRewards = function() {
  50.     this.gainExp();
  51.     this.gainGold();
  52.     this.gainDropItems();
  53. };
  54. BattleManager.gainExp = function() {
  55.     const exp = this._rewards.exp;
  56.     for (const actor of $gameParty.allMembers()) {
  57.         actor.gainExp(exp);
  58.     }
  59. };
  60. BattleManager.gainGold = function() {
  61.     $gameParty.gainGold(this._rewards.gold);
  62. };
  63. BattleManager.gainDropItems = function() {
  64.     const items = this._rewards.items;
  65.     for (const item of items) {
  66.         $gameParty.gainItem(item, 1);
  67.     }
  68. };
复制代码

如果没有的话那就只有一个原因,那些辅助不在队伍里、或者在队伍里但是没有出战。需要修改以下代码来解决,在 rmmz_objects.js 第 4570 行左右。
  1. Game_Actor.prototype.gainExp = function(exp) {
  2.     const newExp = this.currentExp() + Math.round(exp * this.finalExpRate());
  3.     this.changeExp(newExp, this.shouldDisplayLevelUp());
  4. };
  5. Game_Actor.prototype.finalExpRate = function() {
  6.     return this.exr * (this.isBattleMember() ? 1 : this.benchMembersExpRate());
  7. };
  8. Game_Actor.prototype.benchMembersExpRate = function() {
  9.     return $dataSystem.optExtraExp ? 1 : 0;
  10. };
复制代码

也可以看一下是不是主C的 exr 属性(经验值倍率)太高了,比如有的插件会根据战斗内的杀敌数临时调整该属性。
作者: 沈大师    时间: 昨天 10:50
小秋橙 发表于 2025-7-25 22:37
不对啊,MZ默认好像是所有人获得同样多经验呀,就在 rmmz_managers.js 第 3000 行左右。楼主是不是用了别的 ...

我去看了一下,确实是插件的问题,太感谢了!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1