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: KTitleUpdate ACE
  • Original author: kyonides
  • Original date: June 17, 2023
  • Source thread: https://forums.rpgmakerweb.com/threads/ktitleupdate-ace.158410/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSS3 Scripts (RMVX Ace)

Summary

KTItleUpdate ACE by Kyonides​ Introduction Well, I think the title is pretty much self descriptive but here we go!

Archived First Post

KTItleUpdate ACE

by Kyonides

Introduction

Well, I think the title is pretty much self descriptive but here we go!

Did you ever need to dynamically change your Title Scene but couldn't do it on your own?
Then use this scriptlet and you will be able to do it by yourself!

This is NOT a Plug and Play Script, yet, it will work from the very beginning if you are using the default assets in your game project.

Please read the instructions embedded in my script.

Ruby:
# * KTitleUpdate ACE * #
#   Scripter : Kyonides Arkanthes
#   2023-06-16

# This scriptlet lets you change the Background and Foreground Titles of your
# game project based on the value of a predefined Game Variable.

# You must configure 7 CONSTANTS to tell it which Title will be displayed on
# screen at that specific point.

# * Warning! * #
# If you don't use the Scene_End menu scene, delete that part from this script.

module KTitleUpdate
  # For the Game's Root Save Directory the String might be "Save*"
  # For a Custom Save Directory the String might be "CustomDir/Save*"
  DIR_N_SAVE_FILENAME = "Save*"
  TITLE_VAR_ID = 1
  # Load Data Types: :var_max or :recent
  LOAD_DATA_TYPE = :var_max
  USE_BACKGROUNDS = true
  USE_FOREGROUNDS = true
  # Manually List All of Your Background and Foreground Titles
  BACKGROUNDS = ["Book", "Fountain", "Island", "Sword"]
  FOREGROUNDS = ["Metal", "Heroes", "Mist", "Mountains"]

  extend self
  def sort_save_files
    Dir[DIR_N_SAVE_FILENAME].sort
  end

  def find_bg_fg(index)
    [BACKGROUNDS[index], FOREGROUNDS[index]]
  end
end

module DataManager
  extend self
  attr_accessor :titles, :total_save_files
  def load_vars_only(fn)
    File.open(fn, "rb") do |file|
      Marshal.load(file)
      data = Marshal.load(file)
      variables = data[:variables]
      @titles << variables[KTitleUpdate::TITLE_VAR_ID]
      @make_times << File.mtime(fn) rescue Time.at(0)
    end
  end

  def check_save_files
    @titles = []
    @make_times = []
    filenames = KTitleUpdate.sort_save_files
    filenames.each {|fn| load_vars_only(fn) }
    @total_save_files = filenames.size
  end

  def highest_titles
    KTitleUpdate.find_bg_fg(@titles.max - 1)
  end

  def latest_titles
    time_max = @make_times.max
    title_index = @make_times.index(time_max)
    title_index = @titles[title_index] - 1
    KTitleUpdate.find_bg_fg(title_index)
  end

  def default_title?
    @titles.empty? or @titles.max == 0
  end
  check_save_files
end

class Scene_Title
  alias :kyon_title_change_scn_ttl_create_backgr :create_background
  def create_background
    if DataManager.default_title?
      kyon_title_change_scn_ttl_create_backgr
    else
      custom_background
    end
  end

  def custom_background
    case KTitleUpdate::LOAD_DATA_TYPE
    when :var_max
      background, foreground = DataManager.highest_titles
    when :recent
      background, foreground = DataManager.latest_titles
    end
    @sprite1 = Sprite.new
    @sprite1.bitmap = Cache.title1(background)
    @sprite2 = Sprite.new
    @sprite2.z = 25
    @sprite2.bitmap = Cache.title2(foreground)
    center_sprite(@sprite1)
    center_sprite(@sprite2)
  end
end

class Scene_End
  alias :kyon_title_change_scn_end_comm_ttl :command_to_title
  def command_to_title
    kyon_title_change_scn_end_comm_ttl
    DataManager.check_save_files
  end
end

DOWNLOAD DEMO & SCRIPT

Side Note

Usually, I would not make this kind of simple scripts, still, an unknown forumer was desperate to get another one work the way he expected and it made me flex my scripting muscles once again.

Terms & Conditions

Free for use in any game
Due credit is optional but appreciated.
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 optional but appreciated. 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