Any way to make the Wait command use a Variable? [Solved]

Nimbus

Veteran
Veteran
Joined
Jun 30, 2014
Messages
56
Reaction score
12
First Language
English
Primarily Uses
I'm making a timing-based baseball minigame. I have a common event loop that cycles through all of the hits you can get (single, double, out, etc) and it stops on the current result when you hit enter. I have it set up to use different wait times for each result so that certain outcomes are harder to get (for example, Out waits for 15 frames while Home Run only appears for 5 frames).

I was hoping to add an extra layer of complexity by giving each batter different stats. If you have a guy who is better at hitting home runs, then while he's batting the Wait command should wait longer on the Home Run space and make it more likely for you to end up with that outcome. I could come up with some kind of formula to calculate the exact wait time for each result, but since Wait only lets you input a number, I'm not sure how I would go about applying that variable.

Does anyone have any ideas on the best way to tell the Wait command to use a variable as its number? Right now my best solution is having a separate conditional branch for each batter (if Batter A switch is on, wait for 5 frames, if Batter B switch is on, wait for 10 frames, etc) For two teams of 9 players though, that would make a TON of conditional branches, especially if I wanted to later incorporate the pitcher's stats into the equation as well. There's gotta be a better way to do it... right?
 
Last edited by a moderator:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,546
Reaction score
3,717
First Language
Java's Crypt
Primarily Uses
RMMZ
Script call:

$gameMap._interpreter.wait($gameVariables.value(15));
Replace 15 by the number of the variable you want.
 

McTone

This Guy
Veteran
Joined
May 15, 2013
Messages
203
Reaction score
34
First Language
English
Primarily Uses
Maybe you can sort of do this in reverse. Have  an event that checks the variable stat and use a few conditional branches to set the wait time. 

Would look like this:

Control Branch: Variable [variable linked to stat] == X

>Wait: 5 frames

Control Branch: Variable [variable linked to stat] == X2

>Wait: 10 frames

Like that? Or does that not do what you want?
 

Nimbus

Veteran
Veteran
Joined
Jun 30, 2014
Messages
56
Reaction score
12
First Language
English
Primarily Uses
Script call:

$gameMap._interpreter.wait($gameVariables.value(15));Replace 15 by the number of the variable you want.
Whoa, I had no idea this command existed. As hard as I try, I guess I can never break free of that rpgm2k3 mentality. :p

But this is exactly what I needed. Thank you so much!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,539
Members
137,834
Latest member
EverNoir
Top