How to select/attack hidden enemies?

Johnny_Ray

Villager
Member
Joined
Sep 11, 2019
Messages
23
Reaction score
21
First Language
English
Primarily Uses
RMMV
So in battle there are 3 enemies,by default 2 of these enemies are hidden if they don't have state 8(it means that this enemy is Active if it has it). and non active enemies have state 7(Inactive). I have 2 problems, one being that when the active enemy dies he has to swap with an inactive enemy as long as the inactive enemy still has hp. But since the active enemy cannot select hidden enemies he can't normally swap.I've tried doing this with scripts,switches,variables but i'm not quiet there...
EX:
var enem1 = $gameTroop.members()[0];var enem2 = $gameTroop.members()[1];var enem3 = $gameTroop.members()[2];var target;var user;
if (enem1.isStateAffected(8)) {user = enem1;let WhichEnemy = [enem2, enem3];let ChoosedEnemy = WhichEnemy[Math.floor(Math.random() * WhichEnemy.length)];target = ChoosedEnemy;} else if (enem2.isStateAffected(8)) {user = enem2;let WhichEnemy = [enem1, enem3];let ChoosedEnemy = WhichEnemy[Math.floor(Math.random() * WhichEnemy.length)];target = ChoosedEnemy;} else if (enem3.isStateAffected(8)) {user = enem3;let WhichEnemy = [enem1, enem2];let ChoosedEnemy = WhichEnemy[Math.floor(Math.random() * WhichEnemy.length)];target = ChoosedEnemy;}
if (target.isStateAffected(1) || target.hp == 0)) {if (user = enem1 && target = enem2 && enem2.hp == 0) {target = enem3;target.appear(), target.removeState(7),target.addState(8);} else if (user = enem1 && target = enem3 && enem3.hp == 0) {target = enem2;target.appear(), target.removeState(7),target.addState(8);} else if (user = enem2 && target = enem1 && enem1.hp == 0) {target = enem3;target.appear(), target.removeState(7),target.addState(8);} else if (user = enem2 && target = enem3 && enem3.hp == 0) {target = enem1;target.appear(), target.removeState(7),target.addState(8);} else if (user = enem3 && target = enem2 && enem2.hp == 0) {target = enem1;target.appear(), target.removeState(7),target.addState(8);} else if (user = enem3 && target = enem1 && enem1.hp == 0) {target = enem2;target.appear(), target.removeState(7),target.addState(8);}
} else {target.appear(), target.removeState(7),target.addState(8);}
if (user.hp == 0) { user.removeState(7),user.removeState(8),user.removeState(9),user.hide() } else { user.addState(7),user.addState(9),user.removeState(8),user.hide() };

The second problem is more of a semi-problem, as said above you cannot hit hidden enemies so how would an AOE skill make sense you ask?
<After Eval>
var min = Math.round(a.atk * 0.8);
var max = Math.round(a.atk);
var dmg = Math.floor(Math.random()*(max-min+1))+min;
var enemy = $gameTroop.members()[1];
enemy.gainHp(-dmg);
enemy.startDamagePopup();
</After Eval>

So that's all i had to say...thanks for reading.
 

JosephSeraph

White Mage
Restaff
Joined
Mar 7, 2014
Messages
1,169
Reaction score
1,417
First Language
Portuguese
Perhaps you should try to use other effects to achieve the same result? Such as adding the <untargetable> (or something) tag to State 8 (i'm sure SOME yanfly plugin does that).... But you know, mixing and matching effects with these 2 states until they do what you want to do and you don't have to edit the behavior of hidden enemies hmm
 

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

Latest Threads

Latest Profile Posts

My app store submission for Knight Bewitched 2 got rejected - I forgot that Google's not as fond of scantily clad girls as Steam is. I'll have to replace my cover art...
I have just restored the Pelican Town Community Center in Stardew Valley. Somehow I feel like I've completed a rite of passage as a gamer.
Just a heads-up that Slip into Ruby and Jump into Javascript might be a bit slow for now while I'm on the team porting the YEP plugins to VisuStella's MZ suite.
So I managed to build a teleport skill. You can see the progression in the development topic
https://forums.rpgmakerweb.com/index.php?threads/in-dev-multi-hit-target-selection.125049/

Here's how it looks:


But the real question is, can I pull off FF8?

I love these little slime battlers. Really wish I could find more animated ones :'(

Forum statistics

Threads
100,630
Messages
977,963
Members
132,249
Latest member
gothsorrowsuffer
Top