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.
$game_party.alive_members.size == 1
You can use this in a conditional branch.
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?
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.
Thanks, I think I can work with that.