So if I followed that correctly at a quick glance, you interact with the event (the nurse) and it asks you if you want to heal. If you say no it exits out the loop, if you say yes it checks if you have 30 gold, if you don't it exits out the loop, if you do it removes it and checks if the main character is dead, if he is then it will heal him otherwise it will heal whoever is in the second party slot regardless of their health state... At least that is what it seems like you have there.
EDIT:
So I'm going off that and that alone. You can use
Tsukihime's Choice Options Script
It's plug and play so simply place it under materials and you are ready to get eventing... I've took the liberty of making an example of what a working event would look like using this script to select an actor and heal them.
What this does as an event combined with the script is when you interact with the event, it gives you choices, If Actor 1, 2 and 4 are in the party but 3 is absent it will only show 1, 2 and 4. If Actor 4 and 2 are absent but 1 and 3 are present, it will only show 1 and 3. So you will only have selections for members actually within the party and selected that choice will heal that member. Plug the script in, plug this eventing into your own and you are away.
As an added bonus if you wanted to take it to the next level. You can disable choices based on whether they are dead or not.
disable_choice(1, $game_actors[1].dead?)Though I haven't tested that, it should work... so basically you'll only see choices of Actors in the party and the ones that are not dead are will be made grey and disabled so you can see they are in your party but cannot be healed as they are not dead. Though I would imagine you would still want to heal characters with low health, even if they are not dead. But the option is there.