{Tutorial} Understand how to create Scene in MV

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Hi guys!


Here Nio Kasgami for explain to you...


How to create your custom Scene in MV!




it's nice to have new scene but how it's works!? 


hehe it's simple but in first let's see a fast overview on how it's would "normally" look in MV


//==============================================================================
// ■ Scene_Test
//------------------------------------------------------------------------------
// this a dummy Scene for show structure.
//==============================================================================
function Scene_Test(){this.initialize.apply(this,arguments);}
//----------------------------------------------------------------------------
// ◎ new inheritance : SceneMenuBase
//----------------------------------------------------------------------------
//<"Makes Scene_Test inherit the functions and properties of Scene_MenuBase">
//----------------------------------------------------------------------------
Scene_Test.prototype = Object.create(Scene_MenuBase.prototype);
//----------------------------------------------------------------------------
// ◆ new constructor: Scene_Test
//----------------------------------------------------------------------------
// tell the function constructor is Scene_Test
//----------------------------------------------------------------------------
Scene_Test.prototype.constructor = Scene_Test;
//----------------------------------------------------------------------------
// ○ new function: prepare
//----------------------------------------------------------------------------
// <"Permits to transfert external values from event scripts calls in game.">
//----------------------------------------------------------------------------
Scene_Test.prototype.prepare = function(ai_id) {
.scene_id = ai_id;
};
//----------------------------------------------------------------------------
// ○ new function: initialize
//----------------------------------------------------------------------------
// <"Sets the default values of the scene">
// EXTRA : <"Always do inheritance with your Scene initialize function
// it's important!">
//----------------------------------------------------------------------------
Scene_Test.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
//----------------------------------------------------------------------------
// ○ new function: start
//----------------------------------------------------------------------------
// <"it's set's the flag ready and start the scene always do inheritance.">
//----------------------------------------------------------------------------
Scene_Test.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
}
//----------------------------------------------------------------------------
// ○ new function: create
//----------------------------------------------------------------------------
// <"Serve for create your scene contents and to load it in your scene.">
//---------------------------------------------------------------------------
Scene_Test.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.get_ai_data();
this.create_window();
};
//----------------------------------------------------------------------------
// ○ new function: update
//----------------------------------------------------------------------------
// <"Update the Scene.">
//---------------------------------------------------------------------------
Scene_Test.prototype.update = function() {
Scene_MenuBase.prototype.update.call(this);
};
//----------------------------------------------------------------------------
// ○ new function: terminate
//----------------------------------------------------------------------------
// <"dispose the content of the scene">
//---------------------------------------------------------------------------
Scene_Test.prototype.terminate = function() {
Scene_MenuBase.prototype.terminate.call(this);
};
/////////////////////////////////////////////////////////////
// personal function
// <"Unrelated to the tutorial.">
////////////////////////////////////////////////////////////
Scene_Test.prototype.get_ai_data = function() {
$game_personalities.get_personality(this.scene_id);
};

Scene_Test.prototype.create_window = function() {
this.message_window = new Window_Message();
};


Okai now you maybe why ask...WHY THIS structure exclusively?


not that's it's mandatory, but it's recommended to do this why?


Simply how Ojima-san coded the whole setup of SceneManager make the system having "forced" function in our scene.


But not all these function are mandatory in the good works of a Scene...let's show both category and their use.


Mandatory functions

Spoiler


  •  initialize : this function is the core of your scene it's what who actually initialize your function but it's can rename like you want...but for permit inheritance with MV  function and comprehension  better name it initialize.


Spoiler



   how to setup : 


you first of all call it inside the function like this : 




function Scene_Test() {this.initialize.apply(this,arguments);}


it's will tell the system the first method executed is initialize.


Inheritance : mandatory why?


because it's here the scene get all the information from Stage. Stage is a special JS portion in the Rpg Core who handles Scene drawing on screen.


how to setup :




Scene_Test.prototype.initialize = function() { Scene_MenuBase.prototype.initialize.call(this); };


it's a super equivalent in JS it's will get the proprieties of the parent function


PS : do not forgot to do this for permit your Scene to get the inheritance.




