查看: 4113|回复: 2

[已经解决] 目前有能使用的雾脚本吗

[复制链接]
梦石
0
星屑
3677
在线时间
4468 小时
注册时间
2008-6-12
回帖
776
发表于 2015-10-27 19:13:56 | 显示全部楼层 |阅读模式

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

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

×
或者应该说插件更合理,官方ULC有个foreground脚本,但似乎不是来实现雾效果的。
请问各路大神,目前有雾脚本了吗
本人三无老人,请大神轻拍
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-10-27 20:55:22 | 显示全部楼层
本帖最后由 tseyik 于 2015-10-27 20:56 编辑

回錯帖了
[fold=FontEditor][pre lang="ruby"]//=============================================================================
// FontEditor.js
//=============================================================================

/*:
* This plugin overwrites the default behaviour of Window_Base.
* Use more than one font name separated by a comma to auto search for the
* next font if preceding cannot be found.
* Window_Base functions overwritten:     standardFontFace
*                                        standardFontSize
*                                        resetFontSettings
* Bitmap functions redefined:            drawText                           
*
* @plugindesc Alter the default font settings used by Window_Base and its inheritors... and load custom fonts.
* @author Traverse (27/10/2015)
*
* @param Load Custom Fonts
* @desc Add custom fonts to LOAD (not USE) here. Check Help for instructions.
* @default
*
* @param Font Name (English)
* @desc Change the default English font used by Window_Base.
* @default GameFont
*
* @param Font Size
* @desc Change the default font used by Window_Base. Default = 28.
* @default 28
*
* @param Outline Width
* @desc Change the width of the font outline. Default = 4.
* @default 4
*
* @param Outline Color
* @desc Change the color of the font outline. Default = rgba(0, 0, 0, 0.5).
* @default rgba(0, 0, 0, 0.5)
*
* @param Font Name (Japanese)
* @desc Change the default Japanese font used by Window_Base.
* @default GameFont
*
* @param Font Name (Chinese)
* @desc Change the default Chinese font used by Window_Base.
* @default SimHei, Heiti TC, sans-serif
*
* @param Font Name (Korean)
* @desc Change the default Korean font used by Window_Base.
* @default Dotum, AppleGothic, sans-serif
*
* @param Font Name (Russian)
* @desc Change the default Russian font used by Window_Base.
* @default GameFont
*
* @param Text X-Offset
* @desc Add a custom x-coordinate pixel offset to all drawn text. Use for fonts chopped off from the left. Default = 0
* @default 0
*
* @help In order to use a custom font, it must first be placed in the fonts folder.
Then it must be LOADED by the game. After loading, it must be SET to be used,
either with this plugin, or another one, or by modifying the core code directly.
The format for LOADING (not SETTING) custom fonts with this plugin is:
   
    refname,fontname/refname2,fontname2/refname3,fontname3/ect.
Example: Arial,Arial.ttf/Courier New,Courier New.ttf/ComSns,Comic Sans.ttf
   
Each 'refname' is a unique identifier. This is what you put in when SETTING
the font for use in the Font Name boxes of this plugin and what you will call
(as a string) if you want to set the font in a script/plugin/modification to
the core code.

Each fontname is the filename of the font you are using as it appears in the
fonts folder, and COMPLETE WITH FILE EXTENSION.

Due to how this plugin parses the strings, there must NOT be any spaces between
the commas and slashes that do not exist in the original filename.
E.g. Arial, Arial.ttf/... will NOT be loaded (unless the filename is " Arial.ttf").
*/

