frustratingly mz does this by default, yet i havent been able to find a solution to this for mv for a long time
basically i use a heavily customized hud and the way states display now doesnt work for me, ideally id only need to show one and in the event an actor has multiple, it cycles between them (as it does by default when enemies have multiple states) i have no idea why its the default function for enemies but is seemingly very difficult to pull off when it comes to actors but maybe its just a lot more niche of a problem than i thought it would be
for the record im using srd battle status customizer to draw actor states on my custom hud im not sure how relevant that is but id assume it uses the same function as default to draw states
any help would be greatly appreciated this is probably the last major technical hurdle i have right now so i really want to resolve it before the forums closure
Well since the stateicon sprite already exist in the codes, I made this, imitating a bit how it's made in MZ. It works for base game, though you need to adjust position and also remove the lines that draws the normal icons in the window. But you need to add similar functionality in that SRD plugin.
const _myEdit1_WindowBattleStatus_drawItem = Window_BattleStatus.prototype.drawItem;
Window_BattleStatus.prototype.drawItem = function(index) {
_myEdit1_WindowBattleStatus_drawItem.call(this, index);
this._stateSprites = this._stateSprites || [];
const actor = $gameParty.battleMembers()[index];
const rect = this.itemRect(index);
if (actor && rect) {
const stateSpriteX = this.stateSpriteX(rect);
const stateSpriteY = this.stateSpriteY(rect);
this.createStateSprite(actor, stateSpriteX, stateSpriteY);
}
};
Window_BattleStatus.prototype.createStateSprite = function(actor, x, y) {
if (!this._stateSprites[actor.actorId()]) {
const actorIndex = actor.index();
const sprite = new Sprite_StateIcon();
this.addChild(sprite);
sprite.setup(actor);
sprite.move(x, y);
this._stateSprites[actor.actorId()] = true;
}
};
Window_BattleStatus.prototype.stateSpriteX = function(rect) {
return rect.x + 100;
};
Window_BattleStatus.prototype.stateSpriteY = function(rect) {
return rect.y + 30;
};
hi thanks a ton for putting this together, im struggling to find exactly where to put it though
i tried looking for obvious stuff like ctrl+f searching for "icons" and trying to find anything that looks like the setup to that function but i havent been able to get it to work with anything i replace and all of it feels like its calling some function thats already been defined somewhere
do you have an example of what the default icon drawing looks like maybe that i could use as reference or anything i should search that could work, im not the best at identifying this kind of thing
It worked for me in base game (meaning cycling sprite appeared, like I said I didn't remove the normal icons there yet, but that should be just commenting out a line or something). I'll check tomorrow how you can add that to the SRD plugin, if I have motivation, unless someone else does it for you.
EDIT: Oh and that's a plugin, so copy paste to notepad, save as .js file and add as plugin.
ohh thank you i was trying to add it to the srd plugin
also no worries!! ill mess around with it in the meantime and try to get it working thanks for all your help
Put this as plugin below SRD plugins. You can alter the positions X and Y in the last two methods. This seemed to work for me, but I only quickly tested it.
You can remove the normal icons from plugin settings (edit: meaning SRD plugin). At the top it asks a comma separated list of what to draw.
const _myEdit1_WindowBattleStatusUpgrade_drawItem = Window_BattleStatusUpgrade.prototype.drawItem;
Window_BattleStatusUpgrade.prototype.drawItem = function() {
_myEdit1_WindowBattleStatusUpgrade_drawItem.call(this);
this._stateSprite = this._stateSprite || null;
const actor = this._actor;
if (actor) {
const stateSpriteX = this.stateSpriteX();
const stateSpriteY = this.stateSpriteY();
this.createStateSprite(actor, stateSpriteX, stateSpriteY);
}
};
Window_BattleStatusUpgrade.prototype.createStateSprite = function(actor, x, y) {
if (!this._stateSprite) {
const sprite = new Sprite_StateIcon();
this.addChild(sprite);
sprite.setup(actor);
sprite.move(x, y);
this._stateSprite = true;
}
};
Window_BattleStatusUpgrade.prototype.stateSpriteX = function() {
return 50;
};
Window_BattleStatusUpgrade.prototype.stateSpriteY = function() {
return 25;
};
So you got everything working, cool.
If you want to change the scale, I think you just add in the method there (change the scale value to what you want between 0 - 1):
Window_BattleStatusUpgrade.prototype.createStateSprite = function(actor, x, y) {
if (!this._stateSprite) {
const sprite = new Sprite_StateIcon();
this.addChild(sprite);
sprite.setup(actor);
sprite.scale.x = 0.8;
sprite.scale.y = 0.8;
sprite.move(x, y);
this._stateSprite = true;
}
};