How to add a timer to items or skills?

What is the best way to add a "timer" to an item or skill? So that after using the item the effect of that item will end when the timer reaches 0.
Make a common event, set to a switch that will be turned on when the skill is active, and make it a parallel process. 


Wait 60 frames, control variable Seconds (make one of the ingame variables 'seconds' or whatever you'd like) and 'add' 1. (Make sure you don't have it 'set' 1, but 'add' 1.) 


Create a conditional branch that says when seconds is equal to or greater than whatever your limit for the skill is, cancel that skill. 


Then have it turn the switch off that it is bound to. 
Ugh... I am sure that is more simple that it sounds but I will see if I can pull it off. A screenshot of such an event would be fantastic though, heh.


Edit: Hey, why does my tag say "advanced member" and yours "newbie" when you know all this stuff and I don't? I'm filing a complaint with management! 😳
Ask and you shall receive! Actually the answer I gave you before was very one-dimensional, it only would have worked in a very limited scope. Here's a way (I tested it, of course) to make it a lot more versatile for you. 


 So first, let's take the item you want to use. In the example, ive just edited a basic potion.


common event example2.png


As you can see, I've set this item to have an additional effect. It adds a state. It also calls a common event that will 'activate' a different common event. We'll get to that in a bit. Now I don't need to show a picture of this next bit because it's very simple, all I've done is created a new state named '10 second Wait'. Call it whatever you'd like, this won't be the only state you'll probably make for this. It's just there to be a condition that we'll check in a bit. 


Now you need to make two common events. The first one will simply activate the other.


This is the common event called by the item. All item effects will call this common event, the one we called as an effect of potion in the example above;


comm pic 1.png


That will turn the real common event on. This is necessary because you want the item's effect to occur without stopping everything else on the map, and long story short this will make that possible. 


Now here's the real common event being turned on. 


comm pic 2.png


Here you check for the state and then act accordingly. In the situation above, every time I use a potion it makes my character move extremely slow for 10 seconds, then the effect is cancelled and the event is switched off. But you can have whatever effects you want! This is all for outside of battle, of course, there's no need to do anything special for battle because most of those things can be set from within the item's database page.


Please let me know if any of this doesn't make sense, or if it's brought on more questions. Or of course, if I have yet to answer the questions you've asked. 
Magnificent, you sir are a god send. Thank you.
Not a problem ^^ 
There is an option in the menu for "Control Timer" so isn't there some simple way it can be used to create a timer for items/skills? Just curious.


Edit: Well, I am still trying to get this to work. I have to say that RPG Maker is the most convoluted, unintuitive, ridiculous program to use I have ever seen. It's like learning an entire language for scripting. What is so humorous is the slogan about it "being easy enough for a child to use". I think my problem is that I keep trying to make sense of it and it doesn't really make sense in any conventional way. No matter what I do there will spring up another 10 problems that I have to face. Currently I am trying to add a timer to a "torch" created by Terrax Lighting plugin but it would/should be no different that adding a timer to anything else, except that one of the steps in the above explanation targets a specific character in the party (Haraold) and in my game I have a max party formation of 8... which honestly I have no idea whether or not that would affect anything but it is just giving me such a migraine that I would rather not add a timer to a torch at all. Lol...


Basically what I am trying to do is create a torch that when clicked on in the inventory will 1) check to see if a torch is lit then 2) if no light source is present it will light the torch (which will burn for 5 minutes then turn off) and 3) if a light source is present (torch is already burning) it will ask if the player wants to extinguish the torch. I had everything set up all except for the timer part.


/end rant


Either way, I appreciate the help. I will bookmark this page and come back to this later.
Well, I made the torch timer effect. Not positive how the lighting plugin you're using works, but I worked up a timer for you that should help. Just make the Torch item non-consumable and have it trigger the the common event on the right side. Then make another common event triggered (in parallel) by the light switch (No pun intended) as is shown in the left event. You can tweak this as needed, it was just a basic example. Hope that helps a little bit. If it's the actual lighting event command giving you issues, can't help ya there, sadly. (Edit: Another way to do the timer, if you don't know about it would be to setup a variable called 'seconds,'  then put that as +1 every 60 frames in loop. Put a conditional branch in there for when it reaches 300 to jump to a label placed outside of the loop. Then reset your seconds variable to 0 when you turn your light switch off.


torchtimer.png
this is a great thread. Thank you for the idea!
Thank you standardplayer!

I was trying to create a potion that increases player movement speed for a short time,
so your detailed example was especially useful. And it worked!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-a-timer-to-items-or-skills.60184/