Travelling Merchant Opening Shop In Battle

I have a random encounter that is a travelling merchant. I'm trying to get it so the player can decided to shop, not shop, or even attack the merchant. I can get the last two options to work but when the player says yes to shop, the store doesn't open. Depending what is set up it just means the batle continues or I can abort the battle. Making the merchant 'immortal' doesn't help either.

I'd prefer to force the dialogue tree from the start (currently 1st round has to finish meaning the player could kill the merchant before the options come up). Any easy way to do this that I'm missing?
Interesting! It seems the Shop Processing event command explicitly checks whether the party is out of battle before deciding whether to show the shop. 😐

It's easy to remove the check, but I don't know whether it'll have any bad side-effects, so use at your own risk! Just save this as a .js file (Save As > File Type: All Files, Filename: whateverYouLike.js) then import as a plugin, save your project, and test~
JavaScript:
Game_Interpreter.prototype.command302 = function() {
//  if (!$gameParty.inBattle()) {  // removed check
        var goods = [this._params];
        while (this.nextEventCode() === 605) {
            this._index++;
            goods.push(this.currentCommand().parameters);
        }
        SceneManager.push(Scene_Shop);
        SceneManager.prepareNextScene(goods, this._params[4]);
//  }
    return true;
};
Hopefully it'll work out OK! 🙏
I'll try it out in a 'copy' version of my game just to make sure. Thanks for the help. *crosses fingers*
@Volourn in case it doesn't work, try removing the "!" for
if (!gameParty.inBattle()) .... to if ($gameParty.isBattle())

I dont know if it does the same when ruling that it out though 🙂
this is just a simple alternate way if the above doesn't work 🙂

but ceathryl knows what she does though =)
@Volourn in case it doesn't work, try removing the "!" for
if (!gameParty.inBattle()) .... to if ($gameParty.isBattle())

I dont know if it does the same when ruling that it out though 🙂
this is just a simple alternate way if the above doesn't work 🙂

but ceathryl knows what she does though =)

Absolutely do not do this, or shops will *only* work in battle. 😛
or add a like !$gamePlayer.isBattler || $gamePlayer.isBattle()

might have the same effect to do both, but you have to try itotherwise.
I try to think for solution which can help as well 🙂 try to improve my js knowledge =)

Original thread: https://forums.rpgmakerweb.com/threads/travelling-merchant-opening-shop-in-battle.124232/