The problem is in the method 'process_escape' within the 'BattleManager' module. I have added some comments to the code below to sort of help explain what is going on (hopefully).
#-------------------------------------------------------------------------- # * Escape Processing #-------------------------------------------------------------------------- def self.process_escape # '$game_message.add' outputs a modified version of the EscapeStart text to the message buffer. # The 'sprintf' command basically takes the 'EscapeStart' text and replaces the '%s' -- an indicator # for 'string' -- with the text output of the 'name' method within 'Game_Party' ('Eric', or 'Eric's Party'). $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name)) success = @preemptive ? true : (rand < @escape_ratio) Sound.play_escape if success process_abort else @escape_ratio += 0.1 # Here is the primary issue. Unlike line 222, 'sprintf' is not used on 'EscapeFailure', and no # string indicator ('%s') is even in the failure text by default. So, what we need to do is change # 'EscapeFailure' to include '%s' where the name should be inserted. $game_message.add('\.' + Vocab::EscapeFailure) $game_party.clear_actions end wait_for_message return success endThe following scriptlet should allow for what you are wanting. For the purposes of compatibility, I have chosen to use a round-about way to alter the 'process_escape' method.
Code:
#==============================================================================# ** Vocab#------------------------------------------------------------------------------# This module defines terms and messages. It defines some data as constant# variables. Terms in the database are obtained from $data_system.#==============================================================================module Vocab # Since the script is going to over-write the actual 'EscapeFailure' constant, # I created a copy with the only difference being the added string indicator ('%s') # and an underscore in the name. EscapeFailure_ = "However, %s was unable to escape!" end # Vocab#==============================================================================# ** BattleManager#------------------------------------------------------------------------------# This module manages battle progress.#==============================================================================module BattleManager #-------------------------------------------------------------------------- # * ALIAS - Escape Processing #-------------------------------------------------------------------------- class << self unless method_defined?(:battle_Y1oisDRH_battle_manager_process_escape) alias_method(:battle_Y1oisDRH_battle_manager_process_escape, :process_escape) end end def self.process_escape(*args, &block) # Here I perform the 'sprintf' text replacement using the copied 'EscapeFailure_' # constant, then use 'const_set' to over-write the actual 'EscapeFailure' constant # which the following aliased command will use. Vocab.const_set("EscapeFailure", sprintf(Vocab::EscapeFailure_, $game_party.name)) battle_Y1oisDRH_battle_manager_process_escape(*args, &block) end end # BattleManager
thanks very much for all the help! i had an idea that it was something in BattleManager that was determining what to use for %s, but couldn't figure it out, didn't guess it was the sprintf command.
i've pasted in your script and it's working great! would you be able to do a similar thing with something other than 'game_party', and how would you figure out what it would need to be called? say if you were to use a specific actor name instead?
would it be too much to ask what the bits above and below the explained script in the BattleManager escape processing alias mean? if it's a good idea to do aliases for the sake of compatibility when making these kinds of edits, i'd love to know how they work too, if it's not too much trouble.
would i be right in thinking that to do it without an alias you would just change "$game_message.add('\.' + Vocab::EscapeFailure)" to "$game_message.add('\.' + sprintf(Vocab::EscapeFailure, $game_party.name)), and replace "it" in the vocab with "%s"?
sorry for putting this in the wrong forum, i'll be more careful in the future.