MV Steal Skill rate modifies by User's Luck and Target's remaining HP

Hello, I'm trying to create a skill that allows the user to capture an enemy's "soul" (which is an item that would act like a Pokemon TM to teach a character a skill) : I'm using Atreyo Ray's SimpleStealSkill plugin (that I added to this post) which does a nice job : it allows me to create a skill that steals a specific item, and to set a random chance of success for it.
It also lets me add a sucess rate modifier note tag (<steal_chance:X>) on classes, actors, weapons, armors and states.

What I'd like is for the random chance of capture to not be purely random, but to be influenced somehow by the User's Luck and by the Target's remaining HP, but I have no idea how to set that up.
Could you help with a formula, to be either included in the plugin itself, or in the formula of the <steal_chance:X> note tag?
Thanks a lot!
The issue is that the meta tag is stored as a string and the plugin converts that tag to a number to calculate the steal chance, but if you use a formula there it'll try to convert the string representation of the formula to a number, fail, and default to 0.

You'd need to modify modify line 150 of the plugin; probably the easiest thing to do would be to do

chance += Number(eval(obj.meta.steal_chance) || 0);

Then you can put your formula in the chance notetag.
The issue is that the meta tag is stored as a string and the plugin converts that tag to a number to calculate the steal chance, but if you use a formula there it'll try to convert the string representation of the formula to a number, fail, and default to 0.

You'd need to modify modify line 150 of the plugin; probably the easiest thing to do would be to do

chance += Number(eval(obj.meta.steal_chance) || 0);

Then you can put your formula in the chance notetag.
Thanks for the answer! I changed the line 150 and it doesn't break the plugin, so that's good, but I don't know how to define my formula for the steal chance...

I tried this :

<steal_chance: a.stc * ((b.maxhp * 2) / (b.maxhp + b.hp)) * ((128 + a.luk) / 128)>

but I'm getting an error telling me that a and b are not defined. I tried with user and target but I get the same result (did I mention I don't really know what I'm doing ? ^^")
Bumping that one, please help a poor artist who can't put two lines of code together :')
a/b and user/target aren't defined in the stealChance function, so they're not available to be used in your formula since the engine doesn't know what you mean.

For user, you can just use "this", since the function is attached to the battler who's trying to steal. For target it's a bit tricker. You'd have to do something like

this.opponentsUnit().members()[BattleManager._action._targetIndex]
a/b and user/target aren't defined in the stealChance function, so they're not available to be used in your formula since the engine doesn't know what you mean.

For user, you can just use "this", since the function is attached to the battler who's trying to steal. For target it's a bit tricker. You'd have to do something like

this.opponentsUnit().members()[BattleManager._action._targetIndex]
Thanks a whole lot! I managed to have *something* working, but still couldn't figure out how to make it work like I intend to: basically I tested each of the elements of the formula independantly (the opponent's hp, max hp, and the user's luck) and they each affect the steal chance rate.

What I can't figure out is how to call for the base item's steal chance in that formula.

