public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers
Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: KSteps2Doom ACE
  • Original author: kyonides
  • Original date: March 19, 2024
  • Source thread: https://forums.rpgmakerweb.com/threads/ksteps2doom-ace.166982/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSS3 Scripts (RMVX Ace)

Summary

KSteps2Doom ACE by Kyonides​ Introduction This script turns the map's encounter steps as a fixed number.

Archived First Post

KSteps2Doom ACE

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 regions.
You have set no regions on that map?
Well, that means you won't be fighting any given monster.

ksteps2doom_ace01.jpg

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    = [104, 26]
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[troop_id]
    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!

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

License / Terms Note

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

Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rgss3#script-archive

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar