# * 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