KinoCornell

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
First Language
English
Primarily Uses
RMMV
I'm attempting to set up a menu using a flipped layout plugin from a very helpful YouTube tutorial video. The layout I'm using is in this very simple script here (I didn't create it):

/*:
* @plugindesc alt menu
* @author SumRndmDde
* @Help
*/

Scene_Menu.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createGoldWindow();
this.createStatusWindow();
/*
this._commandWindow
this._goldWindow
this._statusWindow
*/

this._statusWindow.x = 0;

this._commandWindow.x = this._statusWindow.width;

this._goldWindow.x = this._statusWindow.width;
this._goldWindow.y = this._commandWindow.height;

};

What I'm needing to do here is add a new window below the Command Window and above the Gold Window. That additional Window needs to have 3 lines of information:

1.) A dynamic string of text based on a value in one of my game variables.
2.) The display name of the current map.
3.) The current save file's playtime.

I know this probably seems super simple to most of you, but I am not very adept in JS. I've combed through several videos and posts trying to figure out how to do this myself (at least the second and third item to start with), but I cannot make it work.

The first item I'm not sure if I would have to do just a long series of "if..else" statements within the JS itself or if you can run a common event from the menu's JS to determine the string (to maybe streamline it?). But I have no idea how in the JS to reference an in-game variable and then display it as text.

Any help would be greatly appreciated. Thank you.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
609
First Language
English
Primarily Uses
RMMV
I just learned how to do this, tinkering around with that script you shown.
Screen%20Shot%202017-03-28%20at%201.12.23%20AM.png

PHP:
Scene_Menu.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createCommandWindow();
    this.createGoldWindow();
    this.createStatusWindow();
   
    // begin custom window
    this._myCustomWindow = new Window_Help(4); // height is 4 lines
    this._myCustomWindow.x = 0;
    this._myCustomWindow.y = Graphics.boxHeight - this._myCustomWindow.height - this._goldWindow.height;
    this._myCustomWindow.width = this._goldWindow.width;
    this._myCustomWindow.visible = true;
    this._myCustomWindow.setText(
       "Attribute:"+
       "\n" +
       [
           "Message 0", // notice these messages
           "Message 1",
           "Message 2",
           "Message 3"
       ][
           $gameVariables.value(19) // notice this game variable
       ] +
       "\n" +
       $dataMapInfos[$gameMap._mapId].name +
       // $dataMap.displayName + // or maybe you want display name?
       "\n" +
       $gameSystem.playtimeText()
    );
    this.addWindow(this._myCustomWindow);
};
 

KinoCornell

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
First Language
English
Primarily Uses
RMMV
Oh awesome! Thank you so much! One thing I'm trying to figure out, and I just tried throwing in some "if..else" statements but I can't get it to show up...

This is specific to the "Attribute" and "Message" part. I want this to show a rank based on how many in-game quests have been completed (stored in a specific variable).

I will ultimately replace the word "Attribute" with the word "Rank".
Then, where "Message 0" is, I want it to recognize when $gameVariables.value(5) is less than 10 and output the phrase "Amateur Mercenary."
Then when $gameVariables.value(5) is greater than 9 and less than 20 I want it to output "Novice Mercenary."
So and and so forth for each different "Rank" I have planned at specific quest completion.

I tried to modify your code like this:

// begin custom window
this._myCustomWindow = new Window_Help(4); // height is 4 lines
this._myCustomWindow.x = 0;
this._myCustomWindow.y = Graphics.boxHeight - this._myCustomWindow.height -

this._goldWindow.height;
this._myCustomWindow.width = this._goldWindow.width;
this._myCustomWindow.visible = true;
this._myCustomWindow.setText(
"Rank:"+
"\n" +
[
$gameVariables.value(5) // notice this game variable
]
[
if $gameVariables.value(5) < 10
"Amateur Mercenary";
else if $gameVariables.value(5) > 9 & < 20
"Novice Mercenary";
end;
] +
"\n" +
$dataMapInfos[$gameMap._mapId].name +
// $dataMap.displayName + // or maybe you want display name?
"\n" +
$gameSystem.playtimeText()
);
this.addWindow(this._myCustomWindow);
};

But I didn't do something right, and the entire window won't show up when it's like that. How can I fix it?
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
609
First Language
English
Primarily Uses
RMMV
Where everything greater than 20 is Rank 4 and so forth...
PHP:
var index = $gameVariables.value(5) < 5  ? 0 :
            $gameVariables.value(5) < 10 ? 1 :
            $gameVariables.value(5) < 15 ? 2 :
            $gameVariables.value(5) < 20 ? 3 : 4;
this._myCustomWindow.setText(
   "Rank:"+
   "\n" +
   [
      "Rank 0",
      "Rank 1",
      "Rank 2",
      "Rank 3",
      "Rank 4"
   ][index] +
   "\n" +
   $dataMapInfos[$gameMap._mapId].name +
   // $dataMap.displayName + // or maybe you want display name?
   "\n" +
   $gameSystem.playtimeText()
);
 

KinoCornell

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
First Language
English
Primarily Uses
RMMV
So if I'm sticking it in the right place, the final result should look like this?:

Scene_Menu.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createGoldWindow();
this.createStatusWindow();

// begin custom window
this._myCustomWindow = new Window_Help(4); // height is 4 lines
this._myCustomWindow.x = 0;
this._myCustomWindow.y = Graphics.boxHeight - this._myCustomWindow.height - this._goldWindow.height;
this._myCustomWindow.width = this._goldWindow.width;
this._myCustomWindow.visible = true;
var index = $gameVariables.value(5) < 5 ? 0 :
$gameVariables.value(5) < 10 ? 1 :
$gameVariables.value(5) < 15 ? 2 :
$gameVariables.value(5) < 20 ? 3 : 4;
this._myCustomWindow.setText(
"Attribute:"+
"\n" +
[
"Rank 0",
"Rank 1",
"Rank 2",
"Rank 3",
"Rank 4"
][index] +
"\n" +
$dataMapInfos[$gameMap._mapId].name +
// $dataMap.displayName + // or maybe you want display name?
"\n" +
$gameSystem.playtimeText()
);

Correct? I put it in there like this but the window just doesn't appear.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
609
First Language
English
Primarily Uses
RMMV
If that is the whole plugin, it has an unexpected end of input error.
It's missing addWindow and an END which in javascript is a curly brace }.
Code:
this.addWindow(this._myCustomWindow);
};
 

KinoCornell

171st Street Games
Member
Joined
Mar 8, 2017
Messages
17
Reaction score
2
First Language
English
Primarily Uses
RMMV
That worked! I was able to get all of the different variable quantities and their corresponding output set up. I've tested it in-game and it all works perfectly! Thank you so much!!
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
609
First Language
English
Primarily Uses
RMMV
Don't thank me. Thank @SumRndmDde
I only tinkered with that thing you posted.
 

Latest Threads

Latest Posts

Latest Profile Posts

Here's a screenshot of my newest map. Take in consideration that I'm no mapper at all. :p

quicktrip-dungeon002.jpg
new-lightning-rod-1.gif


Today I removed a lot of flashing used in many attack animations. Instead there's a deep or shallow rumble (it's more satisfying when the controller rumbles with it anyway). I thought about it ever since I nearly blinded myself in the early morning and because someone brought it up. I also realized I have to redo much of Somewhen's thread...
My car Got hit by a car. I'm alive . Left hand hurts to poops . Spend so much time trying to motivate for these moments. Reality is so much quicker, can't sleep and world move on ish.
Just got done hand feeding some baby raccoons who were orphaned when the mother was killed by a car.

First time in my life I've done it and they are adorable.

Taking them in the morning to a Rescue that specializes in wild animals so they will survive. :D

Forum statistics

Threads
131,627
Messages
1,221,687
Members
173,361
Latest member
Bardo_89
Top