KSkillMsg ACE

KSkillMsg ACE

by Kyonides
​

Introduction

Do you want to replace the default message for the Escape skill?
Or any other skill? :S
Now you can do it by using special note tags! 😀

Please read the instructions already embedded in the script before asking questions here.

The Script

Ruby:
# * KSkillMsg ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-09-19

# * How to Use * #
# Option 1: Place 1 or more notetags in a given Skill's Note Box.
# Option 2: Set a custom "string" to the ESCAPE_START Constant below.

# - Example of a Note Tag for Actors - Skill can be cast individually - #
#<message: actor 1 leaves at once.>

# - Example of a Note Tag for Enemies - #
#<message: enemy 1 chickens out.>

# - ESCAPE_START Constant's Default Value - #
# Below you will find the expression %s included in the string.
# It is used as a placeholder for the party's name.
# ESCAPE_START = "%s runs away from danger."

module KSkillMsg
  ESCAPE_START = "%s runs away from danger."
  REGEX_ACTOR = /<message: (actor) (\d+) ([^>]+)>/i
  REGEX_ENEMY = /<message: (enemy) (\d+) ([^>]+)>/i
  def self.process_msg(subject, item, default_line)
    regex = subject.is_a?(Game_Enemy)? REGEX_ENEMY : REGEX_ACTOR
    item.note[regex]
    ($1.nil? or subject.id != $2.to_i)? default_line : " " + $3
  end
end

module BattleManager
  def self.process_escape
    text = rand(100) < 50 ? Vocab::EscapeStart : KSkillMsg::ESCAPE_START
    text = sprintf(text, $game_party.name)
    $game_message.add(text)
    success = @preemptive ? true : (rand < @escape_ratio)
    Sound.play_escape
    if success
      process_abort
    else
      @escape_ratio += 0.1
      $game_message.add('\.' + Vocab::EscapeFailure)
      $game_party.clear_actions
    end
    wait_for_message
    return success
  end
end

class Game_Enemy
  def id
    @enemy_id
  end
end

class Window_BattleLog
  alias :kyon_escape_msg_win_btl_log_disp_use_itm :display_use_item
  def display_use_item(subject, item)
    return alternate_display_use_item(subject, item) if item.is_a?(RPG::Skill)
    kyon_escape_msg_win_btl_log_disp_use_itm(subject, item)
  end

  def alternate_display_use_item(subject, item)
    line = KSkillMsg.process_msg(subject, item, item.message1)
    add_text(subject.name + line)
    return if item.message2.empty?
    wait
    add_text(item.message2)
  end
end

Terms & Conditions

Free for use in ANY game.
Due credit is mandatory.
The script is distributed AS IS.
That's it!
A Very Useful Update!​

The latest version of my script allows you to change ANY SKILL's first message based on a very special note tag you can type right into your note box. 😉

For Actors:

Ruby:
<message: actor 1 leaves at once.>

For Enemies:

Ruby:
<message: enemy 1 chickens out.>

Have a Nice String Replacement Day! 😀​

Original thread: https://forums.rpgmakerweb.com/threads/kskillmsg-ace.161272/