[solved]Variable that keeps increasing when the switch is on

Hello!
Is there a way to keep increasing or decreasing the variable with the switch on?
I want to make it not just increase or decrease by 1 per second, but by 1 per 3 seconds or 2 per second.
Yes, this uses the basic event commands.

Make a parallel event that has Wait for 180 frames (3 seconds) then Control Variable to add 1.
Yes, this uses the basic event commands.

Make a parallel event that has Wait for 180 frames (3 seconds) then Control Variable to add 1.
Thanks for the comments! But if I do this, I don't know how to switch off when I want. For example, when a player presses the command to study, the intelligence (variable) keep goes up by 1 every 3 seconds, and I want to stop increasing by pressing quit when I want.
I do hope you do not feel short changed. To be fair for ATT_Turan, the post answered exactly for what you had inquired as per the wording in your original post. There was no mention of an "off". Turan is very good about being succinct and accurate in phrasing for posts, and also many others here. (Myself excluded, as I am still learning the proper phrasing so as to be brief)


As for the follow up question-
Wouldn't you just link it (the above variable event) to a switch event?

-conditional branch whether in a single command page or across 2 with individual conditions (if switch X "on" / if Switch X "off" respectively)
You wouldn't need a 'physical' switch on the map that the player depresses/flips/etc... although you could if you wanted to.
The originating inquiry, of the parallel variable event, would be separate event but controlled by the switch.
The variable would still be available for checks as it would maintain that variable to be called, until used by different event. Meaning when it stops, the stored variable doesn't disappear on its own.
Provided no other events alter that variable for other uses... when turned back on, it would continue to increase intelligence variable (from where it had 'paused') per the wait frames as designed prior, until being turned off once more.



Those who are familiar with a more efficient and optimal route to achieve the inquired outcome, do elaborate.

-Lindy
I want to stop increasing by pressing quit when I want.
What does "pressing quit" mean? Do you want to assign a button to be for quitting skills? You'd use a plugin that runs a common event when you press the button and turns off the switch for your parallel event in my first post.

For example, Yanfly's Button Common Events.

You could also have the same switch activate a second parallel event which uses Conditional Branch to look for a particular key to be pressed, and then turns the switch off.
What does "pressing quit" mean? Do you want to assign a button to be for quitting skills? You'd use a plugin that runs a common event when you press the button and turns off the switch for your parallel event in my first post.

For example, Yanfly's Button Common Events.

You could also have the same switch activate a second parallel event which uses Conditional Branch to look for a particular key to be pressed, and then turns the switch off.

I'm sorry. My explanation was not enough. And I'm not an English speaker, so I'm using a translator, so I might not understand well. I'd appreciate your understanding.
cap2.png

This is what I want to make
cap1.png

and I wrote the event like this.
This will cause a wait in the loop and I can't turn the switch off. I'm doing something wrong and I'm not sure what to do.

I do hope you do not feel short changed. To be fair for ATT_Turan, the post answered exactly for what you had inquired as per the wording in your original post. There was no mention of an "off". Turan is very good about being succinct and accurate in phrasing for posts, and also many others here. (Myself excluded, as I am still learning the proper phrasing so as to be brief)


As for the follow up question-
Wouldn't you just link it (the above variable event) to a switch event?

-conditional branch whether in a single command page or across 2 with individual conditions (if switch X "on" / if Switch X "off" respectively)
You wouldn't need a 'physical' switch on the map that the player depresses/flips/etc... although you could if you wanted to.
The originating inquiry, of the parallel variable event, would be separate event but controlled by the switch.
The variable would still be available for checks as it would maintain that variable to be called, until used by different event. Meaning when it stops, the stored variable doesn't disappear on its own.
Provided no other events alter that variable for other uses... when turned back on, it would continue to increase intelligence variable (from where it had 'paused') per the wait frames as designed prior, until being turned off once more.



Those who are familiar with a more efficient and optimal route to achieve the inquired outcome, do elaborate.

-Lindy
My explanation wasn't good enough. Sorry.

Thank you for your explanation, but I don't understand it very well. I attached the image and wrote it again.
No, no need to apologize. You are doing great. We are happy to have you in the community.

As you can tell from my prior post, I also am not perfect at communication either. My apologies as well.
This is also a good situation to force me to be better for the community. Thank you. Benefit is a two way street.

Any following questions are not for judgement or mockery. They are honest inquiry to which provide greater aid in a more clear fashion. It is to know where to start or how to explain it accurately to suit your personal needs for your project. I believe you are not actually a beginner, perhaps. At least, your original post leans you to understand potentially more than a new beginner.


