Get Enemy Id?

I'm trying to make a skill that gives you a specific item based on which enemy you use it against. To specify, you use the skill against different colored slime enemies and get slime of that color back. I have most the process figured out, but how do you get the ID of an enemy?

Once I get that, I'm going to set up a case statement that you give the enemy ID to and it returns the item ID to give to the player (this part works I know how to do that)

but if anyone has other ideas for how to pull this off, let me know.
I have a similar mechanic in my game with conditional drops...enemies drop specific items if you kill them using a skill of a certain element or while they have a specific state....I don't know if this is what you want but here you go

I have a similar mechanic in my game with conditional drops...enemies drop specific items if you kill them using a skill of a certain element or while they have a specific state....I don't know if this is what you want but here you go


This looks like exactly what I need! Thank you~!!!

**EDIT** ah wait hold on, I got so excited about this I didn't think it through. This only drops the items upon death abut I need them to drop the item at the time the skill is used. Possibly even multiple times. So while this is a really cool script it's not what I need
I think I've found a way to do it...create a common event for each type of colored slime you want...like "red slime....blue slime...etc" then make the desired skill call this comon event...

Let's say: double slash causes blue slime to drop...so you put the "blue slime" common event in the double slash skill...
you want "super strike" to drop red slime...so you put the "red slime" common event on the "super strike" skill...and so on

on each of the comon events you create a conditional branch...if "slime drop" is on then drop "blue slime"....(the color is respective to the color you want to drop obviously)

Now create a switch called "slime drop"...and turn it on at the start of battle (on the troops menu)...put it at the start of every battle with a monster that will drop blue slime...at the start of every battle the event "slime drop" will be activated and when you use "double slash" you will get a blue slime...(just be sure to turn off the "slime drop" event at the end of battle otherwise this will happen in every battle)

The problem with this of course is that you can't have multicolored slimes in the same battle...unless you want the slimes drops to be only skill specific and not monster specific
I think I've found a way to do it...create a common event for each type of colored slime you want...like "red slime....blue slime...etc" then make the desired skill call this comon event...

Let's say: double slash causes blue slime to drop...so you put the "blue slime" common event in the double slash skill...
you want "super strike" to drop red slime...so you put the "red slime" common event on the "super strike" skill...and so on

on each of the comon events you create a conditional branch...if "slime drop" is on then drop "blue slime"....(the color is respective to the color you want to drop obviously)

Now create a switch called "slime drop"...and turn it on at the start of battle (on the troops menu)...put it at the start of every battle with a monster that will drop blue slime...at the start of every battle the event "slime drop" will be activated and when you use "double slash" you will get a blue slime...(just be sure to turn off the "slime drop" event at the end of battle otherwise this will happen in every battle)

The problem with this of course is that you can't have multicolored slimes in the same battle...unless you want the slimes drops to be only skill specific and not monster specific

Unfortunately this isn't what I'm looking for either. What I need is just one skill that can get the item from any enemy. The item depends on which enemy you used it against.

I ended up finding a similar solution though, so it's not far off. But it's not an elegant one...I have the skill apply a status and in the troop events it checks for the status and drops the item if it's applied.

I'd really rather make this a script. But in order to do that I need to know the enemy ID and I just can't find it.
Perhaps you could use this as a basis for what you want to do. As far as I can see, one of your problems is knowing which enemies are in the troop.

To find members of a troop which are of a particular type (slime/imp/whatever), with id being the number of the slot in the enemies tab with that particular enemy.

In this example, I am searching for enemies with the enemy id 1

$game_troop.members.select { |enemy| enemy.enemy_id == 1 }
Perhaps you could use this as a basis for what you want to do. As far as I can see, one of your problems is knowing which enemies are in the troop.

To find members of a troop which are of a particular type (slime/imp/whatever), with id being the number of the slot in the enemies tab with that particular enemy.

In this example, I am searching for enemies with the enemy id 1

$game_troop.members.select { |enemy| enemy.enemy_id == 1 }

"enemy_id" is what I needed yes! I just need to make a damage formula that uses b.enemy_id and use that to get my item. I just tested it too and it seems to work!

Sorry I was late to respond to this lol. But this should be the answer.

Original thread: https://forums.rpgmakerweb.com/threads/get-enemy-id.128520/