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

Project1

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

[有事请教] 窗口脚本的问题大佬请教下!

[复制链接]

Lv2.观梦者

梦石
0
星屑
634
在线时间
72 小时
注册时间
2018-4-19
帖子
23
跳转到指定楼层
1
发表于 2018-6-27 15:27:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
麻烦大佬帮我看看这个要怎么用

//-----------------------------------------------------------------------------
//  Galv's Message Background
//-----------------------------------------------------------------------------
//  For: RPGMAKER MV
//  Galv_MessageBackground.js
//-----------------------------------------------------------------------------
//  2016-04-02 - Version 1.4 - compatibilty fix for Message Styles plugin
//  2015-10-30 - Version 1.3 - removed accidental code + compatiblity change
//  2015-10-27 - Version 1.2 - fixed a bug with images showing over top
//  2015-10-26 - Version 1.1 - fixed bug with variable setting
//  2015-10-25 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------

var Imported = Imported || {};
Imported.Galv_MessageBackground = true;

var Galv = Galv || {};        // Galv's main object
Galv.MBG = Galv.MBG || {};    // Galv's Message Background stuff
Galv.Mstyle = Galv.Mstyle || {};  // Compatibility
//-----------------------------------------------------------------------------
/*:
* @plugindesc Displays an image behind messages in place of the windowskin
*
* @author Galv - galvs-scripts.com
*
* @param Image Variable ID
* @desc Variable used to determine which image to display
* /img/system/msgimg_X.png - where X is the variable's value
* @default 1
*
* @param Disable Switch ID
* @desc Turn this switch ON usig control switches to disable the
* message image and revert back to windowskin (make 0 to not use)
* @default 1
*
* @help
*   Galv's Message Background
* ----------------------------------------------------------------------------
* Set the variable ID number you would like to use in the settings.
* This is the in-game variable that you wil change with "Control Variables"
* event command. (Default is variable 1, which has a value of 0 by default)
* This will select images from your project's folders:
* /img/system/msgimg_X.png - where X is the variable's value
*
* You can also set a switch ID in the settings. If you choose a switch, then
* during the game you can turn that switch number ON with "Control Switches"
* to disable the background image and go back to using default windowskin.
* This defaults to 0 meaning do not use this option.
*
* This 'Show Message' settings of "window", "Dim" and "Tranparent" have an
* effect on the message background image. Window shows image normally, Dim
* shows the image partially transparent and Transparent makes it invisible.
*/


//-----------------------------------------------------------------------------
//  CODE STUFFS
//-----------------------------------------------------------------------------



