Can someone with java knowledge help me with the functionality of this script? Currently it captures the assigned music for a region at the time and place a character enters the map, but I would like it to update - to switch to a new music track when a different designated region is entered. I am thinking a parallel process check (loop) with a wait time would work but not sure how to implement. Right now, it functions at the time of map entry only. A map properties note entry looks like:
<bgm12: Song1> .... where 12 is the region and Song1 is the filename of the BGM without extension
<bgm12: Song1> .... where 12 is the region and Song1 is the filename of the BGM without extension
Code:
Game_Map.prototype.autoplay = function() {
if($gamePlayer.regionId() && $dataMap.meta["bgm" + $gamePlayer.regionId()]) {
var dataBgm = $dataMap.meta["bgm" + $gamePlayer.regionId()].trim().split(" ");
var bgm = {
name: (dataBgm[0] === "Null" ? "" : dataBgm[0]),
volume: (dataBgm[1] === undefined ? $dataMap.bgm.volume : parseInt(dataBgm[1], 10)),
pan: (dataBgm[2] === undefined ? $dataMap.bgm.pan : parseInt(dataBgm[2], 10)),
pitch: (dataBgm[3] === undefined ? $dataMap.bgm.pitch : parseInt(dataBgm[3], 10))
};
AudioManager.playBgm(bgm);
} else if($dataMap.autoplayBgm) {
AudioManager.playBgm($dataMap.bgm);
}
};