Kuu_t

Veteran
Veteran
Joined
Jun 19, 2016
Messages
34
Reaction score
23
First Language
Finnish
Primarily Uses
RMMV
Hello everybody,

I have a traditional puzzle, where the player pushes a boulder on the button to open a door.

The puzzle is fine, but I'd like to do it more interesting for the player. I'd like to randomize the pitch of the pushing SFX to make it less monotonous to listen.

Is there a way to achieve this by eventing? I prefer eventing over a plugin because I'm already using Yanflies moving route plugins. I'm afraid that I'd broke the system with another plugin to override the moving route.

boring_sfx_by_lokki_kuutamo-dcmeob9.png
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
3,051
Reaction score
2,324
First Language
English
Primarily Uses
RMMV
Set a variable to random value (for example, random 1-3), then make conditional branches to cover each possible outcome (1, 2, 3, if following the example) with a different sound.
 

Kuu_t

Veteran
Veteran
Joined
Jun 19, 2016
Messages
34
Reaction score
23
First Language
Finnish
Primarily Uses
RMMV
Thanks! Unfortunately, I had to do it outside of the moving route loop. This is a bit clunky solution, but it works.

scrap_by_lokki_kuutamo-dcmfufk.png
 

OS87

Warper
Member
Joined
May 11, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hey,
I wrote a little script for you to handle randomized sound effects within a move route.

add it to a new .js file in your js/plugins folder and activate it in the editor.

Code:
function soundPool(a, b) {
    // a = sound file name
    // b = number of sounds
return a + Math.floor(Math.random() * (b+1));
};

To use:
Create copies or rename your sound files so they share the same name, ending in a different number, starting at zero.
So the files would be:
Raise0.ogg
Raise1.ogg
Raise2.ogg

But it needs to start at 0, and there can't be any gaps in numbering. (so no 1,2,4,6).

In your Set Movement Route, select the "script" option, and paste in:
AudioManager.playSe({name: soundPool('Raise', 2), volume: 100, pitch: 100, pan: 0})

Obviously you can set the file name, the number to count up to, volume, pitch and pan to whatever you like!

How it works:
The script is a little function I've arbitrarily called soundPool, in the example above you give it two arguments: 'Raise' (the sound 'family' name) and 2; the highest number you have in that pool of sounds.
Used inside the AudioManager.playSe functionality from the engine itself, it justs chooses a random file from that pool of Raise sounds from 0 to the max you set.

Alternatively / Additionally:

Code:
function Pitchy(a, b) {
    // a = base value
    // b = range either side for random number
return a + Math.floor(Math.random() * (2*b+1) -b);
}

You can vary the pitch like this, input your base value and the number of variance you want on either side.

So in your setMovement you could have:
AudioManager.playSe({name: 'Raise0', volume: 100, pitch: Pitchy(100,2), pan: 0})

And this would use one sound, but every time it's played it'd be pitched within 2 of
100, (so it'd play at pitch 98,99,100,101 or 102).

You can use either or both at the same time, and they won't interfere with any other scripts, they're just additional tools you can use in your script calls.

Hope these help, your game looks nice!
 
Last edited:

Latest Threads

Latest Profile Posts

One year and two days ago, I got RMMV. So far I have:

» Gotten Ideas™ from VXA’s music.
» Made a test project to teach myself the basics.
» Successfully done up a no-combat outline for Ideas™.
» Entered the Boss Battle Build Bout.
» Burned out for over seven months after trying the One Map Challenge.
» Found my groove again about a month ago.

And it feels good to be back on track again.
Let there be light!
title2 copy.png

Just a little mood-piece for the game I'm working on with @spillycat :)
Logo of the new game I‘ve been working on with @Finnuval ! F05668FB-8AE1-4214-948F-0F58397FF282.jpeg
"What!? 2000!? There's no way that can be right!""It's over 2900!"

Forum statistics

Threads
123,061
Messages
1,153,695
Members
161,398
Latest member
OnTheForumAndLuvinIt
Top