I don't know how to update a value in window without it constantly drawing. I have a status effect system that kills the target after 10 turns(there's a way to remove the effect) and a timer appears above their heads letting the player know how many turns they have left.
If the current countdown is 5, I want it to say 5 and not 1098765 overlapped. I've tried clearing the rectangle, even destroying it but that doesn't prevent redrawing. The countdown to be drawn:
the countdown is iterated at the end of each turn process:
If the current countdown is 5, I want it to say 5 and not 1098765 overlapped. I've tried clearing the rectangle, even destroying it but that doesn't prevent redrawing. The countdown to be drawn:
JavaScript:
CurseCountDownWindow.prototype.drawCountDown = function(actorId) {
const actors = $gameParty.members()
const actorIndex = actors.findIndex(members => members.actorId() === actorId)
this.drawText(actors[actorIndex]._curseTurnCount, 0, 0, 48);
};
the countdown is iterated at the end of each turn process:
JavaScript:
BattleManager.processTurn = function() {
const subject = this._subject;
const action = subject.currentAction();
if (subject.hasState(Curse.curseStatus) === true) {
// Either was removed, yet to be applied or the application is in progress.
if (subject._curseTurnCount === -1) {
subject._hasCurse = true;
subject._curseTurnCount = 10;
// passed to the window's drawCountDown method for testing.
Curse.cursedActorId = subject.actorId();
};
if (subject._hasCurse === true && subject._curseTurnCount > 0) {
subject._curseTurnCount -= 1;
// the count down in the window should be changed here to reflect turns
// left til death.
if (subject._curseTurnCount === 0) {
Curse.cursedActorId = 0;
subject._curseTurnCount = -1;
subject._hasCurse = false;
subject.die();
};
};
};
if (action) {
action.prepare();
if (action.isValid()) {
this.startAction();
}
subject.removeCurrentAction();
} else {
this.endAction();
this._subject = null;
}
};