Sure, I can be specific!
So, with KC Mirror 1.4.2 for MV and Galv CharacterFrames for MV:
When KC Mirror was above it was not creating reflections. (I know this is expected)
When KC Mirror was below Galv character frame, the game crashed at startup returning:
RangeError: Maximum call stack size exceeded at Function.keys (<anonymous>)
Turning KC mirror or Galv Character Frames OFF was resolving the crash issue.
In the header, I have noticed the MZ mention, eventhough this was in the MV plugin:
@Author K. Chavez * @url
https://github.com/kchavezdev/RPGMP_Mirrors
* @target MV * @orderAfter PluginCommonBase
* @orderAfter GALV_DiagonalMovementMZ
* @orderAfter GALV_CharacterFramesMZ
* @orderAfter GALV_EventSpawnerMZ *
* @plugindesc [v1.4.2]Add reflections to events and actors.
(as in GALV_CharacterFramesMZ)
I guess Galv plugins must be a little different in both versions. I have never touched MZ so I am not sure.
Basically I have replaced:
Spoiler: Original
JavaScript:
if (Imported.Galv_CharacterFrames) {
KCDev.Mirrors.Sprite_Reflect_initMembers_GalvCF = KCDev.Mirrors.Sprite_Reflect.prototype.initMembers;
KCDev.Mirrors.Sprite_Reflect.prototype.initMembers = function () {
KCDev.Mirrors.Sprite_Reflect_initMembers_GalvCF.apply(this, arguments);
this._cframes = 3;
};
KCDev.Mirrors.Sprite_Reflect_refreshGraphic_GalvCF = KCDev.Mirrors.Sprite_Reflect.prototype.refreshGraphic;
KCDev.Mirrors.Sprite_Reflect.prototype.refreshGraphic = function () {
KCDev.Mirrors.Sprite_Reflect_refreshGraphic_GalvCF.apply(this, arguments);
const cf = this._characterName.match(Galv.CF.regex || /%\((\d+)\)/);
if (cf) {
this._cframes = Number(cf[1]);
}
else {
this._cframes = 3;
}
};
KCDev.Mirrors.setReflectFrame_GalvCF = KCDev.Mirrors.setReflectFrame;
/**
* @param {KCDev.Mirrors.Sprite_Reflect} r
*/
KCDev.Mirrors.setReflectFrame = function (r) {
// store character values
const tmpCFrames = r._character._cframes;
// write reflection values
r._character._cframes = r._cframes;
KCDev.Mirrors.setReflectFrame_GalvCF.apply(this, arguments);
// restore original character values
r._character._cframes = tmpCFrames;
};
// hacky speedup
// basically, hitting "load game" to a map with many reflections chugs otherwise on MZ
// this seems to be related to property access times?
// not entirely sure, but this fixes the slow down and shouldn't conflict with other plugins?
if (!JsonEx._cleanMetaData) {
// ported from MV
JsonEx._cleanMetadata = function (object) {
if (!object) return;
delete object['@'];
if (typeof object === 'object') {
Object.keys(object).forEach(function (key) {
var value = object[key];
if (typeof value === 'object') {
JsonEx._cleanMetadata(value);
}
});
}
};
KCDev.Mirrors.JsonEx_parse = JsonEx.parse;
JsonEx.parse = function (s) {
const obj = KCDev.Mirrors.JsonEx_parse.apply(this, arguments);
JsonEx._cleanMetadata(obj)
return obj;
};
}
}
if (Imported.Galv_DiagonalMovement && Galv.DM.diagGraphic) {
KCDev.Mirrors.setReflectFrame_GalvDM = KCDev.Mirrors.setReflectFrame;
/**
* @param {KCDev.Mirrors.Sprite_Reflect} r
*/
KCDev.Mirrors.setReflectFrame = function (r) {
const tmpDiagDir = r._character._diagDir;
if (r._isReflectionWall && tmpDiagDir) r._character._diagDir = r._character.reverseDir(tmpDiagDir);
KCDev.Mirrors.setReflectFrame_GalvDM.apply(this, arguments);
r._character._diagDir = tmpDiagDir;
};
}
if (Imported.Galv_EventSpawner) {
KCDev.Mirrors.Spriteset_Map_unspawnEvent = Spriteset_Map.prototype.unspawnEvent;
Spriteset_Map.prototype.unspawnEvent = function (eventId) {
for (let i = 0; i < this._characterSprites.length; i++) {
const sprite = this._characterSprites[i];
if (sprite._reflectionFloor) {
const char = sprite._character;
if (char.isSpawnEvent && char._eventId === eventId) {
this._tilemap.removeChild(sprite._reflectionFloor);
this._tilemap.removeChild(sprite._reflectionWall);
}
}
}
KCDev.Mirrors.Spriteset_Map_unspawnEvent.apply(this, arguments);
};
KCDev.Mirrors.Spriteset_Map_clearSpawnedEvents = Spriteset_Map.prototype.clearSpawnedEvents;
Spriteset_Map.prototype.clearSpawnedEvents = function (clearSaved) {
for (let i = 0; i < this._characterSprites.length; i++) {
const sprite = this._characterSprites[i];
if (sprite._reflectionFloor) {
const char = sprite._character;
if (char.isSpawnEvent && (clearSaved || !char.isSavedEvent)) {
this._tilemap.removeChild(sprite._reflectionFloor);
this._tilemap.removeChild(sprite._reflectionWall);
}
}
}
KCDev.Mirrors.Spriteset_Map_clearSpawnedEvents.apply(this, arguments);
};
With:
Spoiler: EDITED
JavaScript:
if (Imported.Galv_CharacterFrames) {
// Initialize members for Sprite_Reflect
KCDev.Mirrors.Sprite_Reflect_initMembers_GalvCF = KCDev.Mirrors.Sprite_Reflect.prototype.initMembers;
KCDev.Mirrors.Sprite_Reflect.prototype.initMembers = function () {
KCDev.Mirrors.Sprite_Reflect_initMembers_GalvCF.apply(this, arguments);
this._cframes = 3;
};
// Refresh graphic for Sprite_Reflect
KCDev.Mirrors.Sprite_Reflect_refreshGraphic_GalvCF = KCDev.Mirrors.Sprite_Reflect.prototype.refreshGraphic;
KCDev.Mirrors.Sprite_Reflect.prototype.refreshGraphic = function () {
KCDev.Mirrors.Sprite_Reflect_refreshGraphic_GalvCF.apply(this, arguments);
const cf = this._characterName.match(/\%\((\d+)\)/);
if (cf) {
this._cframes = Number(cf[1]);
} else {
this._cframes = 3;
}
};
// Set reflect frame for Sprite_Reflect
KCDev.Mirrors.setReflectFrame_GalvCF = KCDev.Mirrors.setReflectFrame;
KCDev.Mirrors.setReflectFrame = function (r) {
// Store character values
const tmpCFrames = r._character._cframes;
// Write reflection values
r._character._cframes = r._cframes;
KCDev.Mirrors.setReflectFrame_GalvCF.apply(this, arguments);
// Restore original character values
r._character._cframes = tmpCFrames;
};
// Override patternWidth for Sprite_Reflect
KCDev.Mirrors.Sprite_Reflect_patternWidth_GalvCF = KCDev.Mirrors.Sprite_Reflect.prototype.patternWidth;
KCDev.Mirrors.Sprite_Reflect.prototype.patternWidth = function () {
if (this._tileId > 0) {
return $gameMap.tileWidth();
} else if (this._isBigCharacter) {
return this.bitmap.width / this._cframes;
} else {
return this.bitmap.width / (this._cframes * 4);
}
};
// Override updatePattern for Sprite_Reflect
KCDev.Mirrors.Sprite_Reflect_updatePattern_GalvCF = KCDev.Mirrors.Sprite_Reflect.prototype.updatePattern;
KCDev.Mirrors.Sprite_Reflect.prototype.updatePattern = function () {
if (!this.hasStepAnime() && this._stopCount > 0) {
this.resetPattern();
} else {
this._pattern = (this._pattern + 1) % (this._cframes + this._spattern);
}
};
}
if (Imported.Galv_DiagonalMovement && Galv.DM.diagGraphic) {
KCDev.Mirrors.setReflectFrame_GalvDM = KCDev.Mirrors.setReflectFrame;
/**
* @param {KCDev.Mirrors.Sprite_Reflect} r
*/
KCDev.Mirrors.setReflectFrame = function (r) {
const tmpDiagDir = r._character._diagDir;
if (r._isReflectionWall && tmpDiagDir) r._character._diagDir = r._character.reverseDir(tmpDiagDir);
KCDev.Mirrors.setReflectFrame_GalvDM.apply(this, arguments);
r._character._diagDir = tmpDiagDir;
};
}
if (Imported.Galv_EventSpawner) {
KCDev.Mirrors.Spriteset_Map_unspawnEvent = Spriteset_Map.prototype.unspawnEvent;
Spriteset_Map.prototype.unspawnEvent = function (eventId) {
for (let i = 0; i < this._characterSprites.length; i++) {
const sprite = this._characterSprites[i];
if (sprite._reflectionFloor) {
const char = sprite._character;
if (char.isSpawnEvent && char._eventId === eventId) {
this._tilemap.removeChild(sprite._reflectionFloor);
this._tilemap.removeChild(sprite._reflectionWall);
}
}
}
KCDev.Mirrors.Spriteset_Map_unspawnEvent.apply(this, arguments);
};
KCDev.Mirrors.Spriteset_Map_clearSpawnedEvents = Spriteset_Map.prototype.clearSpawnedEvents;
Spriteset_Map.prototype.clearSpawnedEvents = function (clearSaved) {
for (let i = 0; i < this._characterSprites.length; i++) {
const sprite = this._characterSprites[i];
if (sprite._reflectionFloor) {
const char = sprite._character;
if (char.isSpawnEvent && (clearSaved || !char.isSavedEvent)) {
this._tilemap.removeChild(sprite._reflectionFloor);
this._tilemap.removeChild(sprite._reflectionWall);
}
}
}
KCDev.Mirrors.Spriteset_Map_clearSpawnedEvents.apply(this, arguments);
};
That has worked for me.