设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2105|回复: 10
打印 上一主题 下一主题

[有事请教] rpgmakermz如何新增载具车辆类,就像船一样的那种类型?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
74
在线时间
56 小时
注册时间
2022-1-26
帖子
15
跳转到指定楼层
1
发表于 2022-3-8 22:12:04 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
20星屑

Lv4.逐梦者

梦石
0
星屑
5460
在线时间
1119 小时
注册时间
2013-12-3
帖子
266
2
发表于 2022-3-9 01:47:47 | 只看该作者
换个思路 做个载具外观的角色加入队伍带队
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
21932
在线时间
8564 小时
注册时间
2011-12-31
帖子
3362
3
发表于 2022-3-9 14:21:48 | 只看该作者
本帖最后由 tseyik 于 2022-3-9 14:24 编辑


NpcFollower.js
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
74
在线时间
56 小时
注册时间
2022-1-26
帖子
15
4
 楼主| 发表于 2022-3-10 08:08:08 | 只看该作者
tseyik 发表于 2022-3-9 14:21
[fold=NpcFollower.js]//============================================================================ ...

没错就是这种!求插件

点评

下面就是  发表于 2022-3-10 11:21
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
74
在线时间
56 小时
注册时间
2022-1-26
帖子
15
5
 楼主| 发表于 2022-3-10 09:24:50 | 只看该作者
HM495 发表于 2022-3-9 01:47
换个思路 做个载具外观的角色加入队伍带队

如何在载具状态下有shift效果(加速)
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5460
在线时间
1119 小时
注册时间
2013-12-3
帖子
266
6
发表于 2022-3-10 09:30:12 | 只看该作者
王丞相 发表于 2022-3-10 09:24
如何在载具状态下有shift效果(加速)

设置移动路线 玩家 更改移动速度
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
74
在线时间
56 小时
注册时间
2022-1-26
帖子
15
7
 楼主| 发表于 2022-4-28 18:33:32 | 只看该作者
HM495 发表于 2022-3-10 09:30
设置移动路线 玩家 更改移动速度

感谢大佬啊
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1081
在线时间
105 小时
注册时间
2021-8-21
帖子
72
8
发表于 2022-4-29 12:00:30 | 只看该作者
本帖最后由 guihuasheng 于 2022-4-29 12:02 编辑

回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1081
在线时间
105 小时
注册时间
2021-8-21
帖子
72
9
发表于 2022-4-29 12:01:41 | 只看该作者
/*
Title: Land Vehicles
Author: DKPlugins
Site: https://dk-plugins.ru
E-mail: [email protected]
Version: 2.0.0
Release: 10.09.2020
First release: 23.08.2016
*/

/*ru
Название: Наземный Транспорт
Автор: DKPlugins
Сайт: https://dk-plugins.ru
E-mail: [email protected]
Версия: 2.0.0
Релиз: 10.09.2020
Первый релиз: 23.08.2016
*/

