Current Enemy Selected

I would like to know how to know which current enemy I am selecting when I am in battle. When I say current enemy, say I select Attack, it gives me the chance to select among all my targets who to attack, right? I want to know how to get that enemy's id and battler name. What code am I looking into?
Do you want to know on target selection or when the Acton get actually executed? Asking since you can Cancel a order by pressing esc.
Yeah exactly on target selection 🙂
target, under game action apply would work.
It needs to be on Scene_Battle, or else my array that's in scene_battle that checks which ID the enemy won't work :/
um in battle you can dot is target instance of game_enemy, taget.id or something simmalr will give you enemy id.
$gameTroop._enemies[0]._selected   returns true or false if the enemy is current being selected in battle.

Note: enemy 1 is _enemies[0]

From there you can get the enemy id.
You probably want Game_Battler.prototype.select

Game_Battler.prototype.select = function(select){ return function(){ // in this particular instance `select.call(this)` would have suffice select.apply(this, Array.prototype.slice.call(arguments)) if (this instanceof Game_Enemy) { console.log("It's a me, ", this) } else { console.log('Target here is a friend', this) } } }(Game_Battler.prototype.select)Since it's a Game_Battler, you should check if this is instanceof Game_Enemy, since also Game_Actor is a Game_Battler (you can see this by using Heal, for example).

Original thread: https://forums.rpgmakerweb.com/threads/current-enemy-selected.50991/