Current Enemy Selected

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
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?
 

kentaromiura

Veteran
Veteran
Joined
Nov 1, 2015
Messages
46
Reaction score
26
First Language
English
Primarily Uses
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.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Yeah exactly on target selection :)
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
target, under game action apply would work.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
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 :/
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
um in battle you can dot is target instance of game_enemy, taget.id or something simmalr will give you enemy id.
 

Jeremy Cannady

Coldfire
Veteran
Joined
Oct 25, 2015
Messages
449
Reaction score
268
First Language
English
$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.
 
Last edited by a moderator:

kentaromiura

Veteran
Veteran
Joined
Nov 1, 2015
Messages
46
Reaction score
26
First Language
English
Primarily Uses
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).
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top