じ☆ve冰风 发表于 2026-8-3 08:31:08

Dynamic Title


Dynamic Title 1.1
        by Racheal




Introduction
        This script changes the title screen based on a variable set in-game. This could be used, for example, to add a character to the title screen after you meet them.

Features


[*]Change the background, foreground, or both.
[*]Pull the variable from the latest save or the highest from all the saves.
[*]Use numbers corresponding to the variable for your images or set the names of the files you would like to use

How to Use
        Insert the script anywhere in the Materials section above Main.

Script

Spoiler                Code:       
#==============================================================================
# Dynamic Title
# by: Racheal
# Version 1.1
# Created: 24/06/2013
# Updated: 27/09/2013
#==============================================================================
# Changes the title screen based on a variable set in-game.
#==============================================================================
# Instructions:
# * Insert in the Materials section
# * Configure to your liking below
#==============================================================================
# Compatibility:
# This script is for RPG Maker VX Ace
# It is unlikely to work with anything that modifies the way the
# title screen is drawn such as an animated title screen
# * Overwrites: Scene_Title: create_background
#==============================================================================

#==============================================================================
# Customization
#==============================================================================
module Racheal_Title
#Set which variable controls the change in the title screen
TITLE_VARIABLE = 5

#Set which parts of the title screen are affected
CHANGE_BACKGROUND = true
CHANGE_FOREGROUND = true

#Set whether to check the highest variable in all the save files or
#just use the most recent save
CHECK_ALL_SAVES = false

#Set whether to use a series of numbers for the filenames (0.png, 1.png, etc)
#or a series of names you define below
USE_FILENAMES = true
BACKGROUND_NAMES = ["Volcano", "Night"]
FOREGROUND_NAMES = ["Gargoyles", ""]
end
#==============================================================================
# End Customization
#==============================================================================

#==============================================================================
# ** DataManager
#==============================================================================

module DataManager
#--------------------------------------------------------------------------
# * Create Save Header
#--------------------------------------------------------------------------
class << self; alias dynamic_title_make_save_header make_save_header; end
def self.make_save_header
      header = dynamic_title_make_save_header
      header[:title] = $game_variables
      header
end
end

#==============================================================================
# ** Scene_Title
#==============================================================================

class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# * Create Background
#--------------------------------------------------------------------------
def create_background
    @sprite1 = Sprite.new
    sprite_name = Racheal_Title::CHANGE_BACKGROUND ? get_title(1) : $data_system.title1_name
    @sprite1.bitmap = Cache.title1(sprite_name)
    @sprite2 = Sprite.new
    sprite_name = Racheal_Title::CHANGE_FOREGROUND ? get_title(2) : $data_system.title2_name
    @sprite2.bitmap = Cache.title2(sprite_name)
    center_sprite(@sprite1)
    center_sprite(@sprite2)
end
#--------------------------------------------------------------------------
# * Get Title Sprite Name
#--------------------------------------------------------------------------
def get_title(num)
    title = 0
    if Racheal_Title::CHECK_ALL_SAVES
      #Check all saves
      for i in 0...DataManager.savefile_max
      header = DataManager.load_header(i)
      next unless header and header[:title]
      title = ].max
      end
    else
      #Check latest save
      header = DataManager.load_header(DataManager.latest_savefile_index)
      if header and header[:title]
      title = ].max
      end
    end
    #---
    if Racheal_Title::USE_FILENAMES
      #convert number to name
      case num
      when 1
      return Racheal_Title::BACKGROUND_NAMES
      when 2
      return Racheal_Title::FOREGROUND_NAMES
      end
    else
      return title.to_s
    end
end
end







Credit
        - Racheal

Author's Notes
        Free for commercial and non-commercial use. Just credit me (and let me know if you use it, just because). There's really not too much to this script. Version 1.1 features increased compatibility with save systems thanks to estriole's tip.

        As this is a script that modifies the save header, it will not work with saves created before this script was installed.


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