查看: 9892|回复: 29

[有事请教] 怎么才能当角色拥有某件物品时才显示某个选项呢?

[复制链接]
梦石
0
星屑
3341
在线时间
469 小时
注册时间
2014-2-6
回帖
217
发表于 2019-9-8 21:59:42 | 显示全部楼层 |阅读模式

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

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

×
直接用条件判断的话,少量还好说,如果是大量物品就条件肢太多了,主要是想用显示选项做一个快捷背包。然后就想问有没有什么方法,能用公共事件什么的判断当角色有某种物品时显示某个选项,没有时不显示。
梦石
3
星屑
5965
在线时间
1186 小时
注册时间
2014-9-6
回帖
189
发表于 2019-9-8 22:34:33 | 显示全部楼层
選擇物品的指令不滿足要求嗎?
回复

使用道具 举报

梦石
0
星屑
69
在线时间
10 小时
注册时间
2019-9-4
回帖
12
发表于 2019-9-8 22:35:10 | 显示全部楼层

  1. var opt=['选项1','选项2']
  2. if($gameParty._items[3]){
  3.         opt.push('选项3')
  4. }
  5. if($gameParty._armors[4]){
  6.         opt.push('选项4')
  7. }
  8. if($gameParty._weapons[5]){
  9.         opt.push('选项5')
  10. }
  11. this.setupChoices([opt])
复制代码
回复

使用道具 举报

梦石
0
星屑
69
在线时间
10 小时
注册时间
2019-9-4
回帖
12
发表于 2019-9-8 22:52:58 | 显示全部楼层

  1. var opt=[]
  2. for(var i in $gameParty._items){
  3.         opt.push($dataItems[i].name)
  4. }
  5. for(var i in $gameParty._armors){
  6.         opt.push($dataArmors[i].name)
  7. }
  8. for(var i in $gameParty._weapons){
  9.         opt.push($dataWeapons[i].name)
  10. }
  11. this.setupChoices([opt])
复制代码

点评

请问有了选项之后,怎么执行内容列...  发表于 2019-9-9 13:18
谢谢大哥!!!!!  发表于 2019-9-9 11:01
回复

使用道具 举报

梦石
0
星屑
3341
在线时间
469 小时
注册时间
2014-2-6
回帖
217
 楼主| 发表于 2019-9-9 11:03:40 | 显示全部楼层

