查看: 1570|回复: 2

[有事请教] 如何在地图上使用翻页键

[复制链接]
梦石
0
星屑
1353
在线时间
412 小时
注册时间
2011-6-10
回帖
26
发表于 2023-6-23 13:20:02 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 darkrabbit 于 2023-6-23 13:21 编辑

请教一下
角色在地图上行走时,可以按系统自带的翻页调用指定公共事件该如何实现?
比如按下Q执行公共事件11,按下W执行公共事件12,就像菜单键一样,只有地图行走界面时有效
这里的Q和W并不一定是Q和W而是MZ系统中自带的“翻页键”,如果玩家更改了快捷键也会改变
用并行事件检测按键太卡了,能不能用插件实现?
梦石
2
星屑
8479
在线时间
463 小时
注册时间
2021-12-4
回帖
486

MZ评测员

发表于 2023-6-23 19:02:43 | 显示全部楼层
[pre lang="js"]Game_Player.prototype.moveByInput = function() {
    if (!this.isMoving() && this.canMove()) {
        if (Input.isTriggered('pageup')) return $gameTemp.reserveCommonEvent(11);
        if (Input.isTriggered('pagedown')) return $gameTemp.reserveCommonEvent(12);
        // 上两行为新增内容,位于rmmz_objects.js第8320行
        let direction = this.getInputDirection();
        if (direction > 0) {
            $gameTemp.clearDestination();
        } else if ($gameTemp.isDestinationValid()) {
            const x = $gameTemp.destinationX();
            const y = $gameTemp.destinationY();
            direction = this.findDirectionTo(x, y);
        }
        if (direction > 0) {
            this.executeMove(direction);
        }
    }
};[/pre]

评分

参与人数 1赞 +1 收起 理由
darkrabbit + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
1353
在线时间
412 小时
注册时间
2011-6-10
回帖
26
 楼主| 发表于 2023-6-25 14:32:17 | 显示全部楼层
实测有效,非常感谢
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部