[MZ]Call a common event before acessing menu

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
352
Reaction score
80
First Language
brazil
Primarily Uses
I'm looking for the file where it calls the main menu scene as I want to add this code before: $gameTemp.reserveCommonEvent(722)
Because I want to call this event before accessing the menu.
Does anyone know where this file is?
I think it's one of those...
1653343073364.png
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,178
Reaction score
732
First Language
Javascript
Primarily Uses
RMMZ
I'm looking for the file where it calls the main menu scene as I want to add this code before: $gameTemp.reserveCommonEvent(722)
Because I want to call this event before accessing the menu.
Does anyone know where this file is?
I think it's one of those...
View attachment 227151
1653346359862.png
^ Helpful?
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,686
Reaction score
9,861
First Language
German
Primarily Uses
RMMV
what exactly do you want that common event to do?

because what you want is not as simple as you assume.

1) common events (all events to be more precise) need a game interpreter to run on. And most scenes do not have such an interpreter.
that is the reason why an item with a common event attached always leaves the menu on use, the attached common event can only be processed on map.
so whatever you want to happen, the common event has to complete BEFORE the menu is opened, or you'll need a much bigger reprogram to add an interpreter to the menu.

2) ever checked the name of the function you found?
RESERVEcommonevent

that function DOES NOT run a common event, it reserve the common event in the queue for the next time it can be run.
If you use it before opening the menu, then the next time the common event can be processed is only AFTER CLOSING the menu again.
as already explained in point 1, adding that command in the sequence will not do what you assume it does, because the menu does not contain any interpreter.

3) changing default code directly is a very bad style of programming that will cause you problems whenever you want to update your project.
it should be written as a plugin.
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
352
Reaction score
80
First Language
brazil
Primarily Uses
Thanks for your attention, but unfortunately it didn't work.
I'm using mmomz plugin, and there is a bug that when you add a player to your group, a clone of the leader appears as a third member.
So I thought of a strategy to solve this bug.
I created an event on the map with the following condition:
$gameActors.actor(1).name().toLowerCase() === $gameActors.actor(2).name().toLowerCase()
the remove member.
It worked, but unfortunately when I access the menu for the second time the clone appears again.
That's when I thought, if I ask to call a common event before accessing the menu it will work, but unfortunately it didn't.
I'll leave two screens here to try to clarify...

1653347018639.png
1653347057375.png
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
352
Reaction score
80
First Language
brazil
Primarily Uses
what exactly do you want that common event to do?

because what you want is not as simple as you assume.

1) common events (all events to be more precise) need a game interpreter to run on. And most scenes do not have such an interpreter.
that is the reason why an item with a common event attached always leaves the menu on use, the attached common event can only be processed on map.
so whatever you want to happen, the common event has to complete BEFORE the menu is opened, or you'll need a much bigger reprogram to add an interpreter to the menu.

2) ever checked the name of the function you found?
RESERVEcommonevent

that function DOES NOT run a common event, it reserve the common event in the queue for the next time it can be run.
If you use it before opening the menu, then the next time the common event can be processed is only AFTER CLOSING the menu again.
as already explained in point 1, adding that command in the sequence will not do what you assume it does, because the menu does not contain any interpreter.

3) changing default code directly is a very bad style of programming that will cause you problems whenever you want to update your project.
it should be written as a plugin.
I'm using mmomz plugin, and there is a bug that when you add a player to your group, a clone of the leader appears as a third member.
So I thought of a strategy to solve this bug.
I created an event on the map with the following condition:
$gameActors.actor(1).name().toLowerCase() === $gameActors.actor(2).name().toLowerCase()
the remove member.
It worked, but unfortunately when I access the menu for the second time the clone appears again.
That's when I thought, if I ask to call a common event before accessing the menu it will work, but unfortunately it didn't.
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,178
Reaction score
732
First Language
Javascript
Primarily Uses
RMMZ
what exactly do you want that common event to do?

because what you want is not as simple as you assume.

1) common events (all events to be more precise) need a game interpreter to run on. And most scenes do not have such an interpreter.
that is the reason why an item with a common event attached always leaves the menu on use, the attached common event can only be processed on map.
so whatever you want to happen, the common event has to complete BEFORE the menu is opened, or you'll need a much bigger reprogram to add an interpreter to the menu.

2) ever checked the name of the function you found?
RESERVEcommonevent

that function DOES NOT run a common event, it reserve the common event in the queue for the next time it can be run.
If you use it before opening the menu, then the next time the common event can be processed is only AFTER CLOSING the menu again.
as already explained in point 1, adding that command in the sequence will not do what you assume it does, because the menu does not contain any interpreter.

3) changing default code directly is a very bad style of programming that will cause you problems whenever you want to update your project.
it should be written as a plugin.
Yep I was thinking the same exact thoughts :)

@Decinbr... only one way I can really see implementing this to work as desired is something like the following...

Use:

Like this:
1653347568520.png
Then in the common event after doing the pre-menu stuff, run the menu like this:
1653347482907.png
...or also this should do almost the same thing...
1653347886172.png
Don't know if it will work for what you need though.
The above example just plays the exclamation balloon over the player then enters the menu.
 
Last edited:

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
352
Reaction score
80
First Language
brazil
Primarily Uses
Yep I was thinking the same exact thoughts :)

@Decinbr... only one way I can really see implementing this to work as desired is something like the following...

Use:

Like this:
Then in the common event after doing the pre-menu stuff, run the menu like this:
...or also this should do almost the same thing...
Don't know if it will work for what you need though.
The above example just plays the exclamation balloon over the player then enters the menu.
My friend, first of all I would like to thank you very much for your effort to help others, this is not the first time you have done this.
I managed to solve the problem as follows.
I used the command: $gameTemp.reserveCommonEvent(X)
on line 938 as you taught, and I added it on line 968 too, and I also added 2 more of these codes in the plugin, MMOCore.player
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,178
Reaction score
732
First Language
Javascript
Primarily Uses
RMMZ
My friend, first of all I would like to thank you very much for your effort to help others, this is not the first time you have done this.
I managed to solve the problem as follows.
I used the command: $gameTemp.reserveCommonEvent(X)
on line 938 as you taught, and I added it on line 968 too, and I also added 2 more of these codes in the plugin, MMOCore.player
Very welcome, glad to help out :)
Yay! Great to hear you got it working as needed :cutesmile:

Hope all goes smooth for ya :cutesmile:


Happy Game Making! :LZSgrin:
 

Latest Threads

Latest Posts

Latest Profile Posts

I just got all of my wisdom teeth out today, thankfully I have the rest of the week off.
Man I am learning I am bad at naming armor lmao.
The game's opening, now fully polished! :LZScheeze:





Aaand, here's me working on it in today's "Game Making Every Day" video! :LZSooo:

Hello! Can anyone help me? I followed making cooking tutorial for RPG Maker MV. But for some reason buff state that food gives doesn't work in overworld. It disappears. What am I supposed to do?
A shotgun is not a rifle. Huh.

Forum statistics

Threads
124,406
Messages
1,163,383
Members
163,201
Latest member
YoBa
Top