那再小问一下,选择了某个选项的话,选项执行的内容应该放在哪里?事件脚本的代码我知道,但是不知道放在哪里才能执行....
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2019-9-9 11:21:36 | 显示全部楼层
本帖最后由 tseyik 于 2019-9-9 11:24 编辑

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

  8. /*:
  9. * @plugindesc 【ver.3.10】選択肢の機能拡張
  10. * @author 木星ペンギン
  11. *
  12. * @help ※[]内は未設定でも動作します。
  13. * プラグインコマンド:
  14. *   ChoicePos x y[ row]    # 選択肢の位置(x,y)と行数(row)指定
  15. *   ChoiceVariableId n     # 選択肢のデフォルト位置を変数n番にする
  16. *   ChoiceRect x y width height
  17. *                          # 選択肢の座標とサイズを指定
  18. *   ChoiceUnderMessage     # 選択肢をメッセージの下に表示
  19. *
  20. * ※ プラグインコマンドにて指定する値には変数が使用できます。
  21. *    v[n] と記述することでn番の変数の値を参照します。
  22. *
  23. * 注釈:
  24. *   選択肢ヘルプ             # 各項目の下に設定することでヘルプを表示させる
  25. *
  26. * 選択肢テキスト:
  27. *   if(条件)                # 条件が偽になると項目が表示されなくなる
  28. *   en(条件)                # 条件が偽になると項目が選択不可
  29. *
  30. * ================================================================
  31. * ▼ 使い方
  32. * --------------------------------
  33. *  〇 選択肢を増やす
  34. *   イベントコマンド『選択肢の表示』を続けて配置すると
  35. *   一つの選択肢にまとめられます。
  36. *   まとめたくない場合は、間に注釈などを入れることで
  37. *   通常通り分けることができます。
  38. *
  39. *   『デフォルト』の処理は、なし以外を設定したものが適用されます。
  40. *   『デフォルト』の処理が複数ある場合、
  41. *   後に設定された選択肢のものが適用されます。
  42. *
  43. *   『キャンセル』の処理は、禁止以外を設定したものが適用されます。
  44. *   『キャンセル』の処理が複数ある場合、
  45. *   後に設定された選択肢のものが適用されます。
  46. *
  47. *  『背景』と『ウィンドウ位置』は後の選択肢のものが適用されます。
  48. *
  49. *
  50. * ================================================================
  51. * ▼ プラグインコマンド 詳細
  52. * --------------------------------
  53. *  〇 ChoicePos x y[ row]
  54. *      x   : 選択肢ウィンドウのX座標
  55. *      y   : 選択肢ウィンドウのY座標
  56. *      row : 選択肢ウィンドウの行数。未設定の場合はすべて表示
  57. *   
  58. *   次に表示する選択肢の位置(x,y)と行数(row)指定します。
  59. *   
  60. * --------------------------------
  61. *  〇 ChoiceVariableId n
  62. *      n : 変数番号
  63. *   
  64. *   次に表示する選択肢のデフォルト位置を変数の値にします。
  65. *   さらに現在のカーソル位置を変数に入れます。
  66. *   
  67. *   カーソル位置は最初の選択肢が上から0~5、次の選択肢は10~15と、
  68. *   選択肢毎に+10されます。
  69. *
  70. *   変数に入った値の項目が表示されない場合、なしと同じ処理をします。
  71. *
  72. * --------------------------------
  73. *  〇 ChoiceRect x y width height
  74. *      x      : X座標
  75. *      y      : Y座標
  76. *      width  : 幅
  77. *      height : 高さ
  78. *   
  79. *   次に表示する選択肢の座標とサイズを指定します。
  80. *   
  81. *   各項目、未設定もしくは-1を指定した場合、通常の値が適用されます。
  82. *   
  83. * --------------------------------
  84. *  〇 ChoiceUnderMessage
  85. *  
  86. *   次に表示する選択肢をメッセージウィンドウ内に表示させます。
  87. *   
  88. *   この機能は[文章の表示]と併用しなければ機能しません。
  89. *   [文章の表示]の前に実行してください。
  90. *   
  91. *   選択肢ウィンドウの[背景]は設定したものが適用されます。
  92. *
  93. *
  94. * ================================================================
  95. * ▼ 選択肢テキスト 詳細
  96. * --------------------------------
  97. *  〇 項目が表示される条件の設定
  98. *   選択肢の文章中に
  99. *     if(条件)
  100. *   と入れ、その条件が偽になると項目が表示されなくなります。
  101. *   
  102. *   『デフォルト』の項目が表示されない場合の動作は、
  103. *   プラグインパラメータの[Disabled Index]にて設定できます。
  104. *   
  105. *   『キャンセル』の項目が表示されない場合、禁止と同じ処理をします。
  106. *   
  107. *   条件内では s でスイッチ、v で変数を参照できます。
  108. *   
  109. *     例:if(s[1]) とした場合
  110. *          => スイッチ1番がONで表示、OFFで非表示。
  111. *        if(!s[2]) とした場合
  112. *          => スイッチ2番がOFFで表示、ONで非表示。
  113. *        if(v[5]>0) とした場合
  114. *          => 変数5番が0より大きければ表示、0以下で非表示。
  115. *     
  116. *     変数で使える不等号
  117. *       === : 等しい
  118. *       !== : 等しくない
  119. *       <   : より小さい
  120. *       <=  : より小さいまたは等しい
  121. *       >   : より大きい
  122. *       >=  : より大きいまたは等しい
  123. *     
  124. *     条件式はeval関数で処理されているため、他演算子も使用できます。
  125. *
  126. * --------------------------------
  127. *  〇 項目を半透明で表示する条件の設定
  128. *   選択肢の文章中に
  129. *     en(条件)
  130. *   と入れ、その条件が偽になると項目が半透明で表示されます。
  131. *   半透明となった項目は選択できなくなります。
  132. *
  133. *   条件は上の『項目が表示される条件の設定』と同じです。
  134. *
  135. *   『キャンセル』の項目が半透明の場合、ブザーが鳴ります。
  136. *
  137. *
  138. * ================================================================
  139. * ▼ プラグインパラメータ 詳細
  140. * --------------------------------
  141. *  〇 Disabled Index
  142. *  
  143. *   [デフォルト]となる項目がif(条件)により非表示となった場合、
  144. *   デフォルト位置をどこにするかを設定します。
  145. *   
  146. *     none : [なし]と同じ
  147. *     top  : 先頭の項目
  148. *  
  149. * --------------------------------
  150. *  〇 Plugin Commands / Event Comment
  151. *  
  152. *   プラグインコマンドや注釈で使用するコマンドは、
  153. *   プラグインパラメータから変更できます。
  154. *  
  155. *   コマンドを短くしたり日本語にしたりなどして、
  156. *   自分が使いやすいようにしてください。
  157. *  
  158. *   プラグインコマンドのみ、変更後もデフォルトのコマンドでも動作します。
  159. *
  160. *
  161. * ================================================================
  162. * ▼ その他
  163. * --------------------------------
  164. *  〇 プラグインコマンドの実行タイミング
  165. *   プラグインコマンドを使用する場合、[選択肢の表示]の前に実行するのが
  166. *   好ましいです。
  167. *   ただし、メッセージウィンドウを表示したまま選択肢の処理を実行したい場合、
  168. *   [文章の表示]より前にプラグインコマンドを実行してください。
  169. *
  170. * --------------------------------
  171. *  〇 ヘルプメッセージの表示
  172. *   各選択肢項目の下に注釈で以下の文字列を入れると、
  173. *   続きの文章をヘルプメッセージとしてカーソルを合わせたときに
  174. *   標示させることができます。
  175. *  
  176. *     選択肢ヘルプ
  177. *
  178. *   ※注意点
  179. *    ヘルプメッセージは[文章の表示]と同じ機能を使っているため、
  180. *    制御文字が使用できます。
  181. *    ただし、\!と\^は使用できません。
  182. *
  183. * ================================
  184. * 制作 : 木星ペンギン
  185. * URL : [url]http://woodpenguin.blog.fc2.com/[/url]
  186. *
  187. * @param maxPageRow
  188. * @type number
  189. * @desc 1ページに表示される行数
  190. * @default 6
  191. *
  192. * @param Disabled Index
  193. * @type select
  194. * @option none
  195. * @option top
  196. * @desc [デフォルト]となる選択肢が表示されない場合のデフォルト位置
  197. * @default none
  198. *
  199. *
  200. * @param === Command ===
  201. *
  202. * @param Plugin Commands
  203. * @type struct<Plugin>
  204. * @desc プラグインコマンド名
  205. * @default {"ChoicePos":"ChoicePos","ChoiceVariableId":"ChoiceVariableId","ChoiceRect":"ChoiceRect","ChoiceUnderMessage":"ChoiceUnderMessage"}
  206. * @parent === Command ===
  207. *
  208. * @param Event Comment
  209. * @type struct<EventComment>
  210. * @desc イベントの注釈で使うコマンド名
  211. * @default {"ChoiceHelp":"選択肢ヘルプ"}
  212. * @parent === Command ===
  213. *
  214. */

  215. /*~struct~Plugin:
  216. * @param ChoicePos
  217. * @desc 選択肢の位置(x,y)と行数(row)指定
  218. * @default ChoicePos
  219. *
  220. * @param ChoiceVariableId
  221. * @desc 選択肢のデフォルト位置を変数n番にする
  222. * @default ChoiceVariableId
  223. *
  224. * @param ChoiceRect
  225. * @desc 選択肢の座標とサイズ(x,y,width,height)指定
  226. * @default ChoiceRect
  227. *
  228. * @param ChoiceUnderMessage
  229. * @desc 選択肢をメッセージの下に表示
  230. * @default ChoiceUnderMessage
  231. *
  232. */

  233. /*~struct~EventComment:
  234. * @param ChoiceHelp
  235. * @desc 各項目の下に設定することでヘルプを表示させる
  236. * @default 選択肢ヘルプ
  237. */

  238. (function() {

  239. const MPPlugin = {};

  240. {
  241.    
  242.     let parameters = PluginManager.parameters('MPP_ChoiceEX');
  243.    
  244.     MPPlugin.maxPageRow = Number(parameters['maxPageRow']);
  245.     MPPlugin.DisabledIndex = parameters['Disabled Index'];
  246.    
  247.     MPPlugin.PluginCommands = JSON.parse(parameters['Plugin Commands']);
  248.     MPPlugin.EventComment = JSON.parse(parameters['Event Comment']);

  249. }

  250. const Alias = {};

  251. //-----------------------------------------------------------------------------
  252. // Game_Message

  253. //15
  254. Alias.GaMe_clear = Game_Message.prototype.clear;
  255. Game_Message.prototype.clear = function() {
  256.     Alias.GaMe_clear.apply(this, arguments);
  257.     this._choiceEnables = [];
  258.     this._choiceResults = [];
  259.     this._helpTexts = [];
  260.     this._choiceX = -1;
  261.     this._choiceY = -1;
  262.     this._choiceWidth = -1;
  263.     this._choiceHeight = -1;
  264.     this._choiceMaxRow = MPPlugin.maxPageRow;
  265.     this._choiceVariableId = 0;
  266.     this.choiceUnderMes = false;
  267. };

  268. Game_Message.prototype.setChoiceEnables = function(enables) {
  269.     this._choiceEnables = enables;
  270. };

  271. Game_Message.prototype.choiceEnables = function() {
  272.     return this._choiceEnables;
  273. };

  274. Game_Message.prototype.setChoiceResults = function(results) {
  275.     this._choiceResults = results;
  276. };

  277. Game_Message.prototype.setChoiceHelpTexts = function(texts) {
  278.     this._helpTexts = texts;
  279. };

  280. Game_Message.prototype.isHelp = function() {
  281.     return this._helpTexts.length > 0;
  282. };

  283. Game_Message.prototype.setChoicePos = function(x, y, row) {
  284.     this._choiceX = x;
  285.     this._choiceY = y;
  286.     this._choiceWidth = -1;
  287.     this._choiceHeight = -1;
  288.     this._choiceMaxRow = row;
  289. };

  290. Game_Message.prototype.setChoiceRect = function(x, y, width, height) {
  291.     this._choiceX = x;
  292.     this._choiceY = y;
  293.     this._choiceWidth = width;
  294.     this._choiceHeight = height;
  295. };

  296. Game_Message.prototype.setChoiceVariableId = function(id) {
  297.     this._choiceVariableId = id;
  298. };

  299. Game_Message.prototype.shiftLine = function(height) {
  300.     this._choiceY += height;
  301.     this._choiceHeight -= height;
  302. };


  303. //-----------------------------------------------------------------------------
  304. // Game_Interpreter

  305. //336
  306. Game_Interpreter.prototype.setupChoices = function(params) {
  307.     var data = {
  308.         choices: [],
  309.         enables: [],
  310.         results: [],
  311.         helpTexts: [],
  312.         cancelType: -1,
  313.         defaultType: -1,
  314.         positionType: 0,
  315.         background: 0
  316.     };
  317.     data = this.addChoices(params, this._index, data, 0);
  318.     if (data.choices.length > 0) {
  319.         var helpTexts = [];
  320.         if (data.helpTexts.length > 0) {
  321.             helpTexts = data.results.map( i => data.helpTexts[i] );
  322.         }
  323.         var cancelType = -1;
  324.         if (data.cancelType.mod(10) === 8 || data.results.contains(data.cancelType)) {
  325.             data.results.push(data.cancelType);
  326.             cancelType = data.choices.length;
  327.         }
  328.         var index = data.defaultType;
  329.         if ($gameMessage._choiceVariableId > 0) {
  330.             index = $gameVariables.value($gameMessage._choiceVariableId);
  331.         }
  332.         var defaultType = data.results.indexOf(index);
  333.         if (index >= 0 && defaultType < 0 && MPPlugin.DisabledIndex === "top")  {
  334.             defaultType = 0;
  335.         }
  336.         $gameMessage.setChoices(data.choices, defaultType, cancelType);
  337.         $gameMessage.setChoiceEnables(data.enables);
  338.         $gameMessage.setChoiceResults(data.results);
  339.         $gameMessage.setChoiceHelpTexts(helpTexts);
  340.         $gameMessage.setChoiceBackground(data.background);
  341.         $gameMessage.setChoicePositionType(data.positionType);
  342.         $gameMessage.setChoiceCallback( n => this._branch[this._indent] = data.results[n] );
  343.     } else {
  344.         this._branch[this._indent] = -1;
  345.     }
  346. };

  347. Game_Interpreter.prototype.addChoices = function(params, i, data, d) {
  348.     var regIf = /\s*if\((.+?)\)/;
  349.     var regEn = /\s*en\((.+?)\)/;
  350.     for (var n = 0; n < params[0].length; n++) {
  351.         var str = params[0][n];
  352.         if (regIf.test(str)) {
  353.             str = str.replace(regIf, '');
  354.             if (RegExp.$1 && !this.evalChoice(RegExp.$1)) continue;
  355.         }
  356.         var enable = true;
  357.         if (regEn.test(str)) {
  358.             str = str.replace(regEn, '');
  359.             enable = this.evalChoice(RegExp.$1);
  360.         }
  361.         data.choices.push(str);
  362.         data.enables.push(enable);
  363.         data.results.push(n + d);
  364.     }
  365.     var cancelType = params[1];
  366.     if (cancelType !== -1) {
  367.         data.cancelType = cancelType + d;
  368.     }
  369.     var defaultType = params.length > 2 ? params[2] : 0;
  370.     if (defaultType >= 0) {
  371.         data.defaultType = defaultType + d;
  372.     }
  373.     data.positionType = params.length > 3 ? params[3] : 2;
  374.     data.background = params.length > 4 ? params[4] : 0;
  375.     var command;
  376.     for (;;) {
  377.         i++;
  378.         command = this._list[i];
  379.         if (!command) break;
  380.         if (command.indent === this._indent) {
  381.             if (command.code === 402) {
  382.                 this.getHelpText(command.parameters[0] + d, i + 1, data);
  383.             } else if (command.code === 404) {
  384.                 break;
  385.             }
  386.         }
  387.     }
  388.     command = this._list[i + 1];
  389.     if (command && command.code === 102) {
  390.         this.addChoices(command.parameters, i + 1, data, d + 10);
  391.     }
  392.     return data;
  393. };

  394. Game_Interpreter.prototype.getHelpText = function(c, i, data) {
  395.     var command = MPPlugin.EventComment.ChoiceHelp || '選択肢ヘルプ';
  396.     if (this._list[i].code === 108 && this._list[i].parameters[0] === command) {
  397.         var texts = [];
  398.         while (this._list[i + 1].code === 408) {
  399.             i++;
  400.             texts.push(this._list[i].parameters[0]);
  401.         }
  402.         data.helpTexts[c] = texts;
  403.     }
  404. };

  405. Game_Interpreter.prototype.evalChoice = function(formula) {
  406.     try {
  407.         var s = $gameSwitches._data;
  408.         var formula2 = formula.replace(/v\[(\d+)\]/g,
  409.             (match, p1) => $gameVariables.value(parseInt(p1)) );
  410.         return !!eval(formula2);
  411.     } catch (e) {
  412.         alert("条件エラー \n\n " + formula);
  413.         return true;
  414.     }
  415. };

  416. //362
  417. Game_Interpreter.prototype.command403 = function() {
  418.     if (this._branch[this._indent] !== -2) {
  419.         this.skipBranch();
  420.     }
  421.     return true;
  422. };

  423. Game_Interpreter.prototype.command404 = function() {
  424.     if (this.nextEventCode() === 102) {
  425.         this._branch[this._indent] -= 10;
  426.         this._index++;
  427.     }
  428.     return true;
  429. };

  430. //1739
  431. Alias.GaIn_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  432. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  433.     Alias.GaIn_pluginCommand.apply(this, arguments);
  434.     var args2 = this.mppPluginCommandArgs(args);
  435.     switch (command) {
  436.         case MPPlugin.PluginCommands.ChoicePos:
  437.         case 'ChoicePos':
  438.             var x = args2[0];
  439.             var y = args2[1];
  440.             var row = args2[2] || 99;
  441.             $gameMessage.setChoicePos(x, y, row);
  442.             break;
  443.         case MPPlugin.PluginCommands.ChoiceVariableId:
  444.         case 'ChoiceVariableId':
  445.             $gameMessage.setChoiceVariableId(args2[0]);
  446.             break;
  447.         case MPPlugin.PluginCommands.ChoiceRect:
  448.         case 'ChoiceRect':
  449.             var x = (args2[0] === undefined ? -1 : args2[0]);
  450.             var y = (args2[1] === undefined ? -1 : args2[1]);
  451.             var width = (args2[2] === undefined ? -1 : args2[2]);
  452.             var height = (args2[3] === undefined ? -1 : args2[3]);
  453.             $gameMessage.setChoiceRect(x, y, width, height);
  454.             break;
  455.         case MPPlugin.PluginCommands.ChoiceUnderMessage:
  456.         case 'ChoiceUnderMessage':
  457.             $gameMessage.choiceUnderMes = true;
  458.             break;
  459.     }
  460.     return true;
  461. };

  462. Game_Interpreter.prototype.mppPluginCommandArgs = function(args) {
  463.     var v = $gameVariables._data;
  464.     return args.map(function(arg) {
  465.         try {
  466.             return eval(arg) || 0;
  467.         } catch (e) {
  468.             return arg;
  469.         }
  470.     });
  471. };

  472. //-----------------------------------------------------------------------------
  473. // Window

  474. Window.prototype.isClearWindowRect = function() {
  475.     return true;
  476. };

  477. //-----------------------------------------------------------------------------
  478. // WindowLayer

  479. //7100
  480. Alias.WiLa__canvasClearWindowRect = WindowLayer.prototype._canvasClearWindowRect;
  481. WindowLayer.prototype._canvasClearWindowRect = function(renderSession, window) {
  482.     if (window.isClearWindowRect())
  483.         Alias.WiLa__canvasClearWindowRect.apply(this, arguments);
  484. };

  485. //7162
  486. Alias.WiLa__maskWindow = WindowLayer.prototype._maskWindow;
  487. WindowLayer.prototype._maskWindow = function(window, shift) {
  488.     Alias.WiLa__maskWindow.apply(this, arguments);
  489.     if (!window.isClearWindowRect()) {
  490.         var rect = this._windowRect;
  491.         rect.x = 0;
  492.         rect.y = 0;
  493.         rect.width = 0;
  494.         rect.height = 0;
  495.     }
  496. };

  497. //-----------------------------------------------------------------------------
  498. // Window_ChoiceList

  499. Window_ChoiceList.prototype.isClearWindowRect = function() {
  500.     return !this._underMessage;
  501. };

  502. if (Window_ChoiceList.prototype.hasOwnProperty('close')) {
  503.     Alias.WiChLi_close = Window_ChoiceList.prototype.close
  504. }
  505. Window_ChoiceList.prototype.close = function() {
  506.     if ($gameMessage.isHelp()) this._messageWindow.onShowFast();
  507.     var _super = Alias.WiChLi_close || Window_Command.prototype.close;
  508.     _super.apply(this, arguments);
  509. };

  510. if (Window_ChoiceList.prototype.hasOwnProperty('select')) {
  511.     Alias.WiChli_select = Window_ChoiceList.prototype.select;
  512. }
  513. Window_ChoiceList.prototype.select = function(index) {
  514.     var variableId = $gameMessage._choiceVariableId;
  515.     if (index !== this.index() && variableId > 0) {
  516.         var results = $gameMessage._choiceResults;
  517.         $gameVariables.setValue(variableId, results[index]);
  518.     }
  519.     var _super = Alias.WiChli_select = Window_Command.prototype.select
  520.     _super.apply(this, arguments);
  521. };

  522. //34
  523. Alias.WiChLi_updatePlacement = Window_ChoiceList.prototype.updatePlacement;
  524. Window_ChoiceList.prototype.updatePlacement = function() {
  525.     Alias.WiChLi_updatePlacement.apply(this, arguments);
  526.     if ($gameMessage._choiceWidth >= 0) {
  527.         this.width = Math.min($gameMessage._choiceWidth, Graphics.boxWidth);
  528.     }
  529.     if ($gameMessage._choiceHeight >= 0) {
  530.         this.height = Math.min($gameMessage._choiceHeight, Graphics.boxHeight);
  531.     }
  532.     if ($gameMessage._choiceX >= 0) {
  533.         this.x = Math.min($gameMessage._choiceX, Graphics.boxWidth - this.width);
  534.     }
  535.     if ($gameMessage._choiceY >= 0) {
  536.         this.y = Math.min($gameMessage._choiceY, Graphics.boxHeight - this.height);
  537.     }
  538.     this._underMessage = $gameMessage.choiceUnderMes;
  539. };

  540. //67
  541. Window_ChoiceList.prototype.numVisibleRows = function() {
  542.     return Math.min($gameMessage.choices().length, $gameMessage._choiceMaxRow);
  543. };

  544. //103
  545. Window_ChoiceList.prototype.makeCommandList = function() {
  546.     var choices = $gameMessage.choices();
  547.     var enables = $gameMessage._choiceEnables;
  548.     for (var i = 0; i < choices.length; i++) {
  549.         this.addCommand(choices[i], 'choice', enables[i]);
  550.     }
  551. };

  552. //110
  553. Alias.WiChLi_drawItem = Window_ChoiceList.prototype.drawItem;
  554. Window_ChoiceList.prototype.drawItem = function(index) {
  555.     this.changePaintOpacity(this.isCommandEnabled(index));
  556.     Alias.WiChLi_drawItem.apply(this, arguments);
  557. };

  558. //123
  559. Alias.WiChLi_callOkHandler = Window_ChoiceList.prototype.callOkHandler;
  560. Window_ChoiceList.prototype.callOkHandler = function() {
  561.     Alias.WiChLi_callOkHandler.apply(this, arguments);
  562.     this._messageWindow.forceClear();
  563. };

  564. //129
  565. Alias.WiChLi_callCancelHandler = Window_ChoiceList.prototype.callCancelHandler;
  566. Window_ChoiceList.prototype.callCancelHandler = function() {
  567.     Alias.WiChLi_callCancelHandler.apply(this, arguments);
  568.     this._messageWindow.forceClear();
  569. };

  570. if (Window_ChoiceList.prototype.hasOwnProperty('processCancel')) {
  571.     Alias.WiChLi_processCancel = Window_ChoiceList.prototype.processCancel
  572. }
  573. Window_ChoiceList.prototype.processCancel = function() {
  574.     var type = $gameMessage.choiceCancelType();
  575.     var results = $gameMessage._choiceResults;
  576.     var index = results.indexOf(results[type]);
  577.     if (this.isCancelEnabled() && index !== type && !this.isCommandEnabled(index)) {
  578.         this.playBuzzerSound();
  579.     } else {
  580.         var _super = Alias.WiChLi_processCancel || Window_Command.prototype.processCancel;
  581.         _super.apply(this, arguments);
  582.     }
  583. };

  584. Window_ChoiceList.prototype.callUpdateHelp = function() {
  585.     if (this.active && this._messageWindow && $gameMessage.isHelp())
  586.         this.updateHelp();
  587. };

  588. Window_ChoiceList.prototype.updateHelp = function() {
  589.     this._messageWindow.forceClear();
  590.     var texts = $gameMessage._helpTexts[this.index()];
  591.     $gameMessage._texts = texts ? texts.clone() : [''];
  592.     this._messageWindow.startMessage();
  593. };


  594. //-----------------------------------------------------------------------------
  595. // Window_Message

  596. //109
  597. Alias.WiMe_updatePlacement = Window_Message.prototype.updatePlacement;
  598. Window_Message.prototype.updatePlacement = function() {
  599.     Alias.WiMe_updatePlacement.apply(this, arguments);
  600.     this.clearUnderChoice();
  601. };

  602. Window_Message.prototype.clearUnderChoice = function() {
  603.     if ($gameMessage.choiceUnderMes) {
  604.         var x = this.x + this.standardPadding();
  605.         x += this._textState.left || 0;
  606.         var y = this.y + 4;
  607.         var height = this.windowHeight();
  608.         $gameMessage.setChoiceRect(x, y, -1, height);
  609.     }
  610. };

  611. if (Window_Message.prototype.hasOwnProperty('processNewLine')) {
  612.     Alias.WiMe_processNewLine = Window_Message.prototype.processNewLine;
  613. }
  614. Window_Message.prototype.processNewLine = function(textState) {
  615.     if ($gameMessage.choiceUnderMes) $gameMessage.shiftLine(textState.height);
  616.     var _super = Alias.WiMe_processNewLine || Window_Base.prototype.processNewLine;
  617.     _super.apply(this, arguments);
  618. };

  619. //149
  620. Alias.WiMe_updateInput = Window_Message.prototype.updateInput;
  621. Window_Message.prototype.updateInput = function() {
  622.     if ($gameMessage.isHelp() && this._textState) return false;
  623.     return Alias.WiMe_updateInput.apply(this, arguments);
  624. };

  625. //196
  626. Alias.WiMe_onEndOfText = Window_Message.prototype.onEndOfText;
  627. Window_Message.prototype.onEndOfText = function() {
  628.     if ($gameMessage.isHelp() && !this._choiceWindow.active) {
  629.         this.startInput();
  630.     } else {
  631.         Alias.WiMe_onEndOfText.apply(this, arguments);
  632.     }
  633. };

  634. //207
  635. Alias.WiMe_startInput = Window_Message.prototype.startInput;
  636. Window_Message.prototype.startInput = function() {
  637.     if (this._choiceWindow.active) return true;
  638.     if ($gameMessage.isChoice() && $gameMessage.choiceUnderMes)
  639.         $gameMessage.shiftLine(this._textState.height);
  640.     return Alias.WiMe_startInput.apply(this, arguments);
  641. };

  642. Window_Message.prototype.forceClear = function() {
  643.     this._textState = null;
  644.     this.close();
  645.     this._goldWindow.close();
  646. };

  647. Window_Message.prototype.onShowFast = function() {
  648.     this._showFast = true;
  649. };

  650. //243
  651. Alias.WiMe_newPage = Window_Message.prototype.newPage;
  652. Window_Message.prototype.newPage = function(textState) {
  653.     Alias.WiMe_newPage.apply(this, arguments);
  654.     this.clearUnderChoice();
  655. };






  656. })();
复制代码

http://woodpenguin.web.fc2.com/MV_Plugin/MPP_ChoiceEX.html
    通常6つまでしか表示できない選択肢を、無制限に拡張できます。
通常最多只能顯示6個選項可以無限擴展。
    スイッチや変数などによる条件で、その選択肢の有無を設定できます。
您可以根據開關和變量等條件設置該選項是否可用。
    選択肢ウィンドウの表示位置を一時的に変更することができます。
可以臨時更改選項窗口的顯示位置
    条件を設定することで、その項目を半透明にして選択不可にすることができます。
通過設置條件,您可以使項目半透明而不可選擇。

回复 1 0

使用道具 举报

梦石
0
星屑
3341
在线时间
469 小时
注册时间
2014-2-6
回帖
217
 楼主| 发表于 2019-9-9 11:31:01 | 显示全部楼层
tseyik 发表于 2019-9-9 11:21
[fold=選択肢拡張(ver. 3.10)]//====================================================================== ...

Thanks♪(・ω・)ノ
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2019-9-9 19:22:16 | 显示全部楼层
説明
◆選択肢を繋げて項目数を増やす

    『選択肢の表示』を続けて配置すると、一つの選択肢にまとめられます。
    まとめたくない場合は、間に注釈などを入れることで通常通り分けることができます。
    『デフォルト』の処理は、なし以外を設定したものが適用されます。
    『デフォルト』の処理が複数ある場合、後に設定された選択肢のものが適用されます。
    『キャンセル』の処理は、禁止以外を設定したものが適用されます。
    『キャンセル』の処理が複数ある場合、後に設定された選択肢のものが適用されます。

