查看: 10303|回复: 9

[原创发布] 仿黄金太阳式自动跳跃(手动设置)

[复制链接]

Mr.Gandum

梦石
0
星屑
226
在线时间
2070 小时
注册时间
2007-1-31
回帖
2982

贵宾

发表于 2015-10-24 10:21:19 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 feizhaodan 于 2015-11-18 14:36 编辑

[pre lang="javascript" file="JumpGap.js"]//=============================================================================
// Jump Gap
// Jump Gap.js
// Version: 1.01
// Changes: 1.01
//          - Added a detection to prevent jumping into non-movable tile or
//            tile that is occupied by events.
//          - Added Config option to decide SE played when jumping.
//          1.00
//          - First Published.
//=============================================================================

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

var Kien = Kien || {};
Kien.JumpGap = {};


//=============================================================================
/*:
* @plugindesc Add the feature of auto jumping through gaps
* @author Kien

* @param SE Name
* @desc Name of SE played when jumping. Left Empty to not play SE.
* @default

* @param SE Volume
* @desc Volume of SE.
* @default 90

* @param SE Pitch
* @desc Pitch of SE.
* @default 100

* @param SE Pan
* @desc Pan of SE.
* @default 100

* @help
* ============================================================================
* * Jump Gap (English Document)
* ============================================================================
* Add a easy way to perform jumping at 1 tile space gaps, similar to the game Golden Sun Series.
* ============================================================================
* * How to Use
* ============================================================================
* Add following notes to the maps you want this feature enables:
* <Jump Region *rid,*dir>
* This will set region ID *id as marker of a jump action, allowing to jump to *dir directions.
* For example:
* <Jump Region 63,2468> will set region 63 as a marker to allow player jump from all direction, and
* <Jump Region 62,2> will set region 62 as a marker to allow player jump from up to down.
* allowed directions are 2=down, 4=left, 6=right and 8=up.
* The marker is use to mark the map tile that is not passable normally, and at 1 tile further there have a passable tile.
* ============================================================================
* * End of Document (English Document)
* ============================================================================
* ============================================================================
* * 自動ジャンプ(Japanese Document)
* ============================================================================
* 黄金の太陽シリーズに似たコントロール可能な自動ジャンプ機能を追加します。
* ============================================================================
* * 使い方
* ============================================================================
* 次のような内容を適用したいマップのメモ欄に追加します:
* <Jump Region *rid,*dir>
* これはrid番のリージョンIDを、*dir方向に向かってジャンプできるように設定するマーカーとして機能させます
* 例として、<Jump Region 63,2468>はリージョンID63が設定された通行不能タイルをすべての方向に向かってジャンプ可能なタイルとして設定し、
* <Jump Region 62,2>はリージョンID62が設定された通行不能タイルを下方向に向かってジャンプ可能なタイルとして設定します。
* 方向として指定可能な数字は2=下方向、4=左方向、6=右方向、8=上方向です。
* 通行不能タイルに指定したリージョンIDを設定し、さらにジャンプ方向に通行可能タイルが存在する場合にのみジャンプします
* ============================================================================
* * ドキュメント終了 (Japanese Document)
* ============================================================================
* ============================================================================
* * 自动跳跃(Chinese Document)
* ============================================================================
* 添加类似黄金太阳系列的自动跳跃功能。需要用户自己设置可跳跃区域
* ============================================================================
* * 用法
* ============================================================================
* 添加以下内容到地图的备注栏
* <Jump Region *rid,*dir>
* 这将把rid号区域ID设置为可以向dir方向跳跃的标记。
* 比如说,<Jump Region 63,2468>会将区域63设置为允许向全方向跳跃的标记,
* <Jump Region 62,2>会将区域62设置为允许向下方跳跃的标记。
* 可以设置的方向为2=下方,4=左方,6=右方,8=上方。
* 标记不可通行的图块。当不可通行图块的前方(玩家移动的方向&你设置的方向)有可通行图块时执行跳跃。
* ============================================================================
* * 文档结束 (Chinese Document)
* ============================================================================
*/

Kien.JumpGap.parameters = PluginManager.parameters("JumpGap");
Kien.JumpGap.SE = { name:   Kien.JumpGap.parameters["SE Name"],
                    pitch:  Kien.JumpGap.parameters["SE Pitch"],
                    volume: Kien.JumpGap.parameters["SE Volume"],
                    pan:    Kien.JumpGap.parameters["SE Pan"]}

Kien.JumpGap.Game_Player_moveStraight = Game_Player.prototype.moveStraight;
Game_Player.prototype.moveStraight = function (d) {
    Kien.JumpGap.Game_Player_moveStraight.call(this, d);
    if (!this.isMovementSucceeded() && !$gameMap.isEventRunning()) {
        var x2 = $gameMap.roundXWithDirection(this._x, d);
        var y2 = $gameMap.roundYWithDirection(this._y, d);
        var rid = $gameMap.regionId(x2, y2);
        if ($gameMap.jumpDirFromRegion(rid).contains(d)) {
            var x3 = $gameMap.roundXWithDirection(x2, d);
            var y3 = $gameMap.roundYWithDirection(y2, d);
            if (this.canPassByJump(x3,y3)){
                this.jump(x3 - this._x,y3  - this._y);
                if (!Kien.JumpGap.SE.name.length == 0){
                    AudioManager.playSe(Kien.JumpGap.SE);
                }
            }
        }
    }
};

