Identifying alive numbers of a specific enemy in troop

Right.

So what I'm *trying* to do, is to run a common event on the condition that there are *three* ALIVE specific enemies in a troop.

For instance, let's say I have one Marshmellow and three Twinkies in a battle troop - I want to run a condition in the common event that checks if there are three alive Twinkies. In the instance that they are alive, I want these Twinkies to have a joint-attack in which all three of them combine for it.

It's rather complicated and I don't know if I'm going about it the right way. Even if I do get as far as successfully creating the condition, I'm not sure how I would suddenly add a skill to their skillset and then get them to execute it.

My train of thought here is that if I use Yanfly's Battle AI Core plugin I can prioritize a specific skill near the top, so that when it is "activated" (via the conditional check) it is first in priority order. THEN, the skill itself would have an effect that would reset the turns of the other 2 Twinkies, meaning that the enemies would only use it ONCE until one of them gets to their next turn. Yikes.

I don't really know how I would do that second part either. I hope I've been pretty clear with the rest of it.

Thoughts and suggestions?

Thanks!
Easy.

Go to Database.
Click on Troops.
If you need that on a specific battle only, make a Troops for that battle.
Choose that Troops.
Put your eyes on Battle Event.
Set it to run each turn. (Span: Turn)
Now, create a Conditional Branch, choose the third Tab, and select Enemy (Choose the enemy) and select State: KnockOut.
If you need to check for two enemies, you have to put another Conditional Branch, into this conditional branch's True branch, that will check out the second enemy.
P.S.
Make sure to call the battle using THAT Troop and not any previous. Many users forget to change that in the map or event that triggers the battle.
What a fantastic set of instructions. Thanks!

What would be the most straight forward manner in which to remove the intended skill should one of the enemies be killed?
What a fantastic set of instructions. Thanks!

What would be the most straight forward manner in which to remove the intended skill should one of the enemies be killed?

You 're welcome.

Ummm... I dont understand the question but here is a continuation on what you wanna achieve (reading your first post again)

So you set a conditional branch.
If you tick the box that has the option Create Else Branch, it will give you the opportunity to put commands for the case that the enemy.... is NOT Knocked out....
Now, you check Knockout for the first. In the else branch you add a conditional branch for the second monster.
In the else of the second conditional branch, just put a third conditional branch for the third one.
If none is dead... they unleash the ability putting commands inside the third conditional branche's Else. 😉

It's like:

If ENEMY A KO
Then
.........
ELSE:
If ENEMY B KO
Then
.........
ELSE:
If ENEMY C KO
Then
.........
ELSE:​
Set a switch named abilityON to ON
END IF
END IF
END IF

How to do that super ability...
It occurs always, calling a common event using a skill.
Go to database. Choose Skill.
(Skill > Effects> Other> Call Common Event)
in the common event you do the ability if using a conditional branch you check that the abilityON is actually ON.
Then you do the ability and set the abilityON switch to OFF.
You could also use a variable.

Let's say enemy 1 is your Marshmellow, and enemies 2, 3 and 4 are Twinkies (this sounds like a very high-calorie battle, but one I'd be happy to take part in!).

Something like this (in your troop event):
Code:
Control Variables: Alive Twinkies = 3
If Enemy 2 is affected by KNOCKOUT
  Control Variables: Alive Twinkies -= 1
End
If Enemy 3 is affected by KNOCKOUT
  Control Variables: Alive Twinkies -= 1
End
If Enemy 4 is affected by KNOCKOUT
  Control Variables: Alive Twinkies -= 1
End

If Alive Twinkies = 3
  enable skill
Else
  disable skill
End

As far as adding/removing the skill, just set it up in the action patterns, and assign a switch. Then in the logic above, turn the switch on or off depending on whether there are 3 alive twinkies. If you want to force them to use that skill as long as there are 3 alive, set the rating higher than all the other skills.

I'm not sure how you'll go about making it a "joint" attack (all 3 attack in one turn, rather than each one having their own turn) - if Yanfly's plugin already handles that, you could go that way. Or you could use a force action for one twinkie and skip turn for the other two, in the if/then/else branches above.
All 3 attack in one turn can be a called common event via the Battle event actually.
Hey guys - thanks for the feedback.

I'm going to carefully go over each of your replies and point out what I find confusing.

@Dreadshadow - your explanation is very clear, there's just one part in particular I'm not sure understand:
How to do that super ability...
It occurs always, calling a common event using a skill.
Go to database. Choose Skill.
(Skill > Effects> Other> Call Common Event)
in the common event you do the ability if using a conditional branch you check that the abilityON is actually ON.
Then you do the ability and set the abilityON switch to OFF.

You're suggesting here to use call a common event ONCE the skill has already been executed - which to me, means there could be a problem of the skill cancelling and the enemy losing a turn if the switch is not ON. Is my thiking sound here?

@Shaz - Much prefer the idea of using variables here because I'm just more comfortable with it. I also like this because it means the skill does not get used at all if the condition is not filled. Actually, there's nothing I don't understand about your answer so I'm going to go with this one.

Lastly, my idea to have the joint-attack was to CANCEL the turns of the other 2 enemies as soon as the first one uses it. So, I need some kind of method of rendering the other two enemies' turns invalid / reset them IN the contents of the actual skill. Any thoughts on this guys?
I'm afraid I don't spend much time working on battles - something I dread doing, that I know will be waiting for me when the time comes. So if my idea of force action and forcing the other two to skip doesn't work (I don't even know if you can force a skip), I'm not sure how you'd achieve it.
@Shaz - I'm going to try and force a skill that has nothing in it and see what that does. Hopefully, nothing. But I have to get this actually working properly first.

I can sort of this to work, but I feel like my lack of understanding for how Conditions and Span work in a battle event are limiting me from pulling this off the way I'd like.

The only way I've managed to get the enemies to use the skill... let's call it... Tiramisu... is when the condition is on 'Turn End' and the Span is on 'Turn'. Using battle or moment has not worked with any other conditions so far. I have no idea why.

So it's good that it will work successfully after a turn end, but that means they can't use it on the first go. Which will defeat the purpose of the skill cause the player will quickly catch on to kill one of these baddies first so they can't use the skill anymore.

EDIT: Oh wait no, rookie error. I got it. I just need to set the turn to 0 - 0. I think. The game's help message with the 'Turn' condition - I don't really understand it. I'm not seeing the pattern between the example numbers it uses.
You can hover over those options for a popup that explains what they mean (or it's probably in the help file as well).

Battle means the troop event page will only run once during the entire battle. That means if it runs once, you update the variable and do the test and it's NOT true (more than, or less than 3 are alive), that's it - it won't run the check again.
Moment means it runs continually, so could be executed several times in a single turn.
Turn is just that - it runs once each turn - this is probably the option you want.

I think 0 + 1 means it will run on turn 0, plus on every 1 turn thereafter. It's been a while since I read up on that.
Great, that last one is what I need and it seems to be working as intended. Just need to work out another way of cancelling the skills of the other enemies. Thanks very much!

Original thread: https://forums.rpgmakerweb.com/threads/identifying-alive-numbers-of-a-specific-enemy-in-troop.85060/