Status
Not open for further replies.

lucasbatata

Villager
Member
Joined
Sep 14, 2018
Messages
6
Reaction score
2
First Language
PT-BR
Primarily Uses
RMMV
Hello everyone! I know there are other threads with similar questions, but I didn't find any that answers exactly my problem (or which I could derive an answer from). When you call a common event with an open menu (eg Skill or Item) the menu is closed (I understand that is because it don't have an interpreter built-in, so it goes back to the map screen to run the event). But after the event is done, I want the Skill menu to be called again. I know it is possible to call it back with
Code:
SceneManager.push(Scene_Skill)
or call instead of push.

But this way, when you close the Skill menu, it goes back to the map, and don't to the Main Menu, and that is what I want. I tried calling
Code:
SceneManager.push(Scene_Skill)
SceneManager.push(Scene_Menu)
to make it open it like a sub-menu, but it doesn't work (I GUESS it can't open a second menu just after opening the first one because of the interpreter issue).

I'm new to MV and JS, I tried to work around with push and call (as I understand, the push was supposed to work differently from call or goto exactly in allowing submenus to be open) and to search for plugins that could solve my problem, but although it seems to be a simple issue, I didn't find an answer in forum nor a plugin that solved it (found this but was not able to make it work the way I need it). I appreciate any help, either a plugin that solves this issue or an explanation on how to correctly use SceneManager scrips to do exactly what I need. Thanks in advance![/CODE]
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,145
First Language
English
Primarily Uses
RMMV
Think of the scenes like a stack of plates. Whatever plate is on top is the active scene, but there might be other scenes below in the stack.

The 'push' method adds a new plate to the top of the stack, and the 'pop' method removes the top plate. The 'goto' method completely clears the stack and then adds a plate.

I tried calling
Code:
SceneManager.push(Scene_Skill)
SceneManager.push(Scene_Menu)
to make it open it like a sub-menu
Think about it with the plate analogy, and I think you will see what you need to do for this to work.
 

lucasbatata

Villager
Member
Joined
Sep 14, 2018
Messages
6
Reaction score
2
First Language
PT-BR
Primarily Uses
RMMV
Thank you for the didactic answer Aloe Guvner, although I was not able to make it perfect, I was able to do what I need. I tried calling the two commands in separate scripts, so when the Skill menu was closed, the script opening the Main Menu was called right away. It was not perfect tough because I want to simulate the normal process of opening them (like clicking to open Main, then Skills), which does not shows an interval between them, but this way you do have a time lag between them (while it processes the script, I presume).

What I'm trying to do specifically is using a skill outside battle that calls a common event, and after it resolves it just goes back to the skill menu as nothing else happened, but as I said, the problem is that when the skill menu is closed: (1) it goes back to the map or (2) as I managed to do now, calls again the main menu but with a time lag between them.

Do you think there is a way to overcome this "time lag" situation just with scripts? Or did I not managed to understand what you tried to explain and there is a better way to do it? (I'm not used to JS and I'm not sure if I got the stack issue right)
 

prepe

Veteran
Veteran
Joined
Apr 11, 2012
Messages
39
Reaction score
5
Primarily Uses
If I read this right then you may need a plugin or a plugin edit. Basically what happenes is if you pull a specific part of a menu from the map it returns to the last position it was pulled from like your skill goes then pulls the skill menu then when you back out it goes straight to the map because the menu was not pulled before going to the skill. It will not return to the menu. If you edit the skill menu plugin so when you close the skill menu it will return to menu every time no mater how it was pulled up that might give you what your looking for when I get home if it's not figured out I'll see what I can do and post the edits you need, but to make sure I got this right.

you use a skill from map by button press, it calls a come even, then when the skill is done it goes to your skills, then when you back out it goes to the map again but you want it to go to the menu instead?

If so I'm sure I can figure out your edit for you when I get home. That would in turn also make no lag to your menu it would just go straight there.
 

lucasbatata

