RMMV A way to disable certain menu elements on certain conditions without disabling the entire menu?

Prince_Eric

Villager
Member
Joined
Aug 22, 2019
Messages
16
Reaction score
2
First Language
Russian
Primarily Uses
RMMV
Good day!

In my game there is one certain area where I want to disable Item, Equip and some other menus but still let player have access to the rest (like Options, Save/Load, Quest Journal, etc). The best would be to hide them, but just disabling them would also be fine.

I found this code (can't remember already, where exactly):
def item if $game_switches[51] == true $game_system.se_play($data_system.decision_se) $scene = Scene_Item.new else $game_system.se_play($data_system.cancel_se)
It prevents from using items if switch is on, but I still can access the menu. Maybe there is a way to modify it somehow?
 

TobyYasha

Spaghetti & Coding go hand in hand.
Veteran
Joined
Sep 11, 2019
Messages
186
Reaction score
277
First Language
English
Primarily Uses
RMMZ
Since you don't mind hiding them there's a pretty simple way, although i'm not sure what this "Quest Journal" that you mentioned is, a plugin by chance?
Either way, if it's only the base menu commands you can do so by using this.
$dataSystem.menuCommands

With this command you have access to:
"item", "skill", "equip", "status", "formation", "save"

Example on how to use it:
In a script call you can type, in order to hide the "item" tab.
$dataSystem.menuCommands[0] = false

If you want to re-enable it you can type this instead:
$dataSystem.menuCommands[0] = true

The only thing you would change at most is the number "0" corresponding to the index of the command, which you can check just above the example i posted, the starting index being 0, of course.

One last detailed is that the code you posted is not javascript, i assume it's Ruby?
Hope this helped you!
 

Prince_Eric

Villager
Member
Joined
Aug 22, 2019
Messages
16
Reaction score
2
First Language
Russian
Primarily Uses
RMMV
Since you don't mind hiding them there's a pretty simple way, although i'm not sure what this "Quest Journal" that you mentioned is, a plugin by chance?
Either way, if it's only the base menu commands you can do so by using this.
$dataSystem.menuCommands

With this command you have access to:
"item", "skill", "equip", "status", "formation", "save"
Thank you! It worked!
And yes, Quest Journal is added by Yanfly's plugin.

It's a bit sad that I only can hide default menus (I actually wanted to hide menu added by Stat Allocation plugin as well), but it's not that big of a deal.
My main concern was that character could eat, drink and use equipment while being in a dream world :D This won't happen now thanks to you.

And the code... yeah, probably. It was for... RPG Maker XP, if I recall correctly.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,677
First Language
English
Primarily Uses
RMMV
It's a bit sad that I only can hide default menus (I actually wanted to hide menu added by Stat Allocation plugin as well)
All of Yanfly's plugins that show on the menu have Plugin Commands to disable and enable them. Just check the documentation.
 

Prince_Eric

Villager
Member
Joined
Aug 22, 2019
Messages
16
Reaction score
2
First Language
Russian
Primarily Uses
RMMV
All of Yanfly's plugins that show on the menu have Plugin Commands to disable and enable them. Just check the documentation.
Thanks for the tip. I guess I've skipped that part.
 

Latest Threads

Latest Profile Posts

imgur sure is getting weird, one day I lose gradually all my images, the other I get them back randomly and then again they disappear again.
Despite OPT2 praise it still has some strange stories in it. Lady Mikka is trying to work herself to death because of guilt. Guilt over what? ¯\_(ツ)_/¯ So instead of finding a NPC to have a heart to heart with her they decide the cure is a new kimono. So when she drops dead she'll at least be well dressed. I haven't even got to the strange part yet.
Did so much work on the game today. I wish I could post it all in this status update but there is a character limit of course haha. I thought about making a topic for updates, though... maybe.
The most recent sign that I am old. I have done martial arts for over 4 decades. Never HAD to stretch out. Good, of course, but never required. Was doing some kicks in the kitchen because, why not, and I felt a pop in the back of my thigh. Now I am limping around. Gotta love getting old.
One of the biggest perks of being fluent in English is how many new and interesting recipes I am able to find and try out that I would have hardly come across if I just spoke my mothertounge :3

Forum statistics

Threads
131,683
Messages
1,222,227
Members
173,435
Latest member
TheAmplifier
Top