设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 119|回复: 0

[转载发布] KLazyWayOut XP

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58751
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68660

    灌水之王

    发表于 2026-7-27 08:45:13 | 显示全部楼层 |阅读模式
    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:       
    1. # * KLazyWayOut XP
    2. #  Scripter : Kyonides Arkanthes
    3. #  2022-06-14
    4. # * A Non Plug & Play Script * #
    5. # Are your players tired of fighting some random mobs?
    6. # Fear not! There is a LAZY way out of such a messy situation!
    7. # A brand new message will show up on the map warning you about the upcoming
    8. # battle. If the player wants to skip it, he or she can pay their way out of it!
    9. # :ox and :oy stands for the X & Y Offsets respectively.
    10. module KLazy
    11.   SWITCH_ID = 1
    12.   ALERT_SOUND = { :name => "", :volume => 70, :pitch => 100 }
    13.   TRANSITION = { :name => "018-Brick02", :frames => 10 }
    14.   FONT = { :name => "Arial", :size => 22,  :bold => false }
    15.   PICTURE = { :name => "app_logo", :ox => 4, :oy => 4 }
    16.   MESSAGE_SIZE = { :x => 100, :y => 4, :width => 480 }
    17.   MESSAGE = [] # Leave it alone!
    18.   MESSAGE << "You are out of luck!"
    19.   MESSAGE << "Some random monsters have appeared!"
    20.   MESSAGE << "Want to pay them %s%s?"
    21.   MESSAGE << ""
    22.   # Battle Skip Cost: { MAPID => cost, etc. }
    23.   SKIP_COST = { 1 => 10 }
    24.   SKIP_COST.default = 20
    25. end
    26. class Spriteset_Map
    27.   def make_battle_alert
    28.     dimensions = KLazy::MESSAGE_SIZE
    29.     mx = dimensions[:x]
    30.     my = dimensions[:y]
    31.     cost = KLazy::SKIP_COST[$game_map.map_id]
    32.     pic = KLazy::PICTURE
    33.     message = KLazy::MESSAGE
    34.     font = KLazy::FONT
    35.     ay = $game_player.y - $game_map.display_y
    36.     @alert_sprite = Sprite.new(@viewport2)
    37.     @alert_sprite.y = ay < 8 ? 344 : 12
    38.     @alert_sprite.z += 1000
    39.     @alert_sprite.bitmap = b = Bitmap.new(dimensions[:width], 132)
    40.     bit = RPG::Cache.picture(pic[:name])
    41.     b.blt(pic[:ox], pic[:oy], bit, bit.rect)
    42.     bit.dispose
    43.     mw = b.width - mx - 8
    44.     b.font.name = font[:name]
    45.     b.font.size = font[:size]
    46.     b.font.bold = font[:bold]
    47.     message.size.times do |n|
    48.       text = sprintf(message[n], cost, $data_system.words.gold)
    49.       b.draw_text(mx, my, mw, 28, text)
    50.       my += 28
    51.     end
    52.     tr = KLazy::TRANSITION
    53.     Graphics.transition(tr[:frames], "Graphics/Transitions/" + tr[:name])
    54.   end
    55.   def dispose_battle_alert
    56.     @alert_sprite.bitmap.dispose
    57.     @alert_sprite.dispose
    58.   end
    59. end
    60. class Scene_Map
    61.   alias :kyon_lf_scn_bttl_up :update
    62.   alias :kyon_lf_scn_bttl_call_bttl :call_battle
    63.   def dispose_alert
    64.     @spriteset.dispose_battle_alert
    65.     @battle_alert = nil
    66.   end
    67.   def update_alert
    68.     $game_system.update
    69.     $game_screen.update
    70.     if Input.trigger?(Input::B)
    71.       $game_system.se_play($data_system.cancel_se)
    72.       kyon_lf_scn_bttl_call_bttl
    73.       dispose_alert
    74.     elsif Input.trigger?(Input::C)
    75.       cost = KLazy::SKIP_COST[$game_map.map_id]
    76.       if $game_party.gold < cost
    77.         $game_system.se_play($data_system.buzzer_se)
    78.         kyon_lf_scn_bttl_call_bttl
    79.         dispose_alert
    80.         return
    81.       end
    82.       $game_system.se_play($data_system.shop_se)
    83.       $game_party.lose_gold(cost)
    84.       $game_temp.battle_troop_id = nil
    85.       dispose_alert
    86.     end
    87.   end
    88.   def update
    89.     if @battle_alert
    90.       update_alert
    91.       return
    92.     end
    93.     kyon_lf_scn_bttl_up
    94.   end
    95.   def battle_alert
    96.     $game_temp.battle_calling = false
    97.     $game_temp.menu_calling = false
    98.     $game_temp.menu_beep = false
    99.     $game_player.make_encounter_count
    100.     $game_player.straighten
    101.     sound = KLazy::ALERT_SOUND
    102.     alert_se = RPG::AudioFile.new(sound[:name], sound[:volume], sound[:pitch])
    103.     $game_system.se_play(alert_se)
    104.     $game_player.straighten
    105.     Graphics.freeze
    106.     @spriteset.make_battle_alert
    107.     @battle_alert = true
    108.   end
    109.   def call_battle
    110.     $game_switches[KLazy::SWITCH_ID] ? battle_alert : kyon_lf_scn_bttl_call_bttl
    111.   end
    112. end
    复制代码


    Spoiler: The New Script
                    Ruby:       
    1. # * KLazyWayOut XP
    2. #   Scripter : Kyonides
    3. #   v1.1.0 - 2025-07-17
    4. # * A Non Plug & Play Script * #
    5. # Are your players tired of fighting some random mobs?
    6. # Fear not! There is a LAZY way out of such a messy situation!
    7. # A brand new message will show up on the map warning you about the upcoming
    8. # battle. If the player wants to skip it, he or she can pay their way out of it!
    9. # Available Payment Methods: Gold & Experience.
    10. # :ox and :oy stands for the X & Y Offsets respectively.
    11. # * Script Call * #
    12. # Set Skip Cost Type - Default Type: :gold
    13. #   $game_party.leader.skip_cost_type = :gold
    14. #   $game_party.leader.skip_cost_type = :exp
    15. module KLazy
    16.   SWITCH_ID = 1
    17.   BACKDROP_COLOR = Color.new(0, 0, 0, 128)
    18.   ALERT_SOUND = { :name => "", :volume => 70, :pitch => 100 }
    19.   TRANSITION = { :name => "018-Brick02", :frames => 10 }
    20.   FONT = { :name => "Arial", :size => 22,  :bold => false }
    21.   PICTURE = { :name => "app_logo", :ox => 12, :oy => 12 }
    22.   MESSAGE_SIZE = { :x => 100, :y => 4, :width => 480 }
    23.   MESSAGE = [] # Leave it alone!
    24.   MESSAGE << "You are out of luck!"
    25.   MESSAGE << "Some random monsters have appeared!"
    26.   MESSAGE << "Want to pay them %s%s?"
    27.   MESSAGE << ""
    28.   EXP_LABEL = "EXP"
    29.   # Battle Skip Cost: { MAPID => cost, etc. }
    30.   GOLD_SKIP_COST = { 1 => 10 }
    31.   GOLD_SKIP_COST.default = 20
    32.   EXP_SKIP_COST = { 1 => 100 }
    33.   EXP_SKIP_COST.default = 200
    34. end
    35. class Game_Actor
    36.   alias :kyon_lw_gm_act_setup :setup
    37.   def setup(actor_id)
    38.     kyon_lw_gm_act_setup(actor_id)
    39.     @skip_cost_type = :gold
    40.   end
    41.   attr_accessor :skip_cost_type
    42. end
    43. class Game_Party
    44.   def leader
    45.     @actors[0]
    46.   end
    47. end
    48. class LazyAlertSprite < Sprite
    49.   def initialize(sy, view=nil)
    50.     super(view)
    51.     self.y = sy
    52.     self.z += 1000
    53.   end
    54.   def make_bitmap(w, h)
    55.     self.bitmap = Bitmap.new(w, h)
    56.     @height = h
    57.   end
    58.   def draw_alert(message)
    59.     dimensions = KLazy::MESSAGE_SIZE
    60.     mx = dimensions[:x]
    61.     my = dimensions[:y]
    62.     mw = self.bitmap.width - mx - 8
    63.     pic = KLazy::PICTURE
    64.     lazy_font = KLazy::FONT
    65.     font = self.bitmap.font
    66.     font.name = lazy_font[:name]
    67.     font.size = lazy_font[:size]
    68.     font.bold = lazy_font[:bold]
    69.     self.bitmap.fill_rect(self.bitmap.rect, KLazy::BACKDROP_COLOR)
    70.     bit = RPG::Cache.picture(pic[:name])
    71.     self.bitmap.blt(pic[:ox], pic[:oy], bit, bit.rect)
    72.     bit.dispose
    73.     leader = $game_party.leader
    74.     pay_gold = leader.skip_cost_type == :gold
    75.     term_gold = $data_system.words.gold
    76.     if pay_gold
    77.       cost = KLazy::GOLD_SKIP_COST[$game_map.map_id]
    78.       label = term_gold
    79.     elsif leader.skip_cost_type == :exp
    80.       cost = KLazy::EXP_SKIP_COST[$game_map.map_id]
    81.       KLazy::EXP_LABEL
    82.     else
    83.       cost = 0
    84.       label = "None"
    85.     end
    86.     message.size.times do |n|
    87.       text = sprintf(message[n], cost, label)
    88.       self.bitmap.draw_text(mx, my + n * 28, mw, 28, text)
    89.     end
    90.     if pay_gold
    91.       label = $game_party.gold.to_s + term_gold
    92.     elsif leader.skip_cost_type == :exp
    93.       label = leader.exp + label
    94.     else
    95.       label = ""
    96.     end
    97.     self.bitmap.draw_text(8, @height - 28, mx - 16, 28, label, 2)
    98.   end
    99. end
    100. class Spriteset_Map
    101.   def make_battle_alert
    102.     message = KLazy::MESSAGE.reject{|ln| ln.empty? }
    103.     msg_height = 16 + message.size * 24
    104.     ay = $game_player.y - $game_map.display_y
    105.     @alert_sprite = LazyAlertSprite.new(ay < 8 ? 344 : 12, @viewport2)
    106.     @alert_sprite.make_bitmap(KLazy::MESSAGE_SIZE[:width], msg_height)
    107.     @alert_sprite.draw_alert(message)
    108.     tr = KLazy::TRANSITION
    109.     Graphics.transition(tr[:frames], "Graphics/Transitions/" + tr[:name])
    110.   end
    111.   def dispose_battle_alert
    112.     @alert_sprite.bitmap.dispose
    113.     @alert_sprite.dispose
    114.   end
    115. end
    116. class Scene_Map
    117.   alias :kyon_lw_scn_bttl_up :update
    118.   alias :kyon_lw_scn_bttl_call_bttl :call_battle
    119.   def dispose_alert
    120.     @spriteset.dispose_battle_alert
    121.     @battle_alert = nil
    122.   end
    123.   def cancel_alert
    124.     $game_system.se_play($data_system.buzzer_se)
    125.     kyon_lf_scn_bttl_call_bttl
    126.     dispose_alert
    127.   end
    128.   def update_alert
    129.     $game_system.update
    130.     $game_screen.update
    131.     if Input.trigger?(Input::B)
    132.       $game_system.se_play($data_system.cancel_se)
    133.       kyon_lf_scn_bttl_call_bttl
    134.       dispose_alert
    135.       return
    136.     elsif Input.trigger?(Input::C)
    137.       leader = $game_party.leader
    138.       if leader.skip_cost_type == :gold
    139.         cost = KLazy::GOLD_SKIP_COST[$game_map.map_id]
    140.         if $game_party.gold < cost
    141.           cancel_alert
    142.           return
    143.         end
    144.         $game_party.lose_gold(cost)
    145.       elsif leader.skip_cost_type == :exp
    146.         cost = KLazy::EXP_SKIP_COST[$game_map.map_id]
    147.         if leader.exp < cost
    148.           cancel_alert
    149.           return
    150.         end
    151.         leader.exp -= cost
    152.       end
    153.       $game_system.se_play($data_system.shop_se)
    154.       $game_temp.battle_troop_id = nil
    155.       dispose_alert
    156.     end
    157.   end
    158.   def update
    159.     if @battle_alert
    160.       update_alert
    161.       return
    162.     end
    163.     kyon_lw_scn_bttl_up
    164.   end
    165.   def battle_alert
    166.     $game_temp.battle_calling = false
    167.     $game_temp.menu_calling = false
    168.     $game_temp.menu_beep = false
    169.     $game_player.make_encounter_count
    170.     $game_player.straighten
    171.     sound = KLazy::ALERT_SOUND
    172.     alert_se = RPG::AudioFile.new(sound[:name], sound[:volume], sound[:pitch])
    173.     $game_system.se_play(alert_se)
    174.     $game_player.straighten
    175.     Graphics.freeze
    176.     @spriteset.make_battle_alert
    177.     @battle_alert = true
    178.   end
    179.   def call_battle
    180.     $game_switches[KLazy::SWITCH_ID] ? battle_alert : kyon_lw_scn_bttl_call_bttl
    181.   end
    182. 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
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-4 12:50 , Processed in 0.081511 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表