◆条件によって、項目を表示させない

    選択肢の文章中に if(条件) と書くことで、その条件が偽になると項目が表示されなくなります。
    s でスイッチを参照できます。
    (例: if(s[3]) でスイッチ番号 3 が ON のとき項目が表示されます)
    v で変数を参照できます。
    (例 : if(v[5] >= 4) で変数番号 5 が 4 以上のとき項目が表示されます)
    この機能により『デフォルト』や『キャンセル』の項目が表示されない場合、なしや禁止と同じ処理をします。

◆条件によって、項目を半透明で表示する

    選択肢の文章中に en(条件) と書くことで、 その条件が偽になると項目が半透明で表示されます。
    「項目を表示させない方法」との併用は可能です。
    条件については、「項目を表示させない方法」と同じです。
    半透明の項目を選択すると、ブザーが鳴ります。
    この機能により「キャンセルの場合」の項目が半透明で表示された場合、ブザーが鳴ります。

◆選択肢ウィンドウの位置を変更する

    プラグインコマンドにて以下のコマンドを実行すると、選択肢ウィンドウの表示位置を一時的に変更することが出来ます。

    プラグインコマンド         説明
    ChoicePos x y[ row]         x : 選択肢ウィンドウの X 座標 (-1でデフォルト値)
    y : 選択肢ウィンドウの Y 座標 (-1でデフォルト値)
    row : 選択肢ウィンドウの最大表示行数
       (未設定の場合、すべて表示)
    ChoiceRect x y[ width[ height]]         x : 選択肢ウィンドウの X 座標 (-1でデフォルト値)
    y : 選択肢ウィンドウの Y 座標 (-1でデフォルト値)
    width : 選択肢ウィンドウの幅 (-1でデフォルト値)
    height : 選択肢ウィンドウの高さ (-1でデフォルト値)
    ※[]内は表記しなくても動作します。

    選択肢ウィンドウの位置変更は、指定した後の一度のみ適用されます。
    メッセージウィンドウと選択肢ウィンドウを同時に表示する場合、【文章の表示】の前に実行してください。

