RMMV lunatic mode selecting state affected enemies

Lu_

Veteran
Veteran
Joined
Sep 26, 2019
Messages
41
Reaction score
14
First Language
German
Primarily Uses
RMMV
i want to create a state that when the affected actor dies damages only enemies who are affected by a certain state.
i used this so far
Code:
if (target.hp <= 0) {

  var enemies = origin.opponentsUnit().aliveMembers();

  for (var i = 0; i < enemies.length; ++i) {

    var enemy = enemies[i];

    enemy.startAnimation(107);

  }

}
but it showes the animation on every enemy and i dont know how i can specify it to the certain state affected enemies.
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
132
Reaction score
73
First Language
French
Primarily Uses
RMMV
you can use enemy.isStateAffected(ID) (ID being the state ID) as a condition inside the for loop. In it, put the animation command and any additional effect you need.
 

Lu_

Veteran
Veteran
Joined
Sep 26, 2019
Messages
41
Reaction score
14
First Language
German
Primarily Uses
RMMV
you can use enemy.isStateAffected(ID) (ID being the state ID) as a condition inside the for loop. In it, put the animation command and any additional effect you need.
so i have to do it like this?
Code:
<Custom Respond Effect>
if (target.hp <= 0) {
  var enemies = origin.opponentsUnit().aliveMembers();
  for (if (enemy.isStateAffected(25) { var i = 0; i < enemies.length; ++i } ) {
    var enemy = enemies[i];
    enemy.startAnimation(107);
  }
}
</Custom Respond Effect>
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
514
Reaction score
242
First Language
German
Primarily Uses
RMMV
JavaScript:
if (target.hp <= 0) {
  var enemies = origin.opponentsUnit().aliveMembers();
  for (var i = 0; i < enemies.length; ++i) {
       var enemy = enemies[i];
       if (enemy.isStateAffected(StateID)) {
           // add DMG effect here..inside of " if (enemy.isStateAffected(StateID)) { "
           // Example: "enemy.gainHp(-100);"
           enemy.startAnimation(107);
       } // closes the " if (enemy.isStateAffected(StateID)) { "
  } // closes the " for (var i = 0; i < enemies.length; ++i) { "
};
its what CHKNRAVE mentioned and i added an Example that can be added to dmg the enemy with -100 HP...
JavaScript:
//to be added in the Example above if needed
enemy.gainHp(-100);
 
Last edited:

Lu_

Veteran
Veteran
Joined
Sep 26, 2019
Messages
41
Reaction score
14
First Language
German
Primarily Uses
RMMV
JavaScript:
if (target.hp <= 0) {
  var enemies = origin.opponentsUnit().aliveMembers();
  for (var i = 0; i < enemies.length; ++i) {
       var enemy = enemies[i];
       if (enemy.isStateAffected(StateID)) {
           // add DMG effect here..inside of " if (enemy.isStateAffected(StateID)) { "
           // Example: "enemy.gainHp(-100);"
           enemy.startAnimation(107);
       } // closes the " if (enemy.isStateAffected(StateID)) { "
  } // closes the " for (var i = 0; i < enemies.length; ++i) { "
};
its what CHKNRAVE mentioned and i added an Example that can be added to dmg the enemy with -100 HP...
JavaScript:
//to be added in the Example above if needed
enemy.gainHp(-100);
it is working ty!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,096
Members
137,587
Latest member
Usagiis
Top