RMMV - Need help with Riposte Skill state

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
31
Reaction score
14
First Language
English
Primarily Uses
RMMV
Hello! I'm working on a state that will return a portion of the damage to the attacker. This state is tied to a skill called Riposte. This skill required a melee weapon equipped (I got that covered and working) and will only return damage if the attacker is using a melee weapon (this is where I need help).

I'm using Yanfly engine plugins.

This below is what I have in my State, which returns half the damage. What I would like to add is return damage ONLY if the attacker is using a melee weapon. So, how would I code this?

Code:
<Custom React Effect>
if (value > 0 && this.isPhysical()) {
  var recoil = value * 0.5;
  var dmg = Math.ceil(recoil);
  user.gainHp(-1 * dmg);
  if (user.isDead()) {
    user.performCollapse();
  }
}
</Custom React Effect>
I was thinking of changing the first line to add a check, but can't figure it out:

if (value > 0 && this.isPhysical() && this.somethingsomething() !== 'missile')
 
Last edited:

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
31
Reaction score
14
First Language
English
Primarily Uses
RMMV
Took me a while and a lot of digging, but I've found the solution and learned a lot in the process...

the function I was looking for is in Yanfly's plugin YEP_WeaponAnimation.js: getUniqueWeaponMotion()

Basically, I've added the function to see if the attacker is using a melee or ranged weapon (in this case, 'missile').

Step 1: define monsters' attacks as ranged by adding <Weapon Motion: missile> in the notetag.

Step 2: this is the notetag in my state for riposte:

Code:
<Custom React Effect>

if (value > 0 && this.isPhysical() && this.isHpEffect() & user.getUniqueWeaponMotion() !== 'missile') {
  var recoil = value * 0.5;
  var dmg = Math.ceil(recoil);
  user.gainHp(-1 * dmg);
  user.addState(15);
  if (user.isDead()) {
    user.performCollapse();
  }
}
</Custom React Effect>
 

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

Latest Threads

Latest Profile Posts

made a bio for the protag in my project!
Beggar : "I haven't eat for days..."
Kid : "Just do crime! You will get daily necessity for free in prison~"
Stream is a bit late but will be live shortly with some game development! Feel free to drop by!
omg, why persona 5 is so good?

Forum statistics

Threads
99,155
Messages
962,412
Members
130,724
Latest member
Cryp2o
Top