/*:
* @plugindesc v.2.0.0 Adds a land vehicles
* @author DKPlugins
* @url https://dk-plugins.ru
* @target MZ
* @help

### Info about plugin ###
Title: DK_Land_Vehicles
Author: DKPlugins
Site: https://dk-plugins.ru
Version: 2.0.0
Release: 10.09.2020
First release: 23.08.2016

###=========================================================================
## Compatibility
###=========================================================================
RPG Maker MV: 1.5+
RPG Maker MZ: 1.0+

###===========================================================================
## Plugin commands (RPG Maker MV)
###===========================================================================
1. Change vehicle BGM: ChangeVehicleBGM [TYPE] [NAME] [VOLUME] [PITCH] [PAN]
TYPE - Type of vehicle
NAME - BGM name
VOLUME - Volume
PITCH - Pitch
PAN - Panorama
Example: ChangeVehicleBGM bike Ship1 90 100 0

2. Set vehicle location: SetVehicleLocation [TYPE] [MAP ID] [X] [Y]
TYPE - Type of vehicle
MAP ID - Map id
X - The X coordinate
Y - The Y coordinate
Example: SetVehicleLocation bike 2 1 1

3. Change vehicle image: ChangeVehicleImage [TYPE] [NAME] [INDEX]
TYPE - Type of vehicle
NAME - Image name
INDEX - Image index
Example: ChangeVehicleImage car Vehicle 0

4. Set vehicle speed: SetVehicleMoveSpeed [TYPE] [SPEED]
TYPE - Type of vehicle
SPEED - Speed
Example: SetVehicleMoveSpeed car 4

###===========================================================================
## License and terms of use
###===========================================================================
You can:
-To use the plugin for your non-commercial projects
-Change code of the plugin

You cannot:
-Delete or change any information about the plugin
-Distribute the plugin and its modifications

## Commercial license ##
To use the plugin in commercial projects, you must be my subscriber on patreon
https://www.patreon.com/dkplugins

###===========================================================================
## Support
###===========================================================================
Donate: https://dk-plugins.ru/donate
Become a patron: https://www.patreon.com/dkplugins

* @command ChangeVehicleBGM
* @desc Change vehicle BGM
*
* @arg type
* @text Type
* @desc Vehicle type
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg bgm
* @text BGM
* @desc BGM
* @type struct<VehicleBGM>
* @default {"name":"","volume":"90","pitch":"100","pan":"0"}

* @command SetVehicleLocation
* @desc Set vehicle location
*
* @arg type
* @text Type
* @desc Vehicle type
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg mapId
* @text Map Id
* @desc Map id
* @type number
* @min 1
* @default 1

* @arg x
* @text X
* @desc The X coordinate
* @type number
* @min 0
* @default 0

* @arg y
* @text Y
* @desc The Y coordinate
* @type number
* @min 0
* @default 0

* @command ChangeVehicleImage
* @desc Change vehicle image
*
* @arg type
* @text Type
* @desc Vehicle type
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg characterName
* @text Graphic file
* @desc Graphic file
* @type file
* @dir img/characters
* @require 1
* @default Vehicle

* @arg characterIndex
* @text Graphic index
* @desc Graphic index. Numbering starts from 0.
* @type number
* @min 0
* @default 0

* @command SetVehicleMoveSpeed
* @desc Set vehicle speed
*
* @arg type
* @text Type
* @desc Vehicle type
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg speed
* @text Speed
* @desc Vehicle speed
* @type number
* @min 1
* @default 5

* @param vehicles
* @text Vehicles
* @desc List of vehicles
* @type struct<Vehicle>[]
* @default []

*/

