KLazyWayOut
#1
KLazyWayOut
XP only
by Kyonides Arkanthes

Introduction

Confused Are your players Boring tired of fighting some random mobs?
Grinning Fear not! There is a LAZY way out of such a messy situation! Laughing

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!

The Script

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



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 beer for non commercial games.
Contact me if you want to go commercial. (There will be an inexpensive charge for this script only.)
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: 2 Guest(s)