$game_party.alive_members returns an array. [0] simply grabs the first of those. In this case, there is no need to test that the array is not empty, as if $game_party.alive_members were empty, everyone would be dead, and you would have gotten a gameover before this point.
I'm not sure I'm grasping your hypothetical situation correctly, so let me know if you need any changes. If we are looking for possibly multiple actors who have accessory 100 equipped and are inflicted with state 87, and we want them to use skill 190 on themselves and remove the state (so they don't keep doing it each turn), this is how I would begin (I will include comments this time) :
Code:
# grab into an array all battlers who have the accessory and are inflicted with state 87
# we should probably also only include alive members, as a dead member wouldn't be able to execute an action
members = $game_party.battle_members.select{|actor| actor.armors.include?($data_armors[100]) && actor.state?(87) && actor.alive?}
# loop through each (if none were found, the loop won't run, otherwise it will run once for each person found)
members.each do |actor|
# remove the state if we want to wait until it's added again
actor.remove_state(87)
# set up the force action - the parameters are:
# [who is forcing (0=enemy;1=actor), user id/index, skill id, target index]
@params = [1, actor.id, 190, actor.index]
# and call the Interpreter command to force the action
command_339
end
This should work, as command_339 is being called on each iteration, and will delay until the action is complete, and then it will move to the next one. So they won't all execute the actions at the same time, but in turn.
So I would test with that, and if there were errors or it didn't seem to work properly, I'd start tweaking and experimenting.
If you wanted a different actor to execute the action, there are a few ways to do it, but you'd have to decide whether it could still be the person who is the target, filter to exclude dead battlers, and cater for the possibility that the target is the only living battle member (so if you want it to be anyone
but the target, you could end up with nobody and that would be an issue). In this case, you could exclude the actor.alive? test from the array creation in the first command.
I hope that's not all too confusing for you
