MV {RESOLVED} LadyBakerville's Enemy Positions plugin is not functioning correctly

Original forum post containing the plugin.

I've been trying to get this plugin to work, but no matter what tags I use or plugin parameters I set, there's no change in enemy positions on the battle screen.

Game resolution is set to 1459x1080.
I've tried tagging enemies with <UseDefaultXPos> and <UseDefaultXPos>, and have tried setting the parameter Use Default Placement to true. Even with default placement formula of '0', enemies do not shift from the settings in the troops menu. With enemies tagged with <XPosEval: 0> and <YPosEval: 0> still don't shift from their troop settings.

I have tried moving the plugin order from first to last.

Here's a screenshot of my plugin setup.

plugins.png


I'd be happy to provide more info if needed. Any help would be appreciated.
First off, the plugin isn't "not functioning correctly"; as a matter of fact I have just tested and confirmed that it does indeed work as intended. It is most likely either user error or plugin conflict, and in the case of the latter you can check it by turning off/on your other plugins until you find which one is causing the issue.

If you still can't find what is causing the issue, please post screenshots of your plugin parameters and enemy notetags, as well as explain in more detail what you are trying to achieve / what actually happens. Also, press F8 to bring up the console and check if there are any error messages.
please try the test with yanfly's battle engine disabled (start new playtest).

yanfly implemented its own way to handle enemy positions on screen changes, and that is likely interfering.
you might also try to place the enemy position plugin below yanfly's battle engine to give that priority, but that doesn't always work.
as far I can read the code quickly, EnemyPlacement should be BELOW
YEP_BattleEngineCore to function correctly though and not ABOVE it.

party manager is also wiser to set below the BattleEngineCore as it
is more battle related.

if you categorize the plugins better, it should work.
This post is invalidated by the post below. Seems either there's an error in the plugin code or something fouled up when I downloaded the plugin or somesuch. I'll leave this post here for reference only, unless the moderators demand that I remove it.

Perhaps I'm having a problem understanding what this plugin should be doing. What I expect is to be able to enter a formula that will specify the positions that the enemy sprites should be rendered to the battle scene. What I am experiencing is.. nothing. At all.

I moved the plugin to a clean test environment with no other plugins installed or enabled except the community basic plugin (with only the expended resolution enabled) and the enemy positions plugin.

Here are the current plugins.
plugins1.png


Here are the current settings.
pluginsettings.png


Here are the enemy settings.
enemysettings.png


Here is the resulting battle scene.
battlescene.png


(Sorry about the reduced image size, the sever choked on the full sized image for some reason.) Anyway, I'm not sure what I might be doing wrong. So far as I can tell I should be able to input a position as an integer and see the enemy sprites rendered in that position... right?

Am I just misunderstanding something vital about the functioning of this plugin?
Ok, I test ran the game, enetered the battle scene, and opened the console and found this:

js/plugins/EnemyPlacement.js:114 Uncaught SyntaxError: Unexpected identifier

Which I find odd as line 114 of the plugin is the end of the file... Sadly that's about the extent of my javascript know-how, the rest of the file looks like ants running across the screen to me.

here's a copy-paste of the contents of the plugin that I downloaded. Could I ask someone more experienced to please help debug it?

Spoiler: The plugin code
JavaScript:
/*:
 * @plugindesc v1.0.1 Lets you place enemy battlers using a semi-dynamic formula.
 * @author LadyBaskerville
 *
 * @param Use Default Placement
 * @desc If true, all enemies with no notetags will be placed at the default position specified in the parameters below.
 * @type boolean
 * @default false
 *
 * @param Default X Position
 * @desc X position if no notetag is present. Default: 16 + (troopSize + 2) * 32 - index * 32
 * @default 16 + (troopSize + 2) * 32 - index * 32
 *
 * @param Default Y Position
 * @desc Y position if no notetag is present. Default: screenHeight - statusHeight - troopSize * 48 + (index+1) * 48 - 32
 * @default screenHeight - statusHeight - troopSize * 48 + (index+1) * 48 - 32
 *
 * @help
 * EnemyPlacement.js
 * Version 1.0.1
 *
 * Use the following notetags in the enemy notebox:
 *
 * <XPosEval: [expression]> and <YPosEval: [expression]>
 * to place the enemy graphic at the X/Y position to which the Javascript line
 * [expression] evaluates. You can also use pure numbers.
 *
 * <UseDefaultXPos> and <UseDefaultYPos>
 * to place the enemy graphic at the default position specified
 * in this plugin's parameters.
 *
 * The plugin parameters allow you to set default formulas for the X and Y
 * positions. Set the parameter "Use Default Placement" to true if all
 * enemies without their own <X/YPosEval> notetags should use these default
 * values. You can also keep "Use Default Placement" set to false and use
 * the <UseDefaultX/YPos> notetags for each enemy that should be placed
 * at the default position.
 *
 * You can use the following variables as part of [expression]:
 * screenWidth - the width of the game window in pixels
 * screenHeight - the height of the game window in pixels
 * troopSize - the number of enemies in the troop
 * index - the index of the enemy within the troop
 * statusHeight - the height of the status window
 * (If you know what you are doing, you can also use:
 *  this - the Game_Troop object
 *  e - the Game_Enemy object)
 * For reference, the default X/Y positions in the parameters are:
 * X: 16 + (troopSize + 2) * 32 - index * 32
 * Y: screenHeight - statusHeight - troopSize * 48 + (index+1) * 48 - 32
 *
 * Changelog:
 * Version 1.0.1
 * - Fixed a mistake in the calculation of statusHeight.
 * Version 1.0.0
 * - Finished the plugin.
 *
 * Free for use in both non-commercial and commercial games.
 * No credit required.
 * Edits and reposts allowed.
 */