My post was... worded quite poorly.
My solution, which is only one possible way to attain your result, is not the only or best. There are other potential routes to execute what you want as an end result. This is what I know. It may seem a bit crude. I am not 'advanced' at all. I generally use the base engine for the most part.

Turin's solution utilizes plugins. That is a good option to investigate as well.
Plugins often do the heavy lifting by outsourcing the code that you otherwise would need to program yourself with more effort. It is similar to think of it like using a calculator for math instead of only using pen an paper. It makes situations more expedient. You do need to know how to operate the calculator properly or you will not get an accurate result that you are expecting.


(by the way, your artistic drawling is fantastic. I love it. It is also very clear)


What it appears you are seeking is:

1. The player chooses to active the 'study' event
-this activates the 'study' switch
2. The 'study action' enables the player character to 'learn' increasing the variable.
3. The variable for Intelligence continues increasing over time (as solved/depicted in the second post above by Turin) until the player chooses to halt the progress. (loop)
4. Player halts progress: variable is paused / stagnant ...in example: does not gain increase in variable until reengaged.

Yes?
I understand your full intent?

-----------------------------
Spoiler
booting up my RPmaker and testing so I can explain properly without wasting your time leading you wrong. This is to your benefit. Sometimes I remember button names wrong when, not looking at it. I don't want to do that to you.
Will take some time.
Just wanted to you to know that you are not ignored / abandoned / etc.
Sorry I am not quicker.

I will update this here when I have more aid to provide.

If any other forum member wants to beat me to the solution, you will not step on my toes. The important part is to offer OP aid.
ok. (thumbs up) it worked.
Spoiler: Synopsis of example
What I did:

I created the switch event, activated when player touches + below character
Switch turns on or off "Study" action via dialogue choice. You can alter how the switch is activated. (This was just what I chose for this example.)
This is in front of the 'study' desk.
I placed a book on the desk there for visual effect. Book opens and closes based on if switch is on or off. That is all book event does. It is cosmetic. I wanted a visual confirmation for myself to see when the switch was on or off.

The Variable loop event is in the upper left. You can put it wherever you want. I chose this, it was out of the way. It is parallel, so player interaction by walking should not change it. This is the "Study" action for the variable.

The scrolls on the back wall was so I had something I could confirm variable increasing. It is a simple text to display the variable quotient.
Spoiler: Test Room
StudyRoom RPGMV.png
Spoiler: Variable Loop
Variable Loop.png


you may not need the ELSE part. I threw that in just in case. I did not test to see if it works without the ELSE.
Spoiler: This is the on / off switch for "study"
Study? Yes / No
Practice study.png
Spoiler: This is the on / off switch for "study" PAGE 2
Quit Study? Yes/ No
Practice study pg2.png


Take note of "self switch A", this is important
Spoiler: Check Int Variable
Check Int Variable.png
Spoiler: Book Close
Book close.png
Spoiler: Book Open
Book open-close.png
Spoiler: Check Int before
Check Int at 0.png
Spoiler: Player studying
Player studying.png
Spoiler: Check Int after some time studying
Test Int at 9.png

There are some oversights with this.
This was quick creation and not a polished result.

Spoiler: Obvious flaws with this (fast) example
1. While 'studying' player is able to still move around the map.
- This could be solved in a number of ways.
One way is to increase events around that square that will turn off study automatically just by moving away from the book.
You also could look into inserting a command line in the switch event that restricts player movement when the switch is on.
I forget where to find it in the menu, at the moment.

2. (designed as is, and quickly only to be example of concept) To 'end' study you have to reinitiate touching the square the player is on and then choosing to 'end' study. This is poor flaw. It is not natural for the player to potentially choose to follow through without prompting to 'turn off'.
Again, many ways to correct this.
- One way is to have the interaction (page 2) be action button + same as player and keep transferring the player back to the book if they do not choose to end study.

3. Also, this does not display a status bar for the progress. My best guess is to seek a plugin that does On Map display. I personally have not used status bar displays in my projects.
- you could set up an additional sprite near by on the desk or something that changes the image every time when the variable increases. Maybe an hourglass spins around. This is of course necessarily not a nice, clearly visible reading like a progress bar... so it is not an optimal choice, if you are looking to duplicate your drawing above accurately.
However, you could use sprites of number integers instead if desperate. That could be clear and obvious for progress.
- this would require a variable check to match the variable number so your graphic is accurate to what the count is on the variable.
Your choice, you probably can find a better visual solution.
Clarification: Flaws are because of how I told the engine to do things. It is not engine's fault. Engine will only do what it is told. There are many amazing things RM engine is capable.

