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

Project1

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

[原创发布] 一个可控的标题指令,适用通关后开启二周目或彩蛋房间。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
帖子
416
跳转到指定楼层
1
发表于 2015-12-3 20:54:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 夏末渐离 于 2016-2-16 22:02 编辑
  1. /*:
  2. * @plugindesc 这个插件名必须为XM_FinalTitle.js,可以在通关后制作类似彩蛋小屋,或者进入二周目这样的功能。
  3. * @author XMJL
  4. * @param FinalTitleName
  5. * @default new special game
  6. *
  7. * @param FinalTitleVisible
  8. * @desc true or false
  9. * @default false
  10. *
  11. * @param  MapID
  12. * @default 2
  13. *
  14. * @param  ActorXY
  15. * @default 8,6
  16. *
  17. * @param matchCode
  18. * @default GoodGame
  19. *
  20. * @help
  21. *使用说明:
  22. *FinalTitleName:标题名
  23. *FinalTitleVisible:标题名是否可见,默认可见(true)
  24. *MapID:选择最后一个标题指令时主角将被传送到这个地图ID
  25. *ActorXY:选择最后一个标题指令时主角将被传送到指定地图的这个位置
  26. *matchValue:与插件指令保存的值进行比较的值
  27. *使用方法:
  28. *在游戏事件中使用插件指令: Save code    Ex: Save GoodGame
  29. *code必须和前面设定的matchValue的值相同,最后的标题指令才能使用。
  30. *缺点:进入二周目后一周目数据将被清空,相当于另外一个新建游戏的选项。
  31. */
  32. (function()
  33. {
  34.     var parameters = PluginManager.parameters('XM_FinalTitle');
  35.     var FTName = String(parameters['FinalTitleName']);
  36.     var FTVisible=eval(String(parameters['FinalTitleVisible']));
  37.     var MapID = Number(parameters['MapID']);
  38.     var matchValue=String(parameters['matchCode']);
  39.     var Actor_Position=Find_XY();
  40.     var currentGlobal;//临时的全局变量
  41.     function Find_XY()
  42.     {
  43.         var res = /(\d+),*(\d+)/.exec(parameters['ActorXY']);
  44.         return {x: Number(res[1]), y: Number(res[2])};
  45.     }
  46.     var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  47.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  48.         _Game_Interpreter_pluginCommand.call(this, command, args);
  49.         if (command === 'Save')
  50.         {
  51.             var code=args[0];
  52.             currentGlobal=code;
  53.             XMJL_SaveMyData(code);
  54.         }
  55.     };
  56.     //save
  57.     var XMJL_SaveMyData=function(code)
  58.     {
  59.         var myConfig=ConfigManager.makeData();
  60.         myConfig.code=code;
  61.         StorageManager.save(-1, JSON.stringify(myConfig));
  62.     };

  63.     //load
  64.    var XMJL_ConfigManage_applyData=ConfigManager.applyData;
  65.     ConfigManager.applyData = function(config)
  66.     {
  67.         XMJL_ConfigManage_applyData.call(this,config);
  68.         currentGlobal=XMJL_LoadOther(config,'code');
  69.     };
  70.     var XMJL_LoadOther=function(config,name)
  71.     {
  72.         var value=config[name];
  73.         if(value==undefined)
  74.         return;
  75.         else
  76.         return value;
  77.     };
  78.     DataManager.setupFinishGame=function()
  79.     {
  80.         this.createGameObjects();
  81.         this.selectSavefileForNewGame();
  82.         $gameParty.setupStartingMembers();
  83.         $gamePlayer.reserveTransfer(MapID,Actor_Position.x,Actor_Position.y); //MapId,x,y
  84.         Graphics.frameCount = 0;
  85.     };

  86.     var MakeNewTitleCommand=Window_TitleCommand.prototype.makeCommandList;
  87.     Window_TitleCommand.prototype.makeCommandList=function()
  88.     {
  89.         MakeNewTitleCommand.call(this);
  90.         if(FTVisible||currentGlobal!=undefined)
  91.         this.addCommand(FTName,'Symbol',XMJL_FinalTitleAvailable());
  92.     };
  93.     var XMJL_FinalTitleAvailable=function()
  94.     {
  95.         if(currentGlobal==matchValue)
  96.             return true;
  97.         else
  98.             return false;
  99.     };
  100.     var MakeNewSymbol=Scene_Title.prototype.createCommandWindow;
  101.     Scene_Title.prototype.createCommandWindow = function()
  102.     {
  103.         MakeNewSymbol.call(this);
  104.         this._commandWindow.setHandler('Symbol', this.commandFinishGame.bind(this));
  105.     };
  106.     Scene_Title.prototype.commandFinishGame = function() {
  107.         DataManager.setupFinishGame();
  108.         this._commandWindow.close();
  109.         this.fadeOutAll();
  110.         SceneManager.goto(Scene_Map);
  111.     };
  112. })();