Scene_Test.prototype = Object.create(Scene_MenuBase.prototype);


  • create : This section is the place where you create and load all your contents Ojima setup the SceneManager make call create when loading the scene. So it's better to input all your "create" and load method in this.
Spoiler



How to setup : It's like a regular function where you call your method.


Inheritance : non-mandatory why?


actually in the Scene_Base is done so it's not mandatory unless you want to inherit of the SceneMenu_Base contents.


  • start : it's the function who actually start the scene without this one your scene wouldn't run at all.
Spoiler



How to setup : as a regular function.


Inheritance : mandatory why?


Because it's here is set the ready flags in so be sure to do likes the initialize method and to call it 
  • update : it's the function who update your screen it's inherit of important option for your scene so be sure to add it with all the inheritance who go with it.







Non mandatory 

Spoiler




  • terminate  it's the function who Dispose all your content Specially your sprite at the end of the scene. it's not forced to add to the Scene function if you don't dispose anything's.
  • prepare : casual function used in ace...it's was used to get named like you want but now you are forced to name it prepare due how SceneManager is handle...In simple this method serve for transfer data from a event script call to the Scene Function...use it when you absolutely need to transfer data. Unless that it's not useful.
  • isBusy : this one serve for the Fadein time don't add it unless you want to change the time you transfer your scene.

and that's all I hope this tutorial help you to understand how works Scene in MV :)
 
Last edited by a moderator:

Rainbow AC

Warper
Member
Joined
Dec 11, 2016
Messages
3
Reaction score
0
First Language
English/Spanish
Primarily Uses
It only works in VXA?
 
Last edited by a moderator:

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
this is too hard for me.


i have difficulty with prototype.


i need study more V2B tutorial  ;_;
 

GE_Peter

Veteran
Veteran
Joined
Dec 13, 2016
Messages
37
Reaction score
11
First Language
English
Primarily Uses
RMMV
Thanks for the explanation!


Just a couple of questions about the prepare method:


// ○ new function: prepare
//----------------------------------------------------------------------------
// <"Permits to transfert external values from event scripts calls in game.">
//----------------------------------------------------------------------------
Scene_Test.prototype.prepare = function(ai_id) {
.scene_id = ai_id;
};


Why does .scene_id start with a full stop? I thought you couldn't do that in Javascript; is it supposed to be 'this.scene_id'?


And what is 'scene_id' used for in the rest of the code? I can't find it when I do a search of all the core .js files.
 

Riku_Masamune

Veteran
Veteran
Joined
Aug 23, 2016
Messages
31
Reaction score
8
First Language
English
Primarily Uses
RMMZ
Okay... Quick question on this (is this the right place to post a question?), but I was using YEP_MainMenuMangaer, created a menu slot (via Common Event), but I want it to be like a different window (scene) not just a text box in the corner. So, using this could I edit that JS to make it so that my new slot could be implemented? Made a funny info section in game.
 

Kurdiez

Villager
Member
Joined
Jan 24, 2017
Messages
19
Reaction score
1
First Language
English
Primarily Uses
What exactly is a scene vs map? It seems to me so far, whatever game objects I instantiate gets eventually added to the scene. Can one scene have multiple maps? I would like to understand the scope of the term scene used in RPG Maker MV.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
@Kurdiez in simple a map itself is a scene or if I explain the scene_map is the scene who show the map but a map itself is just a json while the scene is what will process your map

You could have multiple maps show but would require to edit some mv codebase for show multiple map in game
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
personally I delete this map system
My map are now a full sprites, and event picture or other element are children of map scene.
It's much simpler to understand and above all better performance.
This also removes the problem of floating virgul when zooming or moving the map to 60fps with a lot of elements to syncro.
 

Pan5ky

Warper
Member
Joined
Jan 21, 2014
Messages
3
Reaction score
4
First Language
German
Primarily Uses
RMMV
this is really hard to read, i would suggest you cut those lines and special characters out and maybe use something like github gists to show the code with syntax highlighting and proper formating.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,045
Members
137,569
Latest member
Shtelsky
Top