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

[转载发布] KSteps2Doom VX

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

    连续签到: 2 天

    [LV.7]常住居民III

    7565

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-22 08:51:48 | 显示全部楼层 |阅读模式
    KSteps2Doom VX

    by Kyonides


    Introduction

    This script turns the map's encounter steps as a fixed number.
    It features a simple HUD to let you know when you are about to trigger a random encounter on the current map.
    The HUD will disappear if you leave any of the monster areas.
    You have set no areas on that map?

    Well, that means you won't be fighting any given monster.






    Spoiler: The Script
                    Ruby:       
    1. # * KSteps2Doom VX * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   2024-03-19
    4. # This script turns the map's encounter steps as a fixed number.
    5. # It features a simple HUD to let you know when you are about to trigger a
    6. # random encounter on the current map.
    7. module KSteps2Doom
    8.   COUNTER_ICON_INDEX = 112
    9.   COUNTER_X  = 4
    10.   COUNTER_Y  = 4
    11.   COUNTER_WH = [104, 26]
    12. end
    13. class Game_Map
    14.   alias :kyon_steps2doom_gm_map_setup :setup
    15.   def setup(map_id)
    16.     kyon_steps2doom_gm_map_setup(map_id)
    17.     areas = $data_areas.values.compact
    18.     @map_areas = areas.select {|area| area.map_id == @map_id }
    19.   end
    20.   attr_reader :map_areas
    21. end
    22. class Game_Player
    23.   attr_reader :encounter_count
    24.   def make_encounter_count
    25.     @encounter_count = 0
    26.   end
    27.   def update_encounter
    28.     return if $TEST and Input.press?(Input::CTRL)
    29.     return if in_vehicle? or !area_found?
    30.     @encounter_count += 1
    31.   end
    32.   def map_area?(area)
    33.     rect = area.rect
    34.     return false if rect.x > @x or rect.y > @y
    35.     return false if @x >= rect.x + rect.width
    36.     return false if @y >= rect.y + rect.height
    37.     return true
    38.   end
    39.   def area_found?
    40.     $game_map.map_areas.find {|area| map_area?(area) } != nil
    41.   end
    42. end
    43. class EncounterSprite < Sprite
    44.   include KSteps2Doom
    45.   def initialize(vp=nil)
    46.     super(vp)
    47.     self.x = COUNTER_X
    48.     self.y = COUNTER_Y
    49.     self.bitmap = Bitmap.new(*COUNTER_WH)
    50.     make_rects
    51.   end
    52.   def make_rects
    53.     grad_width = bitmap.width / 2
    54.     @black = Color.new(0, 0, 0)
    55.     @alpha = Color.new(0, 0, 0, 0)
    56.     @left_rect = Rect.new(0, 0, grad_width, bitmap.height)
    57.     @right_rect = Rect.new(grad_width, 0, grad_width, bitmap.height)
    58.     @text_rect = Rect.new(32, 0, bitmap.width - 36, 24)
    59.     pos = COUNTER_ICON_INDEX
    60.     icon = Cache.system("IconSet")
    61.     icon_rect = Rect.new(pos % 16 * 24, pos / 16 * 24, 24, 24)
    62.     @icon = Bitmap.new(24, 24)
    63.     @icon.blt(0, 0, icon, icon_rect)
    64.   end
    65.   def refresh
    66.     self.visible = $game_player.area_found?
    67.     return if $game_player.encounter_count == @last_steps
    68.     @last_steps = $game_player.encounter_count
    69.     self.bitmap.clear
    70.     es = $game_map.encounter_step
    71.     counter = sprintf("%02d/%02d", @last_steps, es)
    72.     bitmap.gradient_fill_rect(@left_rect, @alpha, @black)
    73.     bitmap.gradient_fill_rect(@right_rect, @black, @alpha)
    74.     bitmap.blt(8, 0, @icon, @icon.rect)
    75.     bitmap.draw_text(@text_rect, counter)
    76.   end
    77.   def dispose_all
    78.     @icon.dispose
    79.     bitmap.dispose
    80.     dispose
    81.   end
    82. end
    83. class Spriteset_Map
    84.   alias :kyon_steps2doom_sprtst_map_crt_pix :create_pictures
    85.   alias :kyon_steps2doom_sprtst_map_up :update
    86.   alias :kyon_steps2doom_sprtst_map_disp :dispose
    87.   def create_pictures
    88.     kyon_steps2doom_sprtst_map_crt_pix
    89.     make_encounter_counter
    90.   end
    91.   def make_encounter_counter
    92.     @encounter_sprite = EncounterSprite.new(@viewport3)
    93.   end
    94.   def update_encounter_bitmap
    95.     @encounter_sprite.refresh
    96.   end
    97.   def update
    98.     kyon_steps2doom_sprtst_map_up
    99.     update_encounter_bitmap
    100.   end
    101.   def dispose
    102.     kyon_steps2doom_sprtst_map_disp
    103.     @encounter_sprite.dispose_all
    104.   end
    105. end
    106. class Scene_Map
    107.   def update_encounter
    108.     return if $game_map.interpreter.running?
    109.     return if $game_system.encounter_disabled
    110.     return if $game_map.encounter_step != $game_player.encounter_count
    111.     troop_id = $game_player.make_encounter_troop_id
    112.     return unless $data_troops[troop_id]
    113.     $game_player.make_encounter_count
    114.     $game_troop.setup(troop_id)
    115.     $game_troop.can_escape = true
    116.     $game_temp.battle_proc = nil
    117.     $game_temp.next_scene = "battle"
    118.     preemptive_or_surprise
    119.   end
    120. end
    复制代码




    Terms & Conditions

    Free for use in ANY game.
    Due credit is mandatory.
    Mention this forum in your game credits.
    That's it!



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

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-30 21:25 , Processed in 0.074364 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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