Hi fellow Makers.
Is there a way to get the index of a highlighted battler ?
For example, $gameTroop.members()[0]._hp returns the current hp of the first enemy.
Which script would return the current hp of the currently highlighted battler ?
I'm trying to customize the BattleEnemy and the BattleActor windows so I need the index before the target has been selected.
If that index doesn't exist, how would you check the hp of the highlighted battler ?
I hope I'm clear enough.
Thx for your help
No it's really the index I want.
I said it didn't work but It was my mistake.
Could you add something to return 0 if nobody is selected ?
If you want to see the value of hoveredBattler in the console, just add console.log(hoveredBattler); as the last line of the script.
Honestly I wouldn't know why it messes it up without seeing your script.
So it was a noob issue again, sorry about that.
Thanks again for your help.
Hey it's me again.
I'm still stuck on a thing.
I'd like to move the BattleEnemy window to match the selected enemy coordinates.
With the previous function coded by Tea's Jam, I can easily get the target screenX and screenY
but I can't find the way make to make the window move.
I've tried using the refresh function but I guess it just refresh the content of the window.
Since the window is only created once,
how can I change its position mid-battle ?
Up !
My BattleEnemy window still won't move.
I'm currently trying to use a function similar to the Scene_Battle.prototype.updateWindowPositions function.
function MoveWindow(){
if (this._enemyWindow.x != something) {
this._enemyWindow.x = something;
}
};
I don't understand why this._enemyWindow.x returns undefined when this._statusWindow.x works fine in the Scene_Battle.prototype.updateWindowPositions function.
Also, I'm not really sure of where I should run this function, I was thinking of adding a line a the end of
Window_BattleEnemy.prototype.select = function(index) {
Window_Selectable.prototype.select.call(this, index);
$gameTroop.select(this.enemy());
};
Please help me or I might start begging.
Hey, I'm Back.
In case someone is interested, I finally made my window move using
function MoveWindow(){
if (SceneManager._scene._enemyWindow.x != something) {
SceneManager._scene._enemyWindow.x = something;
}
};
I also managed to add this function to the select function as mentioned previously and it's working, my window as I want.
I'm sure my script is a mess but I feel like I improved a lot for this.