How do I detect if certain music is playing by script?

GamoupIndustries

Villager
Member
Joined
May 25, 2021
Messages
11
Reaction score
0
First Language
English
Primarily Uses
RMVXA
I'm using VX Ace and when I run the following script:
Ruby:
if (AudioManager._currentBgm.name != "Dungeon4")
    Audio.bgm.play("Dungeon4");
It shows an error.
So how do I fix the script?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,699
Reaction score
2,800
First Language
English
Primarily Uses
RMMZ
What's the error?

Wait, AudioManager doesn't exist in VX Ace. The module is Sound, but I'm not sure it can have its currently-playing BGM checked like that. Let me have a look.

Edit: Got it.

if (RPG::BGM.last.name != "Dungeon4")
 
Last edited:

GamoupIndustries

Villager
Member
Joined
May 25, 2021
Messages
11
Reaction score
0
First Language
English
Primarily Uses
RMVXA
But how do I change the volume and pitch?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,300
Reaction score
8,367
First Language
German
Primarily Uses
RMMV
nothing in your original post said anything about volume or pitch.

I suggest you give us a full description of what you want to do (instead of questions about tiny steps of how you want to do the unknownwhat), and then we can point you to how it is best done - scripts are not always the best solution for example.
 

GamoupIndustries

Villager
Member
Joined
May 25, 2021
Messages
11
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Conditional Branch: If RPG::BGM.last.name != "Field3"
Conditional Branch: If Ship is Driven
Play BGM: "Ship", 105, 100
Else
Play BGM: "Field3", 105, 100
Branch End
Branch End
 

Latest Threads

Latest Profile Posts

PSA: please stop putting the word 'Eternal' in your game titles.
RMMZ: "Simple enough for a child!"
also RMMZ: "What, you're trying to make an RPG and you didn't know about Euler angles?"
I kinda spent the day having my own little gamejam and came up with this Catastrophe!

GZOq45s.png
Have Defeated Enemy Join Party as Actor, Show Passage Status, & MZ-Chan Art | RPG Maker News #107

My outfit at Metrocon. It was fun.

Forum statistics

Threads
113,626
Messages
1,076,289
Members
147,640
Latest member
RuddyKoeol
Top