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