I need help figuring out what's wrong with this Common Event!
RPG Maker VXAce SupportYou've got a bit of a logic flaw in there. I'm guessing you want to do some stuff, then wait until the player takes 5 steps, then continue?
You set steps to 0, and then you immediately set steps to the number of steps taken in the game, which could be greater than 5 (and very most likely WILL be). In that case, you go into an endless loop.
You basically need two variables - one for the current number of steps, which you'll update each loop to see if the player has moved, and another one for the target number of steps, which you'll set to the current number + 5 before going into the loop. Then you just need to compare them to see if the total steps taken is 5 more than when the loop began. Also add a wait in there to actually allow the player to move.
This is what you want for that part:
You set steps to 0, and then you immediately set steps to the number of steps taken in the game, which could be greater than 5 (and very most likely WILL be). In that case, you go into an endless loop.
You basically need two variables - one for the current number of steps, which you'll update each loop to see if the player has moved, and another one for the target number of steps, which you'll set to the current number + 5 before going into the loop. Then you just need to compare them to see if the total steps taken is 5 more than when the loop began. Also add a wait in there to actually allow the player to move.
This is what you want for that part:
Code:
Control Variables: [Steps] = Game Data > Other > Steps
Control Variables: [Target Steps] = [Steps] + 5
Loop
Wait 5 Frames
Control Variables: [Steps] = Game Data > Other > Steps
Conditional Branch: [Steps] > [Target Steps]
Break
End
End
I'm grateful for the reply but... it doesn't seem to be working it still freezes. Just in case I misinterpreted here's what I put in.
Control Variables: [Steps] = Game Data > Other > Steps
Control Variables: [Target Steps] = Variable [Steps]
Control Variables: [Target Steps] += 5
Loop
Wait: 5 Frame(s)
Control Variables: [Steps] = Game Data > Other > Steps
Conditional Branch: [Steps] > [Target Steps]
Break Loop
Control Variables: [Steps] = Game Data > Other > Steps
Control Variables: [Target Steps] = Variable [Steps]
Control Variables: [Target Steps] += 5
Loop
Wait: 5 Frame(s)
Control Variables: [Steps] = Game Data > Other > Steps
Conditional Branch: [Steps] > [Target Steps]
Break Loop
can you post new screenshots?
Are you sure it's getting stuck here? That seems to be okay - at least it looks that way for me.
Can you post a screenshot of the event that calls this common event? I'm wondering if you're triggering an autorun somewhere else, as that would cause the game to freeze too.
Can you post a screenshot of the event that calls this common event? I'm wondering if you're triggering an autorun somewhere else, as that would cause the game to freeze too.
hmmm ... don't see anything wrong there either (I was expecting a Call Common Event command from another event).
Are you able to zip up your project and load it up to dropbox for me to take a look? Include a save file where that skill has been learned, if necessary, so I don't have to play through the game at all in order to reproduce the issue.
Are you able to zip up your project and load it up to dropbox for me to take a look? Include a save file where that skill has been learned, if necessary, so I don't have to play through the game at all in order to reproduce the issue.
Here's the link to the Dropbox: https://www.dropbox.com/s/fuhx8r5rklzicok/Chest%20Nut%20Hills.exe?dl=0
I made a new starting map just go to that weird statue thing you'll get everything you need.
I made a new starting map just go to that weird statue thing you'll get everything you need.
Why is it an exe? Did you compress it? I need to be able to open it in the editor to look at your maps/events.
OK I uploaded the whole folder. https://www.dropbox.com/sh/wsavuxes8am90vo/AAAzhFo5sFgYs9ASQvU_ajpYa?dl=0
alrigth - I went to the "weird statue thing" and it told me to come back later. Which map am I supposed to be on? I also can't see the Flight skill. What's its id?
The ID for flight is 023.
You should be able to use this on any map since it's not specific to one. And it's crashed on all the maps I've tried using it on. Also which map are you starting on I'm pretty sure I made a unique map for testing (Called ForShaz). But I think I now where you are. If you're in a town. That's the wrong map but you should be able to move your starting location.
You should be able to use this on any map since it's not specific to one. And it's crashed on all the maps I've tried using it on. Also which map are you starting on I'm pretty sure I made a unique map for testing (Called ForShaz). But I think I now where you are. If you're in a town. That's the wrong map but you should be able to move your starting location.
The starting map is called Coaojfkb. There is no map called ForShaz in the project you sent me.
edit: Found it. The map is called Copy and Paste, and the item I need to interact with is a wooden box, not a 'weird statue thing'.
edit 2:
Okay, I'm able to reproduce the problem easily. Finding the cause is proving a bit difficult. I've ascertained that it's not caused by any of your additional scripts (though I haven't checked the RTP scripts to see if you've made any changes to any of them - have you?) It's not another event on the map that's causing it, and there are no common events set to autorun that are active at this time.
A bit stumped atm, but still looking.
edit 3:
Got it. It seems to be related to having the whole lot in a single common event that's not set to parallel process. It seems to be waiting for the common event to end, before the player regains control of the character. It's either not registering the key presses despite the wait, or just not moving the player. I WAS able to open up the debug console though, so that kind of indicates key presses ARE being processed. To solve it,
1. create a new common event, and make it turn on a switch.
2. Then go back to your existing common event, set it to parallel process, and use that switch as the condition.
3. At the very end of the common event, turn that switch off.
4. Now go to your skill and change the common event attached to the skill to the new one.
Once the common event is running as a parallel process, it all works. I also tried splitting it up over 3 common events, putting the stuff in the loop in the middle one and removing the loop (letting the parallel process common event do the looping for me). This worked too, but the above is probably easier.
edit: Found it. The map is called Copy and Paste, and the item I need to interact with is a wooden box, not a 'weird statue thing'.
edit 2:
Okay, I'm able to reproduce the problem easily. Finding the cause is proving a bit difficult. I've ascertained that it's not caused by any of your additional scripts (though I haven't checked the RTP scripts to see if you've made any changes to any of them - have you?) It's not another event on the map that's causing it, and there are no common events set to autorun that are active at this time.
A bit stumped atm, but still looking.
edit 3:
Got it. It seems to be related to having the whole lot in a single common event that's not set to parallel process. It seems to be waiting for the common event to end, before the player regains control of the character. It's either not registering the key presses despite the wait, or just not moving the player. I WAS able to open up the debug console though, so that kind of indicates key presses ARE being processed. To solve it,
1. create a new common event, and make it turn on a switch.
2. Then go back to your existing common event, set it to parallel process, and use that switch as the condition.
3. At the very end of the common event, turn that switch off.
4. Now go to your skill and change the common event attached to the skill to the new one.
Once the common event is running as a parallel process, it all works. I also tried splitting it up over 3 common events, putting the stuff in the loop in the middle one and removing the loop (letting the parallel process common event do the looping for me). This worked too, but the above is probably easier.
Thank you so much it works now! 😀 Thank you!
Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-figuring-out-whats-wrong-with-this-common-event.65530/



