DoctorLoops

Villager
Member
Joined
Sep 14, 2022
Messages
11
Reaction score
13
First Language
English
Primarily Uses
RMMV
I have an enemy that patrols through a hallway by setting their Automatic Movement to Custom: Route > "Move Up, Left, etc". If they bump into the player, it triggers Battle Processing and they fight. However, if the player Escapes, the enemy immediately resumes it's patrol route and can bump into the player again right away, triggering the fight again. I tried fixing this by making the enemy wait for 60 frames before resuming it's route (by going to Battle Processing > "Can Escape" and then adding Movement Command: Wait 60 to the "If Escape" part of the event.

The problem is that making the enemy Wait in this manner messes up their patrol! When the 60 frames pass, the enemy resumes it's patrol, but skips whichever command was next before combat started.

For example, let's say an enemy's Custom: Route is set to:
- Move up
- Move up
- Move down
- Move down

If you collide with the enemy after the first Move Up and then Escape, the enemies next movement will be Move Down, skipping the second Move Up. Is there a way to fix this? Or alternatively, is there a better way to handle Player Escape so that the enemy can't immediately collide with the Player again if they're set to a specific patrol route?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,586
Reaction score
11,050
First Language
English
Primarily Uses
RMMV
Do you specifically want your enemies to work that way? In most games I've played that have on-map encounters, the enemy is taken off the map entirely after the battle, whether or not I won.

Others have the period of you being flashy invulnerable, and you could replicate that by starting a timer (or using a variable) and including in your enemy events "if timer > 0 end event".

But I think just taking them away would work and fit general expectations.
 

DoctorLoops

Villager
Member
Joined
Sep 14, 2022
Messages
11
Reaction score
13
First Language
English
Primarily Uses
RMMV
If I can't find an alternate way to resolve this, I suppose I could use that method. It's just always seemed weird to me that the enemy would straight-up disappear after escaping a fight with them when it's just the two of you in a room. Like, where do they go? They weren't killed, so it seems fitting that they'd continue to chase you or resume their patrol.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,244
Reaction score
4,703
First Language
EN
Primarily Uses
RMMZ
Yes, that's a bug in RMMV's core scripts. You can patch it with a small plugin like this (there may be a more elegant approach):
JavaScript:
void (function(alias) {
	Game_Character.prototype.restoreMoveRoute = function() {
		alias.apply(this, arguments);
		this._moveRouteIndex--;
	};
})(Game_Character.prototype.restoreMoveRoute);
Or here's a ready-made version I wrote a while ago:
(This bug has been fixed in MZ as of v1.2.1: link to bug report.)
 

DoctorLoops

Villager
Member
Joined
Sep 14, 2022
Messages
11
Reaction score
13
First Language
English
Primarily Uses
RMMV
Yes, that's a bug in RMMV's core scripts. You can patch it with a small plugin like this (there may be a more elegant approach):
JavaScript:
void (function(alias) {
    Game_Character.prototype.restoreMoveRoute = function() {
        alias.apply(this, arguments);
        this._moveRouteIndex--;
    };
})(Game_Character.prototype.restoreMoveRoute);
Or here's a ready-made version I wrote a while ago:
(This bug has been fixed in MZ as of v1.2.1: link to bug report.)
Aaaa, perfect! :) It works like a charm. Thanks so much!
 

Latest Threads

Latest Profile Posts

I've been thinking about doing a jokey submission for the Christmas jam in which, like a cartoon special where all the characters "play" a counterpart in A Christmas Carol, my MagiCats would each play a role from the C.A. Smith story The Coming of the White Worm, with Cyprian as Evagh, Rousalie as Dooni and so forth. But in the end, I figure all my development efforts should go toward the game proper.
In twitter, square phoenix had successfully prompted chatgpt to make the mini game watermelon pangpang.

drew some stuff to see how frontview might look. not entirely sold on or off of it yet. "could" work, but something feels missing.
Shower Thoughts: ". . . Scammers would be OP in the Elder Scrolls. They could just get speech 100 and blatantly ask everyone for all of their money, and everyone would think it's a great investment. And then after being robbed blind, they'd say, with a smile on their face, 'need something?' "
Day #2 for advent is compiled. Please, go to their threads to share love! But, if you wanna talk to me…what’s your favorite Christmas carol or holiday song?

Forum statistics

Threads
136,694
Messages
1,268,854
Members
180,407
Latest member
noiks
Top