◆選択肢のカーソル初期位置の指定と保存

    プラグインコマンドにて以下のコマンドを実行すると、選択肢ウィンドウのデフォルト位置を変数の値にして、
    選択肢が変更されるたびにその位置を変数に入れます。

    プラグインコマンド         説明
    ChoiceVariableId n         n : 変数番号

    カーソル位置は最初の選択肢が上から0~5、次の選択肢は10~15と、選択肢毎に+10されます。
    メッセージウィンドウと選択肢ウィンドウを同時に表示する場合、【文章の表示】の前に実行してください。

◆選択肢にヘルプを表示する

    各選択肢の分岐の下に注釈で選択肢ヘルプと書くと、
    続きの注釈を項目のヘルプメッセージとしてカーソルを合わせたときに標示させることができます。

        →        

    ヘルプメッセージの表示にはメッセージウィンドウを使用しています。
    よって選択肢直前の【文章の表示】は無視されます。
    選択肢ヘルプがどの選択肢にも設定されていない場合、通常通りの動作をします。
    一つでも設定されていれば、メッセージウィンドウは選択肢ヘルプの表示に使用されます。
    【文章の表示】と同じ機能を使用しているため、制御文字が使用できます。
    ただし、\! と \^ は使用できません。
回复

使用道具 举报

梦石
0
星屑
3341
在线时间
469 小时
注册时间
2014-2-6
回帖
217
 楼主| 发表于 2019-9-9 21:54:28 | 显示全部楼层
tseyik 发表于 2019-9-9 19:22
説明
◆選択肢を繋げて項目数を増やす

想问一下怎么用来着............就是选择不同物品的选项有不同的事件执行,而不是选择第一个选项就执行第一个选项,选择第二个选项就执行第二个选项.
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2019-9-10 09:12:41 | 显示全部楼层
本帖最后由 tseyik 于 2019-9-10 09:14 编辑
天空娃娃 发表于 2019-9-9 21:54
想问一下怎么用来着............就是选择不同物品的选项有不同的事件执行,而不是选择第一个选项就执行第 ...


例(VA版,MV版一様)
choice_ex3.jpg choice_ex4.jpg
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部