(function() {
    var parameters = PluginManager.parameters('FontEditor');
    var eng_font_name = String(parameters['Font Name (English)'] || 'GameFont');
    var jap_font_name = String(parameters['Font Name (Japanese)'] || 'GameFont');
    var cn_font_name = String(parameters['Font Name (Chinese)'] || 'SimHei, Heiti TC, sans-serif');
    var kr_font_name = String(parameters['Font Name (Korean)'] || 'Dotum, AppleGothic, sans-serif');
    var rus_font_name = String(parameters['Font Name (Russian)'] || 'GameFont');
    var font_size =  Number(parameters['Font Size'] || 28);
    var font_outline_width = Number(parameters['Outline Width'] || 4);
    var font_outline_color = String(parameters['Outline Color'] || 'rgba(0, 0, 0, 0.5)');
    var draw_text_offset = Number(parameters['Text X-Offset'] || 0);
   
    var directory = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
    var font_array_string = String(parameters['Load Custom Fonts']);
    var split_strings = (font_array_string.split('/'));
    var cust_font_hash = {};
    split_strings.forEach(function(x) {
        Object.defineProperty(cust_font_hash,
                                x.split(',')[0], {
                                value : x.split(',')[1],
                                enumerable : true})
    });
    Object.keys(cust_font_hash).forEach(function(refname) {
        var fontname = cust_font_hash[refname];
        var font_dir = directory + '/fonts/' + fontname;
        console.log(refname);
        console.log(font_dir);
        Graphics.loadFont(refname, font_dir);
    });
   
    Window_Base.prototype.standardFontFace = function() {
        if ($gameSystem.isJapanese()) {
            return jap_font_name }
        else if ($gameSystem.isChinese()) {
            return cn_font_name }
        else if ($gameSystem.isKorean()) {
            return kr_font_name }
        else if ($gameSystem.isRussian()) {
            return rus_font_name }
        else {
            return eng_font_name }
    };
   
    Window_Base.prototype.standardFontSize = function() {
        return font_size;
    };
   
    Window_Base.prototype.resetFontSettings = function() {
        this.contents.fontFace = this.standardFontFace();
        this.contents.fontSize = this.standardFontSize();
        this.resetTextColor();
        this.contents.outlineWidth = font_outline_width;
        this.contents.outlineColor = font_outline_color;
    };
   
    var _bitmap_drawtext_trav_fontedit_271015 = Bitmap.prototype.drawText;
    Bitmap.prototype.drawText = function(text, x_base, y, maxWidth, lineHeight, align) {
        var x = Number(x_base + draw_text_offset);
        _bitmap_drawtext_trav_fontedit_271015.call(this, text, x, y, maxWidth, lineHeight, align);
    };   
   
}) ();[/pre][/fold]
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-10-30 22:30:27 | 显示全部楼层
本帖最后由 tseyik 于 2015-10-31 14:02 编辑

http://galvs-scripts.com/2015/10/30/mv-layer-graphics/
MV Layer Graphics
Layer Graphics MV v.1.0 (PLUGIN).zip (3.48 KB, 下载次数: 177)
Layer Graphics MV v.1.0 (DEMO).zip (2.52 MB, 下载次数: 180)
[fold]//-----------------------------------------------------------------------------
//  Galv's Layer Graphics
//-----------------------------------------------------------------------------
//  For: RPGMAKER MV
//  GALV_LayerGraphics.js
//-----------------------------------------------------------------------------
//  Version 1.0
//  2015-10-30 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------

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

var Galv = Galv || {};        // Galv's main object
Galv.LG = Galv.LG || {};      // Galv's stuff

//-----------------------------------------------------------------------------
/*:
* @plugindesc Create graphic layers for parallax mapping, fog, etc. View the 'Help' document for plugin commands and info.
*
* @author Galv - galvs-scripts.com
*
* @help
*   Galv's Layer Graphics
* ----------------------------------------------------------------------------
* Each map can have many graphic layers, but be aware that the more you have,
* the more chance the game could lag (especially on slow computers or mobile
* devices).
*
* When a layer is made, it is stored, so you can set layers for maps before
* a player enters them. The layers are created when the map is created, so
* for layer commands created on the same map, 'REFRESH LAYERS' plugin command
* can be used to force the layers to create during play.
*
* Below are commands to be used in the "Plugin Command" event command.
* NOTE: This is different to the "Script" event command.
* ----------------------------------------------------------------------------
*   Plugin Commands (Quick)
* ----------------------------------------------------------------------------
*
*  LAYER MAPID ID GRAPHIC XSPEED YSPEED OPACITY Z XSHIFT YSHIFT BLEND
*
*  LAYER REMOVE MAPID ID
*
*  LAYER REFRESH
*
* ----------------------------------------------------------------------------
*   Plugin Commands (Detailed)
* ----------------------------------------------------------------------------
* To create or change a layer graphic, the following plugin command is used:
*
*  LAYER MAPID ID GRAPHIC XSPEED YSPEED OPACITY Z XSHIFT YSHIFT BLEND
*
* Each property is separated by a space and you will exchange the property
* names above with values.
*
* EXPLANATION OF PROPERTIES:
* LAYER        - do not change this, it is the keyword for the plugin.
* MAPID        - the id of the map you are creating the layer for
* ID           - the id of the layer itself. If you want to change or remove
*              - an existing layer, you refer to it by it's id.
* GRAPHIC      - The filename of the image found in /img/layers/
* XSPEED       - The speed of the horizontal movement. Negatives to go left
* YSPEED       - The speed of the vertical movement. Negatives to go up
* OPACITY      - Transparency of the image (0 - 255)
* Z            - What priority the image has. 0 = ground, 5 = above all chars
* XSHIFT       - Horizonal movement shift that differs from player movement
* YSHIFT       - Vertical movement shift that differs from player movement
*              - Make XSHIFT and YSHIFT = 0 to move with map
* BLEND        - Blend mode (0 = normal, 1 = add, 2 = multiply, 3 = screen)
*
* Example:
* LAYER 12 1 clouds 1 0 155 5 0 0 0
* This will create/change layer 1 on map 12. It will make it use "clouds.png"
* as the image that will scroll right, be partially transparent and above all
*
* Using Variables
* You can use a variable for any property (except 'GRAPHIC') in the plugin
* if you put a "v" before the property. The number after will be variable id.
*
* Example:
* LAYER 12 1 clouds 1 0 v1 5 0 0 0
* This is the same example as above, but will use the value of variable 1
* for the opacity of the layer. This only changes the setting when called,
* changing the variable again without calling this plugin command again will
* not change the layer.
*
* ----------------------------------------------------------------------------
*
*  LAYER REMOVE MAPID ID  - Remove a layer from a map
*
* Example:
* LAYER REMOVE 12 1       - Removes layer 1 from map 12
*
* ----------------------------------------------------------------------------
*
*  LAYER REFRESH          - For creating new layers on the same map as the
*                         - plugin command. Do this command if creating
*                         - NEW layers on the map. It is not required for
*                         - changing existing layers
*
* ----------------------------------------------------------------------------
*
* ----------------------------------------------------------------------------
*   SCRIPT CALL
* ----------------------------------------------------------------------------
* For advanced users only. Layer properties can be accessed via script:
* $gameMap.layerSettings[mapId][layerId].property
* "property" being the above properites in lowercase.
*/

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

