累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 2026-7-12 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
58751
OK点
16
推广点
0
同能卷
50
积分 68660
KLazyWayOut XP
by Kyonides
Introduction
Are your players tired of fighting some random mobs?
Fear not! There is a LAZY way out of such a messy situation!
A brand new message will show up on the map warning you about the upcoming battle. If the player wants to skip it, he or she can pay their way out of it!
Currently Available Payment Methods:
Gold - Default
Experience Points
Spoiler: The Old Script
Ruby: # * KLazyWayOut XP # Scripter : Kyonides Arkanthes # 2022-06-14 # * A Non Plug & Play Script * # # Are your players tired of fighting some random mobs? # Fear not! There is a LAZY way out of such a messy situation! # A brand new message will show up on the map warning you about the upcoming # battle. If the player wants to skip it, he or she can pay their way out of it! # :ox and :oy stands for the X & Y Offsets respectively. module KLazy SWITCH_ID = 1 ALERT_SOUND = { :name => "", :volume => 70, :pitch => 100 } TRANSITION = { :name => "018-Brick02", :frames => 10 } FONT = { :name => "Arial", :size => 22, :bold => false } PICTURE = { :name => "app_logo", :ox => 4, :oy => 4 } MESSAGE_SIZE = { :x => 100, :y => 4, :width => 480 } MESSAGE = [] # Leave it alone! MESSAGE << "You are out of luck!" MESSAGE << "Some random monsters have appeared!" MESSAGE << "Want to pay them %s%s?" MESSAGE << "" # Battle Skip Cost: { MAPID => cost, etc. } SKIP_COST = { 1 => 10 } SKIP_COST.default = 20 end class Spriteset_Map def make_battle_alert dimensions = KLazy::MESSAGE_SIZE mx = dimensions[:x] my = dimensions[:y] cost = KLazy::SKIP_COST[$game_map.map_id] pic = KLazy::PICTURE message = KLazy::MESSAGE font = KLazy::FONT ay = $game_player.y - $game_map.display_y @alert_sprite = Sprite.new(@viewport2) @alert_sprite.y = ay < 8 ? 344 : 12 @alert_sprite.z += 1000 @alert_sprite.bitmap = b = Bitmap.new(dimensions[:width], 132) bit = RPG::Cache.picture(pic[:name]) b.blt(pic[:ox], pic[:oy], bit, bit.rect) bit.dispose mw = b.width - mx - 8 b.font.name = font[:name] b.font.size = font[:size] b.font.bold = font[:bold] message.size.times do |n| text = sprintf(message[n], cost, $data_system.words.gold) b.draw_text(mx, my, mw, 28, text) my += 28 end tr = KLazy::TRANSITION Graphics.transition(tr[:frames], "Graphics/Transitions/" + tr[:name]) end def dispose_battle_alert @alert_sprite.bitmap.dispose @alert_sprite.dispose end end class Scene_Map alias :kyon_lf_scn_bttl_up :update alias :kyon_lf_scn_bttl_call_bttl :call_battle def dispose_alert @spriteset.dispose_battle_alert @battle_alert = nil end def update_alert $game_system.update $game_screen.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) kyon_lf_scn_bttl_call_bttl dispose_alert elsif Input.trigger?(Input::C) cost = KLazy::SKIP_COST[$game_map.map_id] if $game_party.gold < cost $game_system.se_play($data_system.buzzer_se) kyon_lf_scn_bttl_call_bttl dispose_alert return end $game_system.se_play($data_system.shop_se) $game_party.lose_gold(cost) $game_temp.battle_troop_id = nil dispose_alert end end def update if @battle_alert update_alert return end kyon_lf_scn_bttl_up end def battle_alert $game_temp.battle_calling = false $game_temp.menu_calling = false $game_temp.menu_beep = false $game_player.make_encounter_count $game_player.straighten sound = KLazy::ALERT_SOUND alert_se = RPG::AudioFile.new(sound[:name], sound[:volume], sound[:pitch]) $game_system.se_play(alert_se) $game_player.straighten Graphics.freeze @spriteset.make_battle_alert @battle_alert = true end def call_battle $game_switches[KLazy::SWITCH_ID] ? battle_alert : kyon_lf_scn_bttl_call_bttl end end 复制代码
Spoiler: The New Script
Ruby: # * KLazyWayOut XP # Scripter : Kyonides # v1.1.0 - 2025-07-17 # * A Non Plug & Play Script * # # Are your players tired of fighting some random mobs? # Fear not! There is a LAZY way out of such a messy situation! # A brand new message will show up on the map warning you about the upcoming # battle. If the player wants to skip it, he or she can pay their way out of it! # Available Payment Methods: Gold & Experience. # :ox and :oy stands for the X & Y Offsets respectively. # * Script Call * # # Set Skip Cost Type - Default Type: :gold # $game_party.leader.skip_cost_type = :gold # $game_party.leader.skip_cost_type = :exp module KLazy SWITCH_ID = 1 BACKDROP_COLOR = Color.new(0, 0, 0, 128) ALERT_SOUND = { :name => "", :volume => 70, :pitch => 100 } TRANSITION = { :name => "018-Brick02", :frames => 10 } FONT = { :name => "Arial", :size => 22, :bold => false } PICTURE = { :name => "app_logo", :ox => 12, :oy => 12 } MESSAGE_SIZE = { :x => 100, :y => 4, :width => 480 } MESSAGE = [] # Leave it alone! MESSAGE << "You are out of luck!" MESSAGE << "Some random monsters have appeared!" MESSAGE << "Want to pay them %s%s?" MESSAGE << "" EXP_LABEL = "EXP" # Battle Skip Cost: { MAPID => cost, etc. } GOLD_SKIP_COST = { 1 => 10 } GOLD_SKIP_COST.default = 20 EXP_SKIP_COST = { 1 => 100 } EXP_SKIP_COST.default = 200 end class Game_Actor alias :kyon_lw_gm_act_setup :setup def setup(actor_id) kyon_lw_gm_act_setup(actor_id) @skip_cost_type = :gold end attr_accessor :skip_cost_type end class Game_Party def leader @actors[0] end end class LazyAlertSprite < Sprite def initialize(sy, view=nil) super(view) self.y = sy self.z += 1000 end def make_bitmap(w, h) self.bitmap = Bitmap.new(w, h) @height = h end def draw_alert(message) dimensions = KLazy::MESSAGE_SIZE mx = dimensions[:x] my = dimensions[:y] mw = self.bitmap.width - mx - 8 pic = KLazy::PICTURE lazy_font = KLazy::FONT font = self.bitmap.font font.name = lazy_font[:name] font.size = lazy_font[:size] font.bold = lazy_font[:bold] self.bitmap.fill_rect(self.bitmap.rect, KLazy::BACKDROP_COLOR) bit = RPG::Cache.picture(pic[:name]) self.bitmap.blt(pic[:ox], pic[:oy], bit, bit.rect) bit.dispose leader = $game_party.leader pay_gold = leader.skip_cost_type == :gold term_gold = $data_system.words.gold if pay_gold cost = KLazy::GOLD_SKIP_COST[$game_map.map_id] label = term_gold elsif leader.skip_cost_type == :exp cost = KLazy::EXP_SKIP_COST[$game_map.map_id] KLazy::EXP_LABEL else cost = 0 label = "None" end message.size.times do |n| text = sprintf(message[n], cost, label) self.bitmap.draw_text(mx, my + n * 28, mw, 28, text) end if pay_gold label = $game_party.gold.to_s + term_gold elsif leader.skip_cost_type == :exp label = leader.exp + label else label = "" end self.bitmap.draw_text(8, @height - 28, mx - 16, 28, label, 2) end end class Spriteset_Map def make_battle_alert message = KLazy::MESSAGE.reject{|ln| ln.empty? } msg_height = 16 + message.size * 24 ay = $game_player.y - $game_map.display_y @alert_sprite = LazyAlertSprite.new(ay < 8 ? 344 : 12, @viewport2) @alert_sprite.make_bitmap(KLazy::MESSAGE_SIZE[:width], msg_height) @alert_sprite.draw_alert(message) tr = KLazy::TRANSITION Graphics.transition(tr[:frames], "Graphics/Transitions/" + tr[:name]) end def dispose_battle_alert @alert_sprite.bitmap.dispose @alert_sprite.dispose end end class Scene_Map alias :kyon_lw_scn_bttl_up :update alias :kyon_lw_scn_bttl_call_bttl :call_battle def dispose_alert @spriteset.dispose_battle_alert @battle_alert = nil end def cancel_alert $game_system.se_play($data_system.buzzer_se) kyon_lf_scn_bttl_call_bttl dispose_alert end def update_alert $game_system.update $game_screen.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) kyon_lf_scn_bttl_call_bttl dispose_alert return elsif Input.trigger?(Input::C) leader = $game_party.leader if leader.skip_cost_type == :gold cost = KLazy::GOLD_SKIP_COST[$game_map.map_id] if $game_party.gold < cost cancel_alert return end $game_party.lose_gold(cost) elsif leader.skip_cost_type == :exp cost = KLazy::EXP_SKIP_COST[$game_map.map_id] if leader.exp < cost cancel_alert return end leader.exp -= cost end $game_system.se_play($data_system.shop_se) $game_temp.battle_troop_id = nil dispose_alert end end def update if @battle_alert update_alert return end kyon_lw_scn_bttl_up end def battle_alert $game_temp.battle_calling = false $game_temp.menu_calling = false $game_temp.menu_beep = false $game_player.make_encounter_count $game_player.straighten sound = KLazy::ALERT_SOUND alert_se = RPG::AudioFile.new(sound[:name], sound[:volume], sound[:pitch]) $game_system.se_play(alert_se) $game_player.straighten Graphics.freeze @spriteset.make_battle_alert @battle_alert = true end def call_battle $game_switches[KLazy::SWITCH_ID] ? battle_alert : kyon_lw_scn_bttl_call_bttl end end 复制代码
Note: The demo includes some minor edits of the Scene_Title class to make it easy to earn some gold coins and automatically turns Switch #1 on.
Terms & Conditions
Free as in beer for non commercial games.
Contact me if you want to go commercial. (There will be an inexpensive charge for this script only.)
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/klazywayout-xp.148528/
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x