查看: 35847|回复: 66

[原创发布] 【玩家|事件吹出气泡式对话框】ver 1.0

[复制链接]

无限の剣制

梦石
0
星屑
10460
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2015-12-18 01:12:06 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2015-12-19 01:23 编辑

仿VA的 Yami Engine Ace - Pop Message 写的插件。没有做过多的测试,如果有什么奇怪的bug欢迎报告
使用方法见插件说明,对话内容中使用\bm[ID](事件) 或者\bmf[ID] (角色) 吹出气泡。
用到的箭头素材最好根据自己对话框的样式自己PS糊一个,我这里提供一个我瞎点的默认窗口用BubbleTag.png      BubbleTag.png      素材是放在 img/system下的
贴几张效果图 QQ图片20151218010741.png QQ图片20151218010746.png QQ图片20151218010749.png QQ图片20151218010753.png QQ图片20151218010755.png

VIPArcher_Bubble_Message.js
  1. //=============================================================================
  2. // VIPArcher_Bubble_Message.js
  3. //=============================================================================
  4. /*:
  5. * @plugindesc VIPArcher_气泡对话框
  6. * @author VIPArcher
  7. *
  8. * @param BubbleTagName
  9. * @desc 使用的气泡箭头素材文件名(请保存在 /img/system文件夹下)
  10. * @default BubbleTag
  11. *
  12. * @param TopMessageReviseY
  13. * @desc 气泡在人物上方时对话框Y轴的修正量(可以为负)
  14. * @default 0
  15. *
  16. * @param TopTagReviseY
  17. * @desc 气泡在人物上方时气泡箭头Y轴的修正量(可以为负)
  18. * @default 0
  19. *
  20. * @param BottomMessageReviseY
  21. * @desc 气泡在人物下方时对话框Y轴的修正量(可以为负)
  22. * @default 0
  23. *
  24. * @param BottomTagReviseY
  25. * @desc 气泡在人物下方时气泡箭头Y轴的修正量(可以为负)
  26. * @default 0
  27. *
  28. * @help 使用\BM[ID]来指定吹出气泡的事件ID。大小写不敏感。
  29. * ID 为 0 时代表本事件,为其他值时代表对应编号ID的事件。
  30. * 请确保吹出气泡的事件是存在的。
  31. *
  32. * 使用\BMF[ID]来指定吹出气泡的角色。大小写不敏感。
  33. * ID 为 0 时代表玩家,为其他值时代表对应编号跟随队员。
  34. * 请确保吹出气泡的角色是存在的。
  35. *
  36. * ver 1.0.0 最后更新于2015/12/19 最新版地址见:
  37. * https://github.com/VIPArcher/RMMV-JS
  38. */
  39. (function() {
  40.     var parameters        = PluginManager.parameters('VIPArcher_Bubble_Message');
  41.     var topTagReviseY        = String(parameters['TopTagReviseY']        || '0');
  42.     var bottomTagReviseY     = String(parameters['BottomTagReviseY']     || '0');
  43.     var topMessageReviseY    = String(parameters['TopMessageReviseY']    || '0');
  44.     var bottomMessageReviseY = String(parameters['BottomMessageReviseY'] || '0');
  45.     var bubbleTagName   =   String(parameters['BubbleTagName']  ||  'BubbleTag');
  46.     function Window_Message_Face() {
  47.         this.initialize.apply(this, arguments);
  48.     };
  49.     Window_Message_Face.prototype = Object.create(Window_Base.prototype);
  50.     Window_Message_Face.prototype.constructor = Window_Message_Face;
  51.     Window_Message_Face.prototype.initialize = function(messageWindow) {
  52.         var width = this.windowWidth();
  53.         var height = this.windowHeight();
  54.         this._messageWindow = messageWindow;
  55.         Window_Base.prototype.initialize.call(this, 0, 0, width, height);
  56.         this._faceBitmap = null;
  57.         this.visible = false;
  58.         this.opacity = 0;
  59.     };
  60.     Window_Message_Face.prototype.windowWidth = function() {
  61.         return 180;
  62.     };
  63.     Window_Message_Face.prototype.windowHeight = function() {
  64.         return 180;
  65.     };
  66.     Window_Message_Face.prototype.updateLoading = function() {
  67.         if (this._faceBitmap) {
  68.             if (ImageManager.isReady()) {
  69.                 this.drawMessageFace();
  70.                 this._faceBitmap = null;
  71.                 return false;
  72.             } else { return true; };
  73.         } else { return false; };
  74.     };
  75.     Window_Message_Face.prototype.loadMessageFace = function() {
  76.         this._faceBitmap = ImageManager.loadFace($gameMessage.faceName());
  77.     };
  78.     Window_Message_Face.prototype.drawMessageFace = function() {
  79.         this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), 0, 0);
  80.     };
  81.     Window_Message_Face.prototype.update = function() {
  82.         Window_Base.prototype.update.call(this);
  83.         this.updateLoading();
  84.         if (this.contentsOpacity < 255) {this.contentsOpacity += 15};
  85.         if (this.move_x >= 0) {
  86.             this.x += 4;
  87.             this.move_x -= 4;
  88.         }
  89.     };
  90.     Window_Message_Face.prototype.setFace = function() {
  91.         this.contents.clear();
  92.         if (!!this._messageWindow && $gameMessage.faceName() != '') {
  93.             this.loadMessageFace();
  94.             this.setPosition();
  95.             this.show();
  96.             this.open();
  97.         } else { this.hide(); };
  98.     };
  99.     Window_Message_Face.prototype.setPosition = function() {
  100.         this.y = this._messageWindow.height - this.windowHeight();
  101.         this.contentsOpacity = 0;
  102.         if (this.face_name != $gameMessage.faceName() || this.face_index != $gameMessage.faceIndex()){
  103.             if (!!this._messageWindow._event_pop_id || this._messageWindow._event_pop_id === 0) {
  104.                 this.x = - 60;
  105.                 this.move_x = 60;
  106.             };
  107.             this.face_name = $gameMessage.faceName();
  108.             this.face_index = $gameMessage.faceIndex();
  109.         };
  110.     };
  111.     var _messageWindowUpdateOpen = Window_Message.prototype.updateOpen;
  112.     Window_Message.prototype.updateOpen = function() {
  113.         if (SceneManager._scene.constructor === Scene_Map) {
  114.             if (this._opening) {
  115.                 this.openness += 32;
  116.                 if (this.isOpen()) {
  117.                     this._opening = false;
  118.                     if (this._messageBubbleTag._isShow) {
  119.                         this._messageBubbleTag.visible = true;
  120.                         this._messageBubbleTag._isShow = false;
  121.                     };
  122.                 };
  123.             };
  124.         } else{
  125.             _messageWindowUpdateOpen.call(this);
  126.         };
  127.     };
  128.     var _messageWindowClose = Window_Message.prototype.close;
  129.     Window_Message.prototype.close = function() {
  130.         _messageWindowClose.call(this);
  131.         if (SceneManager._scene.constructor === Scene_Map) {
  132.             this._messageBubbleTag.visible = false;
  133.             this._faceWindow.contents.clear();
  134.             this._faceWindow.close();
  135.         };
  136.     };
  137.     var _messageWindowInitialize = Window_Message.prototype.initialize
  138.     Window_Message.prototype.initialize = function() {
  139.         _messageWindowInitialize.call(this);
  140.         this._faceWindow = new Window_Message_Face(this);
  141.         this.addChild(this._faceWindow);
  142.     };
  143.     var _messageWindowUpdate = Window_Message.prototype.update
  144.     Window_Message.prototype.update = function() {
  145.         _messageWindowUpdate.call(this);
  146.         if (this._faceWindow) {this._faceWindow.update()};
  147.     };
  148.     var _createMessageWindowBubbleTag = Scene_Map.prototype.createMessageWindow
  149.     Scene_Map.prototype.createMessageWindow = function() {
  150.         _createMessageWindowBubbleTag.call(this);
  151.         var bubbleTag = new Sprite();
  152.         bubbleTag.bitmap = ImageManager.loadSystem(bubbleTagName);
  153.         this._messageWindow._messageBubbleTag = bubbleTag;
  154.         this.addChild(bubbleTag);
  155.         this._messageWindow._messageBubbleTag.visible = false;
  156.     };
  157.     var _convertEscapeCharacters = Window_Message.prototype.convertEscapeCharacters;
  158.     Window_Message.prototype.convertEscapeCharacters = function(text) {
  159.         this.resetWindowMessage();
  160.         text = _convertEscapeCharacters.call(this,text);
  161.         text = text.replace(/\x1bBM\[(\d+)\]/gi, function() {
  162.             return this.event_pop_message_setup(parseInt(arguments[1]));
  163.         }.bind(this));
  164.         text = text.replace(/\x1bBMF\[(\d+)\]/gi, function() {
  165.             return this.event_pop_message_setup(parseInt(arguments[1]), true);
  166.         }.bind(this));
  167.         text = text.replace(/\x1bCBM/gi, function() {
  168.             return this.event_pop_message_setup(false, true);
  169.         }.bind(this));
  170.         return text;
  171.     };
  172.     var _updatePlacement = Window_Message.prototype.updatePlacement;
  173.     Window_Message.prototype.updatePlacement = function() {
  174.         if (SceneManager._scene.constructor === Scene_Map) {
  175.             if (this._event_pop_id === 0){
  176.                 this._character = !!this._follower ? $gamePlayer : $gameMap.event($gameMap._interpreter.eventId());
  177.                 this.popSetPopPlacement(this._character);
  178.             } else if(this._event_pop_id > 0){
  179.                 if (!!this._follower){
  180.                     this._character = $gamePlayer.followers().follower(this._event_pop_id - 1);
  181.                 } else {
  182.                     this._character = $gameMap.event(this._event_pop_id);
  183.                 };  this.popSetPopPlacement(this._character);
  184.             } else {
  185.                 _updatePlacement.call(this);
  186.             };
  187.         } else {
  188.             _updatePlacement.call(this);
  189.         };
  190.         if (this._faceWindow) {
  191.             this._faceWindow.setFace();
  192.         };
  193.     };
  194.     Window_Message.prototype.resetWindowMessage = function(){
  195.         this.x = 0;
  196.         this._follower = false;
  197.         this._character = false;
  198.         this._event_pop_id = false;
  199.         this.width  = this.windowWidth();
  200.         this.height = this.windowHeight();
  201.     }
  202.     Window_Message.prototype.event_pop_message_setup = function(event_id, follower) {
  203.         if (follower && !$gamePlayer.followers().follower(event_id - 1)) {
  204.             this._event_pop_id = follower ? 0 : false;
  205.             this._follower = true;
  206.         } else {
  207.             this._event_pop_id = event_id;
  208.             this._follower = follower;
  209.         }; return "";
  210.     };
  211.     Window_Message.prototype.popSetPopPlacement = function(character) {
  212.         this.popcaltextStateHW($gameMessage.allText());
  213.         this._messageBubbleTag._isShow = true;
  214.         var x = character.screenX() - this.width / 2;
  215.         var endX = character.screenX() + this.width / 2;
  216.         this.x = x > 0 ? x : 0;
  217.         if(endX > Graphics.boxWidth){ this.x = Graphics.boxWidth - this.width};
  218.         this._bubblePosTag = character.screenY() > Graphics.boxHeight / 2 ? true : false;
  219.         if (this._bubblePosTag) {
  220.             this.y = character.screenY() - this.height - 60 + parseInt(topMessageReviseY);
  221.             this._messageBubbleTag.y = character.screenY() - 65 + parseInt(topTagReviseY);
  222.         } else{
  223.             this.y = character.screenY() + 14 + parseInt(bottomMessageReviseY);
  224.             this._messageBubbleTag.y = character.screenY() + parseInt(bottomTagReviseY);
  225.         };
  226.         this.setBubbleTag(character);
  227.     };
  228.     Window_Message.prototype.setBubbleTag = function(character) {
  229.         var width = this._messageBubbleTag.width;
  230.         var height = this._messageBubbleTag.bitmap.height / 2;
  231.         var y = !this._bubblePosTag ? height : 0;
  232.         this._opening = true;
  233.         this._messageBubbleTag.setFrame(0 ,y ,width ,height);
  234.         this._messageBubbleTag.x = character.screenX() - width / 2;
  235.     };
  236.     Window_Message.prototype.popcaltextStateHW = function(text) {
  237.         var leftX = $gameMessage.faceName() === '' ? 0 : 172;
  238.         var textState = { index: 0, x: leftX, y: 0, width: 0, left: leftX };
  239.         textState.text = this.convertEscapeCharacters(text);
  240.         textState.y = this.calcTextHeight(textState, false);
  241.         while (textState.index < textState.text.length) {
  242.             this.popReadCharacter(textState);
  243.         };
  244.         this.resetFontSettings();
  245.         this.height = textState.height + 36;
  246.         this.width  = textState.width  + 36;
  247.     };
  248.     Window_Message.prototype.popReadCharacter = function(textState) {
  249.         switch (textState.text[textState.index]) {
  250.         case '\n':
  251.             textState.x = textState.left;
  252.             textState.y += this.calcTextHeight(textState, false);
  253.             textState.index++;
  254.             break;
  255.         case '\f':
  256.              textState.index++;
  257.             break;
  258.         case '\x1b':
  259.             switch (this.obtainEscapeCode(textState)){
  260.             case 'C':
  261.                 this.obtainEscapeParam(textState);
  262.                 break;
  263.             case 'I':
  264.                 this.obtainEscapeParam(textState);
  265.                 textState.x += Window_Base._iconWidth + 4;
  266.                 break;
  267.             case '{':
  268.                 if (this.contents.fontSize <= 96) { this.contents.fontSize += 12; };
  269.                 break;
  270.             case '}':
  271.                 if (this.contents.fontSize >= 24) { this.contents.fontSize -= 12; };
  272.                 break;
  273.             };
  274.             break;
  275.         default:
  276.             textState.x += this.textWidth(textState.text[textState.index++]);
  277.             textState.width = textState.width > textState.x ? textState.width : textState.x;
  278.             textState.height = textState.height > textState.y ? textState.height : textState.y;
  279.             break;
  280.         };
  281.     };
  282.     var _drawMessageFace = Window_Message.prototype.drawMessageFace;
  283.     Window_Message.prototype.drawMessageFace = function(){};
  284. })();
复制代码

VIPArcher_Bubble_Message.zip

6.52 KB, 下载次数: 1901

点评

请求扩展功能,对话固定朝向,固定在上方,  发表于 2016-3-18 19:07

评分

参与人数 11星屑 +322 梦石 +1 赞 +5 收起 理由
18259284791 + 1 精品文章
monvshuzi + 1 塞糖
水母书亚 + 1 塞糖
2256538860 + 1 king大大的请求被无情无视······.
congwsbn + 1 塞糖
79160475 + 30 精品文章
king + 96 塞糖
c248611 + 30 塞糖
黑白界 + 100 bug已修复
MeowSnow + 66 (¬(ェ)¬)VIP菊苣都不教窝

查看全部评分

梦石
0
星屑
50
在线时间
69 小时
注册时间
2015-10-25
回帖
34
发表于 2015-12-18 10:38:20 | 显示全部楼层
这个一定要顶一下的
回复

使用道具 举报

梦石
0
星屑
60
在线时间
77 小时
注册时间
2015-12-10
回帖
14
发表于 2015-12-18 14:42:36 | 显示全部楼层
字体大小在哪改? 被无效化了

点评

不是\}和\{么  发表于 2015-12-18 14:54
回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-12-18 15:32:58 | 显示全部楼层
好东西!
回复

使用道具 举报

梦石
0
星屑
55
在线时间
89 小时
注册时间
2010-10-5
回帖
56
发表于 2015-12-18 19:55:46 | 显示全部楼层
有两个箭头,怎么去掉那个

点评

什么情况?能发个截图么?我测试的时候没有出现两个箭头的情况,【应该也不会出现吧?  发表于 2015-12-18 23:11
回复

使用道具 举报

梦石
0
星屑
701
在线时间
511 小时
注册时间
2012-4-8
回帖
193
发表于 2015-12-19 00:52:45 | 显示全部楼层
本帖最后由 黑白界 于 2015-12-19 01:02 编辑

战斗失败后,出现undefined的错误
QQ截图20151219005145.png

其他插件,和战斗有关的只有Yep

如果关闭所有其他插件,只留这个,进入战斗就会报错

点评

感谢反馈,已修正。请再测试一下?  发表于 2015-12-19 01:21
武侠|养成|战棋游戏《以武证道》头秃开发中...
开发日记在此
回复

使用道具 举报

梦石
0
星屑
60
在线时间
77 小时
注册时间
2015-12-10
回帖
14
发表于 2015-12-20 11:56:59 | 显示全部楼层
\bmf的ID能改成对应角色里的ID的而不是对应队伍里的ID吗? 一该队形,白设置了bmf还负面效果了

点评

请问怎么获取指定角色在队伍中的位置  发表于 2017-7-1 20:34
例如对话前判断一下你要说话的角色在队伍中的位置,然后把他赋值给变量1,然后对话可以这样写\bmf[\v[1]]队员说话中  发表于 2015-12-20 12:36
其实这是没必要的,虽然我在帮助里没说明,不过你可以试试\bmf的ID其实是可以使用变量的。  发表于 2015-12-20 12:35

评分

参与人数 1赞 +1 收起 理由
2256538860 + 1 塞糖

查看全部评分

回复 0 1

使用道具 举报

梦石
0
星屑
166
在线时间
630 小时
注册时间
2012-6-9
回帖
1233
发表于 2015-12-20 13:24:37 | 显示全部楼层
ddhkandy 发表于 2015-12-18 19:55
有两个箭头,怎么去掉那个

搜狗截图20151220132727.png

他是想说这个吧。

点评

=。=上面那个是等待按键输入。为啥要去掉@ddhkandy  发表于 2015-12-20 13:37
回复

使用道具 举报

梦石
0
星屑
237
在线时间
76 小时
注册时间
2015-9-3
回帖
6
发表于 2015-12-20 16:16:17 | 显示全部楼层
本帖最后由 余烬之中 于 2015-12-20 16:38 编辑



QQ已删除
有问题请直接回复内容 啥都不说只留个QQ是闹哪样
[
回复

使用道具 举报

梦石
0
星屑
29220
在线时间
1535 小时
注册时间
2006-1-10
回帖
1898

开拓者第一届地图绘制大赛RTP组第四名

发表于 2016-3-16 15:08:40 | 显示全部楼层
本帖最后由 king 于 2016-3-31 20:26 编辑

用起来很方便! 特别喜欢小箭头
@VIPArcher

1.请求扩展功能,对话固定朝向,固定在上方,
因为一些剧情需要,需要自动执行对话,对话会朝向下方

2.选项窗口的位置很奇怪,主要是位置上下的问题,默认功能(左、中、右)有时会偏在上方,有时偏在下方,很奇怪!
   会受角色在画面位置影响




MV帮助 http://miaowm5.github.io/RMMV-F1/日复一日,年复一年人还是保留一点自我兴趣的好啊~~~忘记过去 ,这样我就可以  放弃未来了……哭~~终于找回以前的头像了,哎~~原来我是那么的想念阿……
画地图没灵感?很烦?很无聊 【 戳 我 】一 大 波 地 图 在 等 你  \^0^/
我的游戏
回复 3 0

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部