设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 91|回复: 0

[转载发布] World Map Plugin 2.00b

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    8005

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    30017
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38916

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式

    World Map Plugin 2.00b







             

    Introduction
            This marks my first script for RPGMaker MV, and my first script in JavaScript in over a decade.


            A port and more flexible design based on the original World Map system I put together in RMXP.  Allows for a customizable, fully featured World Map system.  Each World Map location is a 'node', pathing between nodes can be locked/unlocked (ie. landslide occurs, cutting off passage between two towns), arrow support built-in (can be enabled/disabled with custom pictures), which can identify both unlocked paths and locked paths (locked paths uses Disabled Arrows).  Comes with customizable window displaying node status.


    Features
            - Flexible World Map system (nodes may be as little as one tile apart, can daisy chain multiple world maps, etc.)


            - Each node uses Events as much as possible, nodes can be animated.


            - Each node may have between 1 - 4 paths leading to other nodes.


            - No manual pathfinding necessary!  This is all handled by Shaz's Path Finder.


            - Status window displaying status for each node using any variables of your choosing (for example, recommended level, number of chests, etc.)


            - Status window will move if the player gets too close to it.  The player should be unable to get behind the Status window.


            - Game Variable tie-ins to remember the previous map (in case the user decides to cancel out of the world map).


            - Each path can be enabled/disabled using true, false, or a $gameSwitch value.


            - Optional arrow buttonset support (hot/cold/disabled).


            - Cleaned up scripting so no redundant switch checks are made.


    Screenshots

    Spoiler


















    How to Use
            - Copy script into your game js/plugins directory.  Also download the required scripts into the same directory.


            - Import these scripts into your project.


            - Set up Regional Restriction IDs to restrict player movement on the world map (see Yanfly's documentation).


            - Set up BBS Plugin parameters.


            - Set up a World Map, events and Common Events to use with the plugin.  See the Demo for an example of how to set everything up.


    Requirements


            This script was developed to be used in conjunction with the following scripts:

    SpoilerYanfly Region Restrictions: http://yanfly.moe/2015/10/20/yep-18-region-restrictions/


                            Hime Direction Lock: http://himeworks.com/2015/12/movement-direction-lock/








    Demo


            Script Demo is attached. **Updated demo is attached, and demo now includes an example of linked World Maps!**
            Includes scripts from: Yanfly, Hime, and Shaz (Region Restrictions, Direction Lock, and Smart Pathfinding respectively).


    Script

    Spoiler//=============================================================================
    // Bluebooth Plugins - World Map
    // BBS_WorldMap.js
    //=============================================================================

    //=============================================================================
    /*:
    * @title World Map Plugin
    * @author Michael Morris (https://www.patreon.com/bluebooth)
    * @date Feb 11, 2016
    * @filename BBS_WorldMap.js
    * If you enjoy my work, consider supporting me on Patreon!
    *
    * https://www.patreon.com/bluebooth
    *
    * @plugindesc v2.00b Have your own comprehensive World Map system!
    * @author Michael Morris
    * Special Thanks to Tsukihime for all the help.
    *
    * ============================================================================
    * Terms of Use
    * ============================================================================
    *   - Free for use in non-commercial projects with credits
    *   - Contact me for commercial use
    *
    * ============================================================================
    * Parameters
    * ============================================================================
    * @param Debug Mode
    * @desc Enable to activate console variable logging.  Use for debugging odd behaviour.
    * true to enable console variable logging.
    * @default false
    *
    * @param Node Window Position
    * @desc Where to display the node status window.
    * (2 - BOTTOM                                        8 - TOP)
    * @default 2
    *
    * @param Arrow Buffer Size
    * @desc how large any interface elements surrounding the player will be, including gaps.  Arrowsize + gap.  Default: 42
    * These sizes can be found in whatever buttonset you use for BBS_MapControls.js.
    * @default 42
    *
    * @param Idle Text
    * @desc Text to display when moving between nodes.
    * @default Traveling...
    *
    * @param Parameter 1 Format
    * @desc Specify a format in the form: %1%/2
    * where %1 is the first value, and %2 is the second value.
    * for example, %1/%2 where %1 is current value, %2 is max. value.
    * @default %1 %2

    * @param Parameter 2 Format
    * @desc Specify a format in the form: %1%/2
    * where %1 is the first value, and %2 is the second value.
    * for example, %1/%2 where %1 is current value, %2 is max. value.
    * @default %1/%2
    *
    * @param Parameter 3 Format
    * @desc Specify a format in the form: %1%/2
    * where %1 is the first value, and %2 is the second value.
    * for example, %1/%2 where %1 is current value, %2 is max. value.
    * @default %1/%2
    *
    * @param Text Color
    * @desc Color for most text in Node Status Window.
    * (0 - 31, default 0)
    * @default 0
    *
    * @param Name Color
    * @desc Color for node name in Node Status Window.
    * (0 - 31, default 0)
    * @default 0
    *
    * @param Idle Color
    * @desc Color for idle text, displayed when moving between nodes.
    * (0 - 31, default 0)
    * @default 0
    *  
    * @help
    * ============================================================================
    * Description
    * ============================================================================
    *
    * A port and more flexible design based on the original World Map system I put
    * together in RMXP.  Allows for a customizable, fully featured World Map system.
    *
    * ============================================================================
    * Plugin Commands
    * ============================================================================
    *
    * Use the following plugin commands to manipulate world map nodes.
    *
    * Plugin Commands:
    *   
    *   WorldMap UpdateNodeWindow id var1 var2 icon1 eval1 eval2 icon2 eval3 eval4 icon3        # Updates the Node Status Window with parameters given.
    *   WorldMap CloseNodeWindow                        # Closes the Node Status Window.  Do not call Update after this without Opening again first.
    *   WorldMap DrawArrows N E S W                # Draws navigation arrows centered around player.
    *         WorldMap EraseArrows                                # To be called before player moves from one node to another or enters a node!
    *
    * Description of Node event Plugin calls.
    *  USE STANDARD AREA TRANSITION TO ENTER WORLD MAP.  PLACE PLAYER ON APPROPRIATE STARTING NODE.
    *  CREATE AUTORUN EVENT ON WORLD MAP THAT CALLS WorldMap init THEN DEACTIVATES ITSELF
    *  
    *  NODE NAME, NOTE, X, and Y will be handled by the EVENT for NODE.
    *  NAME = EVENT NAME, NOTE = EVENT NOTES, X = EVENT X, Y = EVENT Y
    *  AT EACH NODE, UPDATE USING PLUGIN COMMANDS
    *    UPDATE LOCATION WINDOW EVENTID, VAR1, VAR2, ICON1, VAR3, VAR4, ICON2, VAR5, VAR6, ICON3
    *    SETSURROUNDINGNODES NORTH EAST SOUTH WEST
    *    ENABLESURROUNDINGNODES NESW
    *    DRAWARROWS NESW
    *   
    *          INPUT LISTENER AND HANDLING
    *          
    *    IF PLAYER MOVES ERASEARROWS
    *
    *  CALL CLOSENODEWINDOW BEFORE TRANSITIONING PLAYER OUT (OF WORLD MAP) ON A NODE.
    *  CALL ERASEARROWS BEFORE TRANSITIONING PLAYER OUT (OF WORLD MAP) ON A NODE.
    *
    * ============================================================================
    * Change Log
    * ============================================================================
    * 2.00b - fixed logic error that could hide buttons underneath Node Status Window.
    * 2.00a - separated out world map arrows into BBS_MapControls.js and added mouse/touch support for arrows (now buttons).
    *                 - completed tests ensuring touch and mouse worked properly with world map.
    *                 - removed redundent functions.
    *                 - button commands now much easier to read.
    * 1.01c - separated out last map handling to BBS_TransitionHistory.js to fix world map daisy-chain.
    *  fixed player not facing down after moving between nodes.
    * 1.01b - node status window auto switches y position to avoid obscuring player and player arrows.
    * 1.01a - custom text color issues resolved thanks to Tsukihime.
    * 1.01  - Plugin finished.  All major bugs fixed.
    *
    */
    //=============================================================================

    var Imported = Imported || {} ;
    var BBS = BBS || {};
    Imported.WorldMap = 1;
    BBS.WorldMap = BBS.WorldMap || {};

    (function() {

            //=============================================================================
            // Parameter Variables
            //=============================================================================
            var parameters = PluginManager.parameters('BBS_WorldMap');
            var debugging                  = eval(String(parameters['Debug Mode'] || 'false'));

            var enableNodeWnd          = eval(String(parameters['Enable Node Window'] || 'true'));
            var nodeWindowPos          = Number(parameters['Node Window Position'] || '2');
            var btnBufferSize          = Number(parameters['Arrow Buffer Size'] || '42');

            var idleText                  = String(parameters['Idle Text'] || 'Traveling...');
            var textColor                  = Number(parameters['Text Color'] || '0');
            var nameColor                  = Number(parameters['Name Color'] || '0');
            var idleColor                  = Number(parameters['Idle Color'] || '0');

            var param1Format          = String(parameters['Parameter 1 Format'] || '%1 %2');
            var param2Format          = String(parameters['Parameter 2 Format'] || '%1/%2');
            var param3Format          = String(parameters['Parameter 3 Format'] || '%1/%2');

            //=============================================================================
            // Game_Interpreter
            //=============================================================================
        var BBS_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
        Game_Interpreter.prototype.pluginCommand = function(command, args) {
            if (command === 'WorldMap') {
                switch (args[0]) {
                            case 'init':
                                    SceneManager._scene.onLoad();
                                    break;
                            case 'CloseNodeWindow':
                                    SceneManager._scene.closeNodeWindow();
                                    break;
                            case 'UpdateNodeWindow':
                                    SceneManager._scene.changeNode(Number(args[1]), String(args[2]), String(args[3]), String(args[4]), String(args[5]), String(args[6]), String(args[7]), String(args[8]), String(args[9]), eval(args[10]), String(args[11]));
                                    break;
                            };
            }
                    else {
                            BBS_Game_Interpreter_pluginCommand.call(this, command, args);
                    }
        };

            //=============================================================================
            // Window_NodeStatus
            //=============================================================================       
            function Window_NodeStatus() {
            this.initialize.apply(this, arguments);
        }

            Window_NodeStatus.prototype = Object.create(Window_Base.prototype);
            Window_NodeStatus.prototype.constructor = Window_NodeStatus;

            Window_NodeStatus.prototype.initialize = function(nodeWindowPos) {
                    var y = 0;
                    var width = Graphics.boxWidth;
                    var height = 128;

                    // Handle positioning offset.
                    if (nodeWindowPos === 2) {
                            y = Graphics.boxHeight - height;
                    }

                    Window_Base.prototype.initialize.call(this, 0, y, width, height);
                    this.refresh();
            };

            Window_NodeStatus.prototype.refresh = function() {
                    var x = this.textPadding();
                    var y = 0;
                    var width = this.contents.width - this.textPadding() * 2;
                    var lineHeight = this.lineHeight() - 6;
                    this.contents.clear();

                    if (this._node <= 0) {
                            // Special case: traveling between nodes.
                            this.textColor(idleColor);
                            this.drawText(idleText, (Graphics.boxWidth / 2) - (this.textWidth(idleText) / 2) - 18, lineHeight * 1);
                            this.changeTextColor(this.normalColor());
                            return;
                    }

                    //this.changeTextColor(nameColor);
                    this.textColor(nameColor);
                    this.drawText(this._name, x, lineHeight * 0);

                    this.textColor(textColor);
                    this.drawText(this._desc, x, Math.floor(lineHeight * 1.5));

                    // Draw additional parameters.
                    // Param 1
                    var col2X = x + (width / 4) * 1;
                    var icon1Width = 0;

                    if (this._icon1 > 0) {
                            this.drawIcon(this._icon1, col2X, lineHeight * 0 + 4);
                            icon1Width = 48;
                    }

                    var text1 = param1Format.format(String(this._var1), String(this._var2));
                    this.drawText(String(text1), col2X + icon1Width, lineHeight * 0);

                    // Param 2
                    var col3X = x + (width / 4) * 2;
                    var icon2Width = 0;

                    if (this._icon2 > 0) {
                            this.drawIcon(this._icon2, col3X, lineHeight * 0 + 4);
                            icon2Width = 48;
                    }               

                    var text2 = param2Format.format(eval(this._eval1), eval(this._eval2));
                    this.drawText(String(text2), col3X + icon2Width, lineHeight * 0);

                    // Param 3
                    var col4X = x + (width / 4) * 3;
                    var icon3Width = 0;

                    if (this._icon3 > 0) {
                            this.drawIcon(this._icon3, col4X, lineHeight * 0 + 4);
                            icon3Width = 48;
                    }       

                    var text3 = param3Format.format(eval(this._eval3), eval(this._eval4));
                    this.drawText(String(text3), col4X + icon3Width, lineHeight * 0);

                    this.changeTextColor(this.normalColor());
            };

            Window_NodeStatus.prototype.changeNode = function(node, var1, var2, icon1, eval1, eval2, icon2, eval3, eval4, icon3) {

                    this._node = node;

                    // Avoid accessing bad array elements.
                    if (node < 0 || $dataMap === undefined) {
                            this.refresh();
                            return;
                    }

                    this._name = $dataMap.events[node].name;
                    this._desc = $dataMap.events[node].note;
                    this._var1 = var1;
                    this._var2 = var2;
                    this._icon1 = icon1;
                    this._eval1 = eval1;
                    this._eval2 = eval2;
                    this._icon2 = icon2;
                    this._eval3 = eval3;
                    this._eval4 = eval4;
                    this._icon3 = icon3;

                    this.refresh();
            };

            BBS.Window_NodeStatus_update = Window_NodeStatus.prototype.update;
            var BBS_Window_NodeStatus_Update = Window_NodeStatus.prototype.update;
            Window_NodeStatus.prototype.update = function() {
                    BBS_Window_NodeStatus_Update.call(this);

                    // Avoid hiding player.
                    switch (nodeWindowPos) {
                            case 2:
                                    var heightClearance = this.y - btnBufferSize;
                                    if ($gamePlayer.screenY() >= heightClearance) {
                                            // Switch y position.
                                            console.log("Time to move up");
                                            nodeWindowPos = 8;
                                            this.y = 0;
                                    }
                                    break;
                            case 8:
                                    var heightClearance = this.height + btnBufferSize;
                                    if ($gamePlayer.screenY() <= heightClearance) {
                                            // Switch y position.
                                            nodeWindowPos = 2;
                                            this.y = Graphics.boxHeight - this.height;
                                    }
                                    break;
                    };

            }

            //=============================================================================
            // Scene_Map
            //=============================================================================
            BBS.Scene_Map_update = Scene_Map.prototype.update;
            var BBS_Scene_Map_Update = Scene_Map.prototype.update;
        Scene_Map.prototype.update = function() {
                    BBS_Scene_Map_Update.call(this);
                    if (this.isNodeWindowOpen()) {
                            this._nodeWindow.update();
                    }
            };

            Scene_Map.prototype.openNodeWindow = function() {
                    this._nodeWindow = new Window_NodeStatus(nodeWindowPos);
                    this._nodeWindowOpen = true;
                    this.addWindow(this._nodeWindow);
            };

            Scene_Map.prototype.changeNode = function(node, var1, var2, icon1, eval1, eval2, icon2, eval3, eval4, icon3) {
                    if (!this.isNodeWindowOpen()) {
                            this.openNodeWindow();
                    }

                    this._nodeWindow.changeNode(node, var1, var2, icon1, eval1, eval2, icon2, eval3, eval4, icon3);
            };

            Scene_Map.prototype.isNodeWindowOpen = function() {
                    if (this._nodeWindowOpen === undefined) return false;
                    return this._nodeWindowOpen;
            };

            Scene_Map.prototype.closeNodeWindow = function() {
                    if (this.isNodeWindowOpen()) {
                            this._nodeWindow.close();
                    }
            };

            Scene_Map.prototype.onLoad = function() {
                    // Start origin node event handling (mimics player walking onto said event).
                    var eId = $gameMap.eventIdXy($gamePlayer.x, $gamePlayer.y);
                    if (eId) {
                            $gameMap.event(eId, 1).start();
                    }

            };

    })(BBS.WorldMap);
    //=============================================================================
    // End of File
    //=============================================================================






    Known Bugs / TODO


            -Open to feature requests and bug reports!


    History


    2.00b


            - fixed logic error that could hide buttons underneath Node Status Window.


            - Manual player movement while SmartPathing is finally locked.  The player cannot force contact with an unintended node.



    2.00a


            - separated out world map arrows into BBS_MapControls.js and added keyboard/mouse/touch support for arrows (now buttons).
            - completed tests ensuring touch and mouse worked properly with world map.
            - removed redundent functions.
            - button commands now much easier to read.


    1.01c


            -NEW: Input attempts using mouse and touch do not allow manual player movement.


            -Player now turns to face down upon arrival at each node.


            -Fixed World Map daisy-chaining issue with new plugin: 





            Suggestions, bug reports, and feature requests are welcomed!


    Compatibility Issues


            None known.  Compatible with Klaus Map Overlays, Terrax Lighting System, and most (if not all) of Yanfly's plugins.


    FAQ


            Q: The demo won't open, how to open it?
            A: Download Winrar and try again.


    Credit and Thanks
            - Micheal Morris @Blue Booth Studios
            - So much credit to Tsukihime for all the help.  I may not have finished this without you!


            - Hime - Movement Direction Lock and Minimum Demo Size.
            - Yanfly - YEP: Regional Restrictions


            - Shaz - Smart Pathfinding


    Author's Notes
            Free for non-commercial usage as long as credit is given, contact me for commercial use.


            Credit needed to use the world map arrow button set provided in the demo.


            Each of the required scripts must also be checked for compliance with their terms of use.


            No updates currently in development.  This plugin is open to feature requests!


    View attachment WM Demo.zip


    View attachment BBS_WorldMap.js


    本贴来自国际rpgmaker官方论坛作者:bluebooth处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/world-map-plugin-2-00b.56133/

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 09:35 , Processed in 0.077754 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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