public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

VXACESound Emitting Events

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Sound Emitting Events
  • Original author: ♥SOURCE♥
  • Original date: May 1, 2012
  • Source thread: https://forums.rpgmakerweb.com/threads/sound-emitting-events.1714/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSS3 Scripts (RMVX Ace)

Summary

Sound Emitting Events ​ (v.2.1) ​

Archived First Post

Sound Emitting Events




(v.2.1)


Introduction

This little script allows you to set up events that will play BGS/ME/SE (you could try BGM, but..) if the player gets close enough.

The volume is based on the distance between the player and the event, so the closer the player is to the event, the louder it will play, the farthest the player is, the softer it will play (or not play at all).

You can set a max volume for the sound/music. (v.2.1)

Features

- Easy to use.

- Compatibility friendly.

- Lemonade friendly.

Screenshot

lsee.png


How to Use

To use it, you just need to make a comment inside the event that would be the sound source with the following →



Code:
LSEE TYPE RANGE PITCH VOLUME FILENAME
If you want a BGS to play, you need to add BGS after LSEE, like this →



Code:
LSEE BGS 8 100 100 Fire
If you want to play ME/SE, you also need to two additional indicators for delay and variance →



Code:
LSEE SE 8 100 45 Absorb2 60 100
Demo

http://www.mediafire...41g2a39vpkuh00d

Script

Code:
#==============================================================================
# ** Lemony's Sound Emitting Events
#------------------------------------------------------------------------------
# * This little script allows to make certain events play music/sounds based
# on player proximity.
# * It is currently limited by one bgs at a time, resulting in lag if one
# sound emitting event's area is overlapping other's sound emitting event area.
#------------------------------------------------------------------------------
# To use it, simple make a comment inside the target event with the following
# LSEE TYPE RANGE PITCH VOLUME FILENAME => LSEE BGS 8 100 100 Fire
# If type is SE or ME, you need two additional variables
# LSEE TYPE RANGE PITCH VOLUME FILENAME DELAY RANDOM
#==============================================================================
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Refresh Alias
  #--------------------------------------------------------------------------
  alias lemony_see_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
	lemony_see_refresh
	return if (@page.nil? || @page.list.nil?)
	@page.list.each {|p| b = p.parameters[0]
	s, @lsee_out = (b != nil && b.is_a?(String)) ? b.split : '', false
	if (p.code == 108 || p.code == 408) && b.include?('LSEE')
	  @lsee_data = [s[1], s[2], s[3].to_i, s[4], s[5], s[6].to_i, s[7].to_i]
	  break if @lsee_data != nil
	else @lsee_out = true end}
  end
  #--------------------------------------------------------------------------
  # * Update Alias
  #--------------------------------------------------------------------------
  alias lemony_see_update update
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
	lemony_see_update
	if !@lsee_data.nil?
	  xx, yy = (@real_x - $game_player.real_x), (@real_y - $game_player.real_y)
	  close = (Math.sqrt((xx * xx) + (yy * yy)) <= @lsee_data[1].to_i)
	  r, d = @lsee_data[1].to_i, Math.sqrt((xx * xx) + (yy * yy))
	  v, go, ms = (r - (d - 1 % r)) * @lsee_data[3].to_i / r, true, ['ME', 'SE']
	  if !@lsee_out
		if ms.include?(@lsee_data[0])
		  @lsee_timer ||= @lsee_data[5] + rand(@lsee_data[6])
		  @lsee_timer = [@lsee_timer - 1, 0].max
		  go = @lsee_timer <= 0
		  @lsee_timer = nil if go
		end
		out = (!@lsee_data[7].nil? && (@lsee_data[7].volume > 0 && !close)) && go
		f = "#{@lsee_data[0]}.new('#{@lsee_data[4]}', #{v}, #{@lsee_data[2]})"
		@lsee_data[7] ||= eval("RPG::" + f) if close && go
		@lsee_data[7].volume = v if !@lsee_data[7].nil? && close
		@lsee_data[7].play if ((!@lsee_data[7].nil? && close) && go) || out
		@lsee_data[7].volume -= 1 if !@lsee_data[7].nil? && !close
		@lsee_data[7] = nil if (!@lsee_data[7].nil? && @lsee_data[7].volume <= 0)
	  elsif @lsee_out
		@lsee_data[7].volume -= 1 if !@lsee_data[7].nil?
		@lsee_data[7].play if !@lsee_data[7].nil? && !ms.include?(@lsee_data[0])
		if (!@lsee_data[7].nil? && @lsee_data[7].volume <= 0)
		  @lsee_data, @lsee_out = nil, false
		end
	  end
	end
  end
end
Author's Notes

Free for use in commercial/noncommercial games, no credits needed.

Features Mentioned

  • Easy to use.
  • Compatibility friendly.
  • Lemonade friendly.

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

License / Terms Note

Free for use in commercial/noncommercial games, no credits needed.

Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#rgss3#script-archive

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar