查看: 5647|回复: 2

[已经解决] 请教几个代码问题(自动存档\删除存档\调用属性)

[复制链接]
梦石
0
星屑
50
在线时间
25 小时
注册时间
2013-8-14
回帖
20
发表于 2016-2-21 11:47:00 | 显示全部楼层 |阅读模式

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

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

×
1.请问如何通过在事件页里插入代码,不显示存档菜单直接存档到n号位置?

2.请问如何不显示存档菜单直接删除n号位置的存档?

3.请问如何调用角色的属性值? 比如我想做出如果主要角色魔法防御>=4,则开启特殊对话选项,我在事件页里没有找到相应设定,所以想通过Conditional Branch里面的Script来做,但是不知道要调用什么代码。
梦石
0
星屑
50
在线时间
370 小时
注册时间
2016-1-7
回帖
81
发表于 2016-2-21 14:08:14 | 显示全部楼层
QQ截图20160221140705.jpg

点评

万分感谢!  发表于 2016-2-21 14:56
已经查明原因:即使保存存档的时候saveGame(2)了,游戏依然会保存到1号存档,所以删除存档也一定要删除(1)才行  发表于 2016-2-21 14:53
保存游戏和属性触发事件都成功了,但是存档删除似乎无效  发表于 2016-2-21 14:50

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 万分感谢!

查看全部评分

回复 1 0

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2016-2-21 14:49:20 | 显示全部楼层
3.
Released under the MIT license
選択肢拡張]
http://woodpenguin.web.fc2.com/MV_Plugin/index.html
http://woodpenguin.web.fc2.com/MV_Plugin/MPP_ChoiceEX.html
現時功能
選択肢項目数増加


可依条件(開関/変数)決定項目表示


可依条件(開関/変数)、項目半透明表示(選擇不能)

選択肢視窗位置自定変更

