Custom data class for a virtual pet menuu?

(I tried posting this on a different thread earlier buut apparently that thread ended months ago and I didn't realize itt, jsjss)

Sooo I'm trying to make a virtual pet menu in MV, except it would be a little bit like a Tamagotchi in a sense that there would be its own little menu for itt

The only problem iss, is that I'd have to make my own custom data class for said options for what the pets should do (for examplee, playing a game or getting food from your inventory to give to themm), whichh... I have no idea how to do that and I haven't found any youtube tutorials or plugins that can really help me with that at alll, how could I do this in MV? X"<

As of noww, the menu looks like thiss, an acquaintance of mine helped me out with the coding aand I'm very gratefulll:

Screenshot 2023-11-12 121846.png
Okay, well...what do you want to happen?

I appreciate you were gifted with some code for this menu, but honestly it might be easier for you to do it through eventing because then you can simply make the results of each choice be whatever you want via event commands.

Welll, when an option such as "Talk" would be pressedd, the pet would be able to say a multitude of different things to you via the text box on the bottomm, when "treat" or "drink" is pressed you'd give the pet something from your inventoryy, aand when "game" is pressed the sprite for the pet on the right would be changed so that the pet is bouncing a ball or somethingg

To do all thatt, I believe you'd need to have a custom data classs, welll, the "talk" option would need an arrayy, buut that would still require the data classs, I believee
Welll, when an option such as "Talk" would be pressedd, the pet would be able to say a multitude of different things to you via the text box on the bottomm, when "treat" or "drink" is pressed you'd give the pet something from your inventoryy, aand when "game" is pressed the sprite for the pet on the right would be changed so that the pet is bouncing a ball or somethingg

To do all thatt, I believe you'd need to have a custom data classs, welll, the "talk" option would need an arrayy, buut that would still require the data classs, I believee
Everything you described can be easily evented from a choice menu. All you're doing is showing text, opening up the select item window, or changing an image. I don't see which part needs a custom data class.
Everything you described can be easily evented from a choice menu. All you're doing is showing text, opening up the select item window, or changing an image. I don't see which part needs a custom data class.
It's that this option would be a separate menu in of itself from the original menuu, can you still do that with a choice menuu?

Something like thiss:

1700542227436.png
It's that this option would be a separate menu in of itself from the original menuu, can you still do that with a choice menuu?

Something like thiss:

View attachment 284570
Did you add these extra menu options with a plugin? It should let you tie the options to common events.
Did you add these extra menu options with a plugin? It should let you tie the options to common events.
Nooo, it had to be coded in by handd X"DD

Through adding in a new command into the menu itselff X">
Nooo, it had to be coded in by handd X"DD

Through adding in a new command into the menu itselff X">
Did your friend edit the code in the RPG maker files or is it extra code that you added as a plugin?
It's that this option would be a separate menu in of itself from the original menuu, can you still do that with a choice menuu?

Something like thiss:

View attachment 284570
Whenever "Pets" in the extra menu option would be pressedd, the menu that I first showed would appearr, aaa
Did your friend edit the code in the RPG maker files or is it extra code that you added as a plugin?
It was extra code that was added as a pluginn X>
It was extra code that was added as a pluginn X>
Ok, can you upload the plugin file or post it using the code tag?

Actually, we don't need to see it. We need to see how you coded your first picture.
Ok, can you upload the plugin file or post it using the code tag?
Suree, I believe the code was thiss:

// Window_MenuCommand
// aliased method
window_menucommand_addoriginalcommands = Window_MenuCommand.prototype.addOriginalCommands;
Window_MenuCommand.prototype.addOriginalCommands = function() {
window_menucommand_addoriginalcommands.apply(this);
this.addCommand("Pets", 'pets', true);
};
// Scene_Menu
// aliased method
scenemenu_createcommandwindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
scenemenu_createcommandwindow.apply(this);
this._commandWindow.setHandler('pets', this.commandPets.bind(this));
Suree, I believe the code was thiss:

// Window_MenuCommand
// aliased method
window_menucommand_addoriginalcommands = Window_MenuCommand.prototype.addOriginalCommands;
Window_MenuCommand.prototype.addOriginalCommands = function() {
window_menucommand_addoriginalcommands.apply(this);
this.addCommand("Pets", 'pets', true);
};
// Scene_Menu
// aliased method
scenemenu_createcommandwindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
scenemenu_createcommandwindow.apply(this);
this._commandWindow.setHandler('pets', this.commandPets.bind(this));
(I have no idea how the code tag works so you're gonna have to endure my naivetyy, I just joined the forumss) X"DD
Everything that you're describing can be implemented via events. It can look exactly like the other menu screens in the game by using pictures the way the tutorial I supplied shows.

It's that this option would be a separate menu in of itself from the original menuu, can you still do that with a choice menuu?
There are simple plugins that allow you to call a common event from a menu option, so yes.

You only "need" to use arrays and data structures and such if you insist on doing this via JavaScript, rather than events. The downside to that is you are pretty much not going to find someone to just do all of it for you. So your options in that route are to either study JavaScript until you know how to do it, or commission someone to code it for you.

May I suggest taking a minute to proofread your replies before posting? The random double and triple letters on a bunch of your words make some of your posts pretty confusing to read.
Everything that you're describing can be implemented via events. It can look exactly like the other menu screens in the game by using pictures the way the tutorial I supplied shows.


There are simple plugins that allow you to call a common event from a menu option, so yes.

You only "need" to use arrays and data structures and such if you insist on doing this via JavaScript, rather than events. The downside to that is you are pretty much not going to find someone to just do all of it for you. So your options in that route are to either study JavaScript until you know how to do it, or commission someone to code it for you.

May I suggest taking a minute to proofread your replies before posting? The random double and triple letters on a bunch of your words make some of your posts pretty confusing to read.
The random letters are a typing quirkk, I have AuDHD aand it makes me feel comfy to type like thiss, forgivee X">

What plugins call a common event from a menu optionn? That could be helpfulll X)
Suree, I believe the code was thiss:

// Window_MenuCommand
// aliased method
window_menucommand_addoriginalcommands = Window_MenuCommand.prototype.addOriginalCommands;
Window_MenuCommand.prototype.addOriginalCommands = function() {
window_menucommand_addoriginalcommands.apply(this);
this.addCommand("Pets", 'pets', true);
};
// Scene_Menu
// aliased method
scenemenu_createcommandwindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
scenemenu_createcommandwindow.apply(this);
this._commandWindow.setHandler('pets', this.commandPets.bind(this));
Ok, that just adds menu options to the main menu. If you want to know how to control things from your pet scenes we need to see the code for that.
Ok, that just adds menu options to the main menu. If you want to know how to control things from your pet scenes we need to see the code for that.
Ahhh, alrightt! X)

