Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Loop Error - Need Assistance

cmmc11

Member

I have been working with RMXP for only about two months now.
Suffice it to say, I am overly pleased with the creator as a whole.
I started creating a game about three days ago called "Heart of Chaos".
It opens with a cutscene on a bridge during a thunderstorm.
There in lies my problem.
I have set a loop up for thunder sounds.
It works great but when I put it in my event command and playtest, it screws the game up by cancelling any command that is after it.

Here is my loop:

@< Loop
@< Controls Variables [001: Thunderstorm] = Random No. (1..3)
@< Conditional Branch [001: Thunderstorm] == 1
@< Screen Flash (255,255,255,255), @40
@< Play SE '061-Thunderclap01', 80, 100
@< Wait: 40 frame(s)
@<
: Branch End
@< Conditional Branch [001: Thunderstorm] == 2
@< Screen Flash (255,255,255,255), @10
@< Play SE '124-Thunder02', 80, 100
@< Wait: 30 frame(s)
@<
: Branch End
@< Conditional Branch [001: Thunderstorm] == 3
@< Screen Flash (255,255,255,255), @15
@< Play SE '125-Thunder03', 80, 100
@< Wait: 35 frame(s)
@<
: Branch End
@<
: Repeat Above
 

poccil

Sponsor

Events like lightning are best done as parallel process events.  Select "Parallel Process" under "Trigger" in the event's dialog box.  Then you can eliminate the "Loop ... Repeat above" within that event.
 
Parallel Processing basically processes the code every frame.
So if you set up a list of code, the commands will happen over and over again, essentially "looping."

Keeping this in mind, all you have to do is make sounds and flashes for the thunderstorm, and then use the "Wait" command for however many frames you want in between each flash.
 

cmmc11

Member

I switched up my events to what you suggested.
I put all of my event codes in the first pane and then put the thunderstorm in the second pane.
It repeats correctly the way you said, repeating with put on parallel process.
However...when I do this, none of the events on the first pane work at all.
What am I doing wrong here?
 
Okay, first of all, what you originally described with your loop works good in itself, but the reason none of the events placed after it are executing, is because they are never being reached, because of the flow of the code. Since it LOOPS, it keeps performing the code in your loop over and over, and doesn't exit that loop, thus it does not reach the code below it.

Here's what you should really do, though. Like the other people stated, create an invisible event which is a Parallel Process, and place your "thunder" code in there (without the loop part...it will loop anyways if it is a parallel process). For your cutscene events, create a NEW event (not a new page in the thunder event, a NEW event), and put your cutscene events in there. This new event should be Autostart (all cutscenes should be Autostart).

That's the general rule of thumb. Use an Autostart event for your main cutscene events, and use Parallel Process events for things that happen in the background that are "parallel" to the main events.

Hope this helps.
 

cmmc11

Member

@ImmuneEntity - Thank you very much, that fixed it wonderfully.
There's is one slight error now though.
The cutscene is supposed to be black fading into the scene.
It does this, but not before flashing a 1 second shot of the scene.
 
Autoruns don't start processing until the map shows, while Parallel Process events begin before the map finishes loading. Because of this reason, if you want to make the player invisible, change some event positions, or use a screen tint, you have to use Parallel Processing, otherwise there will be a 1-frame wait.

What I would do is use Parallel Processing, fade into the scene, then turn on a self-switch.
Now create a new page, with the Conditions the self-switch is on. Make this an Autorun event, and have whatever you want in the cutscene here.
 
Are you going right from the Title screen to Black, then to your opening cutscene?

If so, I would create a new (empty) map for the starting map. Set your main char to 'None' for the graphic (or remove the party members on the System tab in the database).
Use the "Prepare for transition" command to freeze the graphics (black)
Then transfer the player to your starting map (now the 2nd map), change graphic or add the party member, then "Execute Transition" to fade from black to your starting scene.

You can use the "Fading" function in 'Transfer Player' as your transition, or set Fading to 'Off' & use another transition.

I think that's the simplest solution without scripting. 

Be Well

[ edit ] I see Reg beat me to it. Try his idea first. But I figured this is still useful, so I posted it anyways...
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top