Hello! I want a script that changes the bgm automatically based on what character is the first in the party line-up, BUT only changes it for one(or more) particular map(s). For example, in the village, regardless of the line-up, the music remains the same, but in the world map, if X is first in the line-up, the music changes to X, but if Y is the first, the music returns to normal.
Any help would be appreciated. 🙂
You don't need a script for this.
On those maps, put an event set to parallel process that does a series of tests to see who is the leader, and changes the BGM based on the results. I think Control Variables > Game Data > Party Member 1's > ID will let you put the leader's actor id into a variable, then you just use conditional branches to check what's in the variable. Add an Erase Event at the end.
If you want ALL the maps in this special group to play the SAME BGM depending on who is the leader, put all the logic into a common event, then in the parallel process event on each of those maps, just do a Call Common Event followed by an Erase Event.
What happens if you're on one of these maps and the music for the specific actor is playing, and the player changes the formation so someone else is the leader? Is the music to change automatically? That would require something more complicated.
In that case you would use a common event set to parallel process and conditioned by a switch, which would do the music change then turn the switch off, and you'll need a plugin to turn the switch on when the formation is changed.