For the past couple days I've been working on making a custom frontview battle GUI with Yanfly's Battle Status Window and DreamX's extension plugin of the same. Ideally, it'd accomplish the following:
1. Adjust the width of the battle status window depending on how many actors are in the party. For example, if there's only one actor in the party the status window is only 1/4 the screen width, whereas if there's four actors the status window is the entire screen width.
2. Center the battle status window in the middle of the battle screen, again adjusting depending on how many actors there are in the party.
3. Have the party command window adjust its width depending on the battle status window.
4. Have the actor command window appear above the currently selected actor in battle.
That last one has been causing me absolutely no end of trouble. Not necessarily in general implementation, but in that the actor command window doesn't want to stay still when the selection process is over. For whatever stupid reason, when either the party command window is brought up or the last actor has selected their move, the actor command window jumps to the far left of the battle status window as it closes.
It's a bit difficult to explain through words, so here's a picture:
I've gone through several iterations of the formula to position the Actor Command Window, and this -arging- stupid bug has shown up every single -arg-ing time. At least with my current formula, it only happens when the last actor uses a skill that targets another party member.
The formula I'm currently using to decide the X position of the Actor Command window is
And here's all the other formulas I'm changed from the default parameters, in case one of them's causing the problem:
For good measure, here's all the other plugins this project's currently using:
The base plugin for Yanfly's Battle Status window has the Adjust Columns and Show Actor Sprites parameters set to true. The second DreamX extension plugin is a fix containing this code to patch up another problem I was having. The Core Engine also has the Parameter Gauges height set back to the default of 6. Beyond that, all the parameters on the other plugins are default.
I'd really appreciate a response that isn't radio silence. I'm so close to having a frontview battle GUI that I'm completely happy with, but this stupid bug is in the way and I'm extremely frustrated with it. I have absolutely no idea what else I can do that I haven't already done to get rid of it.
EDIT: Well, I guess radio silence is a good motivator to try and fix this stuff on my own, and in this case I actually did manage to fix it on my own. For anyone else who might be struggling with the same problem, here's my solution:
rect.x returns a negative value when there's no actor selected. If it weren't for the Math.max in my previous formula, it would have appeared right off the screen. My proper solution, then was to simply use a conditional branch:
In proper words, this basically says "If there's an actor selected, position the actor command window above the actor; otherwise, the actor command window stays in its previous position."
I figured something along these lines was what I was looking for; it was just figuring out just how to determine the positions of the actor select rectangle and the actor command window's previous positions.
As to why the actor command window only moved when selecting a party member? I forgot to mention that I had the "Close Actor Command when selecting" parameter set to "True." This parameter only works when selecting an enemy, not a fellow actor. So when the last actor selected an enemy it wasn't there and thus didn't move.
This was a pretty frustrating experience, but I'm glad it's over.
1. Adjust the width of the battle status window depending on how many actors are in the party. For example, if there's only one actor in the party the status window is only 1/4 the screen width, whereas if there's four actors the status window is the entire screen width.
2. Center the battle status window in the middle of the battle screen, again adjusting depending on how many actors there are in the party.
3. Have the party command window adjust its width depending on the battle status window.
4. Have the actor command window appear above the currently selected actor in battle.
That last one has been causing me absolutely no end of trouble. Not necessarily in general implementation, but in that the actor command window doesn't want to stay still when the selection process is over. For whatever stupid reason, when either the party command window is brought up or the last actor has selected their move, the actor command window jumps to the far left of the battle status window as it closes.
It's a bit difficult to explain through words, so here's a picture:
I've gone through several iterations of the formula to position the Actor Command Window, and this -arging- stupid bug has shown up every single -arg-ing time. At least with my current formula, it only happens when the last actor uses a skill that targets another party member.
The formula I'm currently using to decide the X position of the Actor Command window is
Code:
Math.max(SceneManager._scene._statusWindow.x + SceneManager._scene._statusWindow.standardPadding() + rect.x + (rect.width - this.width) / 2, SceneManager._scene._statusWindow.x + SceneManager._scene._statusWindow.standardPadding())
And here's all the other formulas I'm changed from the default parameters, in case one of them's causing the problem:
- Battle Status Width:
Code:
Graphics.boxWidth / 4 * $gameParty.battleMembers().length - Battle Status Input/Action X:
Code:
(Graphics.boxWidth - (Graphics.boxWidth / 4 * $gameParty.battleMembers().length)) / 2 - Face X:
Code:
rect.x + (rect.width - ww) / 2 - Party Command X:
Code:
(Graphics.boxWidth - (Graphics.boxWidth / 4 * $gameParty.battleMembers().length)) / 2 - Party Command Y:
Code:
Graphics.boxHeight - SceneManager._scene._statusWindow.height - this.height - Party Command Width:
Code:
Graphics.boxWidth / 4 * $gameParty.battleMembers().length - Party Command Columns:
Code:
this.maxItems() - Party Command Visible Rows: 1
- Actor Command Y:
Code:
Graphics.boxHeight - SceneManager._scene._statusWindow.height - this.height - Actor Command Width:
Code:
SceneManager._scene._statusWindow.width / $gameParty.battleMembers().length - Frontview Actor Sprite Y:
Code:
statusWindow.y + 12
For good measure, here's all the other plugins this project's currently using:
The base plugin for Yanfly's Battle Status window has the Adjust Columns and Show Actor Sprites parameters set to true. The second DreamX extension plugin is a fix containing this code to patch up another problem I was having. The Core Engine also has the Parameter Gauges height set back to the default of 6. Beyond that, all the parameters on the other plugins are default.
I'd really appreciate a response that isn't radio silence. I'm so close to having a frontview battle GUI that I'm completely happy with, but this stupid bug is in the way and I'm extremely frustrated with it. I have absolutely no idea what else I can do that I haven't already done to get rid of it.
EDIT: Well, I guess radio silence is a good motivator to try and fix this stuff on my own, and in this case I actually did manage to fix it on my own. For anyone else who might be struggling with the same problem, here's my solution:
rect.x returns a negative value when there's no actor selected. If it weren't for the Math.max in my previous formula, it would have appeared right off the screen. My proper solution, then was to simply use a conditional branch:
Code:
rect.x >= 0 ? SceneManager._scene._statusWindow.x + SceneManager._scene._statusWindow.standardPadding() + rect.x + (rect.width - this.width) / 2 : this.x
In proper words, this basically says "If there's an actor selected, position the actor command window above the actor; otherwise, the actor command window stays in its previous position."
I figured something along these lines was what I was looking for; it was just figuring out just how to determine the positions of the actor select rectangle and the actor command window's previous positions.
As to why the actor command window only moved when selecting a party member? I forgot to mention that I had the "Close Actor Command when selecting" parameter set to "True." This parameter only works when selecting an enemy, not a fellow actor. So when the last actor selected an enemy it wasn't there and thus didn't move.
This was a pretty frustrating experience, but I'm glad it's over.