查看: 4138|回复: 8

[有事请教] 如何在菜单里增加一个自定义选项

[复制链接]
梦石
0
星屑
1295
在线时间
368 小时
注册时间
2016-6-10
回帖
32
发表于 2020-8-28 15:10:19 | 显示全部楼层 |阅读模式

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

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

×
请问怎样才可以在菜单里增加一个公共事件的选项.
梦石
0
星屑
3930
在线时间
1198 小时
注册时间
2016-8-9
回帖
2355

开拓者

发表于 2020-8-28 20:19:44 | 显示全部楼层
酸酸甜甜就④哇噢
回复

使用道具 举报

梦石
0
星屑
1737
在线时间
123 小时
注册时间
2023-12-26
回帖
184
发表于 2024-3-23 14:03:59 | 显示全部楼层

大佬,小白们不会用,能不能弄一个插件出来和图片备注图片教程说明。
回复

使用道具 举报

梦石
0
星屑
546
在线时间
59 小时
注册时间
2017-8-23
回帖
6
发表于 2024-3-23 14:49:34 | 显示全部楼层
本帖最后由 LifeGame 于 2024-3-23 14:52 编辑
djs789783 发表于 2024-3-23 14:03
大佬,小白们不会用,能不能弄一个插件出来和图片备注图片教程说明。


你可以用站内drill大佬写的插件,或者我下面写的这个
以下内容部分由AI生成

  1. Window_MenuCommand.prototype.addOriginalCommands = function() {
  2.     this.addCommand('YourNewButtonName', 'yourNewButtonSymbol', true);  // 添加一个新的菜单按钮
  3. };

  4. var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
  5. Scene_Menu.prototype.createCommandWindow = function () {
  6.     _Scene_Menu_createCommandWindow.call(this);

  7.     this._commandWindow.setHandler('yourNewButtonSymbol', this.commandYourNewButton.bind(this));  // 添加按钮的事件处理程序
  8. };

  9. Scene_Menu.prototype.commandYourNewButton = function() {
  10.     SceneManager.pop();
  11.     $gameTemp.reserveCommonEvent(事件ID);
  12. };
复制代码

点评

addOriginalCommands也是需要别名的哦~  发表于 2024-3-23 16:34
回复

使用道具 举报

梦石
0
星屑
1737
在线时间
123 小时
注册时间
2023-12-26
回帖
184
发表于 2024-3-24 08:16:54 | 显示全部楼层
LifeGame 发表于 2024-3-23 14:49
你可以用站内drill大佬写的插件,或者我下面写的这个
以下内容部分由AI生成
...

谢谢你,。。。。还是不会。。。脚本要怎么变插件???
回复

使用道具 举报

梦石
0
星屑
546
在线时间
59 小时
注册时间
2017-8-23
回帖
6
发表于 2024-3-24 10:39:48 | 显示全部楼层
djs789783 发表于 2024-3-24 08:16
谢谢你,。。。。还是不会。。。脚本要怎么变插件???


你最好是用Drill大佬的插件,大佬写的插件功能齐全的多。
如果你实在不想用大佬的就直接下载我下面这个
  1. /*:
  2. * @plugindesc 调试1
  3. * @author: lh
  4. *
  5. * @param ggsj
  6. * @text 公共事件ID
  7. * @desc 公共事件ID
  8. * 默认值:1
  9. * @default 1
  10. *
  11. * @param anmz
  12. * @text 按钮名字
  13. * @desc 按钮名字
  14. * 默认值:1
  15. * @default 1
  16. *
  17. * @param anbq
  18. * @text 按钮标签
  19. * @desc 按钮标签
  20. * 默认值:1
  21. * @default 1
  22. */
  23. var params = PluginManager.parameters("TS_1");
  24. var ggsj = Number(params["ggsj"]) || 1;
  25. var anmz = (params["anmz"]) || 1;
  26. var anbq = (params["anbq"]) || 1;

  27. var _Scene_Menu_NewButton = Window_MenuCommand.prototype.addOriginalCommands;
  28. Window_MenuCommand.prototype.addOriginalCommands = function() {
  29.     _Scene_Menu_NewButton.call(this);
  30.     this.addCommand(anmz, anbq, true);  // 添加一个新的菜单按钮
  31. };

  32. var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
  33. Scene_Menu.prototype.createCommandWindow = function () {
  34.     _Scene_Menu_createCommandWindow.call(this);
  35.     this._commandWindow.setHandler(anbq, this.commandYourNewButton.bind(this));  // 添加按钮的事件处理程序
  36. };

  37. Scene_Menu.prototype.commandYourNewButton = function() {
  38.     SceneManager.pop();
  39.     $gameTemp.reserveCommonEvent(ggsj); // 关闭菜单并执行公共事件
  40. };
复制代码
回复

使用道具 举报

梦石
0
星屑
1737
在线时间
123 小时
注册时间
2023-12-26
回帖
184
发表于 2024-3-24 11:20:21 | 显示全部楼层
LifeGame 发表于 2024-3-24 10:39
你最好是用Drill大佬的插件,大佬写的插件功能齐全的多。
如果你实在不想用大佬的就直接下载我下面这个/* ...

脚本代码下载了,要怎么改插件?我用MV啊,是插件,你这代码要怎么写入插件????我有你这代码也不会用啊。我
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部