KSteps2Doom ACE
KSteps2Doom ACEby 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 regions.
You have set no regions on that map?
Well, that means you won't be fighting any given monster.
Spoiler: The Script Ruby:
# * KSteps2Doom ACE * #
# Scripter : Kyonides Arkanthes
# v1.0.0 - 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.
# The HUD will disappear if you leave any of the monster regions.
# * Configuration Section * #
module KSteps2Doom
ICON_INDEX = 9
ICON_OFFSET_X = 32
COUNTER_X = 4
COUNTER_Y = 4
COUNTER_WH =
end
# * End * #
class Game_Map
alias :kyon_steps2doom_gm_map_setup :setup
def setup(map_id)
kyon_steps2doom_gm_map_setup(map_id)
@region_ids = @map.encounter_list.map {|list| list.region_set }
@region_ids = @region_ids.flatten.uniq.sort
end
def monster_region?
@region_ids.any? and region_id($game_player.x, $game_player.y) > 0
end
attr_reader :region_ids
end
class Game_Player
attr_reader :encounter_count
def make_encounter_count
@encounter_count = 0
end
def encounter
return false if $game_map.interpreter.running?
return false if $game_system.encounter_disabled
return false if $game_map.encounter_step != @encounter_count
troop_id = make_encounter_troop_id
return false unless $data_troops
make_encounter_count
BattleManager.setup(troop_id)
BattleManager.on_encounter
return true
end
def update_encounter
return if $TEST && Input.press?(:CTRL)
return if $game_party.encounter_none?
return if in_airship?
return if @move_route_forcing
return if $game_map.region_id(@x, @y) == 0
@encounter_count += 1
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)
iox = ICON_OFFSET_X
@text_rect = Rect.new(iox, 0, bitmap.width - iox - 4, 24)
icon = Cache.system("IconSet")
icon_rect = Rect.new(ICON_INDEX % 16 * 24, ICON_INDEX / 16 * 24, 24, 24)
@icon = Bitmap.new(24, 24)
@icon.blt(0, 0, icon, icon_rect)
end
def refresh
self.visible = $game_map.monster_region?
return if $game_player.encounter_count == @last_steps
self.bitmap.clear
@last_steps = $game_player.encounter_count
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
Download Demo
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-ace.166982/
页:
[1]