Immunity from visible map encounters after battle

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,022
First Language
German
Primarily Uses
RMMV
Hello,


I am implementing on-map encounters using Yanfly's Event Chase Player plugin. The problem that I've run into is that if the player is being chased closely by two or more events and engaged into battle, then if the other enemy has already reached him as well, the player will be engaged into a battle immediately after the first one.


I'd like to get rid of that.


I've tried implementing a common event that is called upon after the battle using Shaz's Battle Result Switches that stops all event movements for a while (with Yanfly's Stop Map Movement plugin) and reenables them after a certain amount of frames.


However, if the enemy has already 'reached' the player beforehand (because it reached the player approximately at the same time as the first enemy), then he is engaged into battle immediately regardless.


I was wondering if there was a way to make the player immune to being engaged on after a battle. Do you have any suggestions on how to implement something like that?


Any kind of help is appreciated! :)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
You could have it so that when you win a battle, a switch is turned on, and for the other event, if that switch is on, do not run the battle processing. However, you'd need a way to turn off the switch after x time, and the only way I can think of is a parallel process that only runs when the switch is on, set to wait x frames, then turn off the switch.
 

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,022
First Language
German
Primarily Uses
RMMV
@bgillisp


Thank you very much! I tried it and it works! :D


Unfortunately, I have really terrible fps-drops when using this solution (dropping to 1~6 fps after a battle). I didn't think that a single parallel process would cause this much lag. I'm not sure whether this is connected to one of the plugins used or the way that the engine checks for the switches on events.


If someone knows of a more elegant solution (or the cause of those lagspikes), I'd be very happy to hear it :)
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Hmmm...if you have the wait set long enough it shouldn't matter. Maybe post your parallel process and your battle processing check so we can see them?
 

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,022
First Language
German
Primarily Uses
RMMV
02.jpg


This is the event that triggers after every battle. This will in turn trigger the following event:01.jpg


And here is the page for the on-map enemy:


03.jpg


The battle processing itself does not have any event pages.


Edit: Forgot the page for non-moving enemies:


04.jpg


Edit 2: I think I've found the solution. Apparently I messed up some of the enemies' pages and didn't remove their custom routes. I am dumb. Thank you so much for your help, @bgillisp! <3
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'd also move the StopMapMovement command (to turn the switch on) to the start of the common event rather than the end.  Because you've got it set to parallel process instead of autorun, it means events with commands could process while you're doing all those conditional branches and text, so it's still possible for one of the events to start their processing before you get to the command that pauses the events.  That's probably the main cause actually - you don't stop them soon enough.  
 
Last edited by a moderator:

Verdelite

Wannabe Developer
Veteran
Joined
May 22, 2016
Messages
138
Reaction score
1,022
First Language
German
Primarily Uses
RMMV
That makes sense! Thank you!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top