之前闲的时候写了一个简单的小插件,虽然我也不太确定是否有前辈或大佬开发过类似的,但如果本插件对一些人有帮助的话还是献一下丑啦~~
这个插件可以在标题界面点击【新游戏】按钮时播放自定义的SE,比如自己喜欢的音效或者人物语音之类的(不过确实没多大用处。。。)
本插件开源免费,如果是js大佬的话,可以增加很多自己想要的功能。我还是太菜了,大佬求轻喷(可能大佬自己操作都比看这个插件来得快吧 hhhh)
可以直接复制也可以下载附件,复制的情况下,请重命名为"RandomSound"并以JavaScript的扩展名保存。谢谢!
新手向插件帮助
更新履历
- //=============================================================================// New Game Random Sound//=============================================================================var Imported = Imported || {};Imported.RandomSound = true;var Sound = Sound || {};//==============================================================================/*: * @author お兄ちゃん大好き * * @plugindesc (V1.2) Randomly play se when player press the "New Game" button * * @param Sound Files for New Game * * @desc List all sound files here you wish to play randomly for New Game. Seperate each sound file with ";". * * @param Sound Files for Continue * * @desc List all sound files here you wish to play randomly For Continue. Seperate each sound file with ";". * * @help * This plugin only has one parameter, which is sound list that will be played * randomly when player press the "New Game" button. * * **The form of the parameter** * FileName1, volume, pitch, pan; FileName2, volume, pitch, pan * E.g. Attack1,100,100,0; Attack2,90,120,0 * * Spaces are allowed but NO TRAILING ";" * * //========================================================================= * // Change Log * //========================================================================= * 2020-5-15 v1.0 * Plugin finished * * 2020-5-16 v1.1 * Optimisation of the algorithm for randomly playing sound effect * * 2020-5-16 v1.2 * New function that randomly play sound effect for Continue button, same as * the "New Game" */ //============================================================================= // Read Files and Initialsing //============================================================================= Sound.Param = PluginManager.parameters('RandomSound'); newGame = String(Sound.Param['Sound Files for New Game']); newGame = newGame.split(';'); conti = String(Sound.Param['Sound Files for Continue']); conti = conti.split(';'); for (i = 0; i < newGame.length; i++) { var property = new Object(newGame[i].split(',')); newGame[i] = {}; newGame[i].name = String(property[0].trim()); newGame[i].volume = Number(property[1].trim()); newGame[i].pitch = Number(property[2].trim()); newGame[i].pan = Number(property[3].trim()); }; for (i = 0; i < conti.length; i++) { var property = new Object(conti[i].split(',')); conti[i] = {}; conti[i].name = String(property[0].trim()); conti[i].volume = Number(property[1].trim()); conti[i].pitch = Number(property[2].trim()); conti[i].pan = Number(property[3].trim()); }; (function() { //============================================================================= // Override the new game function //============================================================================= var randomSound_NewGame = Window_TitleCommand.prototype.processOk; Window_TitleCommand.prototype.processOk = function() { randomSound_NewGame.call(this); if (this.isCurrentItemEnabled() && Window_TitleCommand._lastCommandSymbol == 'newGame') { this.playRandomSoundNewGame(); } else if (this.isCurrentItemEnabled() && Window_TitleCommand._lastCommandSymbol == 'continue') { this.playRandomSoundContinue(); }; }; //============================================================================= // Algorithm for randomly playing sound //============================================================================= Window_TitleCommand.prototype.playRandomSoundNewGame = function() { var rate = 0; if (newGame.length > 1) { rate = Math.floor(Math.random() * newGame.length); }; if (newGame.length != 0) AudioManager.playSe( {"name":newGame[rate].name, "volume":newGame[rate].volume, "pitch":newGame[rate].pitch, "pan":newGame[rate].pan} ); }; Window_TitleCommand.prototype.playRandomSoundContinue = function() { var rate = 0; if (conti.length > 1) { rate = Math.floor(Math.random() * conti.length); }; if (conti.length != 0) AudioManager.playSe( {"name":conti[rate].name, "volume":conti[rate].volume, "pitch":conti[rate].pitch, "pan":conti[rate].pan} ); };})();复制代码
复制代码
本帖来自P1论坛作者526396987,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=481781 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。