(function() {

// LAYER GRAPHIC FOLDER
ImageManager.loadLayerGraphic = function(filename, hue) {
    return this.loadBitmap('img/layers/', filename, hue, true);
};


// PLUGIN CODE
var Galv_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    Galv_Game_Interpreter_pluginCommand.call(this, command, args);
        if (command === 'LAYER') Galv.LG.createLayer(args);
};


// CREATE LAYER
Galv.LG.createLayer = function(config) {
        switch (config[0]) {
        case 'REFRESH':
                // Recreate layer graphics
                SceneManager._scene._spriteset.createLayerGraphics();
                return;
        case 'REMOVE':
                // Remove specified layer object
                mapid = Galv.LG.num(config[1]);
                id = Galv.LG.num(config[2]);
                if (id) {
                        $gameMap.layerSettings[mapid][id] = {};
                } else {
                        $gameMap.layerSettings[mapid] = {};
                };
                return;
        };
       
        // get variables
       

        mapid = Galv.LG.num(config[0]);
        id = Galv.LG.num(config[1]);
        $gameMap.layerSettings[mapid] = $gameMap.layerSettings[mapid] || {};
        $gameMap.layerSettings[mapid][id] = $gameMap.layerSettings[mapid][id] || {};
       
        var x_exist = $gameMap.layerSettings[mapid][id].currentx || 0;
        var y_exist = $gameMap.layerSettings[mapid][id].currenty || 0;
       
        // create object
        $gameMap.layerSettings[mapid][id] = {
                graphic: config[2],         // filename of the graphic in /img/layers/
                xspeed: Galv.LG.num(config[3]),          // speed the layer will scroll horizontally
                yspeed: Galv.LG.num(config[4]),          // speed the layer will scroll vertically
                opacity: Galv.LG.num(config[5]),         // the opacity of the layer
                z: Galv.LG.num(config[6]),               // what level the layer is displayed at (ground is 0)
                xshift: Galv.LG.num(config[7]),          // Moves the layer at a different x amount than the map (0 to not move)
                yshift: Galv.LG.num(config[8]),          // Moves the layer at a different y amount than the map (0 to not move)
                blend: Galv.LG.num(config[9]),           // Blend mode  (0 = normal, 1 = add, 2 = multiply, 3 = screen)
                currentx: x_exist,                        // origin x saved. Reset this on map change
                currenty: y_exist,                        // origin y saved. Reset this on map change
        };

};


Galv.LG.num = function(txt) {
        if (txt[0] === "v") {
                varId = Number(txt.replace("v",""));
                return $gameVariables.value(varId);
        } else {
                return Number(txt);
        };
};




Galv.LG.isEmpty = function(obj) {
        return Object.keys(obj).length === 0;
};


var Galv_Spriteset_Map_createlowerlayer = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function() {
    Galv_Spriteset_Map_createlowerlayer.call(this);
        this.layerGraphics = this.layerGraphics || {};
        this.createLayerGraphics();
};
   
Spriteset_Map.prototype.createLayerGraphics = function() {
    // Create Active Layers On Map
       
        var mapGraphics = $gameMap.layerConfig(); // get object only for the map

        for (var propertyId in mapGraphics) {

                // if layers sprite doesn't exist, make it.
                if (!this.layerGraphics.hasOwnProperty(propertyId)) {
                        this.layerGraphics[propertyId] = this.createLayerSprite(propertyId);
                };

                // If settings are empty for the layer
                if (Galv.LG.isEmpty(mapGraphics[propertyId]) || mapGraphics[propertyId]["graphic"] == "") {
                        //this._tilemap.removeChild(this.layers[propertyId]);

                        var ind = this._tilemap.children.indexOf(this.layerGraphics[propertyId]);
                        if (ind > -1) {
                                this._tilemap.children.splice(ind, 1);
                        }
                       
                } else {
                        this._tilemap.addChild(this.layerGraphics[propertyId]);
                };
        };

};

Spriteset_Map.prototype.createLayerSprite = function(layerId) {
        if (!$gameMap.layerConfig()[layerId]) return null;
        var sprite = new Sprite_LayerGraphic(layerId);
        sprite.move(0, 0, Graphics.width, Graphics.height);
        return sprite;
};
   

// GAME MAP - SETUP LAYER SETTINGS
var Galv_Game_Map_initialize = Game_Map.prototype.initialize;
Game_Map.prototype.initialize = function() {
        Galv_Game_Map_initialize.call(this);
        this.layerSettings = {};   // Store ALL layers here.
};



var Galv_Game_Map_setup = Game_Map.prototype.setup;
Game_Map.prototype.setup = function(mapId) {
        Galv_Game_Map_setup.call(this,mapId);
        for (var obj in this.layerConfig()) {
                obj.currentx = 0;
                obj.currenty = 0;
        };
};


Game_Map.prototype.layerConfig = function() {
        // Get object list from layerSettings
        if (this.layerSettings[this.mapId()]) {
                return this.layerSettings[this.mapId()];
        } else {
                this.layerSettings[this.mapId()] = {}
                return this.layerSettings[this.mapId()];
        };
};


// CREATE LAYER SPRITE
function Sprite_LayerGraphic(id) {
        this.id = id;
    this.initialize.apply(this, arguments);
}


Sprite_LayerGraphic.prototype = Object.create(TilingSprite.prototype);
Sprite_LayerGraphic.prototype.constructor = Sprite_LayerGraphic;


Sprite_LayerGraphic.prototype.initialize = function() {
    TilingSprite.prototype.initialize.call(this);
        this.currentGraphic = "";
    this.createBitmap();
    this.update();
};


Sprite_LayerGraphic.prototype.createBitmap = function() {
        if (Galv.LG.isEmpty($gameMap.layerConfig()[this.id])) {
                this.bitmap = ImageManager.loadLayerGraphic("");
        } else {
                this.bitmap = ImageManager.loadLayerGraphic(this.lValue().graphic);
        };
        this.z = this.lValue().z;
};


Sprite_LayerGraphic.prototype.lValue = function() {
        return $gameMap.layerConfig()[this.id];
};


// Update
Sprite_LayerGraphic.prototype.update = function() {
        TilingSprite.prototype.update.call(this);

        if (this.currentGraphic !== this.lValue().graphic) {
                this.createBitmap();
                this.currentGraphic = this.lValue().graphic;
        };
       
        this.updatePosition();
};

// Update Position
Sprite_LayerGraphic.prototype.updatePosition = function() {
        this.z = this.lValue().z || 0;
        this.opacity = this.lValue().opacity || 0;
        this.blendMode = this.lValue().blend || 0;
       
        this.origin.x = 0 + $gameMap.displayX() * 48 + this.lValue().currentx + this.xOffset();
        this.origin.y = 0 + $gameMap.displayY() * 48 + this.lValue().currenty + this.yOffset();
        this.lValue().currentx += this.lValue().xspeed;
        this.lValue().currenty += this.lValue().yspeed;
};

Sprite_LayerGraphic.prototype.xOffset = function() {
        return $gameMap.displayX() * this.lValue().xshift;
};

Sprite_LayerGraphic.prototype.yOffset = function() {
        return $gameMap.displayY() * this.lValue().yshift;
};

})();[/fold]

点评

非常感谢,终于得到一个正面回答啦!  发表于 2015-10-31 13:24

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 非常感谢,终于得到一个正面回答啦!.

查看全部评分

回复 1 0

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部