扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 118|回复: 0

[转载发布] 【迷你插件】单击开始游戏按钮随机播放自定义音效(更新v1.2

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-2-4 02:05
  • 签到天数: 110 天

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10475
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13225

    灌水之王

    发表于 2024-3-2 03:55:44 | 显示全部楼层 |阅读模式
    之前闲的时候写了一个简单的小插件,虽然我也不太确定是否有前辈或大佬开发过类似的,但如果本插件对一些人有帮助的话还是献一下丑啦~~

    这个插件可以在标题界面点击【新游戏】按钮时播放自定义的SE,比如自己喜欢的音效或者人物语音之类的(不过确实没多大用处。。。)
    本插件开源免费,如果是js大佬的话,可以增加很多自己想要的功能。我还是太菜了,大佬求轻喷(可能大佬自己操作都比看这个插件来得快吧 hhhh)

    可以直接复制也可以下载附件,复制的情况下,请重命名为"RandomSound"并以JavaScript的扩展名保存。谢谢!


    新手向插件帮助



    更新履历




    1. //=============================================================================//  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在线咨询功能删除,谢谢。

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-3-11 00:05 , Processed in 0.134535 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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