Skip to content

Instantly share code, notes, and snippets.

@ossra
Created August 9, 2020 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ossra/6c9035b9b233515fc70aac9d06312d06 to your computer and use it in GitHub Desktop.
Save ossra/6c9035b9b233515fc70aac9d06312d06 to your computer and use it in GitHub Desktop.
Adds the ability to select what scene is loaded on boot.
// +====================================================================================+
// ||| Game | Startup Scene
// +====================================================================================+
/*:
* @target MZ
* @plugindesc [1.00] Adds the ability to select what scene is loaded on boot.
* @author Ossra
*
* @help
* ==| Plugin Information |=================================================
*
* - Author : Ossra
* - Contact : garden.of.ossra [at] gmail
* - Version : 1.00 | RPG Maker MZ 0.9.5
* - Release : 9th August 2020
* - Updated : 9th August 2020
* - License : MIT [https://opensource.org/licenses/MIT]
*
* @param headerPluginOptions
* @text Plugin Options
* @type text
* @default ------------------------------------
*
* @param scene__string
* @parent pluginOptions
* @text Startup Scene
* @desc The scene to load on boot.
* @type combo
* @option Scene_Title
* @option Scene_Map
* @option Scene_Load
* @default Scene_Title
*
* @param headerPluginProperties
* @text Plugin Properties
* @type text
* @default ------------------------------------
*
* @param gid
* @parent pluginProperties
* @text Global Identifier
* @desc Global identification tag for internal use only. Do not change.
* @default ossra-7XhsgeaBtQ11GGEBeh9ILTWdkUm6hR
*/
// +====================================================================================+
if (!$plugins.some((plugin) => plugin.parameters['gid'] === 'ossra-OojTChE3vep9fHc3F')) {
throw `ERROR: The 'Ossra Framework Base' plugin is required!`;
}
(function(___name, ___version) { // {
'use strict';
// +=================================================| Initialization |
// | [Setup] Initialization
// +==================================================================================+
const plugin = new Ossra.Share.Plugin(___name, ___version);
// +----------------------------------------------------------------------------------+
// | [Setup] Commands
// +----------------------------------------------------------------------------------+
// <Helpers> -------------------------------------------------------------------------+
// <Defaults> ------------------------------------------------------------------------+
// <Commands> ------------------------------------------------------------------------+
// +----------------------------------------------------------------------------------+
// | [Setup] Configuration
// +----------------------------------------------------------------------------------+
// <Helpers> -------------------------------------------------------------------------+
// <Defaults> ------------------------------------------------------------------------+
plugin.config.defaults.add('plugin', {
'scene': 'Scene_Title'
});
// <Configuration> -------------------------------------------------------------------+
plugin.config.setup('ossra-7XhsgeaBtQ11GGEBeh9ILTWdkUm6hR');
const ossData = plugin.data;
const ossConfig = plugin.config.data;
// +----------------------------------------------------------------------------------+
// | [Setup] Variables
// +----------------------------------------------------------------------------------+
ossData.onBoot = false;
(function(_) { // {
// +=================================================| SceneManager |
// | [Plugin] SceneManager
// +==================================================================================+
const _alias = plugin.namespace.add('Code.SceneManager');
// ALIAS -----------------------------------------------------------------------------+
// | [Method] goto
// +----------------------------------------------------------------------------------+
_alias.goto = _.goto;
_.goto = function(sceneClass) {
let scene = window[ossConfig.scene];
if (ossData.onBoot && scene) {
sceneClass = scene;
}
ossData.onBoot = false;
_alias.goto.call(this, sceneClass);
}; // SceneManager << goto
})(SceneManager); // }
(function(_) { // {
// +=================================================| Scene_Boot |
// | [Plugin] Scene_Boot
// +==================================================================================+
const _alias = plugin.namespace.add('Code.Scene_Boot');
// ALIAS -----------------------------------------------------------------------------+
// | [Method] start
// +----------------------------------------------------------------------------------+
_alias.start = _.prototype.start;
_.prototype.start = function() {
if (!DataManager.isBattleTest() && !DataManager.isEventTest()) {
ossData.onBoot = true;
}
_alias.start.call(this);
}; // Scene_Boot << start
})(Scene_Boot); // }
})('Game.StartupScene', 1.00); // }
// |///////////////////////////////////| End of File |//////////////////////////////////|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment