Sorry. Electrical outage here left me with no connection for a couple of hours. Alarms are still going off. Not sure what's up with that.
You have vaguely described "life meter" or a "fuel meter" or a "somethings-left meter" that is meant to cause a block of code to restart, once the meter variable gets back to zero. Right? It's like you are trying to create a "do while" or "do until" loop. If that's the case, i often use a flag variable like an alarm to let different pieces of the code talk to each other. You can even have several places in the code where the flag can get "set" and use the state of the flag as your signal to either keep doing the repeatable action or to restart ot. If you do things that way, of course you want your restart code to clear that flag, first thing.
I think this is the key to your question, but it's still worded kinda tricky:
To start with, I can only guess that this is a question. There's no question mark. Second, the role of "q" is still kind of jello for me. At the beginning, you're talking about it as a variable, which makes perfect sense. In another part of the same sentence, though, ("value is first set to q"), you are speaking of "q" as if it's a specific numerical value. And, by the way, "the value" of what is "first set to q"? Even if I were to make an example of a "do while" or a "do until" loop, I can't be sure that it would do what you have in mind. I would be glad to try, but there's just not enough context.
Yes, I know, it can be a pain trying to explain things to people who can't see your code and who don't even know what the game is. Don't sweat it.