[Yanfly's Steal & Snatch] Conditional Steal Skill?

MechScapeZH

Veteran
Veteran
Joined
Mar 23, 2019
Messages
485
Reaction score
578
First Language
English
Primarily Uses
RMMV
Hi everyone,

I've recently hit a snag while making a skill for my new project. I'd like to have it so that the player can only steal from an enemy if they have less than a certain percentage (say, 30%) of their health, and the enemy instantly gets KO'd when the skill is used under that condition. (Essentially kind of a vampire-type skill- take your enemy's stuff & destroy them if they're weak enough. If you haven't weakened them, the skill is useless- better hit them some more!)

The problem is that I can't figure out how to make the Steal effect conditional- the notetag for the Steal/Snatch effect is a standard <Steal: x%> tag, and I'm just not proficient enough with JavaScript to deduce how to work with that.

Can this be done, and if so, how?

Thank you in advance for your help.
 

rainyday

Veteran
Veteran
Joined
Nov 5, 2019
Messages
69
Reaction score
34
First Language
English
Primarily Uses
RMMV
Put this code in your steal skill's notebox.
Code:
 <Custom Steal Success Effect>
    target.die();
  </Custom Steal Success Effect>
<Steal>
<Custom Steal Rate>
  if(target.hp < target.mhp * .3){
  rate = 100;
} else {
rate = 0;
}
</Custom Steal Rate>

This should work, lemme know if you want something changed or if it doesn't work.
 

MechScapeZH

Veteran
Veteran
Joined
Mar 23, 2019
Messages
485
Reaction score
578
First Language
English
Primarily Uses
RMMV
Put this code in your steal skill's notebox.
Code:
 <Custom Steal Success Effect>
    target.die();
  </Custom Steal Success Effect>
<Steal>
<Custom Steal Rate>
  if(target.hp < target.mhp * .3){
  rate = 100;
} else {
rate = 0;
}
</Custom Steal Rate>

This should work, lemme know if you want something changed or if it doesn't work.
This works perfectly! I didn't even know that custom rates & effects existed! Shows how much I know, haha.

Your name has been added to the credits of my game- again, thank you so much for your help!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Just got a better look at the MZ RTP. I'm very happy with it, especially the sci-fi tiles and sprites. Glad I pre-ordered.
I've just checked the VisuStella Plugins for MZ and there are already 11 plugins. The Yanfly team(perhaps a big one?) really works so effectively and efficiently that some MZ users can likely use tons of Yanfly plugins right after MZ's released (still 13 days from now). I wonder if any other plugin developer(or team) will try to compete with Yanfly this time, no matter how slim the chance to win is :)
Hello! :kaopride:I am new to RPG Maker, though I have been lurking the forums for a while. :kaoswt: Hope to make some friends and learn some stuff here! :kaothx:
And now since I've got the whole game parts working, the *contents* await.

I've invented a cheap way to manipulate weather. Should I get it patented?
It's change from frikin' hot to beautiful at the cost of only 4 beers.

Forum statistics

Threads
100,593
Messages
977,577
Members
132,191
Latest member
fegelein
Top