[SOLVED] Disable Escape for Random Encounters? (VX Ace)

I know this has been asked before, but I didn't find a solution I was happy with and so I thought I'd just ask again.

Basically, I want to disable Escaping at a certain point in the game.
Most of the encounters in my game are map-based, but this specific part of the game should feature RANDOM encounters (For which, of course, you CAN'T disable escaping).

Anyone know how I could do this? What I could put in the Troop Event maybe?
Best case scenario would be if the Escape command would be greyed out just like it is when you disable it for event battles.

Also experimented with turning the Escape command on and off via a Switch using Yanfly's "Battle Command List" (Which seemed promising), but I didn't get it to work. Also have no experience with scripting so I can't write anything myself.

Any advice? Thanks.
Moved to: RGSSx Script Support

To make things easier, you could have listed the solutions you already found and state why they didn't suit you.

However, because you have a script that supposedly does this, but it doesn't work when you try it, let's work on that. Please show us how you have set up the script to use this switch, and what you're doing in events at the start and the end of this area to disable/enable the Escape command. Screenshots are preferable to you typing up an explanation.
https://forums.rpgmakerweb.com/index.php?threads/disable-escaping.95449/post-879210
maybe has a solution for you.

There's no way to do it decently without scripting. Luckily, it's very easy to do WITH scripting, given the fact that you said every encounter in this area is unique to that area. For each troop you want to be inescapable, add a Script call to its events and copy/paste the following:

BattleManager._canEscape = false;

Then, set that page to trigger on turn 0. The escape command should now be grayed out.

That said, do use this carefully. Inescapable random encounters can be super annoying, especially if the rate is high. That said, good luck!
https://forums.rpgmakerweb.com/index.php?threads/disable-escaping.95449/post-879210
maybe has a solution for you.

There's no way to do it decently without scripting. Luckily, it's very easy to do WITH scripting, given the fact that you said every encounter in this area is unique to that area. For each troop you want to be inescapable, add a Script call to its events and copy/paste the following:

BattleManager._canEscape = false;

Then, set that page to trigger on turn 0. The escape command should now be grayed out.

That said, do use this carefully. Inescapable random encounters can be super annoying, especially if the rate is high. That said, good luck!

Thanks, I stumbled upon that too, but if I remember correctly, I tried it and it didn't work (Probably because I'm using VX Ace, that thread was about MV. Maybe I was just stupid and it DOES work though, I guess I could try again when I get home)


Moved to: RGSSx Script Support

To make things easier, you could have listed the solutions you already found and state why they didn't suit you.

However, because you have a script that supposedly does this, but it doesn't work when you try it, let's work on that. Please show us how you have set up the script to use this switch, and what you're doing in events at the start and the end of this area to disable/enable the Escape command. Screenshots are preferable to you typing up an explanation.

The other solutions I found Online included raising the agility stats of all enemies to make escaping basically impossible (More of a workaround, not ideal for my project for a variety of reasons) or just disabling the ability to escape altogether (Which I also don't want since the player should be able to escape from battles in earlier sections of the game).

Already reverted my changes so can't post screenshots of how I had set it up (Also not at home right now), but the Yanfly script (https://yanflychannel.wordpress.com/rmvxa/battle-scripts/battle-command-list/) has this section which I though seemed promising:

1626676250010.png


Thought I might be able to set up :escape as a custom command to activate or deactivate with a switch. For example I tried replacing "Handler Method" ( :command_name1) with :escape (While commenting out the normal :escape under Party Commands and instead activating :custom1 of course), but that just ended up crashing the game in my tests. Not sure right now if I also tried replacing :custom1 under :command with :escape, I'll try it again when I'm back home.

If anything works or if anything else comes to mind, I'll post it here in case anyone has the same problem.

Thanks for your replies in any case
The reason your edit did not work is because escape is not a custom party command, but a default one. So the script does not look for the switches and handler method, assuming all default commands will use the default handlers (if you add a custom command, it's assumed you're also adding a custom handler for it). I have not tested this, but give it a go ...

on line 438, it says this:
Code:
add_command(Vocab::escape, :escape, BattleManager.can_escape?)

If your evented battles will ALWAYS allow escape, change that line to this:
Code:
add_command(Vocab::escape, :escape, $game_switches[53])

replacing 53 with whatever switch you want to use.

turn that switch on at the start of the game, off when you first enter this special area, and on again when you exit this special area. This will enable the escape option when the switch is on, and disable it when the switch is off.
The reason your edit did not work is because escape is not a custom party command, but a default one. So the script does not look for the switches and handler method, assuming all default commands will use the default handlers (if you add a custom command, it's assumed you're also adding a custom handler for it). I have not tested this, but give it a go ...

on line 438, it says this:
Code:
add_command(Vocab::escape, :escape, BattleManager.can_escape?)

If your evented battles will ALWAYS allow escape, change that line to this:
Code:
add_command(Vocab::escape, :escape, $game_switches[53])

replacing 53 with whatever switch you want to use.

turn that switch on at the start of the game, off when you first enter this special area, and on again when you exit this special area. This will enable the escape option when the switch is on, and disable it when the switch is off.

OK, that sounds great! Not ALL event battles should be escapable, like Boss battles for example - I guess I'd have to turn the switch on and off for those instances but that should be no problem at all. Will try this later.

Thanks so much for your help!

Original thread: https://forums.rpgmakerweb.com/threads/solved-disable-escape-for-random-encounters-vx-ace.138639/