選択肢拡張
  1. //=============================================================================
  2. // MPP_ChoiceEX.js
  3. //=============================================================================
  4. // Copyright (c) 2015 Mokusei Penguin
  5. // Released under the MIT license
  6. // [url]http://opensource.org/licenses/mit-license.php[/url]
  7. //=============================================================================

  8. /*:
  9. * @plugindesc 【MPP ver.2.1】選択肢の機能拡張
  10. * @author 木星ペンギン
  11. *
  12. * @help イベントコマンド『選択肢の表示』を続けて配置すると
  13. * 一つの選択肢にまとめられます。
  14. * まとめたくない場合は、間に注釈などを入れることで通常通り分けることができます。
  15. *
  16. * 『デフォルト』の処理は、なし以外を設定したものが適用されます。
  17. * 『デフォルト』の処理が複数ある場合、
  18. * 後に設定された選択肢のものが適用されます。
  19. *
  20. * 『キャンセル』の処理は、禁止以外を設定したものが適用されます。
  21. * 『キャンセル』の処理が複数ある場合、
  22. * 後に設定された選択肢のものが適用されます。
  23. *
  24. * 『背景』と『ウィンドウ位置』は後の選択肢のものが適用されます。
  25. *
  26. *
  27. * ●項目が表示される条件の設定
  28. * 選択肢の文章中に
  29. *   if(条件)
  30. * と入れ、その条件が偽になると項目が表示されなくなります。
  31. *
  32. * 条件内では s でスイッチ、v で変数を参照できます。
  33. * (例:if(s[1]) とした場合、スイッチ1番がONで表示、OFFで非表示となります)
  34. *
  35. * 『デフォルト』や『キャンセル』の項目が表示されない場合、
  36. * なしや禁止と同じ処理をします。
  37. *
  38. *
  39. * ●項目を半透明で表示する条件の設定
  40. * 選択肢の文章中に
  41. *   en(条件)
  42. * と入れ、その条件が偽になると項目が半透明で表示されます。
  43. * 半透明となった項目は選択できなくなります。
  44. *
  45. * 条件は上の『項目が表示される条件の設定』と同じです。
  46. *
  47. * 『キャンセル』の項目が半透明の場合、ブザーが鳴ります。
  48. *
  49. *
  50. * ●選択肢の位置と行数指定
  51. * イベントコマンドの【プラグインコマンド】にて以下のように入力すると
  52. * 次に表示する選択肢ウィンドウの位置と最大表示行数が指定できます。
  53. *
  54. *   ChoicePos x y row
  55. *     x   : 選択肢ウィンドウのX座標
  56. *     y   : 選択肢ウィンドウのY座標
  57. *     row : 選択肢ウィンドウの最大表示行数
  58. *           未設定の場合、すべての選択肢が表示されます
  59. *
  60. * ●選択肢のカーソル位置指定と保存
  61. * イベントコマンドの【プラグインコマンド】にて以下のように入力すると
  62. * 次に表示する選択肢のデフォルト位置を変数の値にして、
  63. * 決定またはキャンセル時にカーソル位置をその変数に入れます。
  64. *
  65. *   ChoiceVariableId n
  66. *     n : 変数番号
  67. *
  68. * カーソル位置は最初の選択肢が上から0~5、次の選択肢は10~15と、
  69. * 選択肢毎に+10されます。
  70. *
  71. * 変数に入った値の項目がない場合、なしと同じ処理をします。
  72. *
  73. *
  74. * ●プラグインコマンドの実行タイミング
  75. * 上記のプラグインコマンドを使用する場合、【選択肢の表示】の前に実行するのが
  76. * 好ましいです。
  77. * ただし、メッセージウィンドウを表示したまま選択肢の処理を実行したい場合、
  78. * 【文章の表示】より前にプラグインコマンドを実行してください。
  79. *
  80. * ================================
  81. * 制作 : 木星ペンギン
  82. * URL : [url]http://woodpenguin.blog.fc2.com/[/url]
  83. *
  84. * @param maxPageRow
  85. * @desc 1ページに表示される行数
  86. * @default 6
  87. *
  88. */

  89. (function() {

  90. var parameters = PluginManager.parameters('MPP_ChoiceEX');

  91. var maxPageRow = Number(parameters['maxPageRow']);

  92. var Alias = {};

  93. //-----------------------------------------------------------------------------
  94. // Game_Message

  95. //332
  96. Alias.GaMe_clear = Game_Message.prototype.clear;
  97. Game_Message.prototype.clear = function() {
  98.     Alias.GaMe_clear.call(this);
  99.     this._choiceEnables = [];
  100.     this._choiceX = -1;
  101.     this._choiceY = -1;
  102.     this._choiceMaxRow = maxPageRow;
  103.     this._choiceVariableId = 0;
  104. };

  105. Game_Message.prototype.setChoiceEnables = function(enables) {
  106.     this._choiceEnables = enables;
  107. };

  108. Game_Message.prototype.choiceEnables = function() {
  109.     return this._choiceEnables;
  110. };

  111. Game_Message.prototype.setChoicePos = function(x, y, row) {
  112.     this._choiceX = x;
  113.     this._choiceY = y;
  114.     this._choiceMaxRow = row;
  115. };

  116. Game_Message.prototype.choiceX = function() {
  117.     return this._choiceX;
  118. };

  119. Game_Message.prototype.choiceY = function() {
  120.     return this._choiceY;
  121. };

  122. Game_Message.prototype.choiceMaxRow = function() {
  123.     return this._choiceMaxRow;
  124. };

  125. Game_Message.prototype.setChoiceVariableId = function(id) {
  126.     this._choiceVariableId = id;
  127. };

  128. Game_Message.prototype.choiceVariableId = function() {
  129.     return this._choiceVariableId;
  130. };

  131. //-----------------------------------------------------------------------------
  132. // Game_Interpreter

  133. //9062
  134. Game_Interpreter.prototype.setupChoices = function(params) {
  135.     var data = {
  136.         choices: [],
  137.         enables: [],
  138.         result: [],
  139.         cancelType: -1,
  140.         defaultType: -1,
  141.         positionType: 0,
  142.         background: 0
  143.     };
  144.     data = this.addChoices(params, this._index, data, 0);
  145.     if (data.choices.length > 0) {
  146.         var cancelType = -1;
  147.         if (data.cancelType.mod(10) === 8 || data.result.contains(data.cancelType)) {
  148.             data.result.push(data.cancelType);
  149.             cancelType = data.choices.length;
  150.         }
  151.         var defaultType = -1;
  152.         if ($gameMessage.choiceVariableId() > 0) {
  153.             var index = $gameVariables.value($gameMessage.choiceVariableId());
  154.             defaultType = data.result.indexOf(index);
  155.         } else {
  156.             defaultType = data.result.indexOf(data.defaultType);
  157.         }
  158.         $gameMessage.setChoices(data.choices, defaultType, cancelType);
  159.         $gameMessage.setChoiceEnables(data.enables);
  160.         $gameMessage.setChoiceBackground(data.background);
  161.         $gameMessage.setChoicePositionType(data.positionType);
  162.         $gameMessage.setChoiceCallback(function(n) {
  163.             var result = data.result[n];
  164.             var variableId = $gameMessage.choiceVariableId();
  165.             if (variableId > 0 && result.mod(10) !== 8) {
  166.                 $gameVariables.setValue(variableId, result);
  167.             }
  168.             this._branch[this._indent] = result;
  169.         }.bind(this));
  170.     } else {
  171.         this._branch[this._indent] = -1;
  172.     }
  173. };

  174. Game_Interpreter.prototype.addChoices = function(params, i, data, d) {
  175.     var regIf = /\s*if\(([^\)]+)\)/;
  176.     var regEn = /\s*en\(([^\)]+)\)/;
  177.     for (var n = 0; n < params[0].length; n++) {
  178.         var str = params[0][n];
  179.         if (regIf.test(str)) {
  180.             str = str.replace(regIf, '');
  181.             if (RegExp.$1 && !this.evalChoice(RegExp.$1)) continue;
  182.         }
  183.         var enable = true;
  184.         if (regEn.test(str)) {
  185.             str = str.replace(regEn, '');
  186.             enable = this.evalChoice(RegExp.$1);
  187.         }
  188.         data.choices.push(str);
  189.         data.enables.push(enable);
  190.         data.result.push(n + d);
  191.     }
  192.     var cancelType = params[1];
  193.     if (cancelType !== -1) {
  194.         data.cancelType = cancelType + d;
  195.     }
  196.     var defaultType = params.length > 2 ? params[2] : 0;
  197.     if (defaultType >= 0) {
  198.         data.defaultType = defaultType + d;
  199.     }
  200.     data.positionType = params.length > 3 ? params[3] : 2;
  201.     data.background = params.length > 4 ? params[4] : 0;
  202.     do {
  203.         i++;
  204.     } while (this._list[i].code !== 404 || this._list[i].indent > this._indent)
  205.     if (this._list[i + 1].code === 102) {
  206.         this.addChoices(this._list[i + 1].parameters, i + 1, data, d + 10);
  207.     }
  208.     return data;
  209. };

  210. Game_Interpreter.prototype.evalChoice = function(formula) {
  211.     try {
  212.         var s = $gameSwitches._data;
  213.         var v = $gameVariables._data;
  214.         return !!eval(formula);
  215.     } catch (e) {
  216.         alert("条件エラー \n\n " + formula);
  217.         return true;
  218.     }
  219. };

  220. //9088
  221. Game_Interpreter.prototype.command403 = function() {
  222.     if (this._branch[this._indent] !== -2) {
  223.         this.skipBranch();
  224.     }
  225.     return true;
  226. };

  227. Game_Interpreter.prototype.command404 = function() {
  228.     if (this.nextEventCode() === 102) {
  229.         this._branch[this._indent] -= 10;
  230.         this._index++;
  231.     }
  232.     return true;
  233. };

  234. //10449
  235. Alias.GaIn_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  236. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  237.     Alias.GaIn_pluginCommand.call(this, command, args);
  238.     switch (command) {
  239.     case 'ChoicePos':
  240.         var x = Number(args[0]);
  241.         var y = Number(args[1]);
  242.         var row = Number(args[2] || 99);
  243.         $gameMessage.setChoicePos(x, y, row);
  244.         break;
  245.     case 'ChoiceVariableId':
  246.         $gameMessage.setChoiceVariableId(Number(args[0]));
  247.         break;
  248.     }
  249.     return true;
  250. };

  251. //-----------------------------------------------------------------------------
  252. // Window_ChoiceList

  253. //3843
  254. Alias.WiChLi_updatePlacement = Window_ChoiceList.prototype.updatePlacement;
  255. Window_ChoiceList.prototype.updatePlacement = function() {
  256.     Alias.WiChLi_updatePlacement.call(this);
  257.     if ($gameMessage.choiceX() >= 0 && $gameMessage.choiceY() >= 0) {
  258.         this.x = Math.min($gameMessage.choiceX(), Graphics.boxWidth - this.width);
  259.         this.y = Math.min($gameMessage.choiceY(), Graphics.boxHeight - this.height);
  260.     }
  261. };

  262. //3876
  263. Window_ChoiceList.prototype.numVisibleRows = function() {
  264.     return Math.min($gameMessage.choices().length, $gameMessage.choiceMaxRow());
  265. };

  266. //3912
  267. Window_ChoiceList.prototype.makeCommandList = function() {
  268.     var choices = $gameMessage.choices();
  269.     var enables = $gameMessage.choiceEnables();
  270.     for (var i = 0; i < choices.length; i++) {
  271.         this.addCommand(choices[i], 'choice', enables[i]);
  272.     }
  273. };

  274. //3919
  275. Alias.WiChLi_drawItem = Window_ChoiceList.prototype.drawItem;
  276. Window_ChoiceList.prototype.drawItem = function(index) {
  277.     this.changePaintOpacity(this.isCommandEnabled(index));
  278.     Alias.WiChLi_drawItem.call(this, index);
  279. };

  280. Window_ChoiceList.prototype.processCancel = function() {
  281.     if (this.isCurrentItemEnabled()) {
  282.         Window_Selectable.prototype.processCancel.call(this);
  283.     } else {
  284.         this.playBuzzerSound();
  285.     }
  286. };

  287. })();
复制代码

评分

参与人数 1星屑 +166 收起 理由
余烬之中 + 166 塞糖

查看全部评分

回复 1 0

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部