(function() {

var baseStatusHeight = 4;

// Compatability
if (typeof Imported !== 'undefined' && Imported.YEP_BattleEngineCore) {
    Window_EnemyVisualSelect.prototype.makeWindowBoundaries = function() {
        if (!this._requestRefresh) return;
        this._minX = -1 * this.standardPadding();
        this._maxX = Graphics.boxWidth - this.width + this.standardPadding();
        this._minY = -1 * this.standardPadding();
        this._maxY = Graphics.boxHeight - this.height + this.standardPadding();
    };
    
    baseStatusHeight = eval(Yanfly.Param.BECCommandRows);
}

var defXPosEval = PluginManager.parameters('EnemyPlacement')['Default X Position'] || 0;
var defYPosEval = PluginManager.parameters('EnemyPlacement')['Default Y Position'] || 0;
var useDef = PluginManager.parameters('EnemyPlacement')['Use Default Placement'] == 'true';

_GameTroop_setup = Game_Troop.prototype.setup;
Game_Troop.prototype.setup = function(troopId) {
    _GameTroop_setup.call(this, troopId);
    this.placeEnemies();
};

Game_Troop.prototype.placeEnemies = function() {
    var screenWidth = Graphics.boxWidth;
    var screenHeight = Graphics.boxHeight;
    var troopSize = this._enemies.length;
    var statusHeight = baseStatusHeight * Window_Base.prototype.lineHeight.call(this);
    statusHeight += Window_Base.prototype.standardPadding.call(this) * 2;
    for (var index = 0; index < this._enemies.length; index ++) {
        var e = this._enemies[index];
        if (e.enemy().meta.XPosEval) {
            e._screenX = eval(e.enemy().meta.XPosEval);
        } else if (useDef || e.enemy().meta.UseDefaultXPos) {
            e._screenX = eval(defXPosEval);
        }
        if (e.enemy().meta.YPosEval) {
            e._screenY = eval(e.enemy().meta.YPosEval);
        } else if (useDef || e.enemy().meta.UseDefaultYPos) {
            e._screenY = eval(defYPosEval);
        }
    }
};

})();

EnemyPlacement.js
Displaying EnemyPlacement.js.
Code:
EnemyPlacement.js
Displaying EnemyPlacement.js.

Delete these two lines at the end of the plugin.

It might also be worth noting that setting both the X and Y as an integer will cause ALL enemies to be displayed at the same spot and overlapping, you'd probably want a formula for one or both of them to avoid that (you can refer to the default formula and edit it as needed)
The instructions ask you to put the expression inside []
Code:
EnemyPlacement.js
Displaying EnemyPlacement.js.

Delete these two lines at the end of the plugin.

It might also be worth noting that setting both the X and Y as an integer will cause ALL enemies to be displayed at the same spot and overlapping, you'd probably want a formula for one or both of them to avoid that (you can refer to the default formula and edit it as needed)
Yes, you are correct, it would end up with both enemies overlapping, but at least they would be somewhere besides where they are in the image.

Have no worries, I'll do the math when I'm sure the plugin is doing what I expect it to do, but thanks for the info.

And that fixed it. Thanks again. One of these days I should really study javascript and stop relying on the basic I learned in high school. In the 80's. On an Apple 2...

Moderator: Thread is resolved, you may close it at will. Thank you.

as far I can read the code quickly, EnemyPlacement should be BELOW
YEP_BattleEngineCore to function correctly though and not ABOVE it.

party manager is also wiser to set below the BattleEngineCore as it
is more battle related.

if you categorize the plugins better, it should work.
Thanks for the heads up.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/resolved-ladybakervilles-enemy-positions-plugin-is-not-functioning-correctly.162480/