MZ Audio don't plays sequentially

Hello, guys, I need your help.
I tried to make script for several LLM NPC actions, that were parsed from the output. All works good, but sound effect plays only from the first executed command. I need sounds from all commands to be played sequentially.
Here is my script:
var commandsArray = JSON.parse($gameVariables.value(8));
var npcInventory = $gameVariables.value(5);
function executeCommand(command) {
return new Promise(function (resolve) {
switch (command.action) {
case 'givePlayer':
var amount = command.quantity;
$gameParty.gainGold(amount);
npcInventory["gold"] -= amount;
resolve();
break;
case 'restrainPlayer':
$gameParty.gainItem($dataWeapons[49], 1);
$gameActors.actor(9).changeEquip(0, $dataWeapons[49]);
npcInventory["handcuffs"]--;
AudioManager.playBgs({ name: 'Handcuffs', volume: 90, pitch: 100, pan: 0 });
var timerDuration = 3000;
setTimeout(function () {
AudioManager.stopBgs();
resolve();
}, timerDuration);
break;
case 'shoutPlayer':
var amount = command.quantity * 800;
AudioManager.playBgs({ name: 'shout_09', volume: 90, pitch: 100, pan: 0 });
var timerDuration = amount;
setTimeout(function () {
AudioManager.stopBgs();
resolve();
}, timerDuration);
break;
default:
resolve(); // Если необходимо что-то по умолчанию
break;
}
});
}
function executeCommandsSequentially(commands) {
var index = 0;
function executeNextCommand() {
if (index < commands.length) {
var command = commands[index];
executeCommand(command).then(function () {
index++;
setTimeout(function () {
executeNextCommand();
}, command.timerDuration + 500);
});
} else {
$gameVariables.setValue(8, JSON.stringify([])); // Очищаем массив команд
$gameVariables.setValue(6, 0);
}
}
executeNextCommand();
}
executeCommandsSequentially(commandsArray);
When you post code, you should use the CODE tags (the </> in the edit bar). That will preserve indentations and brackets in your code.

It's really hard to try to follow through that and figure out what's supposed to be happening under which conditions.
Thanks for replying, I had resolved this problem by using SE instead of BGS and combination of script with ingame editor events.

Original thread: https://forums.rpgmakerweb.com/threads/audio-dont-plays-sequentially.162957/