If you inquire about the Yanfly Plugins, mentioned above, in the Javascript/Plugin Support thread area you will probably get a better answer for those than I can provide. At the moment, I can only build 'casual' petal bicycles with my skill. There are people here who are quite capable with their use of the RM game engine and keeping with the metaphor comparison can build Lamborghini quality vehicles. Apologies for my crude solution. I do hope that it does help you understand some of what you had inquired and cleared up the confusion which I may have unintentionally thrust upon you in my previous, initial post.
Again, the example above is not the best way to achieve your goal. One way, sure... but likely not the most optimal.
This is at least what I tired to explain in phrase earlier.
Apologies again for poor communication.

Lindy



** EDIT: Looking at your diagram again....

Do you want the ability for the player to press a key (on the keyboard, for instance) to 'study' and as long as that key stroke is depressed, the variable will increase over time?
Once the Player stops pressing down on the key (physically releases the key), the 'learning' halts.
Is this what you intend instead for your project?

If so, I think this is exactly what Turin was describing as possible with the RMMV engine + "Yanfly's Button Common Events" plugin.
To do the 'progress bar display' (concept portion), you would need a plugin for that execution feature. I am unsure if you can do it with the base engine easier.
No, no need to apologize. You are doing great. We are happy to have you in the community.

As you can tell from my prior post, I also am not perfect at communication either. My apologies as well.
This is also a good situation to force me to be better for the community. Thank you. Benefit is a two way street.

Any following questions are not for judgement or mockery. They are honest inquiry to which provide greater aid in a more clear fashion. It is to know where to start or how to explain it accurately to suit your personal needs for your project. I believe you are not actually a beginner, perhaps. At least, your original post leans you to understand potentially more than a new beginner.


My post was... worded quite poorly.
My solution, which is only one possible way to attain your result, is not the only or best. There are other potential routes to execute what you want as an end result. This is what I know. It may seem a bit crude. I am not 'advanced' at all. I generally use the base engine for the most part.

Turin's solution utilizes plugins. That is a good option to investigate as well.
Plugins often do the heavy lifting by outsourcing the code that you otherwise would need to program yourself with more effort. It is similar to think of it like using a calculator for math instead of only using pen an paper. It makes situations more expedient. You do need to know how to operate the calculator properly or you will not get an accurate result that you are expecting.


(by the way, your artistic drawling is fantastic. I love it. It is also very clear)


What it appears you are seeking is:

1. The player chooses to active the 'study' event
-this activates the 'study' switch
2. The 'study action' enables the player character to 'learn' increasing the variable.
3. The variable for Intelligence continues increasing over time (as solved/depicted in the second post above by Turin) until the player chooses to halt the progress. (loop)
4. Player halts progress: variable is paused / stagnant ...in example: does not gain increase in variable until reengaged.

Yes?
I understand your full intent?

-----------------------------
Spoiler
booting up my RPmaker and testing so I can explain properly without wasting your time leading you wrong. This is to your benefit. Sometimes I remember button names wrong when, not looking at it. I don't want to do that to you.
Will take some time.
Just wanted to you to know that you are not ignored / abandoned / etc.
Sorry I am not quicker.

I will update this here when I have more aid to provide.

If any other forum member wants to beat me to the solution, you will not step on my toes. The important part is to offer OP aid.
ok. (thumbs up) it worked.
Spoiler: Synopsis of example
What I did:

I created the switch event, activated when player touches + below character
Switch turns on or off "Study" action via dialogue choice. You can alter how the switch is activated. (This was just what I chose for this example.)
This is in front of the 'study' desk.
I placed a book on the desk there for visual effect. Book opens and closes based on if switch is on or off. That is all book event does. It is cosmetic. I wanted a visual confirmation for myself to see when the switch was on or off.

The Variable loop event is in the upper left. You can put it wherever you want. I chose this, it was out of the way. It is parallel, so player interaction by walking should not change it. This is the "Study" action for the variable.

The scrolls on the back wall was so I had something I could confirm variable increasing. It is a simple text to display the variable quotient.
Spoiler: Test Room
Spoiler: Variable Loop
View attachment 304762

you may not need the ELSE part. I threw that in just in case. I did not test to see if it works without the ELSE.
Spoiler: This is the on / off switch for "study"
Study? Yes / No
View attachment 304763
Spoiler: This is the on / off switch for "study" PAGE 2
Quit Study? Yes/ No
View attachment 304764

Take note of "self switch A", this is important
Spoiler: Check Int Variable
Spoiler: Book Close
Spoiler: Book Open
Spoiler: Check Int before
Spoiler: Player studying
Spoiler: Check Int after some time studying

