Run event when only one player left alive

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
I have something I want to run in a particular battle if, and only if, all actors are dead except one.  If it were a specific actor left alive, I could do that with a series of conditional branches.  However, I want this to run if it is any actor left alive.  Given the number of possible actors who might be in the battle party, and that party has 5 members, doing this by conditional branches spirals into a nightmare.


Is there a simpler way of identifying if all actors except one is dead?  I would use this on the troop page, set to 'Turn End' .


Thanks.
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
$game_party.alive_members.size == 1


You can use this in a conditional branch.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
You are a star!  Thank you so much.


EDIT


I've just realised that I should have asked a second question.


Because I want to run some dialogue, I need to know which actor it is that is alive.  Is there a a quick way of doing that?
 
Last edited by a moderator:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Yeah. The array will only have one actor in it, and they all start at 0, so:


$game_party.alive_actors[0] # The actor object




I don't like recommending this much coding, but this is what comes to mind in this situation.


actor = $game_party.alive_members[0]
$game_message.background = 0
$game_message.position = 2
$game_message.face_name = actor.face_name
$game_message.face_index = actor.face_index
$game_message.add "I'm alive!"


Those are pretty much the settings of the default message box.


EDIT


Oh, and if you're going to use control characters, use two backslashes \\C[1] with an exception for line breaks \n.
 
Last edited by a moderator:
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Thanks, I think I can work with that.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top