So I wanted to make managing BGM more less of a chore for a dungeon with multiple map that has same BGM music.
When changing the BGM of a dungeon, you also need to change the BGM of other map of the same dungeon.
Well, you can leave them blank so that the last map's BGM played however it will have problem if the dungeon is not linear exploration (Can access other dungeon maps from a town, for example, not just the main entrance. and it will result the Town BGM to carry over to the dungeon map).
The idea in general:
I think the simple way is to fetch note tags as a reference, then loads the data using it as reference.
fetch notetag value of the current map (<BGM_reference: mapID>)
Load Map Data Map(mapID).json using notetag as reference and then fetch BGM.
Play fetched BGM.
I tried making it on my own but i'm pretty much newbiest of newbie at JS, so I'm stuck lol though i can understand a bit.
The condition does work to an extent because it returns "console.log(BGMData)" which is undefined btw; but it failed to fetch another map BGM data and play it (obviously).
If someone do make it, i will compare and study it. Hope i can get better hehe.
If someone do help me, it also help me study how to make plugin. It's fine either way.
Thanks in advance.
When changing the BGM of a dungeon, you also need to change the BGM of other map of the same dungeon.
Well, you can leave them blank so that the last map's BGM played however it will have problem if the dungeon is not linear exploration (Can access other dungeon maps from a town, for example, not just the main entrance. and it will result the Town BGM to carry over to the dungeon map).
The idea in general:
I think the simple way is to fetch note tags as a reference, then loads the data using it as reference.
fetch notetag value of the current map (<BGM_reference: mapID>)
Load Map Data Map(mapID).json using notetag as reference and then fetch BGM.
Play fetched BGM.
I tried making it on my own but i'm pretty much newbiest of newbie at JS, so I'm stuck lol though i can understand a bit.
JavaScript:
Game_Map.prototype.autoplay = function() {
var groupBGM = parseInt($dataMap.meta.bgm_reference);
var BGMsrc = groupBGM.padZero(3);
var BGMData;
DataManager.loadDataFile('BGMData', 'Map'+BGMsrc+'.json')
if ($dataMap.autoplayBgm) {
if ($gamePlayer.isInVehicle()) {
$gameSystem.saveWalkingBgm2();
} else {
AudioManager.playBgm($dataMap.bgm);
}
} else if (groupBGM > 0) {
if ($gamePlayer.isInVehicle()) {
$gameSystem.saveWalkingBgm2();
} else {
console.log(BGMData);
AudioManager.playBgm(BGMData.bgm);
}
}
if ($dataMap.autoplayBgs) {
AudioManager.playBgs($dataMap.bgs);
}
};
The condition does work to an extent because it returns "console.log(BGMData)" which is undefined btw; but it failed to fetch another map BGM data and play it (obviously).
If someone do make it, i will compare and study it. Hope i can get better hehe.
If someone do help me, it also help me study how to make plugin. It's fine either way.
Thanks in advance.