As the title says. I just wanna know if there's a way if we can run out of time by dawdling, resulting in a game over sequence, either by the life bar draining or by variables.
thank you!!
Is there a way we can add a draining timer?
Moderator: EN - Forum Moderators
Is there a way we can add a draining timer?
Live life as you enjoy it, pal!-
I guess not...
I guess not...
Re: Is there a way we can add a draining timer?
Not in real time (it might be possible with clever use of the get_date function, but that's some advanced stuff, and I don't know of any instance of anyone successfully doing that), but you can do it per frame advancement. After each frame you want the timer to drain, just have a variable that decreases in value. Then have another frame that checks if the variable has hit 0 or whatever you want the "run out of time" amount to be, and redirects you to the game over frame once it's hit.
To do this, what you'd do is set an action at the beginning of the timed sequence where you define a variable (let's call it timer) to something like 100 or however long you want the timer to be.
Then to decrease that variable, you'd define it again, enter the same variable name, turn on advanced mode (the checkbox in the corner), and under the "variable value" section, click the "Load from runtime expression" checkbox. Then erase any quotation marks from the field and make sure it just reads
, but replace "timer" with whatever you called the timer variable and 1 with however much you want it to decrease by.
Then you'd make a blank 1/100 second frame after that where you "evaluate conditions to redirect player" and if the variable is below however much you want it to be below, (something like this:) then go to whatever frame you want to go to when time runs out.
Actually displaying an in-game timer to go along with this would be a bit more complicated. You could probably do it by hiding and revealing various foreground objects, but it would be messy.
If you wanted to avoid the variables, you could also just drain life directly. That would have the benefit of also showing the life bar on screen as a representation of how much time is left, but then your timer and life bar wouldn't be independent.
To do this, what you'd do is set an action at the beginning of the timed sequence where you define a variable (let's call it timer) to something like 100 or however long you want the timer to be.
Then to decrease that variable, you'd define it again, enter the same variable name, turn on advanced mode (the checkbox in the corner), and under the "variable value" section, click the "Load from runtime expression" checkbox. Then erase any quotation marks from the field and make sure it just reads
Code: Select all
timer - 1
Then you'd make a blank 1/100 second frame after that where you "evaluate conditions to redirect player" and if the variable is below however much you want it to be below, (something like this:
Code: Select all
timer < 1
Actually displaying an in-game timer to go along with this would be a bit more complicated. You could probably do it by hiding and revealing various foreground objects, but it would be messy.
If you wanted to avoid the variables, you could also just drain life directly. That would have the benefit of also showing the life bar on screen as a representation of how much time is left, but then your timer and life bar wouldn't be independent.
Question Arcs (Threads Coming Eventually)
Gaiden Episodes
Champion of Turnabouts ★
HALLOWEEN HERO
Other
Phoenix Wright: Ace Attornauts
The Curious Case of the Phantom Limousine (Coming Eventually)
The Imposter's Turnabout (Coming Maybe)
Re: Is there a way we can add a draining timer?
GENIUS IDEA! thank you very much! I just never knew variables could do such a thing because I always refrained from touching the advanced mode xD. If it doesn't work for me, I can just always use the life bar as you said.TimeAxis wrote: ↑Fri May 28, 2021 5:27 am Not in real time (it might be possible with clever use of the get_date function, but that's some advanced stuff, and I don't know of any instance of anyone successfully doing that), but you can do it per frame advancement. After each frame you want the timer to drain, just have a variable that decreases in value. Then have another frame that checks if the variable has hit 0 or whatever you want the "run out of time" amount to be, and redirects you to the game over frame once it's hit.
To do this, what you'd do is set an action at the beginning of the timed sequence where you define a variable (let's call it timer) to something like 100 or however long you want the timer to be.
Then to decrease that variable, you'd define it again, enter the same variable name, turn on advanced mode (the checkbox in the corner), and under the "variable value" section, click the "Load from runtime expression" checkbox. Then erase any quotation marks from the field and make sure it just reads, but replace "timer" with whatever you called the timer variable and 1 with however much you want it to decrease by.Code: Select all
timer - 1
Then you'd make a blank 1/100 second frame after that where you "evaluate conditions to redirect player" and if the variable is below however much you want it to be below, (something like this:) then go to whatever frame you want to go to when time runs out.Code: Select all
timer < 1
Actually displaying an in-game timer to go along with this would be a bit more complicated. You could probably do it by hiding and revealing various foreground objects, but it would be messy.
If you wanted to avoid the variables, you could also just drain life directly. That would have the benefit of also showing the life bar on screen as a representation of how much time is left, but then your timer and life bar wouldn't be independent.
this will work greatly, thanks again for the info :3
Live life as you enjoy it, pal!-
I guess not...
I guess not...
- Enthalpy
- Community Manager
- Posts: 5172
- Joined: Wed Jan 04, 2012 4:40 am
- Gender: Male
- Spoken languages: English, limited Spanish
Re: Is there a way we can add a draining timer?
Yeah, timer settings like this are a job for variables. Feel free to ask if you run into any problems.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Re: Is there a way we can add a draining timer?
Thank you
Live life as you enjoy it, pal!-
I guess not...
I guess not...