查看: 1292|回复: 3

[原创插件] 【鸡肋插件系列】测试时在地图上随意点击设置主角的位置

[复制链接]

21

主题

12

金币

2584

贝壳

旅行者

Rank: 1

积分
356

明灯云会员

发表于 2023-10-25 18:42:31 | 显示全部楼层 |阅读模式
本帖最后由 康娜酱 于 2024-4-15 10:20 编辑

mnggiflab-compressed-1698229954437.gif
SetPlayerPositionMidGame.rar (1.03 KB, 下载次数: 0, 售价: 2 贝壳)
附件跟折叠内容完全相同,只是多收2块贝壳~
SetPlayerPositionMidGame.js
var Imported = Imported || {};
Imported.KANNA_SPPMG = true;

/*:
* @plugindesc 测试时在地图中随意地设置主角的位置
* @author 康娜酱
*
* @help 1.注意,不能重命名这个js文件
* 2.功能正在运作时,可按鼠标右键关闭
* 3.仅在测试游戏时生效,即部署后失效
* 4.如有疑问,可加Q群632269521查询
*
* @param switchId
* @desc 启用效果的开关ID
* @default 1
*/

var parameters = PluginManager.parameters('SetPlayerPositionMidGame');
var switchId = Number(parameters['switchId'] || 1);

(function () {

    var _Game_Temp_setDestination = Game_Temp.prototype.setDestination;
    Game_Temp.prototype.setDestination = function (x, y) {
        if ($gameSwitches.value(switchId)) return;
        _Game_Temp_setDestination.call(this, x, y);
    };

    var _Scene_Map_update = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function () {
        _Scene_Map_update.call(this);
        if ($gameTemp.isPlaytest() && $gameSwitches.value(switchId)) {
            if (TouchInput.isCancelled()) $gameSwitches.setValue(switchId, false);
            if (this.isMapTouchOk() && TouchInput.isTriggered()) {
                var tx = TouchInput.x;
                var ty = TouchInput.y;
                var tw = $gameMap.tileWidth();
                var th = $gameMap.tileHeight();
                var px = $gamePlayer.x;
                var py = $gamePlayer.y;
                var sx = $gameMap.adjustX(px) * tw;
                var sy = $gameMap.adjustY(py) * th;
                if (tx < sx) {
                    px -= Math.ceil((sx - tx) / tw);
                } else if (tx > (sx + tw)) {
                    px += Math.floor((tx - sx) / th);
                };
                if (ty < sy) {
                    py -= Math.ceil((sy - ty) / tw);
                } else if (ty > (sy + th)) {
                    py += Math.floor((ty - sy) / th);
                };
                $gamePlayer.locate(px, py);
            };
        };
    };

    var _Scene_Map_isMenuEnabled = Scene_Map.prototype.isMenuEnabled;
    Scene_Map.prototype.isMenuEnabled = function () {
        return _Scene_Map_isMenuEnabled.call(this) && !$gameSwitches.value(switchId);
    };

}());
收起


何谓鸡肋...就是跟按ctrl键的作用没什么大分別...

回复

使用道具 举报

2

主题

0

金币

37

贝壳

旅行者

Rank: 1

积分
12
发表于 2024-2-19 19:25:49 | 显示全部楼层
…………逆天
600h+rmmv萌新,爱好是ps启动,恐解爱好者,正在自己制作恐怖游戏,美化插件的堆积者
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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