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

Project1

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

[已经解决] rpg maker MV 制作一个循环游戏

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
45 小时
注册时间
2008-8-4
帖子
12
跳转到指定楼层
1
发表于 2016-8-31 00:36:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  就是game over以后 我可以给变量计数 下一次游戏的时候根据变量来触发不一样的开场 请问具体需要做什么定义呢?

Lv2.观梦者

梦石
0
星屑
311
在线时间
204 小时
注册时间
2007-2-4
帖子
1817
2
发表于 2016-8-31 11:34:27 | 只看该作者
本帖最后由 玄天 于 2016-8-31 11:38 编辑

你这个效果用全局变量类型的插件就行了。

比如这个插件的功能大概就是指定某些变量为全局保存,即不管你游戏进度如何,这个变量都会保持在最后更新的状态。这样你只要在需要分歧的地方加个条件分歧就行了,很简单。
JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // MrTS_GlobalSavesData.js
  3. //=============================================================================
  4.  
  5. /*:
  6. * @plugindesc Allows player to set and change variables that affect all saves.
  7. * @author Mr. Trivel
  8. *
  9. * @help
  10. * --------------------------------------------------------------------------------
  11. * Terms of Use
  12. * --------------------------------------------------------------------------------
  13. * Don't remove the header or claim that you wrote this plugin.
  14. * Credit Mr. Trivel if using this plugin in your project.
  15. * Free for commercial non-commercial projects.
  16. * --------------------------------------------------------------------------------
  17. * Version 1.0
  18. * --------------------------------------------------------------------------------
  19. *
  20. * --------------------------------------------------------------------------------
  21. * Plugin Commands
  22. * --------------------------------------------------------------------------------
  23. * GlobalVar Set [NAME] [VALUE] - Sets variable to [VALUE]
  24. * GlobalVar Add [NAME] [VALUE] - Adds [VALUE] to variable
  25. * GlobalVar Sub [NAME] [VALUE] - Subtracts [VALUE] from value
  26. *
  27. * [NAME] - Variable name, case sensitive
  28. * [VALUE] - Value of variable a number or true/false
  29. *
  30. * Examples:
  31. * GlobalVar Set Glasses true
  32. *
  33. * GlobalVar Set GameCompleted 1
  34. * GlobalVar Add GameCompleted 1
  35. * GlobalVar Sub GameCompleted 2
  36. * --------------------------------------------------------------------------------
  37. *
  38. * --------------------------------------------------------------------------------
  39. * Script Calls - for use in switches, variables, branches and script calls
  40. * --------------------------------------------------------------------------------
  41. * DataManager.getGlobalVar(NAME) - returns global variable of NAME
  42. *
  43. * Example:
  44. * DataManager.getGlobalVar(Glasses)
  45. * --------------------------------------------------------------------------------
  46. *
  47. * --------------------------------------------------------------------------------
  48. * Version History
  49. * --------------------------------------------------------------------------------
  50. * 1.0 - Release
  51. */
  52.  
  53. (function() {
  54.  
  55.         //--------------------------------------------------------------------------
  56.         // Game_Interpreter
  57.         //
  58.  
  59.         var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  60.         Game_Interpreter.prototype.pluginCommand = function(command, args) {
  61.                 _Game_Interpreter_pluginCommand.call(this, command, args);
  62.                 if (command.toLowerCase() === "globalvar") {
  63.                         switch (args[0].toUpperCase())
  64.                         {
  65.                                 case 'SET':
  66.                                 {
  67.                                         DataManager.setGlobalVar(args[1], eval(args[2]))
  68.                                 } break;
  69.                                 case 'ADD':
  70.                                 {
  71.                                         DataManager.addGlobalVar(args[1], Number(args[2]))
  72.                                 } break;
  73.                                 case 'SUB':
  74.                                 {
  75.                                         DataManager.setGlobalVar(args[1], Number(args[2]))
  76.                                 } break;
  77.  
  78.                         }
  79.                 }
  80.         };
  81.  
  82.         //--------------------------------------------------------------------------
  83.         // StorageManager
  84.         //
  85.  
  86.         var _StorageManager_localFilePath = StorageManager.localFilePath;
  87.         StorageManager.localFilePath = function(key) {
  88.             if (key === 'globalsavedata') return this.localFileDirectoryPath() + 'globalSaveData.rpgsave';
  89.             else return _StorageManager_localFilePath.call(this, key);
  90.         };
  91.  
  92.         var _StorageManager_webStorageKey = StorageManager.webStorageKey;
  93.         StorageManager.webStorageKey = function(key) {
  94.                 if (key === 'globalsavedata') return 'RPG GlobalSaveData';
  95.                 else return _StorageManager_webStorageKey.call(this, key);
  96.         };
  97.  
  98.         //--------------------------------------------------------------------------
  99.         // DataManager
  100.         //
  101.  
  102.         var _DataManager_loadGameWithoutRescue = DataManager.loadGameWithoutRescue;
  103.         DataManager.loadGameWithoutRescue = function(savefileId) {
  104.                 var success = _DataManager_loadGameWithoutRescue.call(this, savefileId);
  105.             if (success) this._globalSaveData = this.loadGlobalSaveData();
  106.             return success;
  107.         };
  108.  
  109.         var _DataManager_setupNewgame = DataManager.setupNewGame;
  110.         DataManager.setupNewGame = function() {
  111.                 _DataManager_setupNewgame.call(this);
  112.                 this._globalSaveData = this.loadGlobalSaveData();
  113.         };
  114.  
  115.         DataManager.setGlobalVar = function(name, value) {
  116.                 this._globalSaveData[name] = value;
  117.         };
  118.  
  119.         DataManager.addGlobalVar = function(name, value) {
  120.                 if (!this._globalSaveData[name]) this._globalSaveData[name] = 0;
  121.                 this._globalSaveData[name] += value;
  122.         };
  123.  
  124.         DataManager.subGlobalVar = function(name, value) {
  125.                 this.addGlobalVar(name, -value);
  126.         };
  127.  
  128.         DataManager.getGlobalVar = function(name) {
  129.                 if (!this._globalSaveData[name]) this._globalSaveData[name] = 0;
  130.                 return this._globalSaveData[name];
  131.         };
  132.  
  133.         DataManager.loadGlobalSaveData = function() {
  134.                 var data = StorageManager.load('globalsavedata');
  135.                 if (data)
  136.                 {
  137.                         return JsonEx.parse(data);
  138.                 }
  139.                 else return {};
  140.         };
  141.  
  142.         var _DataManager_saveGameWithoutRescue = DataManager.saveGameWithoutRescue;
  143.         DataManager.saveGameWithoutRescue = function(savefileId) {
  144.                 var saved = _DataManager_saveGameWithoutRescue.call(this, savefileId);
  145.                 if (saved) {
  146.                         this.saveGlobalSaveData(this._globalSaveData);
  147.                 }
  148.                 return saved;
  149.         };
  150.  
  151.         DataManager.saveGlobalSaveData = function(data) {
  152.                 StorageManager.save('globalsavedata', JSON.stringify(data));
  153.         };
  154. })();


如果觉得这个不够好还可以搜搜其他的,还有不少其他运作方式的全局变量插件。

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 认可答案

查看全部评分

新しい誕生祝いだッ!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-15 09:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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