RMMV Trying to stop map movement of events with chase player on.

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
243
Reaction score
121
First Language
English
Primarily Uses
Alright, so I have on map encounters with both of my games. Now, when a player escapes, I wanted to give them a grace period where they can't be bumped into an encounter again. I also wanted to make it so that opening a chest or watching a cutscene after avoiding following encounters doesn't create a massive queue behind the player. I figured this plugin was perfect:
Just hit stopmapmovement and events stop... But....

The problem is that some of these on map encounters use this plugin to chase the player when they're spotted:
And any event that's in range of the player (screen and a half distance-ish) doesn't stop their player-spotting routines, and if they're already alerted they'll continue to follow the player regardless of stop map movement.

However, this does work:
When a player is put into stealth, events stop following them. This is fine for escaping, since my original escape event had the player turn semi-transparent anyway, but for cutscenes turning transparent doesn't work. There are script calls that turn off the gauge, and the change in speed, but not the transparency.

TL;DR: Is there a way to call event commands from event chase stealth to get the effect of breaking all events on map chasing the player without the opacity change?

I've been looking through the plug-in's javascript and tried this section out:
Code:
Game_Event.prototype.stealthClearChaseSettings = function() {
    if (this._chasePlayer) this.endEventChase();
    if (this._fleePlayer) this.endEventFlee();
    this._alertLock = 0;
    this._alertPlayer = false;
};
By calling it as Game_Event.prototype.stealthClearChaseSettings()
It didn't return an error in the console, but it also didn't do anything. I'm at a bit of a loss.

Edit:
Also you've got:
Code:
Game_CharacterBase.prototype.opacity = function() {
  var opacity = Yanfly.ECS.Game_CharacterBase_opacity.call(this);
  if (this.isStealthMode()) opacity *= this.stealthTransparencyRate();
  return opacity;
};
Which seems to be the function that sets the player's opacity based on the plug-in settings. I wonder if I can't splice in a conditional that requires a switch to be on for the opacity to apply...
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,768
Reaction score
2,118
First Language
EN
Primarily Uses
RMMZ
First, check whether your Yanfly plugins are loading in the recommended order, listed here:
Notably, Stop Map Movement should load after the Event Chase plugin(s). You can click+drag to rearrange plugins in the Plugin Manager. Remember to save your project to apply Plugin Manager changes before testing.

If that doesn't fix it, you could try putting the following in a Script command:
JavaScript:
$gameMap.events().forEach(function(e) { e.stealthClearChaseSettings(); });
I.e. "for all events on the map, clear their chase settings". I think this will make all events on the map leave "alert mode", which might be overkill if you just want them to stop where they are for a while.

In case it helps: I have an RMMV plugin that can make map events visually freeze and/or have their triggers disabled when a specific switch in on. Link:
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
243
Reaction score
121
First Language
English
Primarily Uses
@caethyril Yeah, I make absolutely sure that plugins are in the right order, so it's not that (though I did try changing the positions of the plugins that are involved a few times just to make sure). Also, googling makes it clear that stopmapevents has no effect on event chase player, go figure.

Anyway, thanks for the code you gave me, it... half-works? When the script runs any events chasing the player go back to their original positions and stop chasing the player, but if the player is in their line of sight when it runs they get alerted again.

I'm thinking I'll try to edit the plugin:
I'm gonna try changing:

Game_CharacterBase.prototype.opacity = function() {
var opacity = Yanfly.ECS.Game_CharacterBase_opacity.call(this);
if (this.isStealthMode()) opacity *= this.stealthTransparencyRate();
return opacity;
};

to
Game_CharacterBase.prototype.opacity = function() {
var opacity = Yanfly.ECS.Game_CharacterBase_opacity.call(this);
if ($gameSwitches.value(x) == true)
{
if (this.isStealthMode()) opacity *= this.stealthTransparencyRate();
}
return opacity;
};

If that doesn't work, I'll take a look at your plugin, thanks.\

Edit:
It's ham-fisted, but the above works
 
Last edited:

Latest Threads

Latest Profile Posts

Still alive! Totally did not finish in time for the Jam (boy that's late) but tl;dr of the last half a year is Work term -> Covid Lockdown -> Sick... again -> Full time Employment. Game stuff has been on hiatus but got a new graphics tablet so hopefully updates again soon. =D
Going on hiatus. Won't be back until mid October.:LZSoops:
Just read the English lyrics for Despacito. Ramen aint innocent no more! :kaodes:
Well today was blown away with nothing to show for it. I made a new character to my game who I was going to have a protection mechanic where he protects my main character randomly unless it's a critical, and no matter what, to check if an attack received will be critical, means checking the apply method. This means rewriting the entire method and I refused to do that.

Forum statistics

Threads
115,316
Messages
1,088,884
Members
149,961
Latest member
MrSunshine
Top