Villager
Member
Joined
Sep 14, 2018
Messages
6
Reaction score
2
First Language
PT-BR
Primarily Uses
RMMV
you use a skill from map by button press, it calls a come even, then when the skill is done it goes to your skills, then when you back out it goes to the map again but you want it to go to the menu instead?

Almost. I actually use the skill from the skill menu. That is why I want the menu to be brought back again as if it was never closed. Since I read that the menu has no interpreter built-in, and therefore would be impossible to use the skill (+commom event) and kept it open, I started to look for a way to reopen it as it was never closed, and stumbled on this issue.

I appreciate all the help
Thanks in advance!
 
Last edited:

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,145
First Language
English
Primarily Uses
RMMV
Think about the analogy again, you can even take 3 pieces of paper and write "Scene_Map", "Scene_Menu", and "Scene_Skill" on them.

Initial State:
You are currently in Scene_Skill and you are about to use the skill. What does the stack look like? Well you are currently in Scene_Skill, so that is on top. Just before, you were in Scene_Menu, and that was in the middle. Before that, you were on the map, so Scene_Map is on the bottom.

During the Common Event:
Like you noticed, using a Common Event brings you to the map (goto SceneMap). In fact, Common Events only work on the map, that's why they do this.

At the end of your common event, you need to rebuild the stack so that it is the same as before.

I tried calling
Code:
SceneManager.push(Scene_Skill)
SceneManager.push(Scene_Menu)

This will create a stack where Scene_Map is on the bottom (good), Scene_Skill is next (bad), and Scene_Menu is on top (bad).
Simply switch those commands, and the stack will be built as you want it.
 

lucasbatata

Villager
Member
Joined
Sep 14, 2018
Messages
6
Reaction score
2
First Language
PT-BR
Primarily Uses
RMMV
I got the explanation, but it didn't work :frown: I just switched these commands, like:
Code:
SceneManager.push(Scene_Menu)
SceneManager.push(Scene_Skill)
but it only opens the Skill Menu (when it is closed, it goes back straight to the map), can't understand why... sorry to take your time :frown:


edit: actually, it seems to work differently depending on calling both on the same script or separately. Calling them together makes the Skill Menu to be opened directly over the map as I said just above (apparently without the main menu in the stack); calling them in separate scripts works fine as I said in another post above and actually solves my problem, except for the timelag between the scenes, that don't happens when you just open the skill menu via main menu clicking. This is not a major problem but would be nice to have it solved!
 
Last edited:

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,145
First Language
English
Primarily Uses
RMMV
Ah, I just tested it, you're right, it doesn't work that way.

We have to manipulate the stack manually, because of how those functions work.

Code:
SceneManager._stack.push(Scene_Map);
SceneManager._stack.push(Scene_Menu);
SceneManager.goto(Scene_Skill);
CommonEvent.png
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,947
Reaction score
5,855
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts


1,Randomly generate events with planted spawner events(great flexibility for customization and auto-match player's level)
2,Randomly enter roguelike dungeon
3,Player can exit dungeon or back to town or choose to challenge BOSS at the end of each dungeon
4,Dungeon maps can be randomly generated by a third-party tool
Got locked out of the house yesterday... best friends who had the spare ghosted me. Locksmith had to literally drill thru the lock bc they couldn't pick it. Whole process took 4 hours and far too much money. And they have to come back next week bc they don't have the right cylinder, cause it's an old interlocking lock. I'm livid lol
 I’m probably going to regret this, but I need kobolds for my project and I’ve decided to sprite them myself. This is Attempt #1, front view only.

KoboldFront.gif
It's a shame that Selection Control will not be ported to MZ. I found a neat way of using it to enable ways for tanks to protect squishies. lol
Lately I have been taking a break from game and resource making so I won't get burnt out. But I am also interested in the Game Jams this site periodically holds. It'd be great if I knew when the next one, if any, is planned.

Forum statistics

Threads
115,354
Messages
1,089,223
Members
150,031
Latest member
Slashqian
Top