じ☆ve冰风 发表于 2026-7-14 22:05:04

KSkillMsg VX

KSkillMsg VX

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!
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7

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

The Script

                Ruby:       
# * KSkillMsg VX * #
#   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
    ($1.nil? or subject.id != $2.to_i)? default_line : " " + $3
end
end

class Game_Enemy
def id
    @enemy_id
end
end

class Scene_Battle
def process_escape
    @info_viewport.visible = false
    @message_window.visible = true
    text = rand(100) < 50 ? Vocab::EscapeStart : KSkillMsg::ESCAPE_START
    text = sprintf(text, $game_party.name)
    $game_message.texts.push(text)
    if $game_troop.preemptive
      success = true
    else
      success = (rand(100) < @escape_ratio)
    end
    Sound.play_escape
    if success
      wait_for_message
      battle_end(1)
    else
      @escape_ratio += 10
      $game_message.texts.push('\.' + Vocab::EscapeFailure)
      wait_for_message
      $game_party.clear_actions
      start_main
    end
end

def alternate_display_use_item(skill)
    line = KSkillMsg.process_msg(@active_battler, skill, skill.message1)
    @message_window.add_instant_text(@active_battler.name + line)
    return if skill.message2.empty?
    wait(10)
    @message_window.add_instant_text(skill.message2)
end

def execute_action_skill
    skill = @active_battler.action.skill
    alternate_display_use_item(skill)
    targets = @active_battler.action.make_targets
    display_animation(targets, skill.animation_id)
    @active_battler.mp -= @active_battler.calc_mp_cost(skill)
    $game_temp.common_event_id = skill.common_event_id
    for target in targets
      target.skill_effect(@active_battler, skill)
      display_action_effects(target, skill)
    end
end
end


Terms & Conditions

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


本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kskillmsg-vx.161315/
页: [1]
查看完整版本: KSkillMsg VX