じ☆ve冰风 发表于 2026-7-17 17:53:17

Can't get off Vehicle Sound MZ

This script adds a sound if player is on a vehicle and cannot exit from it.
If you use it, please add "Evil95" to the credits. Thank you.

Updated to 1.2.


Spoiler: Version 1.2                JavaScript:       
//==============================================================================
// Cant get off Vehicle Sound
// -----------------------------------------------------------------------------
// Version 1.2 (19.06.2023)
// Von Evil95
//==============================================================================
/*:de
* @plugindesc v1.2 Lässt ein Sound ertönen, sofern man nicht mit einem Fahrzeug laden oder austeigen kann.
* @author Evil95
* @target MZ
*
* @param SE
* @type file
* @dir audio/se/
* @desc Wähle ein SE aus.
* @default Buzzer1
*
* @param Volume
* @type number
* @desc Lautstärke.
* Wert zwischen 0 und 100 eingeben.
* @min 0
* @max 100
* @default 100
*
* @param Pitch
* @type number
* @desc Tonhöhe.
* Wert zwischen 50 und 150 eingeben.
* @min 50
* @max 150
* @default 100
*
*/
/*:en
* @plugindesc v1.2 Makes a sound if you cannot exit a vehicle.
* @author Evil95
*
* @param SE
* @type file
* @dir audio/se/
* @desc Select SE audio file.
* @default Buzzer1
*
* @param Volume
* @type number
* @desc Enter value between 0 and 100.
* @min 0
* @max 100
* @default 100
*
* @param Pitch
* @type number
* @desc Enter value between 50 and 150.
* @min 50
* @max 150
* @default 100
*
*/

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

(() => {
    const params = PluginManager.parameters('Evil95_CantGetVehicleOffSound');
    const SE = String(params['SE']);
    const Vol = Number(params['Volume']);
    const Pit = Number(params['Pitch']);

    const _Game_Vehicle_isLandOk = Game_Vehicle.prototype.isLandOk;
    Game_Vehicle.prototype.isLandOk = function(x, y, d) {
      const result = _Game_Vehicle_isLandOk.call(this, x, y, d);
      if (!result) {
            AudioManager.playSe({name: SE, pan: 0, pitch: Pit, volume: Vol});
      }
      return result;
    };
})();

Save it as Evil95_CantGetVehicleOffSound.js.

Many Thanks go toArthran for optimizing my code.


本贴来自国际rpgmaker官方论坛作者:Evil95处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/cant-get-off-vehicle-sound-mz.158458/
页: [1]
查看完整版本: Can't get off Vehicle Sound MZ