There are some oversights with this.
This was quick creation and not a polished result.

Spoiler: Obvious flaws with this (fast) example
1. While 'studying' player is able to still move around the map.
- This could be solved in a number of ways.
One way is to increase events around that square that will turn off study automatically just by moving away from the book.
You also could look into inserting a command line in the switch event that restricts player movement when the switch is on.
I forget where to find it in the menu, at the moment.

2. (designed as is, and quickly only to be example of concept) To 'end' study you have to reinitiate touching the square the player is on and then choosing to 'end' study. This is poor flaw. It is not natural for the player to potentially choose to follow through without prompting to 'turn off'.
Again, many ways to correct this.
- One way is to have the interaction (page 2) be action button + same as player and keep transferring the player back to the book if they do not choose to end study.

3. Also, this does not display a status bar for the progress. My best guess is to seek a plugin that does On Map display. I personally have not used status bar displays in my projects.
- you could set up an additional sprite near by on the desk or something that changes the image every time when the variable increases. Maybe an hourglass spins around. This is of course necessarily not a nice, clearly visible reading like a progress bar... so it is not an optimal choice, if you are looking to duplicate your drawing above accurately.
However, you could use sprites of number integers instead if desperate. That could be clear and obvious for progress.
- this would require a variable check to match the variable number so your graphic is accurate to what the count is on the variable.
Your choice, you probably can find a better visual solution.
Clarification: Flaws are because of how I told the engine to do things. It is not engine's fault. Engine will only do what it is told. There are many amazing things RM engine is capable.

If you inquire about the Yanfly Plugins, mentioned above, in the Javascript/Plugin Support thread area you will probably get a better answer for those than I can provide. At the moment, I can only build 'casual' petal bicycles with my skill. There are people here who are quite capable with their use of the RM game engine and keeping with the metaphor comparison can build Lamborghini quality vehicles. Apologies for my crude solution. I do hope that it does help you understand some of what you had inquired and cleared up the confusion which I may have unintentionally thrust upon you in my previous, initial post.
Again, the example above is not the best way to achieve your goal. One way, sure... but likely not the most optimal.
This is at least what I tired to explain in phrase earlier.
Apologies again for poor communication.

Lindy



** EDIT: Looking at your diagram again....

Do you want the ability for the player to press a key (on the keyboard, for instance) to 'study' and as long as that key stroke is depressed, the variable will increase over time?
Once the Player stops pressing down on the key (physically releases the key), the 'learning' halts.
Is this what you intend instead for your project?

If so, I think this is exactly what Turin was describing as possible with the RMMV engine + "Yanfly's Button Common Events" plugin.
To do the 'progress bar display' (concept portion), you would need a plugin for that execution feature. I am unsure if you can do it with the base engine easier.
Thank you for showing me a great example. I'm touched by your kindness. It's exactly what I want. It was very helpful because there are still many things I don't know. I'll look for more ways to put the menu on the map 🙂 I will also look into the yanfly plug-in! Thank you again!
zbflxl,

Do look for solutions to the faults in that example. It's not pure plug and play or cleanly polished.
For instance, like I mentioned, your player can 'activate' study and then wander the map and do other activities while still getting credit for 'study'. I don't think you intend that. Dishonest players will abuse that exploit.

In any case, thank you for the opportunity to be of service. It was delightful to be of aid to a fellow member who is appreciative, patient and polite. A few days ago there was an individual who turned out not to be so and surprised many people with their personal turn of character. It was... unpleasant. It is quite a rarity though, so don't be discouraged from using the forums. There are lots of wonderful people around, willing to share their knowledge.
I too learned some things with the engine while sorting out how to aid you best. I even have an example project, now, for the future to reference if I want to implement something similar in my projects. Everyone wins.
- Altering your concept to be a "Lore" skill of sorts where the longer you spend in the library 'researching' the more potential rumors and history of the town that are open for the player to discover (through npc dialogue branching) is just one potential modification.
- Throw in this applied to various books (each linked to a separate and differently assigned variable) and it could really do many aspects.
- You could even make it a crude way for the player to qualify the character for skills / classes / jobs / weapon proficiencies granted by npcs later on. (although I think player might prefer to level up their weapon skill by actually using weapons... so maybe rebind that variable linking to the use of a weapon against a particular training dummy or something instead of a book)

If you have time later on.. do look into what Turin was potentially elaborating on. The RM engine is capable of so much more than I am able to properly instruct it to execute. His solution would be vastly more polished as an end result.
By default, as per your diagram... binding the 'study' action (activation) to a particular key (and needing to be in a certain corresponding location as well) would create it to be off by default. You wouldn't have to worry about the player needing to intentionally turn it off like my solution. All they have to do is stop pressing the key. It could alleviate an actual real life away from keyboard exploit I just realized is present with my example 'study' room.
- It would be a good learning opportunity for application of similar events for your future projects.