(function() {
        Galv.MBG.v = Number(PluginManager.parameters('Galv_MessageBackground')["Image Variable ID"]);
        Galv.MBG.s = Number(PluginManager.parameters('Galv_MessageBackground')["Disable Switch ID"]);
        Galv.MBG.disable = false;
        Galv.MBG.window = null;
       
       
// ---------------- WINDOW MESSAGE

// WINDOW MESSAGE START MESSAGE - MOD
Galv.MBG.Window_Message_startMessage = Window_Message.prototype.startMessage;
Window_Message.prototype.startMessage = function() {
        // Create graphic when window is displayed
        if (Galv.Mstyle.target) {
                Galv.MBG.disable = true;
        } else {
                Galv.MBG.disable = false;
        };
       
        Galv.MBG.window = this;
        Galv.MBG.Window_Message_startMessage.call(this);
};

// WINDOW MESSAGE SET BACKGROUND TYPE

Galv.MBG.Window_Message_setBackgroundType = Window_Message.prototype.setBackgroundType;
Window_Message.prototype.setBackgroundType = function(type) {
        if (Galv.Mstyle.target) {
                this.opacity = Galv.Mstyle.opacity;
        } else if (!$gameSwitches.value(Galv.MBG.s)) {
                this.opacity = 0;
                return;
        };
        Galv.MBG.Window_Message_setBackgroundType.call(this,type);
};



// ---------------- SPRITESET MAP



// SPRITESET MAP CREATE LOWER LAYER
Galv.MBG.Spriteset_Map_createUpperLayer = Spriteset_Base.prototype.createUpperLayer;
Spriteset_Base.prototype.createUpperLayer = function() {
        Galv.MBG.Spriteset_Map_createUpperLayer.call(this);
        this.createMsgBg();
};

// SPRITESET MAP CREATE MSG BG
Spriteset_Base.prototype.createMsgBg = function() {
    if (this._msgBgSprite) return;
    this._msgBgSprite = new Sprite_GalvMsgBg();
    this.addChild(this._msgBgSprite);
};


// ---------------- SPRITE GALVMSGBG - NEW

function Sprite_GalvMsgBg() {
    this.initialize.apply(this, arguments);
}

Sprite_GalvMsgBg.prototype = Object.create(Sprite.prototype);
Sprite_GalvMsgBg.prototype.constructor = Sprite_GalvMsgBg;

Sprite_GalvMsgBg.prototype.initialize = function() {
    Sprite.prototype.initialize.call(this);
        this.opacity = 0;
        this.loadBitmap();
    this.update();
};

Sprite_GalvMsgBg.prototype.update = function() {
    Sprite.prototype.update.call(this);
    if (Galv.MBG.window) this.controlBitmap() ;
};

Sprite_GalvMsgBg.prototype.loadBitmap = function() {
        this.imageID = $gameVariables.value(Galv.MBG.v);
    this.bitmap = ImageManager.loadSystem('msgimg_' + this.imageID);
        this.x = 0
        this.z = 10;
};

Sprite_GalvMsgBg.prototype.controlBitmap = function() {
        if ($gameSwitches.value(Galv.MBG.s) || Galv.MBG.window.openness <= 0 || Galv.MBG.disable) {
                this.opacity = 0;
                this.maxopac = 255;
                return;
        };
    if (this.imageID != $gameVariables.value(Galv.MBG.v)) this.loadBitmap();  // If image changed, reload bitmap

        // Control image opacity
        switch ($gameMessage.background()) {
        case 0:
        // Window
                this.opacity = Math.min(Galv.MBG.window._openness,this.maxopac);
                break;
        case 1:
        // Dim
                this.opacity = Galv.MBG.window._openness * 0.5;
                this.maxopac = this.opacity;
                break;
        case 2:
        // Transparent
                this.opacity = 0;
                this.maxopac = 0;
                break;
        };
       
        // Don't change y value if closing as it reverts to positiontype 2
        if (Galv.MBG.window.isClosing()) return;
       
        // Control image position
        switch ($gameMessage.positionType()) {
        case 0:
        //top
                this.y = -(this.bitmap.height * 0.333);
                break;
        case 1:
        // middle
                this.y = (Graphics.boxHeight / 2) - (this.bitmap.height / 2)
                break;
        case 2:
        //bottom
                this.y = Graphics.boxHeight - (this.bitmap.height * 0.666);
                break;
        };
};

})();

Lv3.寻梦者

梦石
0
星屑
4074
在线时间
440 小时
注册时间
2015-4-4
帖子
156
2
发表于 2018-6-27 22:03:51 | 只看该作者
设置您希望在设置中使用的变量ID号。这是随“控制变量”事件命令而改变的游戏变量。(默认为变量1,默认值为0)这将从项目文件夹中选择图像:/img/system/msgimg_X.png   其中x是变量的值

还可以在设置中设置开关ID。如果你选择一个开关,那么在游戏中,你可以用“控制开关”打开开关号来禁用背景图像,然后返回到使用默认的Windows皮肤。默认值为0,

来自
-------------------------百度翻译
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
782
在线时间
109 小时
注册时间
2008-2-10
帖子
254
3
发表于 2018-8-9 09:21:27 | 只看该作者
你这个是菜单窗口还是地图场景的窗口
h
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
29245
在线时间
604 小时
注册时间
2014-7-18
帖子
729

开拓者

4
发表于 2018-8-9 11:34:30 | 只看该作者
这个应该是修改窗口皮肤的脚本吧。
把这个扔到插件目录,之后到MV里面设置参数。
image variable ID是控制使用哪套窗口皮肤的变量ID号,也就是说脚本会读取这个变量的值,来决定使用哪一套窗口皮肤;
disable switch ID是控制是否使用该插件的开关ID号,也就是说如果这个开关为关,那么脚本就会使用MV自带的窗口皮肤/img/system/windowskin.png,否则使用/img/system/msgimg_X.png,其中X对应上面那个变量的值,因此窗口皮肤图片要放到/img/system/下。
最后那个应该是在MV编辑器里面设置的东西,应该是在“显示文字”那里可以选择背景是怎样的,对这个插件有效果。
我手头上没安装MV,所以以上纯属臆断,不保证正确。
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
15544
在线时间
3955 小时
注册时间
2015-9-14
帖子
1334

开拓者

5
发表于 2018-8-9 12:06:32 | 只看该作者
演示工程 Message Background MV v.2.0 (DEMO)0.part1.rar (2 MB, 下载次数: 59) Message Background MV v.2.0 (DEMO)0.part2.rar (82.9 KB, 下载次数: 63)

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-3 19:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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