设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 63|回复: 0

[转载发布] [AG] Character Noisy Steps

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    7959

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    29925
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38778

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    Character Noisy Steps
    by Akumu Games (me)

    Description:
    This plugin makes characters produce stepping sound effects when they move on the map terrain.
    Instructions about how to use it are explained in more detail inside.

    Plugin:
    Spoiler                Code:       
    1. // ============================================================================
    2. // Character Noisy Steps by Akumu Games
    3. // ============================================================================
    4. // For: RPGMAKER MV
    5. // AG_CharacterNoisySteps.js
    6. // Version: 1.2.1
    7. // Free to use for commercial and non commercial projects as long as proper credit is given.
    8. // ============================================================================
    9. /*:
    10. * @plugindesc Characters will produce stepping sound effects when they move on the map terrain.
    11. *
    12. * @author Akumu Games
    13. * ============================================================================
    14. * @param Player Step SE Volume
    15. * @desc The volume at which stepping sound effect will play for the player.
    16. * @default 40
    17. * @param Events Step SE Volume
    18. * @desc The volume at which stepping sound effect will play for events.
    19. * @default 20
    20. * @param Step SE Pitch
    21. * @desc The pitch at which stepping sound effect will play for characters.
    22. * @default 100
    23. * @param Pitch Variance
    24. * @desc The range at which the pitch can oscillate between (placing this value at 0 will null this feature).
    25. * @default 5
    26. * @param Pan Variance
    27. * @desc The pan difference that will play when an event is located to the right/left from the player (placing this value at 0 will null this feature).
    28. * @default 40
    29. * @param Disable Player Noisy Steps Switch ID
    30. * @desc When this switch is turned ON, the player won't produce stepping sound effects.
    31. * @default 0
    32. * @param Disable Events Noisy Steps Switch ID
    33. * @desc When this switch is turned ON, all events on the map won't produce stepping sound effects.
    34. * @default 0
    35. * @param Terrain Tag 0 SE
    36. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 0.
    37. * @default
    38. * @param Terrain Tag 1 SE
    39. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 1.
    40. * @default concrete
    41. * @param Terrain Tag 2 SE
    42. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 2.
    43. * @default sand
    44. * @param Terrain Tag 3 SE
    45. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 3.
    46. * @default carpet
    47. * @param Terrain Tag 4 SE
    48. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 4.
    49. * @default grass
    50. * @param Terrain Tag 5 SE
    51. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 5.
    52. * @default metal
    53. * @param Terrain Tag 6 SE
    54. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 6.
    55. * @default wood
    56. * @param Terrain Tag 7 SE
    57. * @desc Stepping sound effect file name assigned to tiles with terrain tag: 7.
    58. * @default dirt
    59. * @param Size Tag Pitch Increment
    60. * @desc Pitch increment/decrement for event tag <Size:Big|Tiny> (placing this value at 0 won't have any effect).
    61. * @default 40
    62. * @param Special Tag 1 SE
    63. * @desc Stepping sound effect file name assigned to event tag <Special:1>.
    64. * @default robot
    65. * @param Special Tag 2 SE
    66. * @desc Stepping sound effect file name assigned to event tag <Special:2>.
    67. * @default wheels
    68. * @param Special Tag 3 SE
    69. * @desc Stepping sound effect file name assigned to event tag <Special:3>.
    70. * @default claws
    71. * @param Special Tag 4 SE
    72. * @desc Stepping sound effect file name assigned to event tag <Special:4>.
    73. * @default chains
    74. * @param Special Tag 5 SE
    75. * @desc Stepping sound effect file name assigned to event tag <Special:5>.
    76. * @default dragged
    77. * ============================================================================
    78. * @help
    79. * ============================================================================
    80. * Intructions
    81. * ============================================================================
    82. *
    83. * Once you have assigned terrain tag IDs to the tileset and configured the plugin
    84. * parameters accordingly, you can then tag a map event to produce stepping sound
    85. * effects by simply placing the string "<NPC>" somewhere in its event note input
    86. * field.
    87. * You can also employ special tags to events in order to replace the default
    88. * tileset stepping SE. This is useful for events that walk around the map in an
    89. * unique pattern (like for example an evil demon with claws in their feet).
    90. * For this, simply tag the event with "<Special:N>", where N is the number of
    91. * the special stepping SE you previously indicated in the plugin parameters.
    92. * If you don't wish an event to play both, the terrain and special stepping SE
    93. * simultaneously, add the tag "<SpecialOnly>".
    94. * The other special tag is "<Size:Big|Tiny>". This is designed to create a more
    95. * powerful or subtle stepping SE for events bigger/smaller than normal. This
    96. * effect is simulated by increase/decreasing the stepping SE pitch when played.
    97. * As always, make sure to change the plugin parameters for this as required.
    98. *
    99. * Keep in mind:
    100. *     - The player will always make noisy steps unless the designated switch
    101. * is turned ON.
    102. *     - If a map event is off the screen or its priority is above player, it
    103. * won't make noisy steps.
    104. *     - Characters will only make noisy steps if their Walking Animation flag
    105. * is ON.
    106. *
    107. * All stepping sound effects must be placed in the "Audio/SE" game folder, just
    108. * like any other SE you often use :) You can import them from the editor or
    109. * manually. Have fun!
    110. *
    111. * ============================================================================
    112. * Plugin Commands
    113. * ============================================================================
    114. *
    115. * You can use the following plugin command to change the sound effect assigned
    116. * to a terrain tag:
    117. *      SetTerrainTagSE <terrainTagId> <SE file name>
    118. *
    119. *    examples: SetTerrainTagSE 1 Water
    120. *              SetTerrainTagSE 3
    121. *
    122. * Also, if for some reason you require to disable noisy steps for a single
    123. * event, you can use the following script call:
    124. *      setNoisyStepsDisabled(flag)
    125. *
    126. *    examples: $gameMap.event(5).setNoisyStepsDisabled(true);
    127. *              $gameMap.event(this._eventId).setNoisyStepsDisabled(true);
    128. * ============================================================================
    129. */
    130. //=============================================================================
    131. // Parameter Variables
    132. //=============================================================================
    133. (function() {
    134.   
    135.     var parameters = PluginManager.parameters('AG_CharacterNoisySteps');
    136.     var _playerStepSEVolume = Number(parameters['Player Step SE Volume'] || '0');
    137.     var _eventsStepSEVolume = Number(parameters['Events Step SE Volume'] || '0');
    138.     var _stepSEPitch = Number(parameters['Step SE Pitch'] || '100');
    139.     var _pitchVariance = Number(parameters['Pitch Variance'] || '0');
    140.     var _panVariance = Number(parameters['Pan Variance'] || '0');
    141.     var _disablePlayerNoisyStepsSwitch = Number(parameters['Disable Player Noisy Steps Switch ID'] || 0);
    142.     var _disableEventsNoisyStepsSwitch = Number(parameters['Disable Events Noisy Steps Switch ID'] || 0);
    143.     var _terrainTagSE = [String(parameters['Terrain Tag 0 SE'] || ''),
    144.                          String(parameters['Terrain Tag 1 SE'] || ''),
    145.                          String(parameters['Terrain Tag 2 SE'] || ''),
    146.                          String(parameters['Terrain Tag 3 SE'] || ''),
    147.                          String(parameters['Terrain Tag 4 SE'] || ''),
    148.                          String(parameters['Terrain Tag 5 SE'] || ''),
    149.                          String(parameters['Terrain Tag 6 SE'] || ''),
    150.                          String(parameters['Terrain Tag 7 SE'] || '')];
    151.     var _sizeTagPitch = Number(parameters['Size Tag Pitch Increment'] || '0');
    152.     var _specialTagSE = [String(parameters['Special Tag 1 SE'] || ''),
    153.                          String(parameters['Special Tag 2 SE'] || ''),
    154.                          String(parameters['Special Tag 3 SE'] || ''),
    155.                          String(parameters['Special Tag 4 SE'] || ''),
    156.                          String(parameters['Special Tag 5 SE'] || '')];
    157.   
    158.     function isPlayerNoisyStepsDisabled(){
    159.         return $gameSwitches.value(_disablePlayerNoisyStepsSwitch);
    160.     }
    161.   
    162.     function isEventsNoisyStepsDisabled(){
    163.         return $gameSwitches.value(_disableEventsNoisyStepsSwitch);
    164.     }
    165.   
    166.     function getRandomRangeInt(min, max) {
    167.         return Math.floor(Math.random() * (max - min + 1) + min);
    168.     }
    169. //=============================================================================
    170. // Game_Interpreter
    171. //=============================================================================
    172.     var Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    173.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
    174.         Game_Interpreter_pluginCommand.call(this, command, args)
    175.         if (command === 'SetTerrainTagSE'){
    176.             var terrainTag = args[0];
    177.             if (terrainTag >= 0 && terrainTag <= 7){
    178.                 _terrainTagSE[terrainTag] = args[1];
    179.             }
    180.         }
    181.     };
    182.   
    183. //=============================================================================
    184. // Game_CharacterBase
    185. //=============================================================================
    186.   
    187.     Game_CharacterBase.prototype._noisyStep = false;
    188.     Game_CharacterBase.prototype._noisyStepWaitCount = 0;
    189.   
    190.     var characterNoisySteps_Game_CharacterBase_update = Game_CharacterBase.prototype.update;
    191.     Game_CharacterBase.prototype.update = function() {
    192.         this.performNoisyStep();
    193.         if(this._noisyStep){
    194.             this.resetNoisyStepWaitCount();
    195.         }else if(this._noisyStepWaitCount > 0){
    196.             this._noisyStepWaitCount--;
    197.         }
    198.         characterNoisySteps_Game_CharacterBase_update.call(this);
    199.     };
    200.   
    201.     var characterNoisySteps_Game_CharacterBase_setMoveSpeed = Game_CharacterBase.prototype.setMoveSpeed;
    202.     Game_CharacterBase.prototype.setMoveSpeed = function(moveSpeed) {
    203.         characterNoisySteps_Game_CharacterBase_setMoveSpeed.call(this, moveSpeed);
    204.         this.resetNoisyStepWaitCount();
    205.     };
    206.   
    207.     Game_CharacterBase.prototype.resetNoisyStepWaitCount = function() {
    208.         this._noisyStepWaitCount = 256/Math.pow(2, this.realMoveSpeed());
    209.         this._noisyStep = false;
    210.     };
    211.   
    212.     Game_CharacterBase.prototype.isNPC = function() {
    213.         return false;
    214.     };
    215.   
    216.     Game_CharacterBase.prototype.performNoisyStep = function() { };
    217. //=============================================================================
    218. // Game_Player
    219. //=============================================================================
    220.   
    221.     Game_Player.prototype.performNoisyStep = function() {
    222.         if(!isPlayerNoisyStepsDisabled() && this.hasWalkAnime() && this._noisyStepWaitCount == 0 && this.isMoving()){
    223.             this.playNoisyStep();
    224.             this._noisyStep = true;
    225.         }
    226.     };
    227.   
    228.     Game_Player.prototype.playNoisyStep = function() {
    229.         var pitch = getRandomRangeInt(_stepSEPitch - _pitchVariance, _stepSEPitch + _pitchVariance);
    230.         AudioManager.playSe({ name: _terrainTagSE[this.terrainTag()], volume: _playerStepSEVolume, pitch: pitch, pan: 0 });
    231.     };
    232. //=============================================================================
    233. // Game_Event
    234. //=============================================================================
    235.   
    236.   
    237.     var characterNoisySteps_Game_Event_initMembers = Game_Event.prototype.initMembers;
    238.     Game_Event.prototype.initMembers = function() {
    239.         characterNoisySteps_Game_Event_initMembers.call(this);
    240.         this._noisyStepsDisabled = false;
    241.     };
    242.   
    243.     Game_Event.prototype.performNoisyStep = function() {
    244.         if(!isEventsNoisyStepsDisabled() && !this._noisyStepsDisabled && this.isNPC() && this.isNearTheScreen() && this._priorityType < 2 && this.hasWalkAnime() && this._noisyStepWaitCount == 0 && this.isMoving()){
    245.             if(!this.isSpecialOnly()){
    246.                 this.playNoisyStep();
    247.             }
    248.             this.playSpecialNoisyStep();
    249.             this._noisyStep = true;
    250.         }
    251.     };
    252.   
    253.     Game_Event.prototype.playNoisyStep = function() {
    254.         var pitch = getRandomRangeInt(_stepSEPitch - _pitchVariance, _stepSEPitch + _pitchVariance) + _sizeTagPitch*this.sizeMultiplier();
    255.         var pan = _panVariance * this.panVarianceOffset($gamePlayer);
    256.         AudioManager.playSe({ name: _terrainTagSE[this.terrainTag()], volume: _eventsStepSEVolume, pitch: pitch, pan: pan });
    257.     };
    258.   
    259.     Game_Event.prototype.playSpecialNoisyStep = function() {
    260.         if(this.isSpecial()){
    261.             var pitch = getRandomRangeInt(_stepSEPitch - _pitchVariance, _stepSEPitch + _pitchVariance) + _sizeTagPitch*this.sizeMultiplier();
    262.             var pan = _panVariance * this.panVarianceOffset($gamePlayer);
    263.             if(this.event().note.indexOf('<Special:1>') != -1){
    264.                 AudioManager.playSe({ name: _specialTagSE[0], volume: _eventsStepSEVolume, pitch: pitch, pan: pan });  
    265.             }
    266.             if(this.event().note.indexOf('<Special:2>') != -1){
    267.                 AudioManager.playSe({ name: _specialTagSE[1], volume: _eventsStepSEVolume, pitch: pitch, pan: pan });  
    268.             }
    269.             if(this.event().note.indexOf('<Special:3>') != -1){
    270.                 AudioManager.playSe({ name: _specialTagSE[2], volume: _eventsStepSEVolume, pitch: pitch, pan: pan });  
    271.             }
    272.             if(this.event().note.indexOf('<Special:4>') != -1){
    273.                 AudioManager.playSe({ name: _specialTagSE[3], volume: _eventsStepSEVolume, pitch: pitch, pan: pan });  
    274.             }
    275.             if(this.event().note.indexOf('<Special:5>') != -1){
    276.                 AudioManager.playSe({ name: _specialTagSE[4], volume: _eventsStepSEVolume, pitch: pitch, pan: pan });  
    277.             }
    278.         }
    279.     };
    280.   
    281.     Game_Event.prototype.panVarianceOffset = function(character) {
    282.         if(character._x < this._x){
    283.             return 1;
    284.         }
    285.         else if(character._x > this._x){
    286.             return -1;
    287.         }
    288.         else{
    289.             return 0;
    290.         }
    291.     };
    292.   
    293.     Game_Event.prototype.isNPC = function() {
    294.         return this.event().note.indexOf('<NPC>') != -1;
    295.     };
    296.   
    297.     Game_Event.prototype.isSpecial = function() {
    298.         return this.event().note.indexOf('<Special:') != -1;
    299.     };
    300.   
    301.     Game_Event.prototype.isSpecialOnly = function() {
    302.         return this.event().note.indexOf('<SpecialOnly>') != -1;
    303.     };
    304.   
    305.     Game_Event.prototype.sizeMultiplier = function() {
    306.         if(this.event().note.indexOf('<Size:Tiny>') != -1){
    307.             return 1;
    308.         }else if(this.event().note.indexOf('<Size:Big>') != -1){
    309.             return -1;
    310.         }else{
    311.             return 0;
    312.         }
    313.     };
    314.   
    315.     Game_Event.prototype.setNoisyStepsDisabled = function(flag) {
    316.         this._noisyStepsDisabled = flag;
    317.     };
    318. })();
    复制代码





    (save as "AG_CharacterNoisySteps.js" in your plugins folder)

    Credits:
    Author: Akumu Games

    Notes:
    I don't think anyone has made a feature like this one yet. Kinda weird if you ask me.. As the n00b I'm I tried to come up with something while learning JS. I, personally, gonna find it very useful in my projects  


    Please, let me know if you find any glitch (very probable because I'm very tired right now D
    .


    本贴来自国际rpgmaker官方论坛作者:Kyuukon处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/ag-character-noisy-steps.65357/

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 01:34 , Processed in 0.092648 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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