/*:ru
* @plugindesc v.2.0.0 Добавляет наземный транспорт
* @author DKPlugins
* @url https://dk-plugins.ru
* @target MZ
* @help

### Информация о плагине ###
Название: DK_Land_Vehicles
Автор: DKPlugins
Сайт: https://dk-plugins.ru
Версия: 2.0.0
Релиз: 10.09.2020
Первый релиз: 23.08.2016

###=========================================================================
## Совместимость
###=========================================================================
RPG Maker MV: 1.6+
RPG Maker MZ: 1.0+

###=========================================================================
## Команды плагина (RPG Maker MV)
###=========================================================================
1. Изменить BGM транспорта: ChangeVehicleBGM [TYPE] [NAME] [VOLUME] [PITCH] [PAN]
TYPE - Тип транспорта
NAME - Название BGM
VOLUME - Громкость
PITCH - Тон
PAN - Панорама
Пример: ChangeVehicleBGM bike Ship1 100 100 0

2. Переместить транспорт: SetVehicleLocation [TYPE] [MAP ID] [X] [Y]
TYPE - Тип транспорта
MAP ID - Номер карты
X - Координата X
Y - Координата Y
Пример: SetVehicleLocation bike 2 1 1

3. Изменить изображение транспорта: ChangeVehicleImage [TYPE] [NAME] [INDEX]
TYPE - Тип транспорта
NAME - Название изображения
INDEX - Индекс изображения
Пример: ChangeVehicleImage car Vehicle 0

4. Изменить скорость транспорта: SetVehicleMoveSpeed [TYPE] [SPEED]
TYPE - Тип транспорта
SPEED - Скорость
Пример: SetVehicleMoveSpeed car 4

###===========================================================================
## Лицензия и правила использования плагина
###===========================================================================
Вы можете:
-Использовать плагин в некоммерческих проектах
-Изменять код плагина

Вы не можете:
-Удалять или изменять любую информацию о плагине
-Распространять плагин и его модификации

## Коммерческая лицензия ##
Для использования плагина в коммерческих проектах необходимо быть моим подписчиком на патреоне
https://www.patreon.com/dkplugins

###=========================================================================
## Поддержка
###=========================================================================
Поддержать: https://dk-plugins.ru/donate
Стать патроном: https://www.patreon.com/dkplugins

* @command ChangeVehicleBGM
* @desc Изменить BGM транспорта
*
* @arg type
* @text Тип
* @desc Тип транспорта
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg bgm
* @text BGM
* @desc BGM
* @type struct<VehicleBGM>
* @default {"name":"","volume":"90","pitch":"100","pan":"0"}

* @command SetVehicleLocation
* @desc Установить позицию транспорта
*
* @arg type
* @text Тип
* @desc Тип транспорта
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg mapId
* @text Номер карты
* @desc Номер карты
* @type number
* @min 1
* @default 1

* @arg x
* @text X
* @desc Координата X
* @type number
* @min 0
* @default 0

* @arg y
* @text Y
* @desc Координата Y
* @type number
* @min 0
* @default 0

* @command ChangeVehicleImage
* @desc Change vehicle image
*
* @arg type
* @text Тип
* @desc Тип транспорта
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg characterName
* @text Графика
* @desc Графика
* @type file
* @dir img/characters
* @require 1
* @default Vehicle

* @arg characterIndex
* @text Индекс графики
* @desc Индекс графики. Нумерация начинается с 0.
* @type number
* @min 0
* @default 0

* @command SetVehicleMoveSpeed
* @desc Установить скорость транспорта
*
* @arg type
* @text Тип
* @desc Тип транспорта
* @type combo
* @option bike
* @option car
* @default bike
*
* @arg speed
* @text Скорость
* @desc Скорость транспорта
* @type number
* @min 1
* @default 5

* @param vehicles
* @text Транспортные средства
* @desc Список транспортных средств
* @type struct<Vehicle>[]
* @default []

*/

/*~struct~Vehicle:

* @param type
* @text Type
* @desc Vehicle type. Unique for each vehicle!
* @type combo
* @option bike
* @option car
* @default bike

* @param mapId
* @text Map Id
* @desc Start map id
* @type number
* @min 1
* @default 1

* @param x
* @text X
* @desc Start X coordinate
* @type number
* @min 0
* @default 0

* @param y
* @text Y
* @desc Start Y coordinate
* @type number
* @min 0
* @default 0

* @param switch
* @text Switch
* @desc A switch that turns on when the player is using a vehicle
* @type switch
* @default 0

* @param bgm
* @text BGM
* @desc Background music
* @type struct<VehicleBGM>
* @default {"name":"","volume":"90","pitch":"100","pan":"0"}

* @param speed
* @text Speed
* @desc Speed of vehicle
* @type number
* @min 1
* @default 5

* @param characterName
* @text Graphic file
* @desc Graphic file
* @type file
* @dir img/characters
* @require 1
* @default Vehicle

* @param characterIndex
* @text Graphic index
* @desc Graphic index. Numbering starts from 0.
* @type number
* @min 0
* @default 0

* @param includedRegions
* @text Included Regions
* @desc Regions where vehicle can move. 0 - All Regions permitted.
* @type number[]
* @default ["0"]

* @param excludedRegions
* @text Excluded Regions
* @desc Regions where vehicle can not move. Has priority over included regions.
* @type number[]
* @min 1
* @default []

* @param visibilitySwitch
* @text Visibility Switch
* @desc Vehicle visibility switch
* @type switch
* @default 0

*/

