Trying to make a mechanic using variables and common events

Ok so i learned about variables and how they can be used in various situations. Im trying to make a mechanic where the mechanic will will include the variable as well as increase in battle and with certain scenes. i put the variables into common event but i dont know what to do next. as i wanted to use page up and down to show the variables in text boxes.
Screenshot (93).png
Screenshot (93).png
Screenshot (92).png
Hello, Snonuki, how are you? From what I understand there are a few different things you want to do. One of them would be, when pressing Page Up or Page Down, a message would be displayed showing the character's level of corruption or something similar.
Another thing would be, when you were in a new fight, corruption would increase.
And finally, when you had certain interactions in the game, you would also have your corruption increased. For example, when interacting with a cursed object, the player's corruption level would be increased. Am I correct, are these three things you need?

Another point, you sent the same print, were different prints that you mistakenly sent the same? Or, just a mix-up that made you repeatedly send the same image?

Let's go.
First, I would recommend that you do the following, separate your code into functions (as it is a common event). An event to check your current level of corruption or lust with "\v[1]" lust or "\v[2]" corruption.
Second, there is a logic problem in your code, which causes the value to be set to "100" every time. I think it's better to have a function that increases/decreases, one that checks the current value and if necessary one that checks if that corruption is >= 100 then it is set to 100.

My RPG Maker is in Portuguese, I was instructed not to post screenshots of how to do things in it in that language, and I'm having some difficulty changing it. But, I can help you if you are having difficulty. Please answer above what exactly you need and I will try to help you.
Hello, Snonuki, how are you? From what I understand there are a few different things you want to do. One of them would be, when pressing Page Up or Page Down, a message would be displayed showing the character's level of corruption or something similar.
Another thing would be, when you were in a new fight, corruption would increase.
And finally, when you had certain interactions in the game, you would also have your corruption increased. For example, when interacting with a cursed object, the player's corruption level would be increased. Am I correct, are these three things you need?

Another point, you sent the same print, were different prints that you mistakenly sent the same? Or, just a mix-up that made you repeatedly send the same image?

Let's go.
First, I would recommend that you do the following, separate your code into functions (as it is a common event). An event to check your current level of corruption or lust with "\v[1]" lust or "\v[2]" corruption.
Second, there is a logic problem in your code, which causes the value to be set to "100" every time. I think it's better to have a function that increases/decreases, one that checks the current value and if necessary one that checks if that corruption is >= 100 then it is set to 100.

My RPG Maker is in Portuguese, I was instructed not to post screenshots of how to do things in it in that language, and I'm having some difficulty changing it. But, I can help you if you are having difficulty. Please answer above what exactly you need and I will try to help you.
I’m good and yeah one of them would appear when pressing page up or page down. Also yeah that was a mistake sending the same thing twice. So separate the both into functions. And do I make them two separate common events or put them on the same one. And what would the function be to make the value increase and decrease. And would the function to check it and see the current value be the same as the first two functions. I mostly need help with the functions and set up. I’ll be sure to write down how to do it so I have it in the future. Also don’t mind the attachment one as that’s the mistake photo I took, the screenshot that says screenshot 91.
Your events don't make any sense.

You set the variable to 0. Then you add 5. Then you set it directly to 100. So every time you call your event you're accomplishing nothing except making the variable be 100.

You can't just make a text box aside from the Show Text event command, which is not any kind of interactive list. You'd have to either make a much more complex evented menu, or use a plugin.

My RPG Maker is in Portuguese...and I'm having some difficulty changing it.
What difficulty are you having? Is it on Steam or the standalone version?
Your events don't make any sense.

You set the variable to 0. Then you add 5. Then you set it directly to 100. So every time you call your event you're accomplishing nothing except making the variable be 100.

You can't just make a text box aside from the Show Text event command, which is not any kind of interactive list. You'd have to either make a much more complex evented menu, or use a plugin.


What difficulty are you having? Is it on Steam or the standalone version?
Ok noted, I kinda guessed it would just make the variable 100 even if I did the other stuff I did. So how would I make it a complex event menu where it could work. Or can you give me an example on how I should format the menu. Cause I made a skill that’s called lust that enemies will use in battles and that would make the lust variable increase. As for the corruption variable that’ll increase in certain scenes and items.
exemplo.png


I'm sending you a print that can give you an idea of how you can put this together. But, it doesn't include a menu/progress bar to see your lust/corruption, you just check the current value via text message to check if it is being increased as it should.

