- Joined
- Sep 3, 2018
- Messages
- 5
- Reaction score
- 0
- First Language
- Dutch
- Primarily Uses
- RMVXA
So I ran into a problem not too long ago, and I've looked around on the web but didn't see any solution to my problem (I think).
I made a map recently with a waterfall, and I'd like to have the waterfall play a waterfall sound, but I only want it to be hearable when you're close to the waterfall. For that I am using this volume distance script:
I've tried this script before on another map to play a hammer sound when you get close to the forge, and I already found that when you put the event to a parallel process (because to my knowledge the sound doesn't run otherwise) the sound starts infinitely looping over itself which creates a terrible sound and a certain amount of lag. I fixed that issue by simply putting a wait command after the script line to only play the sound every 2 seconds or so, but now that I'm trying it here again that doesn't seem to be a solution.
The SE I use for the Waterfall is quite lengthy (63 seconds) but it is a nice loop and I'd like to stick with it. Now, when I try to run the script through an event, it again starts to infinitely loop over itself, which I do not want. But when I try to add a wait command the command needs to be long enough to stop the sound from looping until it is finished (so 63 seconds), but I found that the sound somehow doesn't play anymore after a wait time of 600 frames/10 seconds.
What I'd basically like to know is if it is possible to run the event when the player enters the map, only play the SE once, wait until the SE is finished and only then start to play it again whilst still using the script so the sound is only hearable in some parts of the map?
I made a map recently with a waterfall, and I'd like to have the waterfall play a waterfall sound, but I only want it to be hearable when you're close to the waterfall. For that I am using this volume distance script:
# Version 1.01# Date : Nov 15, 2013
#------------------------------------------------------------------------------
# Parameters:
# eventID : ID of the event that produces the SE
# md : maximum distance up to which you can hear the SE
# mv : maximum volume of the SE
# return : actual volume depending on the actual distance
#
# Example:
# RPG::SE.new("Cat", volume(@event_id,20,50), 100).play
#------------------------------------------------------------------------------
def volume(eventID, md, mv)
x1 = $game_player.x
y1 = $game_player.y
x2 = $game_map.events[eventID].x
y2 = $game_map.events[eventID].y
d = Math.sqrt((x2-x1)**2 + (y2-y1)**2).round
v = mv-(mv*d/md).round
if v < 0 then
v = 0
end
return(v)
end
#------------------------------------------------------------------------------
# Parameters:
# eventID : ID of the event that produces the SE
# md : maximum distance up to which you can hear the SE
# mv : maximum volume of the SE
# return : actual volume depending on the actual distance
#
# Example:
# RPG::SE.new("Cat", volume(@event_id,20,50), 100).play
#------------------------------------------------------------------------------
def volume(eventID, md, mv)
x1 = $game_player.x
y1 = $game_player.y
x2 = $game_map.events[eventID].x
y2 = $game_map.events[eventID].y
d = Math.sqrt((x2-x1)**2 + (y2-y1)**2).round
v = mv-(mv*d/md).round
if v < 0 then
v = 0
end
return(v)
end
I've tried this script before on another map to play a hammer sound when you get close to the forge, and I already found that when you put the event to a parallel process (because to my knowledge the sound doesn't run otherwise) the sound starts infinitely looping over itself which creates a terrible sound and a certain amount of lag. I fixed that issue by simply putting a wait command after the script line to only play the sound every 2 seconds or so, but now that I'm trying it here again that doesn't seem to be a solution.
The SE I use for the Waterfall is quite lengthy (63 seconds) but it is a nice loop and I'd like to stick with it. Now, when I try to run the script through an event, it again starts to infinitely loop over itself, which I do not want. But when I try to add a wait command the command needs to be long enough to stop the sound from looping until it is finished (so 63 seconds), but I found that the sound somehow doesn't play anymore after a wait time of 600 frames/10 seconds.
What I'd basically like to know is if it is possible to run the event when the player enters the map, only play the SE once, wait until the SE is finished and only then start to play it again whilst still using the script so the sound is only hearable in some parts of the map?