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,764
Reaction score
2,114
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

Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.
E_6fAErVkAQILXu.png
I'm so close to releasing my game on steam! :blush::blush::blush:
Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the Modern British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.

Forum statistics

Threads
115,287
Messages
1,088,668
Members
149,918
Latest member
BlakeVit
Top