じ☆ve冰风 发表于 2026-8-2 07:42:28

Play SE on Balloon Popup

Balloon Sound Effect v1.0
By: Hero_Claive

Intro
I noticed every Ace script about this has either expired or been taken down, so I wrote a quick snippet as replacement. This script automatically plays a specified SE when a balloon event command is called. You can specify the SE, volume, and pitch for each individual balloon.

Features

[*]Play a sound effect when calling a balloon event command
[*]Specify the volume and pitch for each sound effect
[*]Disables this feature with a switch, if desired
Screenshots
Not particularly relevant.

How to use
Place this script below Materials and above Main in the script editor. It's mostly plug-and-play, but you'll need to write in the name for each SE in the configuration section. The SE should be the same name as the one in the Audio/SE folder.

Note: If you want a balloon SE to be silent, simply leave the name as "".

Demo
Not particularly relevant.

Script
Spoiler                Code:       
#==============================================================
# * Hero_Claive Balloon SE
# \\\\\\\\\\\\\\\\\\\\\\\\\\\
# * Free for commercial/non-commercial use, no credit required
#==============================================================

module Balloon_SFX

BALLOON_SFXS = {#Don't touch

#----------------------------------------------------------------------
# Balloon Row => ["File name", Volume, Pitch]
#
# ** Go to Resource Manager and click on System/Balloon to see each row
#----------------------------------------------------------------------

#Exclamation
1 => ["", 100, 100],
#Question
2 => ["", 100, 100],
#Note
3 => ["Saint5", 100, 100],
#Heart
4 => ["", 100, 100],
#Anger
5 => ["", 100, 100],
#Sweat
6 => ["", 100, 100],
#Cobweb
7 => ["", 100, 100],
#Silence
8 => ["", 100, 100],
#Light Bulb
9 => ["", 100, 100],
#zzz
10 => ["", 100, 100]

} #Don't touch

#**Just in case you want to disable this feature, use the switch below:

SWITCH_ID = 0

end


#============================================================================
# * Sprite_Character
#============================================================================
class Sprite_Character < Sprite_Base

#--------------------------------------------------------------------------
# * Overwrite: start_balloon
#--------------------------------------------------------------------------
def start_balloon
    dispose_balloon
    @balloon_duration = 8 * balloon_speed + balloon_wait
    @balloon_sprite = ::Sprite.new(viewport)
    @balloon_sprite.bitmap = Cache.system("Balloon")
    @balloon_sprite.ox = 16
    @balloon_sprite.oy = 32
    play_balloon_se
    update_balloon
end

#--------------------------------------------------------------------------
# * New Method: play_balloon_se
#--------------------------------------------------------------------------
def play_balloon_se
    return if $game_switches == true
    return if @balloon_id == 0
    return if Balloon_SFX::BALLOON_SFXS[@balloon_id] == nil
    name = Balloon_SFX::BALLOON_SFXS[@balloon_id]
    volume = Balloon_SFX::BALLOON_SFXS[@balloon_id]
    pitch = Balloon_SFX::BALLOON_SFXS[@balloon_id]
    unless name == ""
      Audio.se_play('Audio/SE/' + name, volume, pitch)
    end
end

end






Credit
No credit required, usable in commercial or non-commercial projects. Took under five minutes to make so use away. Post any questions, errors, or requested features in this thread or shoot me a PM.


本贴来自国际rpgmaker官方论坛作者:Hero_Claive处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/play-se-on-balloon-popup.98871/
页: [1]
查看完整版本: Play SE on Balloon Popup