Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Bob423

Events that change the volume of a sound, the closer the player gets

Recommended Posts

I'm looking for a script that will let me make things like waterfalls, fountains, etc. that get louder as the player approaches them.

I've tried sensor event scripts that trigger something when the player gets within a certain range, but i can't get it to work the way i want. it doesn't lower the volume as the player walks away.

It's easy to do this with events, but it takes a lot of them, and is annoying to do. plus it will cause a lot of lag once i put the enemies on the map.

Share this post


Link to post
Share on other sites

hm...i'll try this out, thanks

 

wow, um...this looks pretty complicated. was hoping for something simpler

Edited by Bob423

Share this post


Link to post
Share on other sites

i wrote this up to check if the coordinate of a player is equal to that range check of an event:

class Interpreter
 def range_check(range, event)
   #check left
   return true if $game_player.x == $game_map.events[event].x - range &&
  $game_player.y == $game_map.events[event].y
   #check right
   return true if $game_player.x == $game_map.events[event].x + range &&
  $game_player.y == $game_map.events[event].y
   #check down
   return true if $game_player.y == $game_map.events[event].y + range &&
  $game_player.x == $game_map.events[event].x
   #check up
   return true if $game_player.y == $game_map.events[event].y - range &&
  $game_player.x == $game_map.events[event].x
   #check upper left
   return true if $game_player.x == $game_map.events[event].x - range &&
  $game_player.y == $game_map.events[event].y - range
   #check upper right
   return true if $game_player.x == $game_map.events[event].x + range &&
  $game_player.y == $game_map.events[event].y - range
   #check lower left
   return true if $game_player.x == $game_map.events[event].x - range &&
  $game_player.y == $game_map.events[event].y + range
   #check lower right
   return true if $game_player.x == $game_map.events[event].x + range &&
  $game_player.y == $game_map.events[event].y + range
   #else
   return false
 end
end

to use it, the script call is: range_check(RANGE, ID)

use that within a conditional branch and replace RANGE with the range that it returns true, and ID to the id of the event to check against, it will draw a box around the event essential with the given radius of the range and return true if you stand on that radius

Share this post


Link to post
Share on other sites

that doesn't really make much sense, but it doesn't sound like what i want.

 

i want something like this...

i tell an event to play a BGS.

the BGS plays at this volume when the player is x tiles away.

the BGS plays louder when the player is x-5 tiles away

the BGS is played at 100% volume when the player is right next to the event.

 

that's all i want. very simple, easy to use, no complicated configs. a definitely nothing that needs an entire manual to explain

Share this post


Link to post
Share on other sites

you can do that with that script in a conditional branch, example of an event:

conditional branch: script: range_check(1, @event_id)
 play_bgs with volume 100%
branch end

conditional branch: script: range_check(2, @event_id)
 play_bgs with volume 75%
branch end

conditional branch: script: range_check(3, @event_id)
 play_bgs with volume 50%
branch end

conditional branch: script: range_check(4, @event_id)
 play_bgs with volume 25%
branch end

conditional branch: script: range_check(5, @event_id)
 fade out bgs 1 second
branch end




when you execute a play sound command, if the sound is the same as currently been played is does not reset, and only alters the volume and pitch to match the new ones set

Share this post


Link to post
Share on other sites

the value you enter is checked corresponding to the events coordinates, so if you put 1 it checks to see if you are 1 block away in each direction, then if you put 2 it checks 2 blocks in each direction etc, just have a play with it and you will soon catch on :)

Share this post


Link to post
Share on other sites

it didn't work very well. it only works for the tiles vertically and horizontally. like the way a rook moves in chess. i want it to work diagonally too.

Share this post


Link to post
Share on other sites

Too bad this isnt for Ace! I'd enjoy testing it out if it was.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...