Enemy Soul Absorb

I've been making a battle mechanic similar to Castlevania Aria of Sorrow's Soul Absorbing.

Soul Absorb will absorb an enemy's "Soul"(which would be an armor type item) that will give you different abilities and skills.

I am making this skill through a common event but I'm having a problem about the targeting of the enemy.

I have 3 sets of different variables for the chances. High Chance and High Probability (50%), Medium Chance and Medium Probability(25%), and

Low Chance and Low Probability(10%) The six variables are randomized. 

*I just named them chance and probability so it might look cool or something 😀

Then I have a conditional branch that will execute if the target's id will be equal to the enemy's id that I would specify. I used $data_enemies[enemy_id] but I'm not sure if this is the correct one. And here comes the problem. 

Soul Absorb will be successful if there's only one enemy. But there's more than one, the first conditional branch will always be executed if it's not the enemy id of the target. 

Can someone help me on how would I get the target's id so I can use it in the conditional branch?

Here's my common event.

Spoiler
This is the conditional branch for the first enemy, slime.

Soul1.png
Spoiler
And here's for the second enemy.

Soul2.png
uhh please move this topic. i posted it on a wrong topic. sorry
you can do a variable setting on the formula bar... like $game_variables[1] = b.enemy.enemy_id ; damage here

then on the conditonals, just check

if $game_variables[1] == enemy id that you want
Conditional Branch : Script requires a ruby sequence to report either true or false and branches accordingly.

But you only access $data_enemy[1] in your first true branch.

If that works, then it will probably return ture whenever that enemy exists - you don't have any comparison in there to check if that is the targeted enemy, so that branch will execute even if you targeted a different enemy.
If you intend to "wear" the soul, why not just make it an item drop.

There are several condition item drop scripts you can use and set so that once the item is dropped, it can't be dropped anymore (unless you want to allow it to powerup via additional drops.)

You can even use variables and percentages to determine drop rates!

I think that might be a good way to go about doing this.
Okay, so what if you create a new State, called Soul Absorbed, and inflict it on an enemy? At the end of each round, run a Common Event that checks for the state, and if it's present, returns the id for the monster. Based on the ID, see if the matching item is in the inventory (or don't) and if it's not, grant the item.  Then all you need is to script a special item slot for Soul.
If you intend to "wear" the soul, why not just make it an item drop.

There are several condition item drop scripts you can use and set so that once the item is dropped, it can't be dropped anymore (unless you want to allow it to powerup via additional drops.)

You can even use variables and percentages to determine drop rates!

I think that might be a good way to go about doing this.
That's a good idea but I like to get the "soul" instantly after using the skill.

you can do a variable setting on the formula bar... like $game_variables[1] = b.enemy.enemy_id ; damage here

then on the conditonals, just check

if $game_variables[1] == enemy id that you want

 
I'm getting an error. Undefined variable "b". Do I need to change "b" into something?

Conditional Branch : Script requires a ruby sequence to report either true or false and branches accordingly.

But you only access $data_enemy[1] in your first true branch.

If that works, then it will probably return ture whenever that enemy exists - you don't have any comparison in there to check if that is the targeted enemy, so that branch will execute even if you targeted a different enemy.

 
Umm so how can I check if that is my targeted enemy?
That's a good idea but I like to get the "soul" instantly after using the skill.
In that case, is a Soul maybe a State? 
I'm getting an error. Undefined variable "b". Do I need to change "b" into something?
Uhm, you do the = b.enemy.id in the damage formula for the skill in the skill tab... if you did it there, it should not be giving an error...
Uhm, you do the = b.enemy.enemy_id in the damage formula for the skill in the skill tab... if you did it there, it should not be giving an error...
Hi,

I have a similar problem with my monster capture item. I put this in the damage formula, it doesn't result in an error, but doesn't set the variable either.

$data_enemies[x] doesn't give an enemy ID by the way, but some sort of code.

$game_troop.member[x].enemy_id seems to work in the script though. Use it rather than $data_enemies[x].

Oh, x starts with 0 and not 1 (the first enemy in your troop is 0, the second is 1 and so on).
of course it wont... $data_enemies[x] will give you the enemy reference... if you wanna use it, it should be $data_enemies[x].id

I never even said anything about using data_enemies...

which is why I used b.enemy.id... b is the formula default for target, which is better to use than $game_troop.member[x] if you don't know which enemy can be hit.. 

yeah, it should be b.enemy.id
I am already using V's Conditional Checks and it works perfectly for my skill.

Thanks for all the suggestions guys. This topic can be closed now 😀
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/enemy-soul-absorb.18020/