累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 2026-7-12 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
29137
OK点
16
推广点
0
同能卷
50
积分 37596
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: # * KSteps2Doom VX * # # Scripter : Kyonides Arkanthes # 2024-03-19 # 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. module KSteps2Doom COUNTER_ICON_INDEX = 112 COUNTER_X = 4 COUNTER_Y = 4 COUNTER_WH = [104, 26] end class Game_Map alias :kyon_steps2doom_gm_map_setup :setup def setup(map_id) kyon_steps2doom_gm_map_setup(map_id) areas = $data_areas.values.compact @map_areas = areas.select {|area| area.map_id == @map_id } end attr_reader :map_areas end class Game_Player attr_reader :encounter_count def make_encounter_count @encounter_count = 0 end def update_encounter return if $TEST and Input.press?(Input::CTRL) return if in_vehicle? or !area_found? @encounter_count += 1 end def map_area?(area) rect = area.rect return false if rect.x > @x or rect.y > @y return false if @x >= rect.x + rect.width return false if @y >= rect.y + rect.height return true end def area_found? $game_map.map_areas.find {|area| map_area?(area) } != nil end end class EncounterSprite < Sprite include KSteps2Doom def initialize(vp=nil) super(vp) self.x = COUNTER_X self.y = COUNTER_Y self.bitmap = Bitmap.new(*COUNTER_WH) make_rects end def make_rects grad_width = bitmap.width / 2 @black = Color.new(0, 0, 0) @alpha = Color.new(0, 0, 0, 0) @left_rect = Rect.new(0, 0, grad_width, bitmap.height) @right_rect = Rect.new(grad_width, 0, grad_width, bitmap.height) @text_rect = Rect.new(32, 0, bitmap.width - 36, 24) pos = COUNTER_ICON_INDEX icon = Cache.system("IconSet") icon_rect = Rect.new(pos % 16 * 24, pos / 16 * 24, 24, 24) @icon = Bitmap.new(24, 24) @icon.blt(0, 0, icon, icon_rect) end def refresh self.visible = $game_player.area_found? return if $game_player.encounter_count == @last_steps @last_steps = $game_player.encounter_count self.bitmap.clear es = $game_map.encounter_step counter = sprintf("%02d/%02d", @last_steps, es) bitmap.gradient_fill_rect(@left_rect, @alpha, @black) bitmap.gradient_fill_rect(@right_rect, @black, @alpha) bitmap.blt(8, 0, @icon, @icon.rect) bitmap.draw_text(@text_rect, counter) end def dispose_all @icon.dispose bitmap.dispose dispose end end class Spriteset_Map alias :kyon_steps2doom_sprtst_map_crt_pix :create_pictures alias :kyon_steps2doom_sprtst_map_up :update alias :kyon_steps2doom_sprtst_map_disp :dispose def create_pictures kyon_steps2doom_sprtst_map_crt_pix make_encounter_counter end def make_encounter_counter @encounter_sprite = EncounterSprite.new(@viewport3) end def update_encounter_bitmap @encounter_sprite.refresh end def update kyon_steps2doom_sprtst_map_up update_encounter_bitmap end def dispose kyon_steps2doom_sprtst_map_disp @encounter_sprite.dispose_all end end class Scene_Map def update_encounter return if $game_map.interpreter.running? return if $game_system.encounter_disabled return if $game_map.encounter_step != $game_player.encounter_count troop_id = $game_player.make_encounter_troop_id return unless $data_troops[troop_id] $game_player.make_encounter_count $game_troop.setup(troop_id) $game_troop.can_escape = true $game_temp.battle_proc = nil $game_temp.next_scene = "battle" preemptive_or_surprise end 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