じ☆ve冰风 发表于 2026-8-1 15:22:51

Attract Mode


Attract Mode 1.3
        by Racheal




Introduction
        This script allows you to set up an attract mode when the player sits idle on the title screen, similar to many arcade and console games.

Features


[*]Sends the player to a blank map after a certain number of frames spent on the title screen.
[*]Returns the player to the title screen with a press of a button.
[*]*New* Choose to display attract mode once before the first time the title is shown

How to Use
        Insert the script anywhere in the Materials section above Main and then configure the options.

Script

SpoilerSpoiler






#==============================================================================
# Attract Mode
# by: Racheal
# Version 1.3
# Created: 09/12/2013
# Updated: 10/12/2013
#==============================================================================
# Allows you to set up an attract mode map if the player idles on the title
# screen. Attract mode can be canceled at any time with the confirm or cancel
# keys.
#==============================================================================
# Instructions:
# * Insert in the Materials section
# * Configure to your liking below
#==============================================================================

#==============================================================================
# Customization
#==============================================================================
module Racheal_Attract_Mode
# Map that attract mode sends you to
ATTRACT_MAP = 2

# Set whether to view attract mode before the first time you se
# title screen
SHOW_FIRST = true

# Amount of time (in frames) until attract mode kicks in
# The time is set exceptionally low in this demo just so you don't have to
# sit around and wait a long time to see it.
WAIT = 320
end
#==============================================================================
# End Customization
#==============================================================================

module Input

BUTTONS = [
    :LEFT, :UP, :RIGHT,
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7OWN,
    :A, :B, :C,
    :X, :Y, :Z,
    :L, :R,
    :SHIFT, :CTRL, :ALT,
    :F5, :F6, :F7, :F8, :F9
]

def self.any_press?
    BUTTONS.any? {|i| press? i}
end

end

#==============================================================================

module DataManager
#--------------------------------------------------------------------------
# * Set Up Attract Mode
#--------------------------------------------------------------------------
def self.setup_attract
    create_game_objects
    $game_party.setup_starting_members
    $game_map.setup(Racheal_Attract_Mode::ATTRACT_MAP)
    $game_player.moveto(5, 5)
    $game_player.refresh
    Graphics.frame_count = 0
end
end

#==============================================================================

class Scene_Attract < Scene_Map
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
    super
    SceneManager.goto(Scene_Title) if Input.any_press?
end
end

#==============================================================================

class Scene_Title < Scene_Base
@@attract_seen = !Racheal_Attract_Mode::SHOW_FIRST
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
alias scene_title_start_attract_mode start
def start
    unless @@attract_seen
      start_attract
      @@attract_seen = true
      return
    end
    scene_title_start_attract_mode
    @count = 0
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias scene_title_update_attract_mode update
def update
    scene_title_update_attract_mode
    @count += 1
    start_attract if @count == Racheal_Attract_Mode::WAIT
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias scene_title_terminate_attract_mode terminate
def terminate
    Graphics.freeze
    scene_title_terminate_attract_mode if @viewport
end
#--------------------------------------------------------------------------
# * Start Attract
#--------------------------------------------------------------------------
def start_attract
    DataManager.setup_attract
    close_command_window if @command_window
    fadeout_all
    $game_player.transparent = true
    $game_player.followers.visible = false
    $game_player.refresh
    $game_map.autoplay
    SceneManager.goto(Scene_Attract)
end
end





Credit
        - Racheal

Demo
Download Here
        Please don't mind how silly the attract mode is. I already spent way more time on this demo than I did the script. I'm sure it can be used far more effectively than what I showed here.

Author's Notes
        Free for commercial and non-commercial use. Just credit me (and let me know if you use it, just because).

I'd like to eventually figure out an easy way to cancel the attract mode with any player input instead of just the main two keys like it is right now. I'll update the script if I figure out how I want to do this.
        Thanks to Super Cremno 64 Turbo HD, I've updated the script to allow for any standard button to cancel attract mode. The demo has also been updated.

        Since this script just teleports you to a map of your choosing, the possibilities for what you can do with it are pretty plentiful. My only recommendations are to not use anything that requires player input (i.e., a text box that doesn't auto-close) and to return to the title screen at the end of the auto-event.


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