设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4825|回复: 2
打印 上一主题 下一主题

[原创发布] 多周目继承插件

[复制链接]

Lv2.观梦者

梦石
0
星屑
256
在线时间
214 小时
注册时间
2008-12-18
帖子
44
跳转到指定楼层
1
发表于 2018-10-10 11:25:37 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
国庆时候写的多周目插件,
一直犹豫着要不要发出来,
因为自我感觉还是半成品。
少了一些可制定化的设置。
JAVASCRIPT 代码复制下载
  1. /*:
  2.  * Renews.js
  3.  * @plugindesc 多周目游戏
  4.  * @author 魏玉龙
  5.  * @since 2018.10.01
  6.  * @version 0.1
  7.  *
  8.  * @param clearCountVariable
  9.  * @desc 通关次数同步变量值。大于0时,相应变量值同步通关次数。等于0则无变量同步次数。
  10.  * @default 0
  11.  *
  12.  * @param inheritVariables
  13.  * @desc 需要被继承的变量ID 多个变量时用‘,’间隔
  14.  * @default 0
  15.  *
  16.  * @param inheritSwitches
  17.  * @desc 需要被继承的开关ID 多个开关时用‘,’间隔
  18.  * @default 0
  19.  *
  20.  * @help
  21.  * 此插件提供以下插件命令:
  22.  *
  23.  * 通关标记 [string]
  24.  *   对接下来的通关存档做标记
  25.  *
  26.  */
  27.  
  28. (function () {
  29.   var parameters = PluginManager.parameters('Renews');
  30.   var clearCountVariable = Number(parameters['clearCountVariable']) || 0;
  31.   var inheritVariables = parameters['inheritVariables'].split(',');
  32.   var inheritSwitches = parameters['inheritSwitches'].split(',');
  33.  
  34.   var DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
  35.   DataManager.makeSavefileInfo = function () {
  36.     var info = DataManager_makeSavefileInfo.call(this);
  37.     info.gameClear = $gameTemp.isGameClear();
  38.     info.clearSign = $gameTemp.clearSign();
  39.     return info;
  40.   };
  41.  
  42.   DataManager.startRenewGame = function (savefileId) {
  43.     var json = JsonEx.parse(StorageManager.load(savefileId));
  44.     if (this.isThisGameFile(savefileId)) {
  45.       this.createGameObjects();
  46.       this.extractRenewContents(json);
  47.       $gamePlayer.reserveTransfer($dataSystem.startMapId,
  48.         $dataSystem.startX, $dataSystem.startY);
  49.       $gameParty.setupStartingMembers();
  50.       $gameVariables.setValue(clearCountVariable, $gameSystem.gameClearCount());
  51.       return true;
  52.     } else {
  53.       return false;
  54.     }
  55.   }
  56.  
  57.   DataManager.extractRenewContents = function (contents) {
  58.     $gameSystem = contents.system;
  59.     $gameActors = contents.actors;
  60.     $gameParty = contents.party;
  61.     inheritVariables.forEach(function (value) {
  62.       var variableId = Number(value) || 0;
  63.       if (value > 0) {
  64.         $gameVariables.setValue(variableId, contents.variables.value(variableId));
  65.       }
  66.     });
  67.     inheritSwitches.forEach(function (value) {
  68.       var variableId = Number(value) || 0;
  69.       if (value > 0) {
  70.         $gameSwitches.setValue(variableId, contents.Switches.value(variableId));
  71.       }
  72.     });
  73.   }
  74.  
  75.   var Game_Temp_prototype_initialize = Game_Temp.prototype.initialize;
  76.   Game_Temp.prototype.initialize = function () {
  77.     Game_Temp_prototype_initialize.call(this);
  78.     this._gameClear = false;
  79.     this._clearSign = '';
  80.   };
  81.  
  82.   Game_Temp.prototype.isGameClear = function () {
  83.     return this._gameClear;
  84.   };
  85.  
  86.   Game_Temp.prototype.clearSign = function () {
  87.     return this._clearSign;
  88.   };
  89.  
  90.   Game_Temp.prototype.setGameClear = function (sign) {
  91.     this._gameClear = true;
  92.     this._clearSign = sign;
  93.     $gameSystem._gameClearCount += 1;
  94.   };
  95.  
  96.   var Game_System_prototype_initialize = Game_System.prototype.initialize;
  97.   Game_System.prototype.initialize = function () {
  98.     Game_System_prototype_initialize.call(this);
  99.     this._gameClearCount = 0;
  100.   };
  101.  
  102.   Game_System.prototype.gameClearCount = function () {
  103.     return this._gameClearCount;
  104.   }
  105.  
  106.   Window_SavefileList.prototype.drawGameTitle = function (info, x, y, width) {
  107.     if (info.title) {
  108.       var title = info.title;
  109.       if (info.gameClear && info.clearSign) {
  110.         title += ' ' + info.clearSign;
  111.       }
  112.       this.drawText(title, x, y, width);
  113.     }
  114.   };
  115.  
  116.   function Window_RenewGame() {
  117.     this.initialize.apply(this, arguments);
  118.   }
  119.  
  120.   Window_RenewGame.prototype = Object.create(Window_Command.prototype);
  121.   Window_RenewGame.prototype.constructor = Window_RenewGame;
  122.  
  123.   Window_RenewGame.prototype.initialize = function () {
  124.     Window_Command.prototype.initialize.call(this, 0, 0);
  125.     this.updatePlacement();
  126.   };
  127.  
  128.   Window_RenewGame.prototype.windowWidth = function () {
  129.     return 200;
  130.   };
  131.  
  132.   Window_RenewGame.prototype.windowHeight = function () {
  133.     return this.fittingHeight(2);
  134.   };
  135.  
  136.   Window_RenewGame.prototype.updatePlacement = function () {
  137.     this.x = (Graphics.boxWidth - this.width) / 2;
  138.     this.y = (Graphics.boxHeight - this.height) / 2;
  139.   };
  140.  
  141.   Window_RenewGame.prototype.makeCommandList = function () {
  142.     this.addCommand('重新开始', 'renew');
  143.     this.addCommand('取消', 'cancel');
  144.   };
  145.  
  146.   var Scene_Load_prototype_create = Scene_Load.prototype.create;
  147.   Scene_Load.prototype.create = function () {
  148.     Scene_Load_prototype_create.call(this);
  149.     this.createRenewWindow();
  150.   }
  151.  
  152.   Scene_Load.prototype.createRenewWindow = function () {
  153.     this._renewWindow = new Window_RenewGame();
  154.     this._renewWindow.setHandler('renew', this.startRenewGame.bind(this));
  155.     this._renewWindow.setHandler('cancel', this.cancelRenewGame.bind(this));
  156.     this._renewWindow.deactivate();
  157.     this._renewWindow.hide();
  158.     this.addWindow(this._renewWindow);
  159.   }
  160.  
  161.   Scene_Load.prototype.isRenewGame = function () {
  162.     var info = DataManager.loadSavefileInfo(this.savefileId());
  163.     return info.gameClear;
  164.   }
  165.  
  166.   Scene_Load.prototype.startRenewGame = function () {
  167.     this.onStartRenewGame();
  168.   }
  169.  
  170.   Scene_Load.prototype.cancelRenewGame = function () {
  171.     this._renewWindow.deactivate();
  172.     this._renewWindow.hide();
  173.     this.activateListWindow();
  174.   }
  175.  
  176.   Scene_Load.prototype.onSavefileOk = function () {
  177.     Scene_File.prototype.onSavefileOk.call(this);
  178.     if (DataManager.isThisGameFile(this.savefileId())) {
  179.       if (this.isRenewGame()) {
  180.         this._renewWindow.show();
  181.         this._renewWindow.activate();
  182.       } else {
  183.         DataManager.loadGame(this.savefileId())
  184.         this.onLoadSuccess();
  185.       }
  186.     } else {
  187.       this.onLoadFailure();
  188.     }
  189.   }
  190.  
  191.   Scene_Load.prototype.onStartRenewGame = function () {
  192.     DataManager.startRenewGame(this.savefileId());
  193.     SoundManager.playLoad();
  194.     this.fadeOutAll();
  195.     SceneManager.goto(Scene_Map);
  196.     this._loadSuccess = true;
  197.   }
  198.  
  199.   var Scene_Gameover_prototype_gotoTitle = Scene_Gameover.prototype.gotoTitle;
  200.   Scene_Gameover.prototype.gotoTitle = function () {
  201.     if ($gameTemp.isGameClear()) {
  202.       SceneManager.push(Scene_Save);
  203.     } else {
  204.       Scene_Gameover_prototype_gotoTitle.call(this);
  205.     }
  206.   }
  207.  
  208.   var Scene_Save_prototype_popScene = Scene_Save.prototype.popScene;
  209.   Scene_Save.prototype.popScene = function () {
  210.     Scene_Save_prototype_popScene.call(this);
  211.     if ($gameTemp.isGameClear()) {
  212.       SceneManager.goto(Scene_Title);
  213.     }
  214.   }
  215.  
  216.   var Scene_Save_prototype_helpWindowText = Scene_Save.prototype.helpWindowText;
  217.   Scene_Save.prototype.helpWindowText = function () {
  218.     if ($gameTemp.isGameClear()) {
  219.       return '将通关文档存储在哪个文件?';
  220.     } else {
  221.       return Scene_Save_prototype_helpWindowText.call(this);
  222.     }
  223.   };
  224.  
  225.   var Game_Interpreter_prototype_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  226.   Game_Interpreter.prototype.pluginCommand = function (command, args) {
  227.     Game_Interpreter_prototype_pluginCommand.call(this, command, args);
  228.     if (command === "通关标记") {
  229.       var sign = args[1] || '⚝';
  230.       $gameTemp.setGameClear(sign);
  231.     }
  232.   };
  233.  
  234. })();


犹豫了几天还是觉得先发出来吧,让各位小白鼠帮着测测BUG也好啊!

用法很简单!游戏结束前插入指令:通关标记
就可以了!插件可以设定记录通关次数的变量ID
并且可以设置需要下个周目要保存的变量及开关!
通关存档后,存档文件会有标记!就可以从哪个通关档开始新游戏!
继承全部人物属性及物品装备!少了黑名单功能,所以有些不应该被继承的暂时在结局前手动删一下吧!
等有空了继续完善吧!
目前在写一个超级Debug的插件用来调试和测试游戏用,这个插件没有重大BUG暂时不会更新!
小白鼠们可以在该贴下提BUG或需要加入的功能,我有空了就完善一下!

评分

参与人数 2+2 收起 理由
白嫩白嫩的 + 1 精品文章
j296196585 + 1 精品文章

查看全部评分

头像被屏蔽

Lv3.寻梦者

梦石
0
星屑
2379
在线时间
912 小时
注册时间
2014-10-14
帖子
1331

开拓者

2
发表于 2018-10-10 22:56:23 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4502
在线时间
677 小时
注册时间
2013-1-18
帖子
709
3
发表于 2022-4-11 16:25:14 | 只看该作者
@魏玉龙 大佬,这个多周目插件有更新吗?希望能有更多的功能。我很需要这个。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 09:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表