I did some things by code, but you can also do it using variable commands, but I think it's worth trying to get used to these commands.
Spoiler: CODES
Code:
//code 1
value = 5;
$gameVariables.setValue(1, $gameVariables.value(1) + value);

//code 2
lustId = 1;
lust = $gameVariables.value(lustId);
lust_max = 100;
 
if(lust >= lust_max){   
$gameVariables.setValue(lustId, lust_max);
}

Check this: RPG Maker MV/MZ Script Calls

Regarding your other issues, such as increasing your corruption/lust when starting a fight or in certain scenes, you can put this command to increase lust in a common event and call it at the beginning of the scene and during fights, if they are not Random battles you can also call this command before the battle starts. It is also possible to add this command to the troop itself as an event that is triggered once. I think this can give you some direction, but if you have other questions, you can post them!
But, remember as our friend said, the menu issue is a little more complex. It's worth finding a plugin for this.

What difficulty are you having? Is it on Steam or the standalone version?
I currently have a Steam version. I still need to better look for those commands you suggested to me! But, I must resolve it soon. I'm not very familiar with Steam... it would be easier if I found this command within RPG Maker itself, 😅
So how would I make it a complex event menu where it could work.
I really think it would be worth your time to focus on doing some more tutorials and make simple practice games first. These screenshots demonstrate that you really don't understand how events work yet, and that's the backbone of making systems in RPG Maker.

But here.

I'm also going to disagree with @Aleth728 - I understand what he's getting at, and it's a good idea to eventually know some basic script calls. But you definitely shouldn't be trying to mess with any code when you don't even understand how to correctly use the basic event commands.

I still need to better look for those commands you suggested to me! But, I must resolve it soon. I'm not very familiar with Steam...
It's only, like, three clicks :hswt2: If I said it to you before, it should be exactly that.

Right-click MV.
1723862726431.png


Click Properties.
1723862742700.png


It's right there.
1723862769369.png
View attachment 314850

I'm sending you a print that can give you an idea of how you can put this together. But, it doesn't include a menu/progress bar to see your lust/corruption, you just check the current value via text message to check if it is being increased as it should.

I did some things by code, but you can also do it using variable commands, but I think it's worth trying to get used to these commands.
Spoiler: CODES
Code:
//code 1
value = 5;
$gameVariables.setValue(1, $gameVariables.value(1) + value);

//code 2
lustId = 1;
lust = $gameVariables.value(lustId);
lust_max = 100;
 
if(lust >= lust_max){  
$gameVariables.setValue(lustId, lust_max);
}

Check this: RPG Maker MV/MZ Script Calls

Regarding your other issues, such as increasing your corruption/lust when starting a fight or in certain scenes, you can put this command to increase lust in a common event and call it at the beginning of the scene and during fights, if they are not Random battles you can also call this command before the battle starts. It is also possible to add this command to the troop itself as an event that is triggered once. I think this can give you some direction, but if you have other questions, you can post them!
But, remember as our friend said, the menu issue is a little more complex. It's worth finding a plugin for this.


I currently have a Steam version. I still need to better look for those commands you suggested to me! But, I must resolve it soon. I'm not very familiar with Steam... it would be easier if I found this command within RPG Maker itself, 😅
Ok thank you. Also I’ll try to find a plugin for it too. But for now I’ll just use the first code in the common event for both then just place the common event in the troops stuff and in the scenes. If I have any trouble doing the codes I’ll let you know.
I really think it would be worth your time to focus on doing some more tutorials and make simple practice games first. These screenshots demonstrate that you really don't understand how events work yet, and that's the backbone of making systems in RPG Maker.

But here.

I'm also going to disagree with @Aleth728 - I understand what he's getting at, and it's a good idea to eventually know some basic script calls. But you definitely shouldn't be trying to mess with any code when you don't even understand how to correctly use the basic event commands.


It's only, like, three clicks :hswt2:

Right-click MV.
View attachment 314851

Click Properties.
View attachment 314852

It's right there.
View attachment 314853
I mean I get the general premise of events but I get what you mean. I’ll just stick to what I was planning to do if I still figure it out. Thank you and @Aleth728 for your help. I’m doing my best and am still learning. So I should take my time with learning what everything does. The events I’m slowly getting a grasp of but still don’t understand some things which is understandable. Again thank you very much for the help. lol at least I know how to do autorun events properly now. And already know how to do basic text events. And treasure chest events along with shops events.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-a-mechanic-using-variables-and-common-events.171146/