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

Project1

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

[原创发布] 自动战斗插件

[复制链接]

Lv2.观梦者

梦石
0
星屑
256
在线时间
214 小时
注册时间
2008-12-18
帖子
44
跳转到指定楼层
1
发表于 2018-9-13 23:14:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 魏玉龙 于 2018-9-14 17:17 编辑

玩别人做的游戏时,刷野怪有点疲了,就随手写了个自动战斗插件!需要的尽管拿去!

JAVASCRIPT 代码复制下载
  1. /*:
  2.  * AutoBattle.js
  3.  * @plugindesc 自动战斗
  4.  * @author 魏玉龙
  5.  * @since 2018.09.12
  6.  * @version 1.0
  7.  *
  8.  * @param enabled
  9.  * @desc 开启自动战斗
  10.  * @default true
  11.  *
  12.  * @param command
  13.  * @desc 命令显示文字
  14.  * @default 自动
  15.  *
  16.  * @param continous
  17.  * @desc 是否连续的自动战斗
  18.  * @default false
  19.  *
  20.  * @param skipMessage
  21.  * @desc 跳过战斗中的消息
  22.  * @default false
  23.  *
  24.  * @help
  25.  * 此插件提供以下插件命令:
  26.  *
  27.  * AutoBattle enable
  28.  *   开启自动战斗
  29.  *
  30.  * AutoBattle disable
  31.  *   关闭自动战斗
  32.  *
  33.  * AutoBattle continous true/false
  34.  *   是否开启连续的自动战斗
  35.  *
  36.  * AutoBattle skipMessage true/false
  37.  *   是否跳过战斗中的消息
  38.  *
  39.  */
  40.  
  41. (function () {
  42.   var parameters = PluginManager.parameters('AutoBattle');
  43.   var autoBattle = {
  44.     enabled: JSON.parse(parameters['enabled'] || true),
  45.     command: String(parameters['command'] || '自动'),
  46.     continous: JSON.parse(parameters['continous'] || false),
  47.     skipMessage: JSON.parse(parameters['skipMessage'] || false)
  48.   };
  49.  
  50.   var Game_Temp_prototype_initialize = Game_Temp.prototype.initialize;
  51.   Game_Temp.prototype.initialize = function () {
  52.     Game_Temp_prototype_initialize.call(this);
  53.     this._continousAutoBattle = false;
  54.   };
  55.  
  56.   var Scene_Battle_prototype_update = Scene_Battle.prototype.update;
  57.   Scene_Battle.prototype.update = function () {
  58.     Scene_Battle_prototype_update.call(this);
  59.     if ($gameTemp._continousAutoBattle && (Input.isTriggered('escape') || Input.isTriggered('cancel'))) {
  60.       SoundManager.playCancel();
  61.       $gameTemp._continousAutoBattle = false;
  62.     }
  63.   }
  64.  
  65.   var Scene_Battle_prototype_createAllWindows = Scene_Battle.prototype.createAllWindows;
  66.   Scene_Battle.prototype.createAllWindows = function () {
  67.     if (!autoBattle.continous) {
  68.       $gameTemp._continousAutoBattle = false;
  69.     }
  70.     Scene_Battle_prototype_createAllWindows.call(this);
  71.   };
  72.  
  73.   var Scene_Battle_prototype_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
  74.   Scene_Battle.prototype.createPartyCommandWindow = function () {
  75.     Scene_Battle_prototype_createPartyCommandWindow.call(this);
  76.     if (autoBattle.enabled) {
  77.       this._partyCommandWindow.setHandler('auto', this.commandAutoBattle.bind(this));
  78.     }
  79.   };
  80.  
  81.   var Scene_Battle_prototype_startPartyCommandSelection = Scene_Battle.prototype.startPartyCommandSelection;
  82.   Scene_Battle.prototype.startPartyCommandSelection = function () {
  83.     if ($gameTemp._continousAutoBattle && !SceneManager.isSceneChanging()) {
  84.       this.commandAutoBattle.call(this);
  85.     } else {
  86.       Scene_Battle_prototype_startPartyCommandSelection.call(this)
  87.     }
  88.   };
  89.   Scene_Battle.prototype.commandAutoBattle = function () {
  90.     $gameParty.battleMembers().forEach(function (member) {
  91.       if (member.canInput()) {
  92.         member.makeAutoBattleActions();
  93.       }
  94.     });
  95.     $gameTemp._continousAutoBattle = true;
  96.     this._partyCommandWindow.deactivate();
  97.     BattleManager.startTurn();
  98.   };
  99.   Scene_Battle.prototype.refreshAutobattlerStatusWindow = function () {
  100.     $gameParty.battleMembers().forEach(function (member) {
  101.       if (member.isAutoBattle()) {
  102.         this._statusWindow.drawItem(member.index)
  103.       }
  104.     });
  105.   };
  106.  
  107.   var Window_Message_prototype_startPause = Window_Message.prototype.startPause;
  108.   Window_Message.prototype.startPause = function () {
  109.     if ($gameParty.inBattle() && $gameTemp._continousAutoBattle && autoBattle.skipMessage) {
  110.       this.terminateMessage();
  111.     } else {
  112.       Window_Message_prototype_startPause.call(this);
  113.     }
  114.   }
  115.  
  116.   var Window_PartyCommand_prototype_makeCommandList = Window_PartyCommand.prototype.makeCommandList;
  117.   Window_PartyCommand.prototype.makeCommandList = function () {
  118.     Window_PartyCommand_prototype_makeCommandList.call(this);
  119.     if (autoBattle.enabled) {
  120.       this.addCommand(autoBattle.command, 'auto');
  121.     }
  122.   };
  123.  
  124.   var Game_Interpreter_prototype_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  125.   Game_Interpreter.prototype.pluginCommand = function (command, args) {
  126.     Game_Interpreter_prototype_pluginCommand.call(this, command, args);
  127.     if (command === "AutoBattle") {
  128.       switch (args) {
  129.         case 'enable':
  130.           autoBattle.enabled = true;
  131.           break
  132.         case 'disable':
  133.           autoBattle.enabled = false;
  134.           break
  135.         case 'continous':
  136.           autoBattle.continous = JSON.parse(args[1]);
  137.           break
  138.         case 'skipMessage':
  139.           autoBattle.continous = JSON.parse(args[1]);
  140.           break
  141.       }
  142.     }
  143.   };
  144. })();

评分

参与人数 2+2 收起 理由
heipai + 1 精品文章
白嫩白嫩的 + 1 塞糖

查看全部评分

Lv3.寻梦者

梦石
0
星屑
3074
在线时间
685 小时
注册时间
2018-6-1
帖子
272
2
发表于 2018-9-13 23:25:09 | 只看该作者
不会用                 
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
256
在线时间
214 小时
注册时间
2008-12-18
帖子
44
3
 楼主| 发表于 2018-9-13 23:28:55 | 只看该作者
下载后扔到插件目录里,在插件管理器里启用就行了,这很难么?

点评

原来如此 照做了 谢谢  发表于 2018-9-13 23:30
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5692
在线时间
1556 小时
注册时间
2011-6-14
帖子
520
4
发表于 2018-9-13 23:57:00 | 只看该作者
话说我想问下和游戏自带的自动战斗有什么不同吗
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
256
在线时间
214 小时
注册时间
2008-12-18
帖子
44
5
 楼主| 发表于 2018-9-14 00:04:08 | 只看该作者
347780682 发表于 2018-9-13 23:57
话说我想问下和游戏自带的自动战斗有什么不同吗

效果类似梦幻西游那样的游戏挂自动刷经验
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7417
在线时间
947 小时
注册时间
2017-9-27
帖子
583
6
发表于 2018-9-15 10:56:58 | 只看该作者
我以为可以自由设置自动战斗的AI,看代码是不能。

点评

你想多了  发表于 2018-9-15 11:00
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
14219
在线时间
718 小时
注册时间
2011-7-16
帖子
1428

开拓者

7
发表于 2018-9-17 16:26:46 | 只看该作者
不错的插件,看来mv生态日益强大啊
RMMV网络插件,开源免费,内含服务器端,无需强制登录,云数据,弹幕,云存档,排名,兑换码,版本检测,可自由上架下架删除。q群399090587
免打包运行MV游戏,云游戏,安卓App雷神游戏厅,在线玩游戏,上传下载游戏
开源游戏:重装机兵之重装归来【RMMV制作】全球首款按照美剧分季分集的方式发布的游戏
体素画 -- MV画3D像素图的画板
RMMV显示3D模型和场景的插件
RMMV显示spine骨骼动画的插件
RMMV秘密通道插件
突破敌群数量上限8个的插件
在rmmv中显示gif动态图片的插件
一款可以在mv游戏界面的任意位置显示任意文字的插件
RMMV Toast 插件 带物品得失提示,可以设置开启关闭 兼容yep itemcore
制作一个改名卡道具插件、调整标题页面菜单的插件、在标题页面之前显示大段文字的插件、标题页面显示版本号的插件
物品得失自动提示自动上色自动换行插件
我的Q群 663889472
另外,我的插件、范例、游戏都在这里
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
287
在线时间
33 小时
注册时间
2018-9-30
帖子
28
8
发表于 2018-10-2 17:59:06 | 只看该作者
有没有跳过战斗动画的插件,就是和怪物战斗立马出结果的。
每个问题的答案,都在你灵魂深处
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
256
在线时间
214 小时
注册时间
2008-12-18
帖子
44
9
 楼主| 发表于 2018-10-3 10:07:20 | 只看该作者
yushao1999 发表于 2018-10-2 17:59
有没有跳过战斗动画的插件,就是和怪物战斗立马出结果的。

嗯,我也有这个意思,自动战斗还是有点浪费时间了,想做一个直接结束战斗的调试插件!
但问题是,有些战斗里是有剧情对话和一些变量处理的,甚至可能有选项什么的!
直接pass掉有点不合适,还没想好怎么处理。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
151
在线时间
99 小时
注册时间
2018-1-8
帖子
12
10
发表于 2018-12-8 01:15:01 | 只看该作者
能不能分享一下直接跳过战斗的插件啊,中间过程不用管的那种
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 13:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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