How to Loop Something a Specific Amount of Times?

Status
Not open for further replies.

iskillzi

Veteran
Veteran
Joined
Jul 17, 2014
Messages
33
Reaction score
2
First Language
English
Primarily Uses
Hello, I tried looking at a couple guides for loops and how they work but it confused me a bit because I'm trying to loop something for example 3 times then the loop breaks, the guides only showed how to do it an endless amount of times..

So can someone clear up how to loop a specific amount of times and then break that loop?

Also if it helps the loop will be for a move route to loop 3x.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You set a variable to 0 before the loop, then just before the Repeat Above, you add 1 to the variable, then do a Conditional Branch - if the variable is 3 or more, Break Loop.
 

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
Hello, I tried looking at a couple guides for loops and how they work but it confused me a bit because I'm trying to loop something for example 3 times then the loop breaks, the guides only showed how to do it an endless amount of times..

So can someone clear up how to loop a specific amount of times and then break that loop?

Also if it helps the loop will be for a move route to loop 3x.
This is pretty simple, once you know how its done.

At the end of your evet commond string, make a variable add +1, then make a condition branch, if variable = 3(erase event, turn on switch, however you want it to be, if It's a one time event, use a switch/add a 2nd page to require switch on, if you want the event to happen every time you enter map, in the condition branch, set variable at 0/erase event).

To shaz, you don't set the variable at 0, there's no need, variables are 0 by default.
 
Last edited by a moderator:

iskillzi

Veteran
Veteran
Joined
Jul 17, 2014
Messages
33
Reaction score
2
First Language
English
Primarily Uses
Well, that was an extremely easy fix, thanks. :D
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
To shaz, you don't set the variable at 0, there's no need, variables are 0 by default.
I know that :) My reply is based on the assumption that you might have used it for something else (I have a few "generic" variables that I use for many things, when I just need to calculate and use it within the same event), or might want to run this several times. If in doubt, it's ALWAYS best to set the initial value.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top