Escaping from battles with item/skill issues

In my game, I want to add an item that is just like the Poké Doll/Fluffy Tail/Poké Toy from Pokémon, in which you use it during battle and you are guaranteed to escape. The problem is, when I tested this item out, it even lets you escape from bosses, even though I had disabled normal escaping on that boss. You're not able to select the escape option during the battle, but when you use the escape item (Called Antique Doll in my game) you are able to escape, letting you skip the boss. Is there a way to prevent this or do I need a script?

I also want to add a skill called "Illusion" in my game that basically does the same thing, however I tested it and like the Antique Doll, you're able to escape from bosses with it that you should not be able to.

Just in case you ask, yes, I have "can escape" unchecked, and you are not able to use the escape option normally in the boss battle I tested it on.
The problem is the escape skill under features is a guaranteed escape, it works no matter what. Technically it was only meant for monsters as it will ignore the can escape flag, and it has many issues when used by the party (one which you noticed, to find another use it after one party member is KO'd, but the rest of the party isn't...you'll get a game over).

Probably going to need a script to make the escape item work as you wish I'm afraid.
I know I'm answering an old thread, but I came here with the same issue, so I thought I'd post my fix. Here's a quick script that will make the escape special effect work for the party even when some characters are KO. It will not allow escape in battles where escape is not allowed.


EDIT: There is a bug with this script that causes it to say "Failed to escape" up to 4 times (one for each party member) when you try to use it will fighting a boss monster. I don't have time to fix this properly right now, but you can easily avoid the issue by changing your item to affect "The User" instead of "All Allies." It will still cause all allies to escape.

Spoiler
class Game_Actor < Game_Battler
  def item_effect_special(user, item, effect)
    case effect.data_id
    when SPECIAL_EFFECT_ESCAPE
      if BattleManager.can_escape?
        $game_party.battle_members.each do |mem|
          mem.escape
        end
      else
        $game_message.add('\.' + Vocab::EscapeFailure)
      end
    end
    @result.success = true
  end
  
  def escape
    hide if $game_party.in_battle
    clear_actions
    clear_states if alive?
    Sound.play_escape
  end
end



It's written so that if escape isn't allowed, you get an "escape failed" message. If you'd rather get a standard "there was no effect" item message, you can put

Spoiler
return @result.success = false



instead of

Spoiler
$game_message.add('\.' + Vocab::EscapeFailure)
Took me forever to respond but thank you very much for this, I found a different solution a long time ago (making a state called "no escape" which seals the skill and then giving the no escape state to the party at the start of boss battles) but I just tried this instead and it's much simpler, not to mention works better and more reliably, as I was having problems with the no escape state seemingly only working when it wanted to. This is how the escape function should have worked in the first place.
Cool! I'm glad to hear it's useful to someone besides me. I found a bug with it, unfortunately, but it's easy to work around. I added the details in an edit to my previous post. The script itself hasn't changed.

Original thread: https://forums.rpgmakerweb.com/threads/escaping-from-battles-with-item-skill-issues.42792/