查看: 7278|回复: 3

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

[复制链接]
梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
回帖
403
发表于 2015-12-3 20:54:06 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 夏末渐离 于 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 精品文章

查看全部评分

  点我进入    
       ↓      
梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2016-1-5 19:05:58 | 显示全部楼层
本帖最后由 汪汪 于 2016-1-5 19:16 编辑

[pre lang="javascript" file="ConfigBaocun.js"]//=============================================================================
// ConfigBaocun.js
//=============================================================================
/*:
* @plugindesc 用选项内容保存一些数数据
* @author wangwang
*
* @help
*这个借用的是原来游戏保存音量的那个存档......因为一般不会有大变化,所以经常保存也不会造成其他数据错误, 保存我们的东西正好....
*读取
*ConfigManager.load()
*保存
*ConfigManager.save()
*数据
* ConfigManager.other.xxx  ( = yyy )
*/
(function() {

//添加命令
ConfigManager.other  = {}

//制作数据
ConfigManager.makeData = function() {
    var config = {};
    config.alwaysDash = this.alwaysDash;
    config.commandRemember = this.commandRemember;
    config.bgmVolume = this.bgmVolume;
    config.bgsVolume = this.bgsVolume;
    config.meVolume = this.meVolume;
    config.seVolume = this.seVolume;
    config.other = this.other;
   
    return config;
};
//应用数据
ConfigManager.applyData = function(config) {
    this.alwaysDash = this.readFlag(config, 'alwaysDash');
    this.commandRemember = this.readFlag(config, 'commandRemember');
    this.bgmVolume = this.readVolume(config, 'bgmVolume');
    this.bgsVolume = this.readVolume(config, 'bgsVolume');
    this.meVolume = this.readVolume(config, 'meVolume');
    this.seVolume = this.readVolume(config, 'seVolume');
    this.other = this.readOther(config, 'other');
};

ConfigManager.readOther = function(config, name) {
    var value = config[name];
    if (value !== undefined) {
        return value ;
    } else {
        return {};
    }
};


})();[/pre]
其实数据一些简单的数据不用保存得这么麻烦.......

点评

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

使用道具 举报

梦石
0
星屑
410
在线时间
89 小时
注册时间
2012-8-13
回帖
15
发表于 2017-7-6 21:17:10 | 显示全部楼层
为什么我使用了插件指令,标题指令还是没有开启?
回复

使用道具 举报

梦石
0
星屑
992
在线时间
108 小时
注册时间
2022-7-2
回帖
133
发表于 2022-7-6 17:51:28 | 显示全部楼层
6666666666
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部