Is there a plugin (RMMV) that adjust the state icon anchor of every battler? I am using custom battlers and the state icon appear way above the head.
Plugin that adjusts the state icon anchor of each battler!
● ARCHIVED · READ-ONLY
-
-
You could try something like the following code. Increasing the yStateIcon plugin parameter should lower the state icon on the screen.
Code:// AdjustStateIcon.js // Created on 9/3/2018 /*: * @plugindesc This plugin is meant to adjust the position of the * state icon over a battler. * @author Yethwhinger * * @param xStateIcon * @desc Number of pixels to move state icon in x direction * Default = 0 * @default 0 * * @param yStateIcon * @desc Number of pixels to move state icon in y direction * Default = 0 * @default 0 * * @help This plugin adjusts the position of the state icon over * a battler by moving it using the xStateIcon and yStateIcon * parameters. */ var _adjustStateIconParam = PluginManager.parameters('AdjustStateIcon'); var _yStateIcon = Number(_adjustStateIconParam['yStateIcon']); //---------------------------- // Changes to Sprite_StateIcon //---------------------------- var _Sprite_StateIcon_initMembers = Sprite_StateIcon.prototype.initMembers; Sprite_StateIcon.prototype.initMembers = function () { _Sprite_StateIcon_initMembers.call(this); this.x = Number(_adjustStateIconParam['xStateIcon']); }; //---------------------------- // Changes to Sprite_Enemy //---------------------------- Sprite_Enemy.prototype.updateStateSprite = function () { this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9) + _yStateIcon; if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; } }; -
The fact is that I want to use custom made battlers which have different frame width and height. That means that every battler needs to have his own icon anchor/offset parameter. Is it possible to use actor notetag to solve this problem?You could try something like the following code. Increasing the yStateIcon plugin parameter should lower the state icon on the screen.
Code:// AdjustStateIcon.js // Created on 9/3/2018 /*: * @plugindesc This plugin is meant to adjust the position of the * state icon over a battler. * @author Yethwhinger * * @param xStateIcon * @desc Number of pixels to move state icon in x direction * Default = 0 * @default 0 * * @param yStateIcon * @desc Number of pixels to move state icon in y direction * Default = 0 * @default 0 * * @help This plugin adjusts the position of the state icon over * a battler by moving it using the xStateIcon and yStateIcon * parameters. */ var _adjustStateIconParam = PluginManager.parameters('AdjustStateIcon'); var _yStateIcon = Number(_adjustStateIconParam['yStateIcon']); //---------------------------- // Changes to Sprite_StateIcon //---------------------------- var _Sprite_StateIcon_initMembers = Sprite_StateIcon.prototype.initMembers; Sprite_StateIcon.prototype.initMembers = function () { _Sprite_StateIcon_initMembers.call(this); this.x = Number(_adjustStateIconParam['xStateIcon']); }; //---------------------------- // Changes to Sprite_Enemy //---------------------------- Sprite_Enemy.prototype.updateStateSprite = function () { this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9) + _yStateIcon; if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; } };
P.S: Sorry for the late response! -
The plugin below has been modified to allow individual enemy battlers to have their state icon sprites adjusted by using <stateX:number1> and <stateY:number2> in the Note field of the Enemies section of the database. This adjustment is combined with the overall adjustment from the xStateIcon and yStateIcon parameters. For example, using <stateY:25> for a goblin and setting yStateIcon to 50 will result in the state icon being moved down on the screen by 75(=25+50) pixels for goblins.
Code:// AdjustStateIconV2.js // Created on 9/3/2018 // Last modified on 9/17/2018 by Yethwhinger var objYeth = objYeth || {}; /*: * @plugindesc This plugin is meant to adjust the position of the * state icon over a battler. * @author Yethwhinger * * @param xStateIcon * @desc Number of pixels to move state icon in x direction * Default = 0 * @default 0 * * @param yStateIcon * @desc Number of pixels to move state icon in y direction * Default = 0 * @default 0 * * @help This plugin adjusts the position of the state icon over * a battler by moving it using the xStateIcon and yStateIcon * parameters. Additional adjustments for individual enemy battlers * can be made by adding * <stateX:number1> * <stateY:number2> * to the note field in the Enemies section of the database. * number1 and number2 represent pixel adjustments in the x * and y directions. */ objYeth.adjustStateIconParam = PluginManager.parameters('AdjustStateIconV2'); objYeth.yStateIcon = Number(objYeth.adjustStateIconParam['yStateIcon']); //---------------------------- // Changes to Game_Enemy //---------------------------- objYeth.Game_Enemy_setup = Game_Enemy.prototype.setup; Game_Enemy.prototype.setup = function (enemyId, x, y) { var tempX = $dataEnemies[enemyId].meta.stateX; var tempY = $dataEnemies[enemyId].meta.stateY; objYeth.Game_Enemy_setup.call(this, enemyId, x, y); this._stateX = 0; this._stateY = 0; if (tempX) { this._stateX = Number(tempX); } if (tempY) { this._stateY = Number(tempY); } }; //---------------------------- // Changes to Sprite_StateIcon //---------------------------- objYeth.Sprite_StateIcon_setup = Sprite_StateIcon.prototype.setup; Sprite_StateIcon.prototype.setup = function (battler) { objYeth.Sprite_StateIcon_setup.call(this, battler); this.x = Number(objYeth.adjustStateIconParam['xStateIcon']) + battler._stateX; }; //---------------------------- // Changes to Sprite_Enemy //---------------------------- Sprite_Enemy.prototype.updateStateSprite = function () { this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9) + objYeth.yStateIcon + this._battler._stateY; if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; } }; -
I am sorry, but this new version does not seem to work. I installed ONLY THIS plugin on a new project (ver 1.6.1) but the icons do not appear at all (actor or enemy). Everything worked fine when I turned it OFF.
By the way, can these notetags be used also in the Actors section of the database too? It would be a HUGE help for my project with custom battlers. -
I tested the second version of the plugin on both version 1.1 and version 1.6.1 of RPG Maker MV, and it worked on my system. In the second version of the plugin, I changed the plugin name by adding "V2" to the end of the name (since it behaves differently from the earlier version). The plugin looks for the filename, so I should have clarified that the filename for the second version of the plugin needs to be updated to use the newer code.
As for moving the state sprites used with actors, I have made another version of the plugin, called "AdjustStatePositions," that uses the same type of note fields to adjust either enemy state icons or actor state sprites (<stateX:number1> and <stateY:number2>).
Code:// AdjustStatePositions.js // Created on 9/18/2018 var objYeth = objYeth || {}; /*: * @plugindesc This plugin is meant to adjust the positions of the * state displays over battlers. * @author Yethwhinger * * @help This plugin adjusts the position of the state icon over * an enemy battler or the state sprite over an actor battler by * moving it using <stateX:number1> and <stateY:number2> entries * in the note fields of the Enemies and Actors sections of the * database. number1 and number2 represent pixel adjustments in * the x and y directions. */ //---------------------------- // Changes to Game_Enemy //---------------------------- objYeth.Game_Enemy_setup = Game_Enemy.prototype.setup; Game_Enemy.prototype.setup = function (enemyId, x, y) { var tempX = $dataEnemies[enemyId].meta.stateX; var tempY = $dataEnemies[enemyId].meta.stateY; objYeth.Game_Enemy_setup.call(this, enemyId, x, y); this._stateX = 0; this._stateY = 0; if (tempX) { this._stateX = Number(tempX); } if (tempY) { this._stateY = Number(tempY); } }; //---------------------------- // Changes to Game_Actor //---------------------------- objYeth.Game_Actor_setup = Game_Actor.prototype.setup; Game_Actor.prototype.setup = function (actorId) { var tempX = $dataActors[actorId].meta.stateX; var tempY = $dataActors[actorId].meta.stateY; objYeth.Game_Actor_setup.call(this, actorId); this._stateX = 0; this._stateY = 0; if (tempX) { this._stateX = Number(tempX); } if (tempY) { this._stateY = Number(tempY); } }; //---------------------------- // Changes to Sprite_StateIcon //---------------------------- objYeth.Sprite_StateIcon_setup = Sprite_StateIcon.prototype.setup; Sprite_StateIcon.prototype.setup = function (battler) { objYeth.Sprite_StateIcon_setup.call(this, battler); this.x = battler._stateX; }; //---------------------------- // Changes to Sprite_StateOverlay //---------------------------- objYeth.Sprite_StateOverlay_setup = Sprite_StateOverlay.prototype.setup; Sprite_StateOverlay.prototype.setup = function (battler) { objYeth.Sprite_StateOverlay_setup.call(this, battler); this.x = battler._stateX; this.y = battler._stateY; }; //---------------------------- // Changes to Sprite_Enemy //---------------------------- Sprite_Enemy.prototype.updateStateSprite = function () { this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9) + this._battler._stateY; if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; } }; -
Nice work, but there is still a problem: <stateY:number2> does not work for ACTOR battlers. Strangely, <stateX:number1> works perfectly for both enemy and actor battlers.I tested the second version of the plugin on both version 1.1 and version 1.6.1 of RPG Maker MV, and it worked on my system. In the second version of the plugin, I changed the plugin name by adding "V2" to the end of the name (since it behaves differently from the earlier version). The plugin looks for the filename, so I should have clarified that the filename for the second version of the plugin needs to be updated to use the newer code.
As for moving the state sprites used with actors, I have made another version of the plugin, called "AdjustStatePositions," that uses the same type of note fields to adjust either enemy state icons or actor state sprites (<stateX:number1> and <stateY:number2>).
Code:// AdjustStatePositions.js // Created on 9/18/2018 var objYeth = objYeth || {}; /*: * @plugindesc This plugin is meant to adjust the positions of the * state displays over battlers. * @author Yethwhinger * * @help This plugin adjusts the position of the state icon over * an enemy battler or the state sprite over an actor battler by * moving it using <stateX:number1> and <stateY:number2> entries * in the note fields of the Enemies and Actors sections of the * database. number1 and number2 represent pixel adjustments in * the x and y directions. */ //---------------------------- // Changes to Game_Enemy //---------------------------- objYeth.Game_Enemy_setup = Game_Enemy.prototype.setup; Game_Enemy.prototype.setup = function (enemyId, x, y) { var tempX = $dataEnemies[enemyId].meta.stateX; var tempY = $dataEnemies[enemyId].meta.stateY; objYeth.Game_Enemy_setup.call(this, enemyId, x, y); this._stateX = 0; this._stateY = 0; if (tempX) { this._stateX = Number(tempX); } if (tempY) { this._stateY = Number(tempY); } }; //---------------------------- // Changes to Game_Actor //---------------------------- objYeth.Game_Actor_setup = Game_Actor.prototype.setup; Game_Actor.prototype.setup = function (actorId) { var tempX = $dataActors[actorId].meta.stateX; var tempY = $dataActors[actorId].meta.stateY; objYeth.Game_Actor_setup.call(this, actorId); this._stateX = 0; this._stateY = 0; if (tempX) { this._stateX = Number(tempX); } if (tempY) { this._stateY = Number(tempY); } }; //---------------------------- // Changes to Sprite_StateIcon //---------------------------- objYeth.Sprite_StateIcon_setup = Sprite_StateIcon.prototype.setup; Sprite_StateIcon.prototype.setup = function (battler) { objYeth.Sprite_StateIcon_setup.call(this, battler); this.x = battler._stateX; }; //---------------------------- // Changes to Sprite_StateOverlay //---------------------------- objYeth.Sprite_StateOverlay_setup = Sprite_StateOverlay.prototype.setup; Sprite_StateOverlay.prototype.setup = function (battler) { objYeth.Sprite_StateOverlay_setup.call(this, battler); this.x = battler._stateX; this.y = battler._stateY; }; //---------------------------- // Changes to Sprite_Enemy //---------------------------- Sprite_Enemy.prototype.updateStateSprite = function () { this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9) + this._battler._stateY; if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; } }; -
I am sorry that the plugin is not working for you. I have attached some screenshots to show what my setup looks like and the results the plugin is producing on my end. As can be seen in these images, the stateY in the note field for Harold is making his cloud much higher than Marsha's default cloud position. Therese's stateY is making her bubbles extra low. Do you notice any differences between your note field and the ones below? Do you have any other plugins operating?
-
The plugin works fine with actor state overlays, but I don't want to use them. I use YEP_X_VisualStateFX to show icons over the actors and this might be the cause of conflict with your plugin regarding <stateY:number2> problem.
-
I am not familiar with the YEP_X_VisualStateFX plugin. I have downloaded it, but I will need more time to figure out how to get my plugin working with it. Just to clarify, is your project being made in MV version 1.6.1?
-
Yes, currently I am using RPG Maker MV 1.6.1I am not familiar with the YEP_X_VisualStateFX plugin. I have downloaded it, but I will need more time to figure out how to get my plugin working with it. Just to clarify, is your project being made in MV version 1.6.1?
-
I have modified the code to work with actor state icons from the YEP_X_VisualStateFX plugin.
Code:// AdjustStatePositions.js // Created on 9/18/2018 // Last modified on 9/20/2018 by Yethwhinger var objYeth = objYeth || {}; /*: * @plugindesc This plugin is meant to adjust the positions of the * state displays over battlers. * @author Yethwhinger * * @help This plugin adjusts the position of the state icon or * overlay over a battler by moving it using <stateX:number1> * and <stateY:number2> entries in the note fields of the Enemies * and Actors sections of the database. number1 and number2 * represent pixel adjustments in the x and y directions. */ //---------------------------- // Changes to Game_Enemy //---------------------------- objYeth.Game_Enemy_setup = Game_Enemy.prototype.setup; Game_Enemy.prototype.setup = function (enemyId, x, y) { var tempX = $dataEnemies[enemyId].meta.stateX; var tempY = $dataEnemies[enemyId].meta.stateY; objYeth.Game_Enemy_setup.call(this, enemyId, x, y); this._stateX = 0; this._stateY = 0; if (tempX) { this._stateX = Number(tempX); } if (tempY) { this._stateY = Number(tempY); } }; //---------------------------- // Changes to Game_Actor //---------------------------- objYeth.Game_Actor_setup = Game_Actor.prototype.setup; Game_Actor.prototype.setup = function (actorId) { var tempX = $dataActors[actorId].meta.stateX; var tempY = $dataActors[actorId].meta.stateY; objYeth.Game_Actor_setup.call(this, actorId); this._stateX = 0; this._stateY = 0; if (tempX) { this._stateX = Number(tempX); } if (tempY) { this._stateY = Number(tempY); } }; //---------------------------- // Changes to Sprite_StateIcon //---------------------------- objYeth.Sprite_StateIcon_setup = Sprite_StateIcon.prototype.setup; Sprite_StateIcon.prototype.setup = function (battler) { objYeth.Sprite_StateIcon_setup.call(this, battler); this.x = battler._stateX; if (battler.isActor()) { this.y = battler._stateY; } }; //---------------------------- // Changes to Sprite_StateOverlay //---------------------------- objYeth.Sprite_StateOverlay_setup = Sprite_StateOverlay.prototype.setup; Sprite_StateOverlay.prototype.setup = function (battler) { objYeth.Sprite_StateOverlay_setup.call(this, battler); this.x = battler._stateX; this.y = battler._stateY; }; //---------------------------- // Changes to Sprite_Enemy //---------------------------- Sprite_Enemy.prototype.updateStateSprite = function () { this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9) + this._battler._stateY; if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; } }; -
Awesome! Thank you so much for your hard work. How can we credit you in our projects (name, website, etc)?
-
If you would really like to add "Yethwhinger" to the "Thanks" section of your game's credits, that would be generous, but not necessary. I am glad you were happy with the plugin.
-
@Yethwhinger
Is it possible to add in the functionality to move the positions of the state counters and turn counters per enemy/actor? See the attached image for an example of what I mean. The state counter is positioned the way I want in the top window, but if I want to move around the state icon position that appears by the enemy, the state counter/state turn counter appears in odd positions.
If it helps to know, the way it positions the counters is done through parameters in YEP's Buff & States Core plugin.
If it's possible, it could be done through similar tags?
Maybe something like:
<statecounterX:number1>
<statecounterY:number2>
<turncounterX:number1>
<turncounterY:number2>
Edit:
I do not intend to hijack the thread, I actually think the issue I raised is pretty relevant to this request. Because users will very likely want to adjust the positioning for the counters in a separate way so it matches custom positions per enemy. -
I will take a look at the code. It might be a few days before I can get back to you on this matter.
-
Much appreciated!
@Yethwhinger
I had to edit this because I was actually wrong. Turns out your plugin actually does move the state and turn counters in tandem with the custom state icon position. Very early into my project I had adjusted the X and Y anchors for the state icons. Because Yanfly's plugin didn't allow for moving the position of it, I had later disabled it. When I tried yours, the offset visuals were a result of the previous anchor shift I forgot about.
Thanks for getting back to me. I'll be giving you credit in my project! This plugin will be very useful. :D -
I'm glad it worked out for you.
-
@Yethwhinger
Doing further tests with this plugin I discovered that Yanfly Action Sequence 2 breaks the <stateY:number2> functionality. See the images for further details. -
I will investigate and get back to you sometime next week.