There are always... (although, because the universe is how it is, there may be one single counter example to prove my false) ...multiple routes to arrive at a similar if not near identical end result for how to craft your game. Keeping an open mind will only benefit you in the long run. You have shown that you adhere to that concept. Well done.

I look forward to seeing your screenshots in the screenshot threads section, whenever the project progresses sufficiently for your tastes to do so. Screenshot requirements do not have to be from fully complete projects. If you would prefer, of course. No rush, No pressure.

If there is anything in the future, or near future... don't hesitate to ask. If I am around, I'll do what I can to sort out passing on what I know and what could be of use... even if I am unable to fully qualify for your intended solution. Granting a step up is often better than someone instead taking a step away and with that what insight they could share. And, if I am not available, there are numerous individuals far more qualified who consistently are willing to step up to aid others.

좋은 하루 보내세요, 만나서 정말 반가웠어요
(hopefully this translates correctly)

- Lindy
zbflxl,

Do look for solutions to the faults in that example. It's not pure plug and play or cleanly polished.
For instance, like I mentioned, your player can 'activate' study and then wander the map and do other activities while still getting credit for 'study'. I don't think you intend that. Dishonest players will abuse that exploit.

In any case, thank you for the opportunity to be of service. It was delightful to be of aid to a fellow member who is appreciative, patient and polite. A few days ago there was an individual who turned out not to be so and surprised many people with their personal turn of character. It was... unpleasant. It is quite a rarity though, so don't be discouraged from using the forums. There are lots of wonderful people around, willing to share their knowledge.
I too learned some things with the engine while sorting out how to aid you best. I even have an example project, now, for the future to reference if I want to implement something similar in my projects. Everyone wins.
- Altering your concept to be a "Lore" skill of sorts where the longer you spend in the library 'researching' the more potential rumors and history of the town that are open for the player to discover (through npc dialogue branching) is just one potential modification.
- Throw in this applied to various books (each linked to a separate and differently assigned variable) and it could really do many aspects.
- You could even make it a crude way for the player to qualify the character for skills / classes / jobs / weapon proficiencies granted by npcs later on. (although I think player might prefer to level up their weapon skill by actually using weapons... so maybe rebind that variable linking to the use of a weapon against a particular training dummy or something instead of a book)

If you have time later on.. do look into what Turin was potentially elaborating on. The RM engine is capable of so much more than I am able to properly instruct it to execute. His solution would be vastly more polished as an end result.
By default, as per your diagram... binding the 'study' action (activation) to a particular key (and needing to be in a certain corresponding location as well) would create it to be off by default. You wouldn't have to worry about the player needing to intentionally turn it off like my solution. All they have to do is stop pressing the key. It could alleviate an actual real life away from keyboard exploit I just realized is present with my example 'study' room.
- It would be a good learning opportunity for application of similar events for your future projects.

There are always... (although, because the universe is how it is, there may be one single counter example to prove my false) ...multiple routes to arrive at a similar if not near identical end result for how to craft your game. Keeping an open mind will only benefit you in the long run. You have shown that you adhere to that concept. Well done.

I look forward to seeing your screenshots in the screenshot threads section, whenever the project progresses sufficiently for your tastes to do so. Screenshot requirements do not have to be from fully complete projects. If you would prefer, of course. No rush, No pressure.

If there is anything in the future, or near future... don't hesitate to ask. If I am around, I'll do what I can to sort out passing on what I know and what could be of use... even if I am unable to fully qualify for your intended solution. Granting a step up is often better than someone instead taking a step away and with that what insight they could share. And, if I am not available, there are numerous individuals far more qualified who consistently are willing to step up to aid others.

좋은 하루 보내세요, 만나서 정말 반가웠어요
(hopefully this translates correctly)

- Lindy
Thank you. Your words are very helpful to me. I realized how to write an event with your example. And I'm going to try many other ways. It was nice to meet you, too. I'm very happy to say hello in Korean! 😀
Yes... so unless there is anything specific for this individual thread, project specific...
I think the Mods can close it if they need be (per rules) as the solution was acquired.


RPG MAKER MV SUPPORT RULES

After your Question is Answered
...

3. Once solved, report your thread to be closed and marked as solved by a moderator.

Original thread: https://forums.rpgmakerweb.com/threads/solved-variable-that-keeps-increasing-when-the-switch-is-on.168549/