/*~struct~Vehicle:ru

* @param type
* @text Тип транспорта
* @desc Тип транспорта. Уникальное значение для каждого транспорта!
* @type combo
* @option bike
* @option car
* @default bike

* @param mapId
* @text Номер карты
* @desc Стартовый номер карты
* @type number
* @min 1
* @default 1

* @param x
* @text Координата X
* @desc Стартовая координата X
* @type number
* @min 0
* @default 0

* @param y
* @text Координата Y
* @desc Стартовая координата Y
* @type number
* @min 0
* @default 0

* @param switch
* @text Переключатель
* @desc Переключатель, который включается, когда персонаж использует транспорт
* @type switch
* @default 0

* @param bgm
* @text Фоновая музыка
* @desc Фоновая музыка
* @type struct<VehicleBGM>
* @default {"name":"","volume":"90","pitch":"100","pan":"0"}

* @param speed
* @text Скорость
* @desc Скорость транспорта
* @type number
* @min 1
* @default 5
*
* @param characterName
* @text Графика
* @desc Графика
* @type file
* @dir img/characters
* @require 1

* @param characterIndex
* @text Индекс графики
* @desc Индекс графики. Нумерация начинается с 0.
* @type number
* @min 0
* @default 0

* @param includedRegions
* @text Доступные регионы
* @desc Регионы, где транспорт может двигаться. 0 - Все регионы разрешены
* @type number[]
* @default ["0"]

* @param excludedRegions
* @text Недоступные регионы
* @desc Регионы, где транспорт не может двигаться. Имеет приоритет над доступными регионами.
* @type number[]
* @min 1
* @default []

* @param Visibility Switch
* @text Переключатель видимости
* @desc Переключатель видимости транспорта
* @type switch
* @default 0

*/

/*~struct~VehicleBGM:

* @param name
* @text File
* @desc File
* @type file
* @dir audio/bgm/

* @param volume
* @text Volume
* @desc Volume
* @type number
* @min 0
* @max 100
* @default 90

* @param pitch
* @text Pitch
* @desc Pitch
* @type number
* @min 50
* @max 150
* @default 100

* @param pan
* @text Pan
* @text Panorama
* @desc Panorama
* @type number
* @min -100
* @max 100
* @default 0

*/

/*~struct~VehicleBGM:ru

* @param name
* @text Файл
* @desc Файл
* @type file
* @dir audio/bgm/

* @param volume
* @text Громкость
* @desc Громкость
* @type number
* @min 0
* @max 100
* @default 90

* @param pitch
* @text Темп
* @desc Темп
* @type number
* @min 50
* @max 150
* @default 100

* @param pan
* @text Панорама
* @desc Панорама
* @type number
* @min -100
* @max 100
* @default 0

*/

'use strict';

var Imported = Imported || {};
Imported['DK_Land_Vehicles'] = '2.0.0';