Here is what I have ( X being the missing base value for the item's steal chance) :

<steal_chance: (X * ((this.opponentsUnit().members()[BattleManager._action._targetIndex].mhp * 2) / (this.opponentsUnit().members()[BattleManager._action._targetIndex].mhp + this.opponentsUnit().members()[BattleManager._action._targetIndex].hp)) * ((128 + this.luk) / 128)) - X>

Any idea how I could make that part work?
Thanks a lot again for the help!
Bump, hopefully the last one! Super close to have it working as intended.
Bump?
@Trihan Sorry for the tagging but your help was great, any chance you would have an idea?
Bump?
@Trihan Sorry for the tagging but your help was great, any chance you would have an idea?
I'll take a look when I'm back at my hotel!
I'll take a look when I'm back at my hotel!
Thanks a lot! Are you traveling currently? (not to spam my own thread ahah, just curious)
Thanks a lot! Are you traveling currently? (not to spam my own thread ahah, just curious)
I was down south visiting family for my granddad's 91st birthday.
I was down south visiting family for my granddad's 91st birthday.
Nice, I hope you had a nice time with your familiy and that your granddad was doing fine, that's a very respectable age. 🙂
Let me know if by any chance you find time to take a quick look at the plugin, have a good weekend btw!
Just to throw an alternative out there: Yanfly's Steal and Snatch supports notetags for custom steal rates in addition to a lot of other options. So if you were to use that instead of your existing plugin, you'd put something like:
Code:
<Custom Steal Rate>
rate+=((target.mhp * 2) / (target.mhp + target.hp)) * ((128 + user.luk) / 128);
</Custom Steal Rate>
It's not a free plugin, but if you don't have any Yanfly stuff, you get a lot for ten bucks.
Just to throw an alternative out there: Yanfly's Steal and Snatch supports notetags for custom steal rates in addition to a lot of other options. So if you were to use that instead of your existing plugin, you'd put something like:
Code:
<Custom Steal Rate>
rate+=((target.mhp * 2) / (target.mhp + target.hp)) * ((128 + user.luk) / 128);
</Custom Steal Rate>
It's not a free plugin, but if you don't have any Yanfly stuff, you get a lot for ten bucks.
Thanks, I looked into Steal and Snatch (that I own) but the thing is... I was planning to use it for my actual thief character and his skills. ^^"
I'm not 100% sure if I can add items that are not part of the enemy's loot with Steal and Snatch, I'd have to look into it again, but the cool thing with Atreyo Ray's SimpleStealSkill plugin is that you manually add each item to steal, independantly of the monster's loot.
If I was to use Yanfly's plugin, and made the Soul of the monster, say, an Item or an Armor,the skill would also target all of the Items or Armors in the loot of that monster, not only its Soul.

Basically I need two ways of stealing :
- one skill that only steal Souls, and the rate of success is linked to the target's remaining health (and one of the user parameters... Luck for the moment because it still seems to make sense)
- one or several skills for stealing items, weapons, armors, maybe gold... so basically regular Steal skills. Probably only linked to the user's Luck (to be determined).

Another possibility would be to make it into a single Steal logic, that takes the target's HP into account, it could definitely make sense... the thing is that the character able to steal monsters' Souls is the protag, and the second character of the party is a thief/ninja, and reaaally looks like a thief ahah. I don't want them to feel similar, and I also don't want the *obvious* thief to not have a stealing ability.
Thanks, I looked into Steal and Snatch (that I own) but the thing is... I was planning to use it for my actual thief character and his skills. ^^"
I'm not 100% sure if I can add items that are not part of the enemy's loot with Steal and Snatch, I'd have to look into it again, but the cool thing with Atreyo Ray's SimpleStealSkill plugin is that you manually add each item to steal, independantly of the monster's loot.
If I was to use Yanfly's plugin, and made the Soul of the monster, say, an Item or an Armor,the skill would also target all of the Items or Armors in the loot of that monster, not only its Soul.

Basically I need two ways of stealing :
- one skill that only steal Souls, and the rate of success is linked to the target's remaining health (and one of the user parameters... Luck for the moment because it still seems to make sense)
- one or several skills for stealing items, weapons, armors, maybe gold... so basically regular Steal skills. Probably only linked to the user's Luck (to be determined).

Another possibility would be to make it into a single Steal logic, that takes the target's HP into account, it could definitely make sense... the thing is that the character able to steal monsters' Souls is the protag, and the second character of the party is a thief/ninja, and reaaally looks like a thief ahah. I don't want them to feel similar, and I also don't want the *obvious* thief to not have a stealing ability.
This is on my list to help you with but I'm working through a few other things right now, lot of people asking me for stuff today. XD
Thanks, I looked into Steal and Snatch (that I own) but the thing is... I was planning to use it for my actual thief character and his skills. ^^"
Yes? That's what Steal is?
I'm not 100% sure if I can add items that are not part of the enemy's loot with Steal and Snatch, I'd have to look into it again, but the cool thing with Atreyo Ray's SimpleStealSkill plugin is that you manually add each item to steal, independantly of the monster's loot.
If I was to use Yanfly's plugin, and made the Soul of the monster, say, an Item or an Armor,the skill would also target all of the Items or Armors in the loot of that monster, not only its Soul.
That's not correct. There are plugin parameters that determine whether or not the item drops you defined in the database can be stolen, and if yes whether or not that removes them from being dropped. You can configure stealing entirely via notetags.
Basically I need two ways of stealing :
- one skill that only steal Souls, and the rate of success is linked to the target's remaining health (and one of the user parameters... Luck for the moment because it still seems to make sense)
- one or several skills for stealing items, weapons, armors, maybe gold... so basically regular Steal skills. Probably only linked to the user's Luck (to be determined).
You can make two different skills that can both steal and have different success rates and JS customization, as I gave you above.

@Trihan I'm not at all trying to take anything away from you! I just figured since this is getting into heavier customization of this plugin on your free time, and there's an existing plugin that does everything the OP is asking for, I'd mention it.
Yes? That's what Steal is?

That's not correct. There are plugin parameters that determine whether or not the item drops you defined in the database can be stolen, and if yes whether or not that removes them from being dropped. You can configure stealing entirely via notetags.

You can make two different skills that can both steal and have different success rates and JS customization, as I gave you above.

@Trihan I'm not at all trying to take anything away from you! I just figured since this is getting into heavier customization of this plugin on your free time, and there's an existing plugin that does everything the OP is asking for, I'd mention it.
Oh absolutely, I'm not at all mad about you stepping in. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/steal-skill-rate-modifies-by-users-luck-and-targets-remaining-hp.144679/