Dale01102

Villager
Member
Joined
Apr 11, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
I've been trying to make a plugin that allows the player to distribute 'Skill points' between 6 different attributes, but I can't really code haha.


Variable 0001 = Strength
Variable 0002 = Dexterity
Variable 0003 = Constitution
Variable 0004 = Intelligence
Variable 0005 = Wisdom
Variable 006 = Charisma

Variable 0007 = Skill Points

I'm looking to add 6 buttons in the bottom window that will increase the players stats by spending the Skill Points.

If anyone can help me out or point me in the right direction id be grateful

EDIT:
 
Last edited:

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
45,994
Reaction score
16,804
First Language
English
Primarily Uses
RMMV

I've moved this thread to Learning Javascript. Thank you.

 

Dale01102

Villager
Member
Joined
Apr 11, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
I've updated the code but I still need help.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
3,236
Reaction score
2,506
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!

Since you are creating a new scene, I guess the first step is also to create new windows for this scene too.
Meaning, instead of using Window_Base for the Title Window, create a new Window to be the title window(that inherits from the Window Base).

Something like "Window_DistributeSkillTitle", and then create methods on this window to draw the title.

The same behavior is to the Variable window, Sp Window, and Distribute Window.

Like the Scene_Test.prototype.createVariableWindow is doing multiple tasks when the task should be only to create the variable window.
Let the variable window draw its own contents.

This will help you keep things more organized.

On the Distribute window, use the makeCommandList method from the Window_Command to add the commands to distribute the points.
And just use the setHandler method on the scene test function you are creating the window.

You can see examples of this stuff on the RPG Maker code itself. Like the Titlte Command window used on the Scene Title.

I think when you have updated your code this way if you still didn't manage to make what you want, post the update here and I will keep helping you.
 

Dale01102

Villager
Member
Joined
Apr 11, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
Okay, I've done a little research and come back with this.


I still need to add the buttons but your suggestion helped.
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
3,236
Reaction score
2,506
First Language
Portuguese - Br
Primarily Uses
RMMZ
Okay, I've done a little research an come back with this.

changing it again

I still need to add the buttons but your suggestion helped.
I can't see your new code here, maybe you didn't paste it?
Also the first one still the same.

As I said, take a look on the Default RPG Maker code, see how they add a new window on the scene. For example the Title Window.
Don't reuse Window_Base and Window_Command.
Create new windows that inherits from them, just like you did with the Scene_Test that inherits from Scene Menu.

Organize your code, to be more "linear". There are Scene_test everywhere on the code.

After that, I believe I can help you better. If you clear things up, it might help you see things that you didn't see before.
 

Dale01102

Villager
Member
Joined
Apr 11, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
I can't see your new code here, maybe you didn't paste it?
Also the first one still the same.

As I said, take a look on the Default RPG Maker code, see how they add a new window on the scene. For example the Title Window.
Don't reuse Window_Base and Window_Command.
Create new windows that inherits from them, just like you did with the Scene_Test that inherits from Scene Menu.

Organize your code, to be more "linear". There are Scene_test everywhere on the code.

After that, I believe I can help you better. If you clear things up, it might help you see things that you didn't see before.
Sorry, I was just changing it a little i've now updated it. I can't get my head around the buttons.

Capture.JPG
The Orange is Ps.
 
Last edited:

Dale01102

Villager
Member
Joined
Apr 11, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
I can't see your new code here, maybe you didn't paste it?
Also the first one still the same.

As I said, take a look on the Default RPG Maker code, see how they add a new window on the scene. For example the Title Window.
Don't reuse Window_Base and Window_Command.
Create new windows that inherits from them, just like you did with the Scene_Test that inherits from Scene Menu.

Organize your code, to be more "linear". There are Scene_test everywhere on the code.

After that, I believe I can help you better. If you clear things up, it might help you see things that you didn't see before.
I'm trying haha, I'm more of an artist I can't really code.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
3,236
Reaction score
2,506
First Language
Portuguese - Br
Primarily Uses
RMMZ
I'm trying haha, I'm more of an artist I can't really code.
But for what you have created yourself, I don't see why you can't do what I tell you.
First, organize your code.

1 - Create new windows for each window of the scene test. They need to inherit from Window Base and Window Command. Just like you did with the Scene Test inherited from Scene Menu.

2 - Now, separate each one on the code, linearly. Meaning:
  • Scene Test codes
  • Window A codes
  • Window B codes
  • etc...
Currently, they are all mixed up:
  • Scene Test codes
  • Window Base codes
  • Scene Test codes
  • Window Base codes
3 - Let each window handle its own content. Currently, you are using the Scene Test to create the Variable window for example, and on that same function, you are making the Scene Test write all text inside the window. Don't do that.
Use the Scene Test to create the windows, then let the windows handle their own content.

I'm saying this stuff for you because as I see what you coded so far, I'm pretty sure you can do what I say.
 

Dale01102

Villager
Member
Joined
Apr 11, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
I still can't get the buttons to work properly.
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
3,236
Reaction score
2,506
First Language
Portuguese - Br
Primarily Uses
RMMZ
I believe it's a little better.
Now you need to add a handler for each button. This handler is a callback for each button/command you added to the window.

Usually, these handlers are created within the Scene. But you can also do it through the window itself. Example:

JavaScript:
Window_PlayerAttributes4.prototype.makeCommandList = function() {
    this.addCommand("Str", 'option1');
    this.addCommand("Dex", 'option2');
    this.addCommand("Con", 'option3');
    this.addCommand("Int", 'option4');
    this.addCommand("Wis", 'option5');
    this.addCommand("Cha", 'option6');
    // Add handlers
    this.setHandler("option1", this.onOption1)
};

Window_PlayerAttributes4.prototype.onOption1 = function() {
    // Reduce one skill point
    // Add it to the strenght variable.
};

But, sorry if I'm wrong. I'm giving you detailed answers, and the only answer "I still can't get the buttons to work properly.".

I need more information. Why they do not work? What you are trying to do? What are you not understanding?
Did you take a look into the RPG Maker code part that I talked to you about?

In your code, there is already a function that adds a new command into a Command Window and also a function that works as a handler of this command.
If you manage to do that, why can't you do the same for your Command Window on your custom scene?

So, I have to ask, are you using A.I to create this code?
 

Dale01102

Villager
Member
Joined
Apr 11, 2021
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
I needed to set the width and height as it was inherited, it was cutting off the text, so only the first two buttons and half of con was showing.

Window_PlayerAttributes4.prototype.windowHeight = function() { return Graphics.boxHeight * 0.2; }; Window_PlayerAttributes4.prototype.windowWidth = function() { return Graphics.boxWidth; };
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,718
Reaction score
6,540
First Language
English
Primarily Uses
RMMV
I don't know from your last post if you still need help with something.

But as a general bit of logic, it's profoundly unhelpful for you to go back and wipe everything out of your old posts. It makes it impossible for anyone other than Eliaquim to come in and offer any advice.
 

Latest Threads

Latest Profile Posts

Two solid days and I still have four slots left in my custom A2 tilesheet I am drawing.
i really love spaghetti
Who cleaned the cat room, vacuumed and shampoo’d all the area rugs, cleaned the bathrooms, did three loads of laundry ALL BEFORE NOON?! ME!!! I have earned a third espresso shot.
I'm going to put my refrigerator in my bedroom. AMA. Lol.

Forum statistics

Threads
131,523
Messages
1,220,478
Members
173,223
Latest member
ZecaVn
Top