(function() {

    const parameters = PluginManager.parameters('DK_Land_Vehicles');
    const params = {
        vehicles: JSON.parse(parameters.vehicles).map((json) => {
            const data = JSON.parse(json);

            data.mapId = parseInt(data.mapId);
            data.x = parseInt(data.x);
            data.y = parseInt(data.y);
            data.speed = parseInt(data.speed);
            data.switch = parseInt(data.switch);
            data.includedRegions = JSON.parse(data.includedRegions).map(id => parseInt(id));
            data.excludedRegions = JSON.parse(data.excludedRegions).map(id => parseInt(id));
            data.characterIndex = parseInt(data.characterIndex);
            data.visibilitySwitch = parseInt(data.visibilitySwitch);

            if (data.bgm) {
                data.bgm = JSON.parse(data.bgm);
            }

            return data;
        })
    };

    //===========================================================================
    // Game_CharacterBase
    //===========================================================================

    const LandVehicles_Game_CharacterBase_isCollidedWithVehicles =
        Game_CharacterBase.prototype.isCollidedWithVehicles;
    Game_CharacterBase.prototype.isCollidedWithVehicles = function(x, y) {
        return LandVehicles_Game_CharacterBase_isCollidedWithVehicles.apply(this, arguments)
            || this.isCollidedWithLandVehicles(x, y);
    };

    Game_CharacterBase.prototype.isCollidedWithLandVehicles = function(x, y) {
        const vehicles = $gameMap.vehicles();

        for (let i = 0; i < vehicles.length; i++) {
            const vehicle = vehicles;

            if (vehicle.isLandVehicle() && vehicle.opacity() > 0 && vehicle.posNt(x, y)) {
                return true;
            }
        }

        return false;
    };

    //===========================================================================
    // Game Player
    //===========================================================================

    const LandVehicles_Game_Player_triggerTouchActionD1 =
        Game_Player.prototype.triggerTouchActionD1;
    Game_Player.prototype.triggerTouchActionD1 = function(x1, y1) {
        if (this.isCollidedWithLandVehicles(x1, y1)) {
            if (TouchInput.isTriggered() && this.getOnOffVehicle()) {
                return true;
            }
        }

        return LandVehicles_Game_Player_triggerTouchActionD1.apply(this, arguments);
    };

    const LandVehicles_Game_Player_triggerTouchActionD2 =
        Game_Player.prototype.triggerTouchActionD2;
    Game_Player.prototype.triggerTouchActionD2 = function(x2, y2) {
        if (this.isCollidedWithLandVehicles(x2, y2)) {
            if (TouchInput.isTriggered() && this.getOnVehicle()) {
                return true;
            }
        }

        return LandVehicles_Game_Player_triggerTouchActionD2.apply(this, arguments);
    };

    Game_Player.prototype.isInLandVehicle = function() {
        return !this.isInBoat() && !this.isInShip() && !this.isInAirship() &&
            this._vehicleType !== 'walk' && !this.isMoveRouteForcing();
    };

    const LandVehicles_Game_Player_isInVehicle = Game_Player.prototype.isInVehicle;
    Game_Player.prototype.isInVehicle = function() {
        return LandVehicles_Game_Player_isInVehicle.apply(this, arguments)
            || this.isInLandVehicle();
    };

    const LandVehicles_Game_Player_getOnVehicle = Game_Player.prototype.getOnVehicle;
    Game_Player.prototype.getOnVehicle = function() {
        const direction = this.direction();
        const x2 = $gameMap.roundXWithDirection(this.x, direction);
        const y2 = $gameMap.roundYWithDirection(this.y, direction);
        const type = $gameMap.landVehicleType(x2, y2);

        if (type) {
            this._vehicleType = type;
        }

        return LandVehicles_Game_Player_getOnVehicle.apply(this, arguments);
    };

    //===========================================================================
    // Game Vehicle
    //===========================================================================

    const LandVehicles_Game_Vehicle_initMoveSpeed =
        Game_Vehicle.prototype.initMoveSpeed;
    Game_Vehicle.prototype.initMoveSpeed = function() {
        if (this.isLandVehicle()) {
            this.setMoveSpeed(this.vehicle().speed);
        } else {
            LandVehicles_Game_Vehicle_initMoveSpeed.apply(this, arguments);
        }
    };

    const LandVehicles_Game_Vehicle_vehicle = Game_Vehicle.prototype.vehicle;
    Game_Vehicle.prototype.vehicle = function() {
        return LandVehicles_Game_Vehicle_vehicle.apply(this, arguments)
            || params.vehicles.find(v => v.type === this._type) || null;
    };

    const LandVehicles_Game_Vehicle_loadSystemSettings =
        Game_Vehicle.prototype.loadSystemSettings;
    Game_Vehicle.prototype.loadSystemSettings = function() {
        if (!this.isLandVehicle()) {
            return LandVehicles_Game_Vehicle_loadSystemSettings.apply(this, arguments);
        }

        const vehicle = this.vehicle();

        this._mapId = vehicle.mapId;

        this.setPosition(vehicle.x, vehicle.y);
        this.setImage(vehicle.characterName, vehicle.characterIndex);
    };

    const LandVehicles_Game_Vehicle_playBgm =
        Game_Vehicle.prototype.playBgm;
    Game_Vehicle.prototype.playBgm = function() {
        if (this.isLandVehicle()) {
            const bgm = this._bgm || this.vehicle().bgm;

            if (bgm && bgm.name) {
                AudioManager.playBgm(bgm);
            }
        } else {
            LandVehicles_Game_Vehicle_playBgm.apply(this, arguments);
        }
    };

    const LandVehicles_Game_Vehicle_update = Game_Vehicle.prototype.update;
    Game_Vehicle.prototype.update = function() {
        LandVehicles_Game_Vehicle_update.apply(this, arguments);

        const vehicle = this.vehicle();

        if (vehicle && vehicle.visibilitySwitch > 0) {
            if ($gameSwitches.value(vehicle.visibilitySwitch)) {
                this.setOpacity(255);
            } else {
                this.setOpacity(0);
            }
        }
    };

    const LandVehicles_Game_Vehicle_isMapPassable = Game_Vehicle.prototype.isMapPassable;
    Game_Vehicle.prototype.isMapPassable = function(x, y, d) {
        if (this.isLandVehicle()) {
            const x2 = $gameMap.roundXWithDirection(x, d);
            const y2 = $gameMap.roundYWithDirection(y, d);
            const vehicle = this.vehicle();
            const includedRegions = vehicle.includedRegions || [0];
            const excludedRegions = vehicle.excludedRegions || [];
            const regionId = $gameMap.regionId(x2, y2);

            return $gameMap.isPassable(x2, y2)
                && (includedRegions.includes(regionId) || includedRegions.includes(0))
                && !excludedRegions.includes(regionId);
        } else {
            return LandVehicles_Game_Vehicle_isMapPassable.apply(this, arguments);
        }
    };

    Game_Vehicle.prototype.isLandVehicle = function() {
        return !this.isBoat() && !this.isShip() && !this.isAirship();
    };

    const LandVehicles_Game_Vehicle_getOn = Game_Vehicle.prototype.getOn;
    Game_Vehicle.prototype.getOn = function() {
        LandVehicles_Game_Vehicle_getOn.apply(this, arguments);

        const vehicle = this.vehicle();

        if (vehicle && vehicle.switch > 0) {
            $gameSwitches.setValue(vehicle.switch, true);
        }
    };

    const LandVehicles_Game_Vehicle_getOff = Game_Vehicle.prototype.getOff;
    Game_Vehicle.prototype.getOff = function() {
        LandVehicles_Game_Vehicle_getOff.apply(this, arguments);

        const vehicle = this.vehicle();

        if (vehicle && vehicle.switch > 0) {
            $gameSwitches.setValue(vehicle.switch, false);
        }
    };

    //===========================================================================
    // Game_Map
    //===========================================================================

    const LandVehicles_Game_Map_createVehicles = Game_Map.prototype.createVehicles;
    Game_Map.prototype.createVehicles = function() {
        LandVehicles_Game_Map_createVehicles.apply(this, arguments);

        params.vehicles.forEach((vehicle) => {
            this._vehicles.push(new Game_Vehicle(vehicle.type));
        });
    };

    Game_Map.prototype.landVehicleType = function(x, y) {
        const vehicle = this.vehicles()
                             .find(v => v.opacity() > 0 && v.pos(x, y));

        return (vehicle ? vehicle._type : null);
    };

    const LandVehicles_Game_Map_vehicle = Game_Map.prototype.vehicle;
    Game_Map.prototype.vehicle = function(type) {
        const vehicle = LandVehicles_Game_Map_vehicle.apply(this, arguments);

        if (vehicle) {
            return vehicle;
        }

        const vehicles = this.vehicles();

        if (Number.isFinite(type)) {
            return vehicles[type];
        }

        return vehicles.find(v => v._type === type) || null;
    };

    if (Utils.RPGMAKER_NAME === 'MV') {

        const LandVehicles_Game_Interpreter_pluginCommand =
            Game_Interpreter.prototype.pluginCommand;
        Game_Interpreter.prototype.pluginCommand = function(command, args) {
            LandVehicles_Game_Interpreter_pluginCommand.apply(this, arguments);

            switch (command) {
                case 'ChangeVehicleBGM': {
                    const type = args[0];
                    const vehicle = $gameMap.vehicle(type);

                    if (vehicle) {
                        vehicle.setBgm({
                            name: args[1],
                            volume: Number(args[2]),
                            pitch: Number(args[3]),
                            pan: Number(args[4])
                        });
                    } else {
                        throw new Error(`ChangeVehicleBGM: Vehicle with type = ${type} not found!`);
                    }

                    break;
                }
                case 'SetVehicleLocation': {
                    const type = args[0];
                    const vehicle = $gameMap.vehicle(type);

                    if (vehicle) {
                        const mapId = Number(args[1]);
                        const x = Number(args[2]);
                        const y = Number(args[3]);

                        vehicle.setLocation(mapId, x, y);
                    } else {
                        throw new Error(`SetVehicleLocation: Vehicle with type = ${type} not found!`);
                    }

                    break;
                }
                case 'ChangeVehicleImage': {
                    const type = args[0];
                    const vehicle = $gameMap.vehicle(type);

                    if (vehicle) {
                        const name = args[1];
                        const index = Number(args[2]);

                        vehicle.setImage(name, index);
                    } else {
                        throw new Error(`ChangeVehicleImage: Vehicle with type = ${type} not found!`);
                    }

                    break;
                }
                case 'SetVehicleMoveSpeed': {
                    const type = args[0];
                    const vehicle = $gameMap.vehicle(type);

                    if (vehicle) {
                        vehicle.setMoveSpeed(Number(args[1]));
                    } else {
                        throw new Error(`SetVehicleMoveSpeed: Vehicle with type = ${type} not found!`);
                    }

                    break;
                }
            }
        };

    } else {

        PluginManager.registerCommand('DK_Land_Vehicles',
            'ChangeVehicleBGM', (args) => {
            const type = args.type;
            const vehicle = $gameMap.vehicle(type);

            if (vehicle) {
                const bgm = JSON.parse(args.bgm);

                bgm.volume = Number(bgm.volume);
                bgm.pitch = Number(bgm.pitch);
                bgm.pan = Number(bgm.pan);

                vehicle.setBgm(bgm);
            } else {
                throw new Error(`ChangeVehicleBGM: Vehicle with type = ${type} not found!`);
            }
        });

        PluginManager.registerCommand('DK_Land_Vehicles',
            'SetVehicleLocation', (args) => {
                const type = args.type;
                const vehicle = $gameMap.vehicle(type);

                if (vehicle) {
                    const mapId = Number(args.mapId);
                    const x = Number(args.x);
                    const y = Number(args.y);

                    vehicle.setLocation(mapId, x, y);
                } else {
                    throw new Error(`SetVehicleLocation: Vehicle with type = ${type} not found!`);
                }
        });

        PluginManager.registerCommand('DK_Land_Vehicles',
            'ChangeVehicleImage', (args) => {
                const type = args.type;
                const vehicle = $gameMap.vehicle(type);

                if (vehicle) {
                    const name = args.characterName;
                    const index = Number(args.characterIndex);

                    vehicle.setImage(name, index);
                } else {
                    throw new Error(`ChangeVehicleImage: Vehicle with type = ${type} not found!`);
                }
        });

        PluginManager.registerCommand('DK_Land_Vehicles',
            'SetVehicleMoveSpeed', (args) => {
                const type = args.type;
                const vehicle = $gameMap.vehicle(type);

                if (vehicle) {
                    vehicle.setMoveSpeed(Number(args.speed));
                } else {
                    throw new Error(`SetVehicleMoveSpeed: Vehicle with type = ${type} not found!`);
                }
            });

    }

})();
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
523
在线时间
87 小时
注册时间
2022-4-30
帖子
45
10
发表于 2022-5-27 11:41:40 | 只看该作者

如何在载具状态下有shift效果(加速)
回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 12:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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