This document provides an overview of the Scene classes defined in the rpg_scenes.js
file for RPG Maker MV. Scenes manage the different screens and states of the game, such as the title screen, map, menus, and battles.
The superclass for all scenes in the game. It provides fundamental functionalities like managing fade-in/out, window layers, and the scene lifecycle.
Properties:
_active
: Boolean indicating if the scene is active._fadeSign
: Direction of the fade (1 for fade-in, -1 for fade-out)._fadeDuration
: Remaining duration of the current fade effect._fadeSprite
: TheScreenSprite
used for fading._imageReservationId
: ID used for reserving images related to this scene._windowLayer
: AWindowLayer
instance to hold the scene's windows.
Methods:
initialize()
: Constructor.create()
: Called when the scene is created. Meant to be overridden by subclasses to set up scene elements.isActive()
: Returns true if the scene is active.isReady()
: Checks if the scene is ready to start (typically checks if required images are loaded).start()
: Called when the scene becomes active.update()
: Updates the scene state each frame (updates fade, children).stop()
: Called when the scene stops being active.isBusy()
: Returns true if the scene is busy (e.g., during a fade).terminate()
: Called just before switching to another scene. Meant to be overridden for cleanup.createWindowLayer()
: Creates the_windowLayer
.addWindow(window)
: Adds a window to the_windowLayer
.attachReservation()
: Attaches the scene's image reservation ID to theImageManager
.detachReservation()
: Releases the scene's image reservation.startFadeIn(duration, white)
: Starts a fade-in effect.startFadeOut(duration, white)
: Starts a fade-out effect.createFadeSprite(white)
: Creates the sprite used for fading.updateFade()
: Updates the fade effect animation.updateChildren()
: Updates all child display objects.popScene()
: Switches back to the previous scene on the stack.checkGameover()
: Checks if the party is all dead and goes to the game over scene if so.fadeOutAll()
: Fades out screen and audio.fadeSpeed()
: Returns the default fade speed (24 frames).slowFadeSpeed()
: Returns a slower fade speed (48 frames).
The first scene that runs when the game starts. It handles initialization tasks.
Methods:
initialize()
: Constructor.create()
: Loads the database, config, and system window image.loadSystemWindowImage()
: Reserves the 'Window' system image.loadSystemImages()
: (Static) Reserves various essential system images.isReady()
: Checks if the database is loaded and the game font is ready.isGameFontLoaded()
: Checks if the 'GameFont' has loaded, with a timeout.start()
: Preloads sounds, sets up the initial game state (new game, battle test, or event test), and transitions to the appropriate starting scene (Title, Battle, or Map).updateDocumentTitle()
: Sets the browser/window title.checkPlayerLocation()
: Throws an error if the player's starting position is not set.
The scene for the game's title screen.
Methods:
initialize()
: Constructor.create()
: Creates the background, foreground (title text), and command window.start()
: Plays title music and starts the fade-in.update()
: Updates the scene; opens the command window if not busy.isBusy()
: Checks if the command window is closing or the scene is fading.terminate()
: Snaps the current screen for use as a background in menus.createBackground()
: Creates the title screen background sprites (_backSprite1
,_backSprite2
).createForeground()
: Creates the sprite for drawing the game title (_gameTitleSprite
).drawGameTitle()
: Draws the game title text onto the_gameTitleSprite
.centerSprite(sprite)
: Centers a sprite on the screen.createCommandWindow()
: Creates theWindow_TitleCommand
.commandNewGame()
: Handler for the 'New Game' command.commandContinue()
: Handler for the 'Continue' command.commandOptions()
: Handler for the 'Options' command.playTitleMusic()
: Plays the title screen BGM.
The main scene where the player explores the map.
Methods:
initialize()
: Constructor.create()
: Starts loading the map data based on whether it's a transfer or initial load.isReady()
: Checks if the map data has loaded and the base scene is ready.onMapLoaded()
: Called when map data finishes loading; performs transfer and creates display objects.start()
: Starts the scene, handles fade-in based on the previous scene, and starts map BGM/BGS.update()
: Main update loop for the map scene.updateMainMultiply()
: CallsupdateMain
potentially twice if fast-forwarding.updateMain()
: Updates map, player, timer, and screen.isFastForward()
: Checks if the game should be fast-forwarding (event running + OK/Touch hold).stop()
: Handles actions before leaving the map scene (fade-out, stopping player, launching battle).isBusy()
: Checks if the message window, wait count, or encounter effect is active.terminate()
: Cleans up map-specific resources and display objects.needsFadeIn()
: Determines if a fade-in is needed (coming from Battle or Load).needsSlowFadeOut()
: Determines if a slow fade-out is needed (going to Title or Gameover).updateWaitCount()
: Decrements the wait counter.updateDestination()
: Handles touch input for player movement destination.isMapTouchOk()
: Checks if touch input for map movement is allowed.processMapTouch()
: Processes touch input coordinates to set the player's destination.isSceneChangeOk()
: Checks if it's okay to transition to another scene.updateScene()
: Checks for game over, transfers, encounters, menu calls, or debug calls.createDisplayObjects()
: Creates the spriteset, map name window, window layer, and all windows.createSpriteset()
: Creates theSpriteset_Map
.createAllWindows()
: Creates message and scroll text windows.createMapNameWindow()
: Creates theWindow_MapName
.createMessageWindow()
: Creates theWindow_Message
and its sub-windows.createScrollTextWindow()
: Creates theWindow_ScrollText
.updateTransferPlayer()
: Handles player transfer logic.updateEncounter()
: Handles random encounter logic.updateCallMenu()
: Checks for and handles menu activation input.isMenuEnabled()
: Checks if the menu can be opened.isMenuCalled()
: Checks if the menu input (Menu button or Cancel touch) occurred.callMenu()
: Transitions to the menu scene.updateCallDebug()
: Checks for and handles debug screen activation input.isDebugCalled()
: Checks if the debug input occurred during playtest.fadeInForTransfer()
: Performs fade-in specific to player transfers.fadeOutForTransfer()
: Performs fade-out specific to player transfers.launchBattle()
: Initiates the transition to the battle scene.stopAudioOnBattleStart()
: Stops map music before battle.startEncounterEffect()
: Starts the screen zoom/flash effect for battles.updateEncounterEffect()
: Updates the battle encounter zoom/flash effect.snapForBattleBackground()
: Takes a snapshot of the map for the battle background.startFlashForEncounter(duration)
: Starts a screen flash during the encounter effect.encounterEffectSpeed()
: Returns the duration of the encounter effect (60 frames).
The superclass for all menu scenes (Item, Skill, Equip, Status, Options, Save, Load, GameEnd).
Methods:
initialize()
: Constructor.create()
: Creates background, updates actor reference, creates window layer.actor()
: Returns the currently selected menu actor (_actor
).updateActor()
: Updates_actor
based on$gameParty.menuActor()
.createBackground()
: Creates the background sprite using the snapped image fromSceneManager
.setBackgroundOpacity(opacity)
: Sets the opacity of the background sprite.createHelpWindow()
: Creates theWindow_Help
(intended to be called by subclasses).nextActor()
: Switches to the next party member.previousActor()
: Switches to the previous party member.onActorChange()
: Called when the actor changes (intended to be overridden).
The main menu scene.
Methods:
initialize()
: Constructor.create()
: Creates command, gold, and status windows.start()
: Refreshes the status window.createCommandWindow()
: Creates theWindow_MenuCommand
.createGoldWindow()
: Creates theWindow_Gold
.createStatusWindow()
: Creates theWindow_MenuStatus
.commandItem()
: Handler for the 'Item' command.commandPersonal()
: Handler for skill, equip, status commands (activates status window for actor selection).commandFormation()
: Handler for the 'Formation' command.commandOptions()
: Handler for the 'Options' command.commandSave()
: Handler for the 'Save' command.commandGameEnd()
: Handler for the 'Game End' command.onPersonalOk()
: Handler when an actor is selected for skill/equip/status.onPersonalCancel()
: Handler when actor selection is cancelled.onFormationOk()
: Handler when an actor is selected in formation mode (initiates or completes swap).onFormationCancel()
: Handler when formation selection/swap is cancelled.
The superclass for Scene_Item
and Scene_Skill
.
Methods:
initialize()
: Constructor.create()
: Base creation logic.createActorWindow()
: Creates theWindow_MenuActor
for selecting the target actor.item()
: Returns the currently selected item/skill from the_itemWindow
.user()
: Returns the actor using the item/skill (must be overridden).isCursorLeft()
: Checks if the item window cursor is on the left side (for positioning sub-windows).showSubWindow(window)
: Shows and activates a sub-window (like the actor window).hideSubWindow(window)
: Hides and deactivates a sub-window.onActorOk()
: Handler when a target actor is confirmed. Uses the item if possible.onActorCancel()
: Handler when target actor selection is cancelled.determineItem()
: Decides whether to show the actor selection window or use the item immediately.useItem()
: Processes the item/skill usage (plays SE, consumes item, applies effects, etc.).activateItemWindow()
: Refreshes and activates the item/skill list window.itemTargetActors()
: Returns an array of actors targeted by the current item/skill.canUse()
: Checks if the user can use the selected item/skill on any valid target.isItemEffectsValid()
: Checks if the item/skill has a valid effect on at least one potential target.applyItem()
: Applies the item/skill effects to the targets.checkCommonEvent()
: Checks if the item/skill triggered a common event and transitions if needed.playSeForItem()
: Plays the sound effect for the item/skill (intended to be overridden).
The scene for Browse and using items.
Methods:
initialize()
: Constructor.create()
: Creates help, category, item, and actor windows.createCategoryWindow()
: Creates theWindow_ItemCategory
.createItemWindow()
: Creates theWindow_ItemList
.user()
: Returns the actor considered to be using the item (currently the one with the highest PHA).onCategoryOk()
: Handler when an item category is selected.onItemOk()
: Handler when an item is selected.onItemCancel()
: Handler when item selection is cancelled.playSeForItem()
: Plays the item usage sound effect.useItem()
: Calls the baseuseItem
and redraws the item list.
The scene for Browse and using skills.
Methods:
initialize()
: Constructor.create()
: Creates help, skill type, status, item (skill list), and actor windows.start()
: Refreshes the actor display.createSkillTypeWindow()
: Creates theWindow_SkillType
.createStatusWindow()
: Creates theWindow_SkillStatus
.createItemWindow()
: Creates theWindow_SkillList
.refreshActor()
: Updates all windows to reflect the current actor.user()
: Returns the currently selected actor.commandSkill()
: Handler when a skill type is selected.onItemOk()
: Handler when a skill is selected.onItemCancel()
: Handler when skill selection is cancelled.playSeForItem()
: Plays the skill usage sound effect.useItem()
: Calls the baseuseItem
and refreshes windows.onActorChange()
: Refreshes windows when the actor is changed.
The scene for changing actor equipment.
Methods:
initialize()
: Constructor.create()
: Creates help, status, command, slot, and item windows.createStatusWindow()
: Creates theWindow_EquipStatus
.createCommandWindow()
: Creates theWindow_EquipCommand
.createSlotWindow()
: Creates theWindow_EquipSlot
.createItemWindow()
: Creates theWindow_EquipItem
.refreshActor()
: Updates all windows for the current actor.commandEquip()
: Handler for the 'Equip' command.commandOptimize()
: Handler for the 'Optimize' command.commandClear()
: Handler for the 'Clear' command.onSlotOk()
: Handler when an equipment slot is selected.onSlotCancel()
: Handler when slot selection is cancelled.onItemOk()
: Handler when an equipment item is selected (equips the item).onItemCancel()
: Handler when item selection is cancelled.onActorChange()
: Refreshes windows when the actor is changed.
The scene for viewing detailed actor status.
Methods:
initialize()
: Constructor.create()
: Creates the main status window (Window_Status
).start()
: Refreshes the actor display.refreshActor()
: Updates the status window for the current actor.onActorChange()
: Refreshes the window when the actor is changed.
The scene for changing game options.
Methods:
initialize()
: Constructor.create()
: Creates the options window (Window_Options
).terminate()
: Saves the configuration changes.createOptionsWindow()
: Creates theWindow_Options
.
The superclass for Scene_Save
and Scene_Load
.
Methods:
initialize()
: Constructor.create()
: Loads save file images, creates help and list windows.start()
: Refreshes the list window.savefileId()
: Returns the selected save file ID (index + 1).createHelpWindow()
: Creates theWindow_Help
.createListWindow()
: Creates theWindow_SavefileList
.mode()
: Returns the mode ('save' or 'load') (must be overridden).activateListWindow()
: Activates the save file list window.helpWindowText()
: Returns the text for the help window (must be overridden).firstSavefileIndex()
: Returns the initially selected save file index (can be overridden).onSavefileOk()
: Handler when a save file slot is confirmed (intended to be overridden).
The scene for saving the game.
Methods:
initialize()
: Constructor.mode()
: Returns 'save'.helpWindowText()
: Returns the save message text.firstSavefileIndex()
: Returns the last accessed save file index.onSavefileOk()
: Performs the save operation.onSaveSuccess()
: Handler for successful save.onSaveFailure()
: Handler for failed save.
The scene for loading the game.
Methods:
initialize()
: Constructor.terminate()
: Performs actions after loading (calls$gameSystem.onAfterLoad()
).mode()
: Returns 'load'.helpWindowText()
: Returns the load message text.firstSavefileIndex()
: Returns the latest save file index.onSavefileOk()
: Performs the load operation.onLoadSuccess()
: Handler for successful load (plays SE, fades out, goes to map).onLoadFailure()
: Handler for failed load.reloadMapIfUpdated()
: Reloads map data if the game version has changed since saving.
The scene for the game end commands (To Title, Cancel).
Methods:
initialize()
: Constructor.create()
: Creates the command window.stop()
: Closes the command window.createBackground()
: Creates a dimmed background.createCommandWindow()
: Creates theWindow_GameEnd
.commandToTitle()
: Handler for the 'To Title' command.
The scene for buying and selling items in a shop.
Methods:
initialize()
: Constructor.prepare(goods, purchaseOnly)
: Sets up the shop goods and purchase-only status.create()
: Creates all shop windows (help, gold, command, dummy, number, status, buy, category, sell).createGoldWindow()
: Creates theWindow_Gold
.createCommandWindow()
: Creates theWindow_ShopCommand
.createDummyWindow()
: Creates a background window shown when neither buy nor sell is active.createNumberWindow()
: Creates theWindow_ShopNumber
for quantity input.createStatusWindow()
: Creates theWindow_ShopStatus
to show item details/actor stats.createBuyWindow()
: Creates theWindow_ShopBuy
listing items for purchase.createCategoryWindow()
: Creates theWindow_ItemCategory
for selling.createSellWindow()
: Creates theWindow_ShopSell
listing items to sell.activateBuyWindow()
: Shows and activates the buy window.activateSellWindow()
: Shows and activates the sell category/list windows.commandBuy()
: Handler for the 'Buy' command.commandSell()
: Handler for the 'Sell' command.onBuyOk()
: Handler when an item to buy is selected.onBuyCancel()
: Handler when buying is cancelled.onCategoryOk()
: Handler when a sell category is selected.onCategoryCancel()
: Handler when selling category selection is cancelled.onSellOk()
: Handler when an item to sell is selected.onSellCancel()
: Handler when selling is cancelled.onNumberOk()
: Handler when a quantity is confirmed (performs buy/sell).onNumberCancel()
: Handler when quantity input is cancelled.doBuy(number)
: Executes the purchase logic.doSell(number)
: Executes the selling logic.endNumberInput()
: Hides the number window and returns to buy/sell mode.maxBuy()
: Calculates the maximum quantity the player can buy.maxSell()
: Returns the quantity of the item the player possesses.money()
: Returns the player's current gold.currencyUnit()
: Returns the currency unit symbol.buyingPrice()
: Returns the buying price of the current item.sellingPrice()
: Returns the selling price of the current item.
The scene for inputting an actor's name.
Methods:
initialize()
: Constructor.prepare(actorId, maxLength)
: Sets the actor and max name length.create()
: Creates the edit and input windows.start()
: Refreshes the edit window.createEditWindow()
: Creates theWindow_NameEdit
.createInputWindow()
: Creates theWindow_NameInput
.onInputOk()
: Handler when name input is confirmed (sets actor name and pops scene).
The scene for the debug mode (F9), allowing modification of switches and variables.
Methods:
initialize()
: Constructor.create()
: Creates range, edit, and help windows.createRangeWindow()
: Creates theWindow_DebugRange
(Switch/Variable selection).createEditWindow()
: Creates theWindow_DebugEdit
(Value modification).createDebugHelpWindow()
: Creates a window displaying controls (Window_Base
).onRangeOk()
: Handler when a switch/variable range is selected.onEditCancel()
: Handler when editing is cancelled.refreshHelpWindow()
: Updates the help text based on the active window/mode.helpText()
: Returns the appropriate help text for switch or variable editing.
The scene where battles take place.
Methods:
initialize()
: Constructor.create()
: Creates display objects (spriteset, windows).start()
: Starts fade-in, plays battle BGM, begins the battle process.update()
: Main update loop for the battle scene.updateBattleProcess()
: Updates the core battle progression viaBattleManager
.isAnyInputWindowActive()
: Checks if any command input window is active.changeInputWindow()
: Switches between party and actor command input as needed.stop()
: Handles fade-out when the battle ends.terminate()
: Cleans up battle resources, stops music.needsSlowFadeOut()
: Determines if a slow fade is needed (transitioning to Title or Gameover).updateStatusWindow()
: Opens/closes the status window based on message display.updateWindowPositions()
: Adjusts the horizontal position of the status window.createDisplayObjects()
: Creates spriteset and all battle windows.createSpriteset()
: Creates theSpriteset_Battle
.createAllWindows()
: Creates log, status, command, help, skill, item, actor, enemy, message, and scroll windows.createLogWindow()
: Creates theWindow_BattleLog
.createStatusWindow()
: Creates theWindow_BattleStatus
.createPartyCommandWindow()
: Creates theWindow_PartyCommand
.createActorCommandWindow()
: Creates theWindow_ActorCommand
.createHelpWindow()
: Creates theWindow_Help
.createSkillWindow()
: Creates theWindow_BattleSkill
.createItemWindow()
: Creates theWindow_BattleItem
.createActorWindow()
: Creates theWindow_BattleActor
.createEnemyWindow()
: Creates theWindow_BattleEnemy
.createMessageWindow()
: Creates theWindow_Message
.createScrollTextWindow()
: Creates theWindow_ScrollText
.refreshStatus()
: Refreshes the status window.startPartyCommandSelection()
: Begins the party command phase.commandFight()
: Handler for the 'Fight' party command.commandEscape()
: Handler for the 'Escape' party command.startActorCommandSelection()
: Begins an actor's command selection phase.commandAttack()
: Handler for the 'Attack' actor command.commandSkill()
: Handler for the 'Skill' actor command (opens skill window).commandGuard()
: Handler for the 'Guard' actor command.commandItem()
: Handler for the 'Item' actor command (opens item window).selectNextCommand()
: Moves to the next actor's command input or starts the turn.selectPreviousCommand()
: Moves to the previous actor's command input.selectActorSelection()
: Activates the actor selection window.onActorOk()
: Handler when a target actor is confirmed.onActorCancel()
: Handler when actor selection is cancelled.selectEnemySelection()
: Activates the enemy selection window.onEnemyOk()
: Handler when a target enemy is confirmed.onEnemyCancel()
: Handler when enemy selection is cancelled.onSkillOk()
: Handler when a skill is confirmed.onSkillCancel()
: Handler when skill selection is cancelled.onItemOk()
: Handler when an item is confirmed.onItemCancel()
: Handler when item selection is cancelled.onSelectAction()
: Called after a skill/item is chosen; proceeds to target selection or next command.endCommandSelection()
: Closes command windows when input phase ends.
The scene displayed when the party is defeated.
Methods:
initialize()
: Constructor.create()
: Plays game over music and creates the background.start()
: Starts the fade-in.update()
: Checks for input to return to the title screen.stop()
: Fades out all visuals and audio.terminate()
: Stops all audio.playGameoverMusic()
: Plays the game over ME.createBackground()
: Creates the game over background sprite.isTriggered()
: Checks for confirmation input (OK or Touch).gotoTitle()
: Transitions back to the title screen.