Here's the plugin file for it thenn, this shows pretty much all that it's got so farr X>
@Kevonica_ , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.
Ok, you see these functions at the end? Inside the {} for each you need to put
$gameTemp.reserveCommonEvent(ID)
Where ID is the number of your common event.

JavaScript:
Scene_Pets.prototype.commandTreat = function() {
    this.commandCancel();
};

Scene_Pets.prototype.commandDrink = function() {
    this.commandCancel();
};

Scene_Pets.prototype.commandTalk = function() {
    this.commandCancel();
};

Scene_Pets.prototype.commandGame = function() {
    this.commandCancel();
};

Then you make a common event of what you want to happen
Ok, you see these functions at the end? Inside the {} for each you need to put
$gameTemp.reserveCommonEvent(ID)
Where ID is the number of your common event.

JavaScript:
Scene_Pets.prototype.commandTreat = function() {
    this.commandCancel();
};

Scene_Pets.prototype.commandDrink = function() {
    this.commandCancel();
};

Scene_Pets.prototype.commandTalk = function() {
    this.commandCancel();
};

Scene_Pets.prototype.commandGame = function() {
    this.commandCancel();
};

Then you make a common event of what you want to happen
Ooohhh, I see noww! Thank youu X>

Original thread: https://forums.rpgmakerweb.com/threads/custom-data-class-for-a-virtual-pet-menuu.163121/