Game_Player.prototype.canPassByJump = function(x, y) {
    if (!$gameMap.isValid(x, y)) {
        return false;
    }
    if (this.isThrough() || this.isDebugThrough()) {
        return true;
    }
    if ([2,4,6,8].filter(function(d){return $gameMap.isPassable(x, y, d)}).length == 0){
        return false;
    }
    if (this.isCollidedWithCharacters(x,y)) {
        return false;
    }
    return true;
};

Game_Map.prototype.jumpDirFromRegion = function (rid) {
        var reg = RegExp('\<Jump Region '+rid+',([2468]+)\>',"i")
        if ($dataMap.note.match(reg)!= null){
                return (RegExp.$1.toString().split("").map(function(v) {return parseInt(v) } ));
        }
    return [];
}[/pre]
放到mv工程的js/plugins/内,并在Plugin Manager里添加插件即可使用。具体设置方法见help内
2015/11/18: 更新,现在自动判断着地点是否可以通行,并可以自动播放SE

评分

参与人数 1星屑 +66 梦石 +2 收起 理由
余烬之中 + 66 + 2 入图书馆追加

查看全部评分

梦石
0
星屑
287
在线时间
1580 小时
注册时间
2010-6-17
回帖
2818

开拓者贵宾

发表于 2015-10-24 10:24:34 | 显示全部楼层
你写的?

点评

原文肯定是英语+日语。  发表于 2015-10-24 15:51
同时在其他地方发布要改三次?我不想  发表于 2015-10-24 14:08
为啥是中文和英文注释?还有霓虹国语言  发表于 2015-10-24 14:02
不然还有谁  发表于 2015-10-24 10:42
回复

使用道具 举报

永夜蟄居の玖瀨

梦石
0
星屑
71
在线时间
1018 小时
注册时间
2011-9-5
回帖
2707

开拓者贵宾

发表于 2015-10-24 10:41:51 | 显示全部楼层
居然发到水区
回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-10-24 10:42:16 | 显示全部楼层
求讲讲脚本的格式.....
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2015-10-24 11:41:07 | 显示全部楼层
本帖最后由 soulsaga 于 2015-10-24 15:30 编辑

又中英文又日文..
回复

使用道具 举报

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
回帖
6325
发表于 2015-10-24 14:55:33 | 显示全部楼层
soulsaga 发表于 2015-10-24 11:41
又中英文又日文..
为什么注译不用中文写..

估计是哪里搬来的吧

点评

噗噗哈哈哈wwww  发表于 2015-10-24 15:59
长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
回复

使用道具 举报

梦石
0
星屑
211
在线时间
905 小时
注册时间
2010-9-6
回帖
3138
发表于 2015-10-24 15:49:37 | 显示全部楼层
这样的脚本目前也只能放在水区炫耀了,有多少人用上MV了呢?反正偶是不用……LZ就当观众都是来吐槽的,请无视。
回复

使用道具 举报

路人党员

梦石
0
星屑
52
在线时间
2276 小时
注册时间
2010-12-30
回帖
3011
发表于 2015-10-24 16:13:48 | 显示全部楼层
[pre lang="javascript"]//=============================================================================
// Fonts.js
//=============================================================================

/*:
* @plugindesc Manage Game Fonts
* @author 0nepeop1e
*
* @param Bitmap Font
* @desc Default font face used for bitmap in game.
* @default GameFont
*
* @param Window Font
* @desc Default font face used for window in game.
* @default GameFont
*
* @param Fonts
* @desc List of @font-face definded in gamefont.css, seperate with ';', the game will wait until the fonts loaded before start
* @default GameFont
*/

Function.prototype.clone = function() {
    var that = this;
    var temp = function () { return that.apply(this, arguments); };
    for(var key in this) {
        if (this.hasOwnProperty(key)) {
            temp[key] = this[key];
        }
    }
    return temp;
};

(function(pm){
        ft = {};
       
        ft.bitmapFont = pm.parameters('Fonts')["Bitmap Font"] || "GameFont";
        ft.windowFont = pm.parameters('Fonts')["Window Font"] || "GameFont";
        ft.fontsList = (pm.parameters('Fonts')["Fonts"] || "GameFont").split(";");
       
        Scene_Boot.prototype.isGameFontLoaded = function() {
                var loaded = Graphics.isFontLoaded(ft.fontsList[0]);
                for(var i = 1; i < ft.fontsList.length; i++)
                        loaded = loaded && Graphics.isFontLoaded(ft.fontsList);
                if (loaded) {
                        return true;
                } else {
                        var elapsed = Date.now() - this._startDate;
                        if (elapsed >= (20000 * ft.fontsList.length)) {
                                throw new Error('Failed to load Fonts');
                        }
                }
        };
       
        ft._initBitmap = Bitmap.prototype.initialize.clone();
       
        Bitmap.prototype.initialize = function(){
                ft._initBitmap.apply(this, arguments);
                this.fontFace = ft.bitmapFont;
        };
       
        Window_Base.prototype.standardFontFace = function() {
                return ft.windowFont;
        };
       
})(PluginManager);[/pre]
刚刚写了个字体插件
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到engshun@1ppl.me咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复

使用道具 举报

Assassin-K

梦石
0
星屑
4138
在线时间
2281 小时
注册时间
2012-5-23
回帖
3964

贵宾

发表于 2015-10-24 17:38:03 | 显示全部楼层
唷,又一猿诈尸,都回来就好了~
新老程猿来得差不多,MV就该要开版了。

◆ROZONE◆
>洛子又要去流浪地球了……
>如果你看到我在线,又没动静,那只能说明我在挂机……
回复

使用道具 举报

梦石
0
星屑
420
在线时间
26 小时
注册时间
2017-9-29
回帖
13
发表于 2020-11-18 11:37:01 | 显示全部楼层
感谢感谢。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部