复制代码

点评

@余烬之中 你是好人0x0.  发表于 2016-1-6 12:03

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 精品文章

查看全部评分

  点我进入    
       ↓      

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
2
发表于 2016-1-5 19:05:58 | 只看该作者
本帖最后由 汪汪 于 2016-1-5 19:16 编辑

JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // ConfigBaocun.js
  3. //=============================================================================
  4. /*:
  5.  * @plugindesc 用选项内容保存一些数数据
  6.  * @author wangwang
  7.  *
  8.  * @help
  9.  *这个借用的是原来游戏保存音量的那个存档......因为一般不会有大变化,所以经常保存也不会造成其他数据错误, 保存我们的东西正好....
  10.  *读取
  11.  *ConfigManager.load()
  12.  *保存
  13.  *ConfigManager.save()
  14.  *数据
  15.  * ConfigManager.other.xxx  ( = yyy )
  16.  */
  17. (function() {
  18.  
  19. //添加命令
  20. ConfigManager.other  = {}
  21.  
  22. //制作数据
  23. ConfigManager.makeData = function() {
  24.     var config = {};
  25.     config.alwaysDash = this.alwaysDash;
  26.     config.commandRemember = this.commandRemember;
  27.     config.bgmVolume = this.bgmVolume;
  28.     config.bgsVolume = this.bgsVolume;
  29.     config.meVolume = this.meVolume;
  30.     config.seVolume = this.seVolume;
  31.     config.other = this.other;
  32.  
  33.     return config;
  34. };
  35. //应用数据
  36. ConfigManager.applyData = function(config) {
  37.     this.alwaysDash = this.readFlag(config, 'alwaysDash');
  38.     this.commandRemember = this.readFlag(config, 'commandRemember');
  39.     this.bgmVolume = this.readVolume(config, 'bgmVolume');
  40.     this.bgsVolume = this.readVolume(config, 'bgsVolume');
  41.     this.meVolume = this.readVolume(config, 'meVolume');
  42.     this.seVolume = this.readVolume(config, 'seVolume');
  43.     this.other = this.readOther(config, 'other');
  44. };
  45.  
  46. ConfigManager.readOther = function(config, name) {
  47.     var value = config[name];
  48.     if (value !== undefined) {
  49.         return value ;
  50.     } else {
  51.         return {};
  52.     }
  53. };
  54.  
  55.  
  56. })();

其实数据一些简单的数据不用保存得这么麻烦.......

点评

于是理解完毕后更新了主楼的插件。  发表于 2016-1-6 10:58
原来如此,十分感谢。  发表于 2016-1-5 20:23
这个数据是在 Scene_Boot.prototype.create 调用时 第一次 读取的....所以用的时候要注意(当然用时直接使用ConfigManager.load()读取就好.....)  发表于 2016-1-5 19:19
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
395
在线时间
88 小时
注册时间
2012-8-13
帖子
34
3
发表于 2017-7-6 21:17:10 | 只看该作者
为什么我使用了插件指令,标题指令还是没有开启?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
992
在线时间
108 小时
注册时间
2022-7-2
帖子
149
4
发表于 2022-7-6 17:51:28 | 只看该作者
6666666666
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 19:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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