RPG Maker VX Ace – Music Playing in a Specific Region

When I built Storm Point in Tears of the King, I built a magical grove attached to the city, rather like a park.   All of the groves in the game have the same music  except the one in Storm Point; since the Grove is part of Storm Point, it plays the town’s music.  So this week I wanted to see if it was possible to tie the music into a map’s region.  A bit of research revealed that yes, it’s totally possible!  Here’s how you do it.

First, you need to set up the region you want the music to play in, like this.

Storm Point Regions

As you can see, I’ve made the Storm Point grove into Region 1.

Next you need an event.  Here’s the one I have for this particular case:

Storm Point Music Change

You’ll notice that this is triggered only after the Lava Cavern Switch is turned on.  If it’s not on, this event does nothing.

Once the event is triggered, you’re going to use a conditional branch (that’s found under Flow Control, just like Loop from last time).  Go to the fourth page, where you’ll find Script.

Conditional Branch Script

Now you’re going to type in $game_player.region_id == 1 as your script.  The number will be whatever region you used (so in this case, since I used Region 1, I have to use a 1).  Click OK, then fill in what you want to happen when the Player is in that region.  I used Play BGM, which is under Picture and Sounds, and selected the music I wanted whenever the Player stepped into the Grove.  Under Else, I said to play the BGM that normally plays in Storm Point.  Make sure this event runs as either an Auto Run event or a Parallel Process if you have another event going on at the same time as this one (which I do).

And here’s what you end up with:

I’d like to give a big thank you to LoneWolfDon on the RPG Maker forums for his demo of region controlled events.  You can find his discussion and a link to the demo here.  That’s where I got the script I used from.

Advertisements

Leave a comment

Filed under Game Development, RPG, Tears of the King, Tools

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s