查看: 35093|回复: 66

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

[复制链接]

无限の剣制

梦石
0
星屑
10445
在线时间
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下的
[fold=贴几张效果图] QQ图片20151218010741.png QQ图片20151218010746.png QQ图片20151218010749.png QQ图片20151218010753.png QQ图片20151218010755.png [/fold]
[fold=VIPArcher_Bubble_Message.js][pre lang="JAVASCRIPT" file="VIPArcher_Bubble_Message.js"]//=============================================================================
// VIPArcher_Bubble_Message.js
//=============================================================================
/*:
* @plugindesc VIPArcher_气泡对话框
* @author VIPArcher
*
* @param BubbleTagName
* @desc 使用的气泡箭头素材文件名(请保存在 /img/system文件夹下)
* @default BubbleTag
*
* @param TopMessageReviseY
* @desc 气泡在人物上方时对话框Y轴的修正量(可以为负)
* @default 0
*
* @param TopTagReviseY
* @desc 气泡在人物上方时气泡箭头Y轴的修正量(可以为负)
* @default 0
*
* @param BottomMessageReviseY
* @desc 气泡在人物下方时对话框Y轴的修正量(可以为负)
* @default 0
*
* @param BottomTagReviseY
* @desc 气泡在人物下方时气泡箭头Y轴的修正量(可以为负)
* @default 0
*
* @help 使用\BM[ID]来指定吹出气泡的事件ID。大小写不敏感。
* ID 为 0 时代表本事件,为其他值时代表对应编号ID的事件。
* 请确保吹出气泡的事件是存在的。
*
* 使用\BMF[ID]来指定吹出气泡的角色。大小写不敏感。
* ID 为 0 时代表玩家,为其他值时代表对应编号跟随队员。
* 请确保吹出气泡的角色是存在的。
*
* ver 1.0.0 最后更新于2015/12/19 最新版地址见:
* https://github.com/VIPArcher/RMMV-JS
*/
(function() {
    var parameters        = PluginManager.parameters('VIPArcher_Bubble_Message');
    var topTagReviseY        = String(parameters['TopTagReviseY']        || '0');
    var bottomTagReviseY     = String(parameters['BottomTagReviseY']     || '0');
    var topMessageReviseY    = String(parameters['TopMessageReviseY']    || '0');
    var bottomMessageReviseY = String(parameters['BottomMessageReviseY'] || '0');
    var bubbleTagName   =   String(parameters['BubbleTagName']  ||  'BubbleTag');
    function Window_Message_Face() {
        this.initialize.apply(this, arguments);
    };
    Window_Message_Face.prototype = Object.create(Window_Base.prototype);
    Window_Message_Face.prototype.constructor = Window_Message_Face;
    Window_Message_Face.prototype.initialize = function(messageWindow) {
        var width = this.windowWidth();
        var height = this.windowHeight();
        this._messageWindow = messageWindow;
        Window_Base.prototype.initialize.call(this, 0, 0, width, height);
        this._faceBitmap = null;
        this.visible = false;
        this.opacity = 0;
    };
    Window_Message_Face.prototype.windowWidth = function() {
        return 180;
    };
    Window_Message_Face.prototype.windowHeight = function() {
        return 180;
    };
    Window_Message_Face.prototype.updateLoading = function() {
        if (this._faceBitmap) {
            if (ImageManager.isReady()) {
                this.drawMessageFace();
                this._faceBitmap = null;
                return false;
            } else { return true; };
        } else { return false; };
    };
    Window_Message_Face.prototype.loadMessageFace = function() {
        this._faceBitmap = ImageManager.loadFace($gameMessage.faceName());
    };
    Window_Message_Face.prototype.drawMessageFace = function() {
        this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), 0, 0);
    };
    Window_Message_Face.prototype.update = function() {
        Window_Base.prototype.update.call(this);
        this.updateLoading();
        if (this.contentsOpacity < 255) {this.contentsOpacity += 15};
        if (this.move_x >= 0) {
            this.x += 4;
            this.move_x -= 4;
        }
    };
    Window_Message_Face.prototype.setFace = function() {
        this.contents.clear();
        if (!!this._messageWindow && $gameMessage.faceName() != '') {
            this.loadMessageFace();
            this.setPosition();
            this.show();
            this.open();
        } else { this.hide(); };
    };
    Window_Message_Face.prototype.setPosition = function() {
        this.y = this._messageWindow.height - this.windowHeight();
        this.contentsOpacity = 0;
        if (this.face_name != $gameMessage.faceName() || this.face_index != $gameMessage.faceIndex()){
            if (!!this._messageWindow._event_pop_id || this._messageWindow._event_pop_id === 0) {
                this.x = - 60;
                this.move_x = 60;
            };
            this.face_name = $gameMessage.faceName();
            this.face_index = $gameMessage.faceIndex();
        };
    };
    var _messageWindowUpdateOpen = Window_Message.prototype.updateOpen;
    Window_Message.prototype.updateOpen = function() {
        if (SceneManager._scene.constructor === Scene_Map) {
            if (this._opening) {
                this.openness += 32;
                if (this.isOpen()) {
                    this._opening = false;
                    if (this._messageBubbleTag._isShow) {
                        this._messageBubbleTag.visible = true;
                        this._messageBubbleTag._isShow = false;
                    };
                };
            };
        } else{
            _messageWindowUpdateOpen.call(this);
        };
    };
    var _messageWindowClose = Window_Message.prototype.close;
    Window_Message.prototype.close = function() {
        _messageWindowClose.call(this);
        if (SceneManager._scene.constructor === Scene_Map) {
            this._messageBubbleTag.visible = false;
            this._faceWindow.contents.clear();
            this._faceWindow.close();
        };
    };
    var _messageWindowInitialize = Window_Message.prototype.initialize
    Window_Message.prototype.initialize = function() {
        _messageWindowInitialize.call(this);
        this._faceWindow = new Window_Message_Face(this);
        this.addChild(this._faceWindow);
    };
    var _messageWindowUpdate = Window_Message.prototype.update
    Window_Message.prototype.update = function() {
        _messageWindowUpdate.call(this);
        if (this._faceWindow) {this._faceWindow.update()};
    };
    var _createMessageWindowBubbleTag = Scene_Map.prototype.createMessageWindow
    Scene_Map.prototype.createMessageWindow = function() {
        _createMessageWindowBubbleTag.call(this);
        var bubbleTag = new Sprite();
        bubbleTag.bitmap = ImageManager.loadSystem(bubbleTagName);
        this._messageWindow._messageBubbleTag = bubbleTag;
        this.addChild(bubbleTag);
        this._messageWindow._messageBubbleTag.visible = false;
    };
    var _convertEscapeCharacters = Window_Message.prototype.convertEscapeCharacters;
    Window_Message.prototype.convertEscapeCharacters = function(text) {
        this.resetWindowMessage();
        text = _convertEscapeCharacters.call(this,text);
        text = text.replace(/\x1bBM\[(\d+)\]/gi, function() {
            return this.event_pop_message_setup(parseInt(arguments[1]));
        }.bind(this));
        text = text.replace(/\x1bBMF\[(\d+)\]/gi, function() {
            return this.event_pop_message_setup(parseInt(arguments[1]), true);
        }.bind(this));
        text = text.replace(/\x1bCBM/gi, function() {
            return this.event_pop_message_setup(false, true);
        }.bind(this));
        return text;
    };
    var _updatePlacement = Window_Message.prototype.updatePlacement;
    Window_Message.prototype.updatePlacement = function() {
        if (SceneManager._scene.constructor === Scene_Map) {
            if (this._event_pop_id === 0){
                this._character = !!this._follower ? $gamePlayer : $gameMap.event($gameMap._interpreter.eventId());
                this.popSetPopPlacement(this._character);
            } else if(this._event_pop_id > 0){
                if (!!this._follower){
                    this._character = $gamePlayer.followers().follower(this._event_pop_id - 1);
                } else {
                    this._character = $gameMap.event(this._event_pop_id);
                };  this.popSetPopPlacement(this._character);
            } else {
                _updatePlacement.call(this);
            };
        } else {
            _updatePlacement.call(this);
        };
        if (this._faceWindow) {
            this._faceWindow.setFace();
        };
    };
    Window_Message.prototype.resetWindowMessage = function(){
        this.x = 0;
        this._follower = false;
        this._character = false;
        this._event_pop_id = false;
        this.width  = this.windowWidth();
        this.height = this.windowHeight();
    }
    Window_Message.prototype.event_pop_message_setup = function(event_id, follower) {
        if (follower && !$gamePlayer.followers().follower(event_id - 1)) {
            this._event_pop_id = follower ? 0 : false;
            this._follower = true;
        } else {
            this._event_pop_id = event_id;
            this._follower = follower;
        }; return "";
    };
    Window_Message.prototype.popSetPopPlacement = function(character) {
        this.popcaltextStateHW($gameMessage.allText());
        this._messageBubbleTag._isShow = true;
        var x = character.screenX() - this.width / 2;
        var endX = character.screenX() + this.width / 2;
        this.x = x > 0 ? x : 0;
        if(endX > Graphics.boxWidth){ this.x = Graphics.boxWidth - this.width};
        this._bubblePosTag = character.screenY() > Graphics.boxHeight / 2 ? true : false;
        if (this._bubblePosTag) {
            this.y = character.screenY() - this.height - 60 + parseInt(topMessageReviseY);
            this._messageBubbleTag.y = character.screenY() - 65 + parseInt(topTagReviseY);
        } else{
            this.y = character.screenY() + 14 + parseInt(bottomMessageReviseY);
            this._messageBubbleTag.y = character.screenY() + parseInt(bottomTagReviseY);
        };
        this.setBubbleTag(character);
    };
    Window_Message.prototype.setBubbleTag = function(character) {
        var width = this._messageBubbleTag.width;
        var height = this._messageBubbleTag.bitmap.height / 2;
        var y = !this._bubblePosTag ? height : 0;
        this._opening = true;
        this._messageBubbleTag.setFrame(0 ,y ,width ,height);
        this._messageBubbleTag.x = character.screenX() - width / 2;
    };
    Window_Message.prototype.popcaltextStateHW = function(text) {
        var leftX = $gameMessage.faceName() === '' ? 0 : 172;
        var textState = { index: 0, x: leftX, y: 0, width: 0, left: leftX };
        textState.text = this.convertEscapeCharacters(text);
        textState.y = this.calcTextHeight(textState, false);
        while (textState.index < textState.text.length) {
            this.popReadCharacter(textState);
        };
        this.resetFontSettings();
        this.height = textState.height + 36;
        this.width  = textState.width  + 36;
    };
    Window_Message.prototype.popReadCharacter = function(textState) {
        switch (textState.text[textState.index]) {
        case '\n':
            textState.x = textState.left;
            textState.y += this.calcTextHeight(textState, false);
            textState.index++;
            break;
        case '\f':
             textState.index++;
            break;
        case '\x1b':
            switch (this.obtainEscapeCode(textState)){
            case 'C':
                this.obtainEscapeParam(textState);
                break;
            case 'I':
                this.obtainEscapeParam(textState);
                textState.x += Window_Base._iconWidth + 4;
                break;
            case '{':
                if (this.contents.fontSize <= 96) { this.contents.fontSize += 12; };
                break;
            case '}':
                if (this.contents.fontSize >= 24) { this.contents.fontSize -= 12; };
                break;
            };
            break;
        default:
            textState.x += this.textWidth(textState.text[textState.index++]);
            textState.width = textState.width > textState.x ? textState.width : textState.x;
            textState.height = textState.height > textState.y ? textState.height : textState.y;
            break;
        };
    };
    var _drawMessageFace = Window_Message.prototype.drawMessageFace;
    Window_Message.prototype.drawMessageFace = function(){};
})();[/pre][/fold]

VIPArcher_Bubble_Message.zip

6.52 KB, 下载次数: 1900

点评

请求扩展功能,对话固定朝向,固定在上方,  发表于 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
星屑
161
在线时间
629 小时
注册时间
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.

在本版发帖返回顶部