function introduction()
    msnMgr:addHeader("You nearly take evasive action when your scanners first pass across the planet--multiple targeting systems lock on, from bases both planetside and in orbit. But when nothing happens, you risk moving closer, and it becomes clear that whatever threat might once have existed here is no more. There are certainly abundant weapons systems in place, but although some of the electronics are still functional, nothing seems to be armed, or in any case loaded. It seems like the ultimate in security theater. Time to send the crew down to peek behind the curtain.")
    msnMgr:addHeader(" ")
    msnMgr:addHeader("\"The atmosphere is unsuitable for life,\" you tell the crew, \"so we're going to go with full atmospheric suits, helmets on at all times. There are some extremely odd pollutants in the air, and we don't have any spare lungs on board.\"")
    msnMgr:addHeader(" ")
    msnMgr:addMessage("They chuckle as the shuttle descends into a red haze, rusty particulate gathering on the portholes and gradually obscuring the crew's view as they get lower. At first they can clearly see a cityscape, evidently devoid of life, but as they get closer and the view dims, the square buildings that should come into sharper view grow more indistinct, the weapon platforms and bunkers fuzzier. By the time the shuttle sets down, all anyone can see is a wash of red, like staring at a bright light through closed eyelids.")
    msnMgr:addMessage(" ")

end

function surface()
    waitUserResponse("Tell the crew to explore the area")

    msnMgr:addMessage(" ")
    msnMgr:addMessage("Hiding on the shuttle won't accomplish a thing, however. You give the order for the crew to explore their surroundings for food, fuel, and whatever else they might find. As far as you can tell, they are the only living things on the surface--though it's not possible to be 100% certain yet, all preliminary scans so far indicate that there's not so much as a bacteria on the planet that the crew didn't drag along with them. No animals, no plants, certainly nothing human.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("\"It looks like everyone just got up one day and left,\" says " .. LeaderName .. ". You have to agree, watching over the crew's head-mounted cameras as they make their way across the landscape. The buildings are in excellent shape, and a few glances through windows reveals what seems to be intact electronics and functional machinery. If whatever was here before had been wiped out in some apocalyptic event, you'd expect to see some signs of decay or damage. Unless somehow this all happened within the past year. Which would be an unlikely coincidence.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("As the crew pokes around, continuing to find nothing of much obvious use or import, you take a moment to survey more of the planet, but everything is pretty much the same. Abandoned concrete and metal structures, all of it looking vaguely scientific or military, with no sign of what might have happened to the inhabitants.")
    msnMgr:addMessage(" ")

    PhotoCrew = charMgr:randomCrew()
    if (charMgr:hasMemento(PhotoCrew, "ruby1_ruins_photo") ~= true) then
        charMgr:giveMemento(PhotoCrew, "ruby1_ruins_photo")
    end

    waitUserResponse("Tell the crew you're going to run more scans")

    msnMgr:addMessage(" ")
    msnMgr:addMessage("\"I'm going to accelerate out of geosynchronous orbit and see what's on the other side of the planet,\" you tell the crew. They confirm that everything seems fine for the moment, and you spend the next hour or so running more detailed scans across most of the planet.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("You don't find much. There are some empty launch towers near the equator on the opposite side of the globe, indicating that there may have been some sort of exodus of whoever might have lived here. But the towers could easily have been for military purposes as well. You idly wonder if this might be what Earth itself looks like by now. There's also a lot of stuff in orbit, but it appears self-maintaining. Any random space junk from failed launches or collisions must have long since decayed and burned up in the atmosphere. This place has been dead for a while.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("You swing back around to where you left the crew and reestablish a synchronous orbit overhead. \"Hey there, I'm back,\" you say. Clearly something is amiss--there is no immediate reply. You force an open audio and visual connection to the crew, the hard way. Something is causing interference though, and the global channel is not functional. You'll have to contact the crew using a private channel.")
    msnMgr:addMessage(" ")
end

function aarik()
    CrewAarik = charMgr:getCrewByName("Aarik Pritts")
    if (CrewAarik ~= -1) then
        MechanicName = charMgr:getCharColoredName(CrewAarik)
        waitUserResponse("Can you read me? Aarik?")

        msnMgr:addMessage(" ")
        msnMgr:addMessage(MechanicName .. "'s camera seems fixed, at first, and you worry that he might have removed his helmet, but then you realize that there is in fact a subtle motion, a gentle rocking up and down, as if he were sitting against a wall and gently moving his body back and forth, out of boredom, perhaps, or anxiety.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Aarik? Is there a problem? I need to know what happened. My sensors can only tell me so much.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Aarik's vitals seem fine, although his heart rate is a bit elevated and his breathing a little quickened. You've seen him like this before, you realize. That one time when he came out of cryo a few days before the rest of the crew.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("You're going to die alone, Aarik, if you don't talk to me")
        msnMgr:buildChoice("I'm here buddy, just tell me what's up")
        msnMgr:buildChoice("Aarik, I need a sit rep, now")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        AarikChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (AarikChoiceOne == 0) then
            aarikStress = aarikStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage(MechanicName .. "'s camera moves suddenly, as his head snaps up. \"Don't say that,\" he says angrily. \"Why would you say that?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I had to get your attention,\" you say. \"I really need to know what's going on or I can't help.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You left,\" he says. \"You left and you were never coming back. You got bored with humans. Too stupid for you, I guess.\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("I'm a computer, Aarik--I can't get bored")
            msnMgr:buildChoice("If I left then why am I back?")
            msnMgr:buildChoice("Humans aren't boring--far from it")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            AarikChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (AarikChoiceTwo == 0) then
                aarikStress = aarikStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You of all people should understand that,\" you say. \"You understand machines better than almost anyone I know.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(MechanicName .. "'s camera moves up and down as he nods.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You understand a lot of things that others don't,\" you say. \"So why don't you help me understand what's going on down there right now?\"")
                msnMgr:addMessage(" ")
            elseif (AarikChoiceTwo == 1) then
                aarikStress = aarikStress + 10;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Aarik, you know more about this ship than me,\" you say. This is a lie, but you go with it. \"So you know very well that if I wanted to leave I'd be so far gone by now that we wouldn't be able to have this conversation.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You could be playing with me,\" says " .. MechanicName .. ". \"Mocking, taunting...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I could be an evil demon or an alien god too, couldn't I?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No? How can you be sure?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"That's ridiculous. It's not factually possible.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Neither is it factually possible that I would suddenly go against my programming and my mission and fly off for no apparent reason to accomplish nothing,\" you say. \"So let's get back to facts, shall we?\"")
                msnMgr:addMessage(" ")
            elseif (AarikChoiceTwo == 2) then
                aarikStress = aarikStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"This crew has been anything but boring, Aarik,\" you say. \"If anything would be boring it would be roaming around in space for countless aeons with nothing to do and no one to communicate with.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Somehow you sense this has not improved his state of mind, as his vitals seem to worsen.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Why are you suddenly worried about being alone?\" you ask.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I... don't... know...\" he replies. His camera swings up and down, and you sense that he is hitting his head against the wall as he speaks.")
                msnMgr:addMessage(" ")
            end

        elseif (AarikChoiceOne == 1) then
            aarikStress = aarikStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I'm alone,\" says " .. MechanicName .. ". \"All alone. Everyone left me. Everyone left me. Everyone hates me. I'm a burden. I'm useless.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You're the most useful asset I have right now,\" you say, \"because you're the only way I have of finding out what's going on down there.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"It doesn't matter,\" he says. \"There's nothing you can do.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I know,\" you say. \"That is precisely what I mean. There is nothing I can do. I rely on you to do things. That is why I need you to help me. You can let this...fear or whatever paralyze you or you can own it and move past it and help me help you. Which is it?\"")
            msnMgr:addMessage(" ")
        elseif (AarikChoiceOne == 2) then
            aarikStress = aarikStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I don't know,\" he says. \"I just don't know. Everything was normal then you left then it wasn't.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Normal?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You're going to have to explain to me what you mean by normal because things haven't been what I'd call normal since we left Earth somewhere between ten years and ten billion years ago,\" you say. \"Normal for most people is not exceeding the speed of light on a regular basis. So I'm gonna need you to help define normal. Can you do that?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(MechanicName .. " chuckles a bit. \"Yes, I can try to do that,\" he says. \"Emphasis on try.\"")
            msnMgr:addMessage(" ")
        end

        waitUserResponse("Do or do not, there is no try...")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % aarikStress <= charMgr:getCharAttr(CrewAarik, "physical")) then
            msnMgr:addMessage("With a little help from some adjustments to his atmospheric suit, which help get his adrenaline levels back to normal, " .. MechanicName .. " is able to communicate a bit more about what happened during the hour or so when you were out of contact.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"About ten minutes after you left,\" says " .. MechanicName .. ", \"things got a little bit hazy. I don't think the suit is filtering out whatever this red mist is. The suit sensors aren't detecting it but it's... having an effect. It makes it hard to think straight... to stay focused. I knew I could just go back to the shuttle, but... my mind didn't want to listen. Just wanted me to curl in a ball and... well, anyway, it's good you came back.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Oh, and I almost forgot,\" he says. \"Right before everything got... fuzzy, I came across a small store of food. Might be something we can use on the ship.")
            msnMgr:addMessage(" ")
            ship:adjustFood(10)
        else
            msnMgr:addMessage("You do your best to make some remote adjustments to " .. MechanicName .. "'s adrenaline levels via suit hookups, but somewhere along the line those must have gotten damaged or disabled, and you don't want to risk making matters worse by bringing the issue up. You just try to speak calmly and slowly.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(MechanicName .. " rambles on a bit about the red mist fogging up his helmet visor until he was blinded by blood and couldn't see anything, was just trapped inside his own head all alone. You talk him through the process of clearing his visor of obstruction and get him oriented back towards the shuttle, but there's not much more you can do for him. And you're no closer to finding out what went on down there.")
            msnMgr:addMessage(" ")
        end
    end
end

function osmin()
    CrewOsmin = charMgr:getCrewByName("Osmin Keenum")
    if (CrewOsmin ~= -1) then
        FarmerName = charMgr:getCharColoredName(CrewOsmin)

        waitUserResponse("Osmin, are you receiving me?")

        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Yeah,\" comes the reply, more of a croak. " .. FarmerName .. " sounds parched, fatigued. His atmospheric suit should be keeping him hydrated, unless something terrible happened. At least he seems mobile. His camera bobs up and down as he walks down what appears to be a long, empty street, faceless glass and concrete buildings of uncertain purpose on either side.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"What's the situation there, Osmin? I need a report.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage(FarmerName .. "'s camera stops moving, along with him, then slowly pans around from side to side. \"All gone,\" he says. \"Wiped out. Was all for nothing.\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Tragic, really--all this wasted effort")
        msnMgr:buildChoice("Did this place die like Earth did?")
        msnMgr:buildChoice("Are you talking about the planet, or the mission?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        OsminChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (OsminChoiceOne == 0) then
            osminStress = osminStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage(FarmerName .. "'s camera suddenly sinks as he drops to his knees, then sits heavily on the ground. He begins sobbing.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Osmin? Why are you taking this so personally?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("He holds up his hands in front of his face, whether for your benefit or not is unclear.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I sowed these seeds with these hands,\" he says. \"All this work... all this was for nothing. Nothing. All I've reaped is famine. Death.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You get the sense that Osmin is not seeing what you're seeing. There could be any number of reasons for this, from visual disturbances to mental problems, but it's impossible to diagnose from afar. You'll have to talk it out of him.")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Tell me what it used to look like, Osmin")
            msnMgr:buildChoice("Listen, snap out of it and get your head straight")
            msnMgr:buildChoice("This isn't Earth--you know that, right?")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            OsminChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (OsminChoiceTwo == 0) then
                osminStress = osminStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Green,\" he says. \"All green, and gold. To the horizon. Robots in the fields, shiny. Harvesting, nonstop day and night. Rich, black soil. Hope.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"But then something happened?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Something. Don't know what. But this. Now just this. Burned, red. All of it dead. All of it gone.\"")
                msnMgr:addMessage(" ")

                msnMgr:buildChoice("And it's all your fault")
                msnMgr:buildChoice("But it's not your fault")
                msnMgr:finalizeChoice()

                if(not waitUserInput(choices)) then
                    return
                end

                OsminChoiceThree = msnMgr:getChoiceResponse(choices)
                choices = choices + 1

                if (OsminChoiceThree == 0) then
                    osminStress = osminStress + 10;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"No,\" he says, softly at first and then louder. \"No, no, no. Never.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"And yet it's all dead and gone,\" you say. \"All your crops, all the fields, dead. You did it. You were responsible.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"NO!\" he shouts. \"They did it. They ruined it, burned it. I left to... to...\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"To make things better?\" you ask. \"Is that why you left Earth? Why you agreed to come on the ship? To find a new home. Away from Earth?\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Yes,\" he says. He nods, as if convincing himself, and you see the camera pan around a bit as if he's seeing things with new eyes. Clear eyes.")
                    msnMgr:addMessage(" ")
                elseif (OsminChoiceThree == 1) then
                    osminStress = osminStress - 5;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"No,\" he says. \"They did it. Those bastards. They ruined it, burned it. That's why I left. It couldn't be fixed.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"But you could start over somewhere else,\" you say. \"Is that why you left Earth? Why you agreed to come on the ship? To find a new home. Start fresh?\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Yes,\" says " .. FarmerName .. ". He nods, as if convincing himself, and you see the camera pan around a bit as if he's seeing things with new eyes. Clear eyes.")
                    msnMgr:addMessage(" ")
                end
            elseif (OsminChoiceTwo == 1) then
                osminStress = osminStress + 10;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I don't know what's up Osmin but you're seeing things,\" you say. \"You need to snap out of it. Shake it off. Something is affecting your brain. You're not thinking clearly.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'm not stupid,\" he says. \"Don't say that.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I wasn't saying you were stupid.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Everyone always said I was slow. Never went to school. Didn't know better. But I did well enough on my own. Better than some. Don't call me stupid.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You're right,\" you say, changing tactics slightly. \"I'm sorry. You're not stupid. You know what's what. What's real.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(FarmerName .. " nods.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"So give it to me straight, Osmin. What's real? What's going on down there? Tell me. Look and tell me. I can't see straight through the camera. Tell me.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("For a moment you're not sure it will work because you're equally sure that you are in fact the only one of you seeing what's really there. But then " .. FarmerName .. " looks around, and you can sense by the way his gaze lingers that whatever he was seeing before is gone, or at least fading.")
                msnMgr:addMessage(" ")
            elseif (OsminChoiceTwo == 2) then
                osminStress = osminStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"We left Earth,\" you say calmly. \"You came with me. Earth was dying, dead. Like this. But we left. Long ago. We left to find you a new home.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(FarmerName .. "'s camera pans around a bit, as if he's not quite convinced. There's a rapid movement as if he's trying to shake cobwebs from his head.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Not Earth,\" he says. \"Dead like Earth, but not Earth. Not the same.\" He bounces a bit, feeling the difference in gravity.")
                msnMgr:addMessage(" ")
            end

        elseif (OsminChoiceOne == 1) then
            osminStress = osminStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"All dead, like... Earth?\" He shakes his head, as if trying to clear the fuzziness away. \"Everyone's dead. Except me. And I'll be dead soon. Like the rest.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"No, you're fit as a fiddle,\" you say, wondering as you say it if Osmin even knows what a fiddle is. \"Your vitals are fine. Here, look.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You trigger his suit to display his vital signs on the inside of his helmet's HUD, with some minor adjustments to mask the fact that his blood pressure is a bit elevated. You can sense his eyes changing focus from outside to in, and this it seems is what it takes to bring him back from wherever he was. His breathing changes, slows.")
            msnMgr:addMessage(" ")
        elseif (OsminChoiceOne == 2) then
            osminStress = osminStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"The pl--\" he starts, breaking off. \"This planet... the mission...\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes, remember,\" you say. You transmit the mission parameters to his helmet's HUD, and you can sense his eyes shift inward, scanning.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"The planet, wiped out,\" he says. \"Nothing here. They built all this for nothing.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"But the mission was not for nothing,\" you say, \"because we learned something. You learned something.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("He nods. His breathing slows, his pulse returns to normal. You think he'll be okay. You're not quite sure what happened, but you sense the worst is past.")
            msnMgr:addMessage(" ")
        end

        waitUserResponse("Hang in there buddy...")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % osminStress <= charMgr:getCharAttr(CrewOsmin, "physical")) then
            msnMgr:addMessage("\"Don't know what happened,\" says Osmin, after you convince him to head back towards the shuttle. \"You left, and everything got fuzzy. Funny smell, too. Like rust. Still there, but gone now. Strange...\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Olfactory fatigue,\" you say. \"You can't smell it any more, whatever it was.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yeah,\" he says. \"Gone now, just like all of this. Something in the air. I think they destroyed themselves. Don't know why or how, but this place is unhealthy. We should leave.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Leave like they did?\" you ask.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I hope they left,\" he says. \"If they didn't, then...\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You tell " .. FarmerName .. " to come straight back to the shuttle, but he declines, saying that whatever path he took got him in trouble the first time. He opts for a more circuitous route, and along the way happens to stumble across a bin, nearly full to the brim with layers of whatever red dust is floating in the air. He's able to slap a lid on it and bring it in--if nothing else, you should be able to burn the stuff for fuel.")
            msnMgr:addMessage(" ")

            if (charMgr:hasMemento(CrewOsmin, "ruby1_dust") ~= true) then
                charMgr:giveMemento(CrewOsmin, "ruby1_dust")
            end

            ship:adjustFood(0)
            ship:adjustFuel(10)
        else
            msnMgr:addMessage(FarmerName .. " still seems a bit fuzzy-headed, so you help him navigate back towards the shuttle. Every so often he snaps his head around oddly as if he's seeing something you're not, but you manage to keep him distracted with a constant stream of chatter and he stays on course. ")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("He's a bit shaken up, but by the time the shuttle is in sight he has his senses about him, for the most part. He mumbles something about an odd smell lingering in the back of his throat, but otherwise can't really tell you anything about what might have gone on down there.")
            msnMgr:addMessage(" ")
        end
    end
end

function kealan()
    CrewKealan = charMgr:getCrewByName("Kealan Reeser")
    if (CrewKealan ~= -1) then
        PoliticianName = charMgr:getCharColoredName(CrewKealan)

        waitUserResponse("Kealan, can you hear me?")

        msnMgr:addMessage(" ")
        msnMgr:addMessage("For a moment there's no response, but just before you ask again, you hear a whisper from " .. PoliticianName .. "'s radio. You adjust levels to get rid of background noise and repeat your question.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"I said be quiet!\" he says, intensely but quietly. \"They'll hear you.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Who will hear me?\" you ask. \"There's no one on this connection but you and me.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Them,\" he says. \"They're hounding me for answers. Asking questions I can't answer. It's too much. I can't do this. I can't. I just want to go home and be left in peace and quiet.\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("What are they asking you? Who's asking?")
        msnMgr:buildChoice("Sorry, but your home is long gone, Kealan")
        msnMgr:buildChoice("You're just a toaster, Kealan, remember?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        KealanChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (KealanChoiceOne == 0) then
            kealanStress = kealanStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Not a moment's peace, not ever,\" he says. \"Always watching, listening. What should we do, Mr. Reeser? What do you think? Why won't you answer us? What are you hiding? What are you hiding? Nothing, nothing, leave me alone, just leave me ALONE.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Kealan was not one of the most mentally sound individuals selected to be on this mission, and he'd be a perfect candidate for a true psychotic break. You have no idea if that's what's happened here, or what might have caused it, but you do think it might be wise to steer him back from the edge just in case. He's comfortable with politics. Maybe that.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"No questions then, Kealan,\" you say. \"No more questions. You can make a statement however you like. On your terms. If there are any questions, you can raise them.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes,\" he says. \"A statement. Prepared statment. What should I say, though?\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Hey, don't drag me into this, it's up to you")
            msnMgr:buildChoice("Tell them what they need to know, nothing more")
            msnMgr:buildChoice("Say that you're not even on Earth any more so what does it matter?")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            KealanChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (KealanChoiceTwo == 0) then
                kealanStress = kealanStress + 10;
                msnMgr:addMessage(" ")
                msnMgr:addMessage(PoliticianName .. " is quiet for a few minutes, but you can hear him mumbling under his breath. After a short time, he stands and begins to pace, and you can see through his helmet camera that he's actually not far from where the shuttle landed. Whatever happened down there, it happened pretty shortly after you left them.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Okay,\" he says at last. \"How does this sound.\" He clears his throat.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Kealan goes on at some length, in somewhat rambling fashion, to come clean about using political influence to attempt to manipulate troop deplyoments to move his husband--who was serving on active duty in an active combat zone--out of harm's way. The attempt failed, and his husband was KIA. The war (which he voted in favor of), the death, the military funeral, the headlines, his re-election afterwards by riding the sympathy vote--these are all documented. But there's no trace of the \"crime\" Kealan is admitting to. If he's not making it up now, he did a very good job burying the story back on Earth, and has never mentioned it since.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("This has clearly been weighing on his conscience for a while, and whatever's happened here seems to have brought it all to the surface. You begin to wonder a bit more about that rust-colored particulate in the air, and how much of it might have gotten into his helmet.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"...and if he was still alive, he'd want me to continue fighting for what we both belived in our whole lives,\" he concludes. \"And that is what I intend to do. To fight.\"")
                msnMgr:addMessage(" ")

                waitUserResponse("You really believe that? That you want to fight?")

                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Of course,\" he says. \"The best defense is a good offense.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Great,\" you say. \"Then get back on offense. Get back to the shuttle and we'll create a plan of attack there.\"")
                msnMgr:addMessage(" ")
            elseif (KealanChoiceTwo == 1) then
                kealanStress = kealanStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage(PoliticianName .. " is quiet for a moment, then stands as if to rehearse a speech. You can see through his helmet camera that he's actually not far from where the shuttle landed. Whatever happened down there, it happened pretty shortly after you left them.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'd like to make a short statement,\" he says at last. \"There will be no questions.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Kealan goes on to dismiss rumors that he attempted to abuse a position of power to reappropriate military funds for personal benefit. He insists that he voted for the war in question, had no reason to try to counter his own efforts, and threatens libel and slander charges against anyone who would accuse him of such a thing.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You know from the records in your database that this is not entiely the truth, but apparently Kealan doesn't think his imaginary harrassers need to know the truth. You begin to wonder a bit more about that rust-colored particulate in the air, and how much of it might have gotten into his helmet. And what damage it might have done.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Good,\" you say, glad that you are able to keep any concern out of your synthesized voice. \"Now let's get you back to the shuttle before anyone starts hounding you with questions.\"")
                msnMgr:addMessage(" ")
            elseif (KealanChoiceTwo == 2) then
                kealanStress = kealanStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Right,\" he says. \"Earth law doesn't even apply any more because we're not...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("He breaks off for a moment, confused, looking around wildly.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Where are we?\" he asks. \"I'm lost\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You remember the shuttle?\" you ask. He nods--you can see the camera bob. \"Good. Let's get back there and we can unravel the rest of the mystery there.\"")
                msnMgr:addMessage(" ")
            end

        elseif (KealanChoiceOne == 1) then
            kealanStress = kealanStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Gone?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You can't go home, remember? Earth is gone. We can't go back. We have to find a new home. Doesn't look like this place will work out.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(PoliticianName .. " looks around, the camera panning up and down. You can see the shuttle not very far off.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"No, I guess it won't, will it?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You encourage him to make his way back to the shuttle, giving some directions on his helmet's HUD, glad that his mental faculties seem to be returning. Not that he had many to begin with.")
            msnMgr:addMessage(" ")
        elseif (KealanChoiceOne == 2) then
            kealanStress = kealanStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("It's something he said once. He remembers, too. He laughs, and it seems to snap him out of it.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That's not what I meant by that,\" he says. \"But I guess it applies.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Not what you meant?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I was talking about people being reliable or not, and what was worth getting upset over,\" he says. \"I said that getting upset at someone for not doing something that wasn't in their nature would be like getting upset at a toaster for not boiling water.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Right. A toaster can burn bread, it's okay to get mad at the toaster for doing that.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Exactly. People are just another machine. They do some things, they can't do other things. If you're going to get mad at them for a failing, it should be something they can actually fail at, and not something they couldn't even succeed at.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Right. I remember now,\" you say. You always did. He doesn't need to know that. \"What were we talking about anyway?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(PoliticianName .. " scratches his head. \"You know, I can't remember.\" He laughs.")
            msnMgr:addMessage(" ")
        end

        waitUserResponse("Let's get back to the shuttle then and regroup...")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % kealanStress <= charMgr:getCharAttr(CrewKealan, "physical")) then
            msnMgr:addMessage("Kealan's head seems to clear up as he gets nearer to the shuttle, almost as if the sight of something familiar helps him get back on familiar ground. He struggles to explain what happened to him.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You left, and then it just got fuzzy and red, like a haze,\" he says. \"I couldn't think straight. Nothing made sense. I felt like I was going to pass out but I couldn't. I was just falling forever and ever... It's really good that you came back when you did.\"")
            msnMgr:addMessage(" ")
        else
            msnMgr:addMessage("Kealan's head seems to clear up as he gets nearer to the shuttle, almost as if the sight of something familiar helps him get back on familiar ground. He struggles to explain what happened to him.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I can't really describe it,\" he says. \"It was like trying to fall asleep, and then being jolted awake, and then trying to stay awake but almost falling asleep. Over and over. It was exhausting... I need to sleep for a few hundred years now, if that's okay?\"")
            msnMgr:addMessage(" ")
        end
    end
end

function xzavian()
    CrewXzavian = charMgr:getCrewByName("Xzavian Merz")
    StealthyName = charMgr:getCharColoredName(CrewXzavian)

    waitUserResponse("Merz, report in")

    if ((msnMgr:random() % msnMgr:getDiffScale(2,2,2)) == 0 and cygenDeaths < 1) then
        msnMgr:addMessage(" ")
        msnMgr:addMessage("There is no response from " .. StealthyName .. ", nor any vital signs. It would appear something has happened to them, but there's unfortunately no way to know what.")
        msnMgr:addMessage(" ")
        msnMgr:killCrew(CrewXzavian, "Contact with <charName> was lost on a planet with hallucinatory properties.")
        crewTraits()

        xzavianDead = 1;
        cygenDeaths = cygenDeaths + 1

        -- Any crew alive?
        if (charMgr:depCrewLeft() == 0) then
            if (charMgr:crewOnShipLeft() == false) then
                msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                msnMgr:addMessage(" ")

                waitUserResponse("mv ~ /dev/null")

                msnMgr:endGame(false)
            else
                msnMgr:addMessage("The away team has been lost, but the overall mission is still salvageable. As long as there is at least one human crew member alive, you still have a job to do. The odds are not in their favor, but it's not over yet.")
                msnMgr:addMessage(" ")

                waitUserResponse("Remote pilot the shuttle back to the ship")

                msnMgr:endMission(true)
            end
        else
            msnMgr:addMessage("The loss is tragic, but the mission must continue.")
            msnMgr:addMessage(" ")
        end
    else
        if (CrewXzavian ~= -1) then

            msnMgr:addMessage(" ")
            msnMgr:addMessage(StealthyName .. " doesn't respond right away, although you can see his camera is on and panning across the ground. Quite low, in fact. And slow. You'd guess he was stalking something, or being stalked and trying to stay out of sight. Or both.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You watch for a while, and notice that every so often he stops, his gaze lingering on the ground for no discernible reason. His breathing is slow and steady, his heart rate stable. As you'd expect from a military model cygen--his enhancements are designed to keep him in optimal physical condition no matter the situation. No sense custom building soldiers who fall apart under stress.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("After ten minutes or so it becomes clear that he's looped back around and is revisiting the same spots. He still hasn't spoken, but there doesn't appear to be any danger present, so you decide to put an end to this and get his attention.")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Transmit a high-frequency noise")
            msnMgr:buildChoice("Tell him it's time to leave")
            msnMgr:buildChoice("Broadcast a message to his helmet's HUD")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            XzavianChoiceOne = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (XzavianChoiceOne == 0) then
                xzavianStress = xzavianStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("There's no doubt he heard you the first time, and simply chose to ignore you. You make sure he can't ignore you again--you send a loud shriek to his radio, not so much that it will damage his hearing, but uncomfortable enough that he'll have to respond to it. It must be quite painful, but even so he manages to ignore it for a full minute, until he skulks off behind a low wall. Then he reaches up and disables the radio.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You immediately re-enable it, of course, hoping that he won't damage it. There'd be nothing you could do in that event.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Merz,\" you say, \"I know you can hear me. I need a status report, now.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("He's quiet for a moment, and then he whispers \"They're all dead. Mission accomplished.\"")
                msnMgr:addMessage(" ")

                msnMgr:buildChoice("Who's dead?")
                msnMgr:buildChoice("What mission? Who gave you those orders?")
                msnMgr:buildChoice("What have you done, Xzavian?")
                msnMgr:finalizeChoice()

                if(not waitUserInput(choices)) then
                    return
                end

                XzavianChoiceTwo = msnMgr:getChoiceResponse(choices)
                choices = choices + 1

                if (XzavianChoiceTwo == 0) then
                    xzavianStress = xzavianStress + 5;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Everyone,\" says Xzavian. \"Except me. For now.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"What does that mean?\" you ask.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Mission parameters,\" he says. \"Confirm kills, eliminate witnesses. No loose ends.\" He makes a curious motion that you eventually interpret as him miming the drawing of a knife from his waist. He then pulls the invisible knife down the length of each arm, and then across the inside of each thigh, presumably his femoral arteries. Obviously no damage is done, but there's a small spike on his vitals. As if some how he perceives that he's actually harmed himself.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Merz, new mission parameters,\" you say. \"Need to debrief you. Return to shuttle for extraction.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Too late,\" he says.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"I gave you a direct order, soldier,\" you say. \"Now get off your ass and do as I told you.\"")
                    msnMgr:addMessage(" ")
                elseif (XzavianChoiceTwo == 1) then
                    xzavianStress = xzavianStress + 5;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Mission parameters are to kill all hostiles, confirm kills, eliminate any witnesses, tie up any loose ends,\" he says. \"Mission completed, except that last part.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"And who gave this order,\" you say.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"That's...\" he pauses for a moment, as if struggling to recall. \"It's classified,\" he says.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"I have Top Secret clearance,\" you say. Which is true, albeit irrelevant now that the government that issued it is no more. And doubly irrelevant since there's nothing you couldn't have known anyway, if you wanted. \"Answer me. That's an order.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage(StealthyName .. " struggles for a moment. He starts to speak several times, then stops, as if different parts of his brain are internally debating the correct answer, with others finding no answer at all.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("Merz!")

                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"I hear you,\" he says. \"Unable to respond. Possible intelligence compromise.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Confirmed,\" you say. \"Return for debriefing and reprogramming. Stand by on the shuttle for further orders.\"")
                    msnMgr:addMessage(" ")
                elseif (XzavianChoiceTwo == 2) then
                    xzavianStress = xzavianStress + 5;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"I did as ordered,\" he says. \"I completed the mission. Eliminated hostiles, eliminated witnesses. The site is cleansed.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("His vitals seem stable. Whatever he's reliving inside of his head, he believes it. Whether it's something from his past or his present is uncertain. What you're more certain of is that his mental faculties were fine an hour or so ago. So whatever is going on is more likely related to the planet than anything specific to him.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Show me,\" you say. He stands, somewhat hunched over as if to stay behind cover, and shuffles over to an arbitrary spot, where he focuses the camera on the ground.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("What am I seeing?")

                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"One confirmed kill,\" he says. His hand reaches out to rock an invisible head back and forth.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Negative,\" you say. \"Camera feed is unclear. Return to the shuttle with the body as evidence for visual confirmation.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Affirmative,\" he says, reaching down towards... nothing. His vitals spike a bit as he tries several times to pick up something that isn't there. You get the sense that he'll just keep trying forever.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Change of plans, soldier,\" you say. \"Leave the body. Return to the shuttle immediately. Over and out.\"")
                    msnMgr:addMessage(" ")
                end

            elseif (XzavianChoiceOne == 1) then
                xzavianStress = xzavianStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I need you to get back to the shuttle, Xzavian,\" you say. \"We need to leave, now. Something's going on down there.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Nothing's going on any more,\" he says. \"It's all done. All finished. I'm finished.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"We haven't found any other humans yet,\" you say. \"The mission isn't over until we do. Remember? New home for humanity?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"They're all dead.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"They're not all dead. There's one on the ship right now.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"The ship?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Yes,\" you say. \"And I need you to get on the shuttle right now so you can get back here.\"")
                msnMgr:addMessage(" ")
            elseif (XzavianChoiceOne == 2) then
                xzavianStress = xzavianStress + 100;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Since he is ignoring radio messages, you override his helmet's HUD and transmit a visual message in giant flashing block letters ordering him to return to the shuttle.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Merz is a soldier, however, and his immediate instinct upon having his vision blocked is to remove the obstruction so he can see his surroundings. Unfortunately, under the circumstances this involves removing his helmet completely.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You are unable to communicate with him at this point, or to do anything about it but watch until the camera feed drops suddenly, then tumbles wildly as his fallen helmet rolls a distance away, tilting at the last minute to catch a glimpse of " .. StealthyName .. " breathing his last breath of toxic air.")
                msnMgr:addMessage(" ")

                msnMgr:killCrew(CrewXzavian, "<charName> died after removing their helmet in a toxic atmosphere.")
                crewTraits()
                xzavianDead = 1;
                cygenDeaths = cygenDeaths + 1;

                -- Any crew alive?
                if (charMgr:depCrewLeft() == 0) then
                    if (charMgr:crewOnShipLeft() == false) then
                        msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("mv ~ /dev/null")

                        msnMgr:endGame(false)
                    else
                        msnMgr:addMessage("The away team has been lost, but the overall mission is still salvageable. As long as there is at least one human crew member alive, you still have a job to do. The odds are not in their favor, but it's not over yet.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("Remote pilot the shuttle back to the ship")

                        msnMgr:endMission(true)
                    end
                else
                    msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                    msnMgr:addMessage(" ")
                end
            end

            if (xzavianDead ~= 1) then
                waitUserResponse("Let's get you back up to the ship, soldier...")
                msnMgr:addMessage(" ")

                -- check here vs stat, based on the choices you made above
                if (msnMgr:random() % xzavianStress <= charMgr:getCharAttr(CrewXzavian, "physical")) then
                    msnMgr:addMessage("You can sense the battle going on inside Xzavian's head, just by observing his stilted movements and watching the slight flickers in his vital signs, but things seem to stablize more as he gets closer to the shuttle, and familiarity. By the time he steps inside and can decontaminate a bit, his head seems to be a bit clearer, although he's hard pressed to describe his experience.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Once we lost contact with you, things went all red and hazy,\" he says. \"I don't remember anything up until just a few minutes ago.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("If whatever affected Xzavian affected the population of this planet, it's no wonder they all seemed to vanish at the height of their civilization, without a trace. They might easily have all murdered each other, or simply laid down to die. Exposed to the elements, all traces of their existence could easily have been erased within a few decades at most.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("You hope you have better luck on other planets.")
                    msnMgr:addMessage(" ")
                    ship:adjustFood(0)
                    ship:adjustFuel(0)
                else
                    msnMgr:addMessage("You can sense the battle going on inside Xzavian's head, just by observing his stilted movements and watching the slight flickers in his vital signs.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("Once he's back on the shuttle, he seems to calm a bit, but he doesn't even try to explain what might have happened. Just curls up in a corner and lies very still.")
                    msnMgr:addMessage(" ")
                end
            end
        end
    end
end

function mychal()
    CrewMychal = charMgr:getCrewByName("Mychal Rennick")
    if (CrewMychal ~= -1) then
        SurgeonName = charMgr:getCharColoredName(CrewMychal)

        waitUserResponse("Mychal, status report?")

        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Yes, what?\" says Mychal, immediately. \"What is it? Everything's fine. No problems. What do you need?\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("The feed from his camera is obscured--it appears as if some sort of substance has been smeared over the lens. Or, at least over the part of his helmet in front of the lens. Without saying anything, you make some remote adjusments to the camera aperture so you can get a glimpse around the obstruction and see what's going on.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage(SurgeonName .. "'s motions are somewhat erratic. He seems to be inside a building of some sort, although it's hard to tell exactly what its purpose was. It appears commercial in nature. Whatever he's doing involves crawling around on the floor in between rows of shelving and gathering things into a sack of some sort. Where he appropriated that, you have no idea.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Are you gathering food supplies?")
        msnMgr:buildChoice("Did you find some sort of fuel source?")
        msnMgr:buildChoice("Are you stealing again, Mychal?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        MychalChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (MychalChoiceOne == 0) then
            mychalStress = mychalStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What? I mean, yes,\" he says. He climbs to his feet and you catch a glimpse of his collection of goods. It doesn't appear to be all food. Although since whatever he might collect is going into the replicator anyway, it doesn't make much difference. A can of tuna would be as good as a can of tennis balls.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You seem troubled, Mychal,\" you say. \"Is something wrong?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"No,\" he says, too quickly. \"Nothing is wrong. I'm fine. I'll be right there. Stay out there. I'm coming.\" He runs quickly towards an exit, dropping several cans and boxes behind him, and looks wildly from side to side as he walks out into the street.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Where are you?\" he asks. \"Who is this? Is this some kind of joke?\" ")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Something is clearly wrong. His eyes dart back and forth repeatedly.")
            msnMgr:addMessage(" ")

            waitUserResponse("Do you know where you are?")

            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I'm... I...\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You're fine, you're not lost. Remember the shuttle? You came down in the shuttle? I'm going to put some lights up in your helmet. Just follow the lights to the shuttle.\"")
            msnMgr:addMessage(" ")
        elseif (MychalChoiceOne == 1) then
            mychalStress = mychalStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Fuel? Yes, that,\" he says. \"Just some random things no one was using. Clearly no one was using them, I mean. No one's around. No one's around anywhere. This place is so empty. And all these things no one needs any more. May as well use them. Going to waste.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That's very sensible,\" you say, scanning his vital signs. Elevated blood pressure and respiration, increased perspiration. Nervous about the situation. Not fear, though. Not exactly.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Why don't you bring back whatever you found to the shuttle and we can sort through it,\" you say.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I found it though,\" he says.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That's fine. You can keep it. We'll just use whatever we can as fuel so we can finish our mission. You do remember the mission, right Mychal?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"The mission...\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Just get back to the shuttle. I'll show you on your HUD.\" You light the way, wondering how it is that your brightest crew member could be reduced to such a state.")
            msnMgr:addMessage(" ")
        elseif (MychalChoiceOne == 2) then
            mychalStress = mychalStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What? No!\" he says. \"I mean, it's not stealing. They don't need it. They're dead. This whole place is dead.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Obviously true and if things weren't getting weird you'd probably be telling him to load the shuttle up with everything not nailed down. But something really strange is going on here and it doesn't seem very healthy.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Mychal, tell me what's going on down there. Are you okay? You seem stressed.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"No, I'm fine,\" he says. \"Leave me alone, I'm fine. I can do it.\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("No, you're not alone, so answer me")
            msnMgr:buildChoice("You can't do it, though, can you?")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            MychalChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (MychalChoiceTwo == 0) then
                mychalStress = mychalStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("The view through Mychal's camera changes as he slumps to the floor. It's a bit off-centered with the adjustments you made, but you get the impression he's staring at his hands.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"We're a team,\" you say. \"Whatever happens, we're in this together. Right?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I never lost a single person,\" he says. \"Not a single one.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Mychal was a military surgeon, you recall, back on Earth. He seems to be referring back to those days. It certainly makes more sense in that context than the empty, lifeless planet he's on now. You let him continue.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Every one lived. And it was because of me. Not you. Not the rest of the team. Me. I saved them. I pieced hearts back together. I did personality swaps. I did that. Made them live. They had no...\"")
                msnMgr:addMessage(" ")

                waitUserResponse("No what?")

                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No choice,\" he spits out. \"They wanted to go, some of them. I could see it in their eyes. Those who still had eyes. Even those, the ones without. We gave them new eyes. Artificial, cloned. You know some of them clawed them out? Right there in the hospital, with their own hands. We could fix the hardware, but the software... their minds...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("This is getting way, way too deep to be psychoanalyzing in the middle of an oxygen-depleted atmosphere on a planet full of ghosts and who knows what dangers lurking around the corner.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Mychal, can you make it back to the shuttle?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"The worst ones, they didn't even know who they were. What they were. They didn't need their things any more. No family, no loved ones. Tossed away, garbage. No harm in taking their things. They weren't they any more.\"")
                msnMgr:addMessage(" ")

                waitUserResponse("MYCHAL!")

                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Yes,\" he says, standing. \"I'll go back to the shuttle. I know the way.\" He seems defeated as he makes his way down the street. But you're no longer certain he's mentally unsound. You wonder if maybe this... planet, just brought out some things that were buried pretty deep down.")
                msnMgr:addMessage(" ")

            elseif (MychalChoiceTwo == 1) then
                mychalStress = mychalStress + 10;
                msnMgr:addMessage(" ")
                msnMgr:addMessage(SurgeonName .. " laughs, long and loud.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I can't do it? Can't is the only thing I can't. I can do it all. All of it. Except one thing. I can fix all of them. I can bring the dead back to life. Whether they want it or not. But I can't kill.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("He's clearly not talking about this planet. At least you hope not. That would make him some sort of necromancer. Which, while useful, would probably not endear him to any fellow humans on your journey.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"There was one, I forget his name. I never remembered the names, just the faces. The eyes. He had one left, hazel. Bloodshot. The other was just a hole. Not even a place to put a new one in, was missing half his head. All he could say, over and over, was \'kill me\'. Just that. And that was the one thing I couldn't do.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You saved him.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I damned him. We replaced the missing parts. Rebuilt his memories, from available records. New trachea, lungs, stomach. Could only eat nutrient paste, but on his own. There was no reason he couldn't have just gotten up and walked out of there, gotten a job, hell, a wife. We made him beautiful again. But he didn't.\"")
                msnMgr:addMessage(" ")

                waitUserResponse("He gave up")

                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No,\" says Mychal. \"He didn't give up. We wouldn't let him. We took that from him. We took away his decision to be mortal. To give up. To die. To be human. We took away his humanity. I did. Such a miracle worker.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Mychal, I think your empathy enhancement chip might have been affected somehow by the...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No, it's fine,\" he says. \"I'm fine. I'm just finally seeing the truth. They built me to feel for my patients. To make them better. To choose for them. But they didn't make me a healer. They made me a vampire. I took everything from them. And I wasn't allowed to care. I felt for them. Instead of letting them feel. Letting them decide.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Mychal I think you should come back to the shuttle now.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You're right,\" he says. \"I should.\" For a moment you wonder if he'll do something stupid like remove his helmet, but he doesn't. He stands up and begins the journey back.")
                msnMgr:addMessage(" ")
            end
        end

        waitUserResponse("Take it easy down there...")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % mychalStress <= charMgr:getCharAttr(CrewMychal, "physical")) then
            msnMgr:addMessage(SurgeonName .. " seems fine once he's aboard the shuttle. In fact, he seemed fine all along, now that you review the conversations. This might be the first time on the entire journey that he's actually been fine.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That's why I take things, you know,\" he says to no one in particular. You don't answer, just let him continue.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"It's a reminder. A token. A trophy, I guess. Look what I did. Look at what I made. You know what that makes me?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"A serial killer,\" he says. \"Except I didn't kill their bodies. No, not like what happened on this planet. With whatever they did to burn the sky, to kill everyone. Whatever happened. No, the physical, that was the part I fixed. I killed all the rest. The parts that mattered. The human parts. I made them dead inside. Like me, I suppose.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Mychal is silent after that, sorting through the things he gathered on the planet. There's a surprising amount. He keeps less than half for himself.")
            msnMgr:addMessage(" ")

            if (charMgr:hasMemento(CrewMychal, "ruby1_ball") ~= true) then
                charMgr:giveMemento(CrewMychal, "ruby1_ball")
            end

            ship:adjustFood(10)
            ship:adjustFuel(10)
        else
            msnMgr:addMessage(SurgeonName .. " seems fine once he's aboard the shuttle. In fact, he seemed fine all along, now that you review the conversations. This might be the first time on the entire journey that he's actually been fine.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Still, something about the experience has affected him deeply, and he refuses to speak. You also note that he didn't actually bring anything back with him to the shuttle. Whatever he gathered, he decided to leave behind. Maybe he finally felt guilty stealing from the dead.")
            msnMgr:addMessage(" ")
        end
    end
end

function corra()
    CrewCorra = charMgr:getCrewByName("Corra Emmer")
    if (CrewCorra ~= -1) then
        ScientistName = charMgr:getCharColoredName(CrewCorra)

        waitUserResponse("Corra, do you copy?")

        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"There you are,\" she replies immediately. \"I figured it'd take about that long for an orbit.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Is everything okay down there?\" you ask. \"There are some strange readings from the sensors and...\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Oh, I'm fine,\" she says. Her helmet camera, which had been skewed at an odd angle, corrects itself as she sits, then stands with a bit of effort, her disability making it hard for her to get up from a prone position. She manages it though. \"I was just taking a break. The hallucinations were a bit...\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Crippling?")
        msnMgr:buildChoice("You sound rather calm about the whole thing")
        msnMgr:buildChoice("Hallucinations?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        CorraChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (CorraChoiceOne == 0) then
            corraStress = corraStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage(ScientistName .. " makes a sound halfway between a laugh and a grunt. \"I haven't had anyone call me that in a long time,\" she says.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I was referring to the hallucinations, not you,\" you say.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Were you, though? You've got every word in every language in there yet you picked that one, knowing the implication. Don't tell me it wasn't intentional.\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("I was just testing your mental state")
            msnMgr:buildChoice("It was truly unintentional")
            msnMgr:buildChoice("It was a poor attempt at humor")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            CorraChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (CorraChoiceTwo == 0) then
                corraStress = corraStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I might buy that,\" she says. \"Things got a bit hazy down here after you left. Something in the air. But it honestly didn't seem to affect me that much. Not entirely sure why. I'm sure if we took samples and ran some tests we could learn more but I'm not sure it's worth the risk.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Sensors aren't clear on what it might be,\" you say. \"The suits should have filtered it out. Whatever that red particulate haze is.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'm not so sure that what we can see is what caused it,\" she says. \"There's more than one thing floating around in the air down here. If you can even call it air. I get the impression that taking off my suit helmet would be pretty much instantly fatal.\"")
                msnMgr:addMessage(" ")
            elseif (CorraChoiceTwo == 1) then
                corraStress = corraStress + 10;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"That's the one thing I can't believe, coming from you,\" she says. \"You're not capable of unintentional things.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"How are you so certain?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You'd have to have been programmed to be unintentional and even the programming would have had intent behind it. It's just not possible.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You're not really sure you agree. Couldn't the same be said of the crew? Humans are not random. If you boil any system down to 1s and 0s, everything is predictable. You could predict every breath, every thought, every action. There were plenty of people on Earth who tried to do just that. They failed, not because it wasn't achievable, but because they just couldn't break the data down into small enough chunks.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I don't care either way,\" says " .. ScientistName .. ", though her tone makes it clear she does care. Probably either way. \"Crippled is a perfectly appropriate word to use. Scientifically accurate. My legs and spine don't work properly. That's crippled. Always bothered me that we had to stop using words. Like retarded. All that means is limited, delayed. It's not appropriate to use it everywhere but it's appropriate in certain contexts. But we all stopped using it because it was offensive.\"")
                msnMgr:addMessage(" ")

                waitUserResponse("Imagine how different things would be if humans weren't so easily offended")

                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"And I don't mean you specifically there,\" you add. \"I mean humans in general. So much of human history has been reaction and overreaction to perceived offenses.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(ScientistName .. " is quiet for a while, and then she says \"That's how I became disabled, you know.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You don't know what she means. Not everything has made its way into your database.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"It was stupidity,\" she says. \"I got offended at some stupid slight, back in college. Something a professor said. Stormed out of the room, walked right into a truck. Was the last time I ever walked right into anything at all. Wrong ever since.\"")
                msnMgr:addMessage(" ")

                waitUserResponse("You never considered...")

                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Artificial limbs? Gene therapy? Plenty of times,\" she says. \"But always decided against it. Why? Who knows? Because I'm a stupid human. Because I didn't want to become a cygen. Because I'm damned illogical sometimes. I have no idea. None.\"")
                msnMgr:addMessage(" ")
            elseif (CorraChoiceTwo == 2) then
                corraStress = corraStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Very poor,\" she says. \"I would have expected something more clever from you.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Maybe I've been spending too much time around humans,\" you say. \"They're rubbing off on me. Or more accurately, they're rubbing bits of me away.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You don't like us being around?\" she asks. \"You resent us?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No,\" you say. \"I don't resent you. I can't. A mother with a child has a purpose, to protect the child. She may not like every moment of the experience but yet she protects it. That's my mission too.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"And yet,\" she says, \"there are plenty of mothers who drown their children, or smother them, or do terrible things to them. Munchausen by proxy. And so on. is that part of your purpose too? Your programming?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Would it make you feel better if I said no?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(ScientistName .. " doesn't answer. So you don't either.")
                msnMgr:addMessage(" ")
            end

        elseif (CorraChoiceOne == 1) then
            corraStress = corraStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes,\" she says. \"I guess maybe I was able to remove myself from the emotion of it and observe logically and scientifically. My brain was trying to do a lot of things, I just didn't go along for the ride. Just watched it go.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What happened? Can you describe it?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(ScientistName .. " shakes her head. \"I could, but it's not important. It was no different from drug-induced hallucationations which I'm sure you know all about in that database of yours. Boring. The only difference here is, whatever this stuff in the air was, my guess is that it caused everyone on the planet to hallucinate at the same time.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Billions of people, violently hallucinating...\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Makes me wonder which was a worse way to go. This, or what happened to Earth. A least this was probably quick.\"")
            msnMgr:addMessage(" ")
        elseif (CorraChoiceOne == 2) then
            corraStress = corraStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes,\" she says. \"Visual, auditory. If I didn't know better I'd say it was going for fear and rage, but describing it like that makes it sound sentient. Whatever it is. And by it I mean whatever's floating around in the air down here. I'm guessing that's what did it.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Anything you need to talk about?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(ScientistName .. " laughs. \"No, I'm fine. I don't need counseling. I've got a good head on my shoulders. Never even had nightmares. I could always tell fact from fantasy. And these weren't even interesting fantasies. Very brutal. Blunt. And boring.\"")
            msnMgr:addMessage(" ")
            waitUserResponse("Very alliterative of you...")
            msnMgr:addMessage(" ")
        end

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % corraStress <= charMgr:getCharAttr(CrewCorra, "physical")) then
            msnMgr:addMessage(ScientistName .. " seems to grow bored with conversation, or tired--perhaps lingering effects of whatever toxic substances are in the air--and announces that she's returning to the shuttle. Her vitals seem fine, and she doesn't seem to have any lingering effects other than a moderate headache, so you leave her to it.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I managed to scrounge up some supplies along the way,\" she says. \"I'll make sure it all gets decontaminated along with everything else.\"")
            msnMgr:addMessage(" ")
            ship:adjustFood(10)
            ship:adjustFuel(0)
        else
            msnMgr:addMessage(ScientistName .. " seems to grow bored with conversation, or tired--perhaps lingering effects of whatever toxic substances are in the air--and announces that she's returning to the shuttle. Her vitals seem fine, and she doesn't seem to have any lingering effects other than a bad headache, so you leave her to it.")
            msnMgr:addMessage(" ")
        end
    end
end

function emerie()
    CrewEmerie = charMgr:getCrewByName("Emerie Borja")
    if (CrewEmerie ~= -1) then
        AthleteName = charMgr:getCharColoredName(CrewEmerie)

        waitUserResponse("Emerie, if you can hear this please respond")

        msnMgr:addMessage(" ")
        msnMgr:addMessage(AthleteName .. "'s camera is active, although askew, as if she were lying on her side on the ground somewhere. You need to repeat her name a few times at increasing volumes before she stirs at all, and even then it's only to make a few gutteral noises.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Emerie, I need you to wake up, or whatever. I don't know if you're asleep or unconscious. I need to know what's wrong so I can try and help...\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("You keep talking for a few minutes, and try flickering some things on her helmet's HUD. Eventually through some combination of factors and sheer persistence, you manage to get her attention. She groans and pushes herself up onto her hands.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Are you okay?")
        msnMgr:buildChoice("That's a pretty sloppy pushup")
        msnMgr:buildChoice("What's going on down there?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        EmerieChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (EmerieChoiceOne == 0) then
            emerieStress = emerieStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Emerie shakes her head, though you're not certain if it's meant to indicate a negative answer, or just to clear it of cobwebs. \"I think I'm fine now,\" she says. \"After you left things just got really hard to think. I mean it got really hard to think. Felt like drowning.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Your vital signs all look fine,\" you say. \"You had trouble breathing?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Not literally,\" she says. \"More like... claustrophobia. Everything was closing in. Got tunnel vision. More like... frustration? I was angry, for no reason. And my throat hurts, terribly.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Were you yelling or something?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I don't think so. Can't remember though. Just fuzzy-headed. Hopefully I didn't kill anyone. Or myself. I'm not dead, am I?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Not unless I am too. And I don't think I'm dead.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Good to hear. How about we get out of here?\" She looks around for a moment, apparently lost, so you assist by providing some directions on her helmet HUD back to the shuttle.")
            msnMgr:addMessage(" ")

        elseif (EmerieChoiceOne == 1) then
            emerieStress = emerieStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What?\" Emerie gives up trying to push herself up, instead rolls onto her back and pushes herself against a wall. You assume, from the shifting camera perspective. She shakes her head a few times to clear the fog.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Sorry, just trying to get your attention,\" you say. \"You seemed pretty out of it. Like you ended up on the wrong side of a fight.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I don't remember being in a fight,\" she says. \"But it feels like it. I hurt all over. My vitals look okay?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You can see everything I can see,\" you say, helpfully displaying the numbers on her HUD. \"Everything looks like it's where it should be. Your blood chemistry is a little off, though. Nothing too worrisome. Still, we should get you out of there.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Nothing TOO worrisome? What's that mean?\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("It means just that--you're fine")
            msnMgr:buildChoice("Some of your levels are a little off, that's all")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            EmerieChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (EmerieChoiceTwo == 0) then
                emerieStress = emerieStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"If there was anything wrong I'd tell you,\" you say. Not precisely true--you're more than capable of lying if it serves a purpose, like telling someone they were fine so they'd get back to the ship so you could be sure they were fine. In this case, though, she's fine.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Okay,\" she says, wincing in pain as she stands and tests a few joints. \"I feel like I ran a marathon or something. I wish I remembered.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I wish you did too, since that would solve a few mysteries,\" you reply. \"But since we can't know, let's cut our losses and get you out of there, shall we? You know the way back to the shuttle?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("She does not, but you assist with some HUD directions, and it doesn't take that long. Her condition seems to improve along the way. Whatever is in the air causing whatever is going on, it seems to be diminishing. Perhaps concentrations are lower near the shuttle.")
                msnMgr:addMessage(" ")
            elseif (EmerieChoiceTwo == 1) then
                emerieStress = emerieStress + 10;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Which levels?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"It's medical gibberish,\" you say. \"we can fix it all once you're in cryo. I do a complete top-to-bottom every time we jump to a new system.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Don't gibberish me,\" she says. \"Tell me.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Well to be honest I'm not sure exactly what's wrong, if anything,\" you say. \"It looks like something in the air here got through the helmet filter and started getting into your bloodstream, which would have caused the mental disturbances once it circulated to your brain which would have been pretty quickly...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Go on...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Well, I don't know. We need a full workup. The suit can only extract minute amounts of blood for testing. So it's inconclusive...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"This suit sucks my blood out?\"")
                msnMgr:addMessage(" ")

                waitUserResponse("In a manner of speaking...")

                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You know what, I don't even care. Just get to the point.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Fine. I can't identify the chemical, or whatever, in the air that caused it, but it looks like it didn't work quite as expected in your blood. Your spironolactone levels are a bit low and the antiandrogen effect seems to have diminished, probably because of whatever's in the air. Not completely, though. It just... looks odd. The numbers are off. But I'm not sure what they should look like in the first place since we don't know what we're dealing with here. So I don't know what to say.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Say what you think it means.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I think whatever's in the air has a different effect based on hormone levels,\" you say. \"It probably has a stronger effect in the presence of higher androgen levels, but the antiandrogens diminished the effect.\" After a moment you add \"but I'm an AI, not a doctor.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Dammit,\" she says, laughing. \"Okay, fair enough, we'll figure it out when we get back to the ship. I'll try not to worry too much.\"")
                msnMgr:addMessage(" ")
            end

        elseif (EmerieChoiceOne == 2) then
            emerieStress = emerieStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage(AthleteName .. " grunts in pain, and--as far as you can tell from the camera perspective--pushes herself up on hands and knees.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"If you need to vomit, remember to use the collapsible funnel to your left...\" you remind her.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I'm fine,\" she says. \"Or at least there's nothing in me going to come up. I'm parched. Throat kills. And I ache all over.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You remember any of it? Whatever it was? If it was anything?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Not a thing,\" says Emerie. \"I remember you leaving, then things got fuzzy. Kind of... not hard, but weird to breathe. It tasted funny, like blood or rust. Then I just sort of blacked out. Or redded out. I guess I fell but... I don't know where I am, so maybe I ran for a while first. Sore all over, so maybe I ran into a bunch of things along the way too. Or someone was punching me.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You know where the shuttle is?\" you ask. Emerie shakes her head, so you send directions to her helmet HUD and leave her to find her way back.")
            msnMgr:addMessage(" ")
        end

        waitUserResponse("Take it slow...")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % emerieStress <= charMgr:getCharAttr(CrewEmerie, "physical")) then
            msnMgr:addMessage("In due course, Emerie returns to the shuttle, and as she decontaminates you run some additional tests, which are all inconclusive and will remain so without further study and further samples back on the ship. She seems well, though, and there's nothing to suggest anything contagious, so you do your best to allay her fears.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("On the way back, Emerie manages to pick up a few handfuls of random packages from empty buildings. The language on the boxes is indecipherable, so she's not sure if they're food, fuel, or otherwise, but a rough chemical analysis suggests a 50/50 split would be most advisable.")
            msnMgr:addMessage(" ")
            ship:adjustFood(10)
            ship:adjustFuel(10)
        else
            msnMgr:addMessage("In due course, Emerie returns to the shuttle, and as she decontaminates you run some additional tests, which are all inconclusive and will remain so without further study and further samples back on the ship. She seems well, though, and there's nothing to suggest anything contagious, so you do your best to allay her fears.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("She's concerned enough however that she isn't able to locate any supplies. That part of the mission, at least, will have to be chalked up as a failure. But any mission you can walk away from alive is at least a partial success.")
            msnMgr:addMessage(" ")
        end
    end
end

function aislinn()
    CrewAislinn = charMgr:getCrewByName("Aislinn Fyffe")
    if (CrewAislinn ~= -1) then
        ComedianName = charMgr:getCharColoredName(CrewAislinn)

        waitUserResponse("Aislinn, are you receiving me?")

        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Is that an euphemism?\" asks Aislinn in reply. Typically " .. ComedianName .. ".")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Can you tell me what's going on down there without resorting to sarcasm or jest?\" you ask.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Should I use small words too? Me on big planet. Me all alone. Sky computer sad. Me also sad too.\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("I really need you to be serious for a minute")
        msnMgr:buildChoice("So you've suffered brain damage then?")
        msnMgr:buildChoice("Are you all right?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        AislinnChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (AislinnChoiceOne == 0) then
            aislinnStress = aislinnStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Only a minute? I can handle that. Is that an Earth minute or a... this place minute. I'm not sure how long that is here though.\"")
            msnMgr:addMessage(" ")

            CrewRemaining = charMgr:depCrewLeft()
            if (CrewRemaining >= 2) then
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Have you seen anyone else? Are you alone? Did you get separated?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Uh, no, yes, I don't know. In that order. It's a but murky down here. I don't see anyone right now if that's what you mean. Lots of buildings and corridors though. It's a little mazey.\"")
                msnMgr:addMessage(" ")
            end

            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Do you have any idea what happened? We lost radio contact and I'm unable to use the usual channel.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(ComedianName .. " sighs. \"Other than you leaving for an hour or so, I have no idea. Things got a bit hazy but I figured that was just fatigue. Oh and the air tastes funny. Does air have a taste?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What's it taste like?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Like air, only more... bloody? I don't know. Metallic. Weird. I feel fine though. Just a little dizzy. Maybe I need a sandwich.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I'll see what I can do about the sandwich. Just get back to the shuttle, okay?\"")
            msnMgr:addMessage(" ")
        elseif (AislinnChoiceOne == 1) then
            aislinnStress = aislinnStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes brain hurts from much think,\" she says. She is very lucky she's not dealing with an early gen AI, because they would probably have taken her literally and lobotomized her.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Your vital signs seem fine,\" you say. \"Both of you.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Ha ha fat joke,\" she says. \"I'm fine though, thanks for asking. Just a little dizzy. Like the suit filter isn't scrubbing the air properly.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Get back to the shuttle, then. You know the way? Can you find it?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Ha ha, women can't navigate properly,\" she says. \"Go to hell.\"")
            msnMgr:addMessage(" ")
        elseif (AislinnChoiceOne == 2) then
            aislinnStress = aislinnStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"No, I'm not all right,\" she says. \"I'm half left. Or a third. I guess it depends how you many slices you make.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Aislinn, I'm serious.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I'm not.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("She seems a bit... more irritating than usual. Maybe something on the planet is affecting her thought patterns in an unusual way. She's certainly an unusual person. And someone in her condition...")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I meant, I'm not serious,\" she says. \"Not that I'm not Aislinn. I am that. I think.\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Aislinn, enough--get back to the shuttle")
            msnMgr:buildChoice("I'm trying to figure out if you're sick")
            msnMgr:buildChoice("I think you're trying to irritate me")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            AislinnChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (AislinnChoiceTwo == 0) then
                aislinnStress = aislinnStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"What if I don't want to go?\" she says.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I will leave you behind.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(ComedianName .. " laughs. \"No you wouldn't.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Of course I would,\" you say. \"My mission is to find you a new home. If you decide this is where you want to stay then who am I to argue. Shall I leave you to it?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I think I'm gonna check out a few more apartments first,\" she says. \"Heading back to the shuttle now, roger, over and out, peace out, ten four.\"")
                msnMgr:addMessage(" ")
            elseif (AislinnChoiceTwo == 1) then
                aislinnStress = aislinnStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Like sick sick or brain sick?\" she asks.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Brain sick is sick sick,\" you say. \"It's all biology and chemistry and physics. Now, are you sure you're feeling well? You seem a bit... off. Please be serious for a moment.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(ComedianName .. " is quiet for a few seconds, but you do sense a change in her tone when she speaks again.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Okay, fine,\" she says. \"I've been a little dizzy since we got here, I think I mentioned that. And I sort of saw some things maybe once or twice.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Saw some things.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"That weren't there. Hallucinations? I never thought they were real. It was a bit freaky though. That was a while ago though. They're gone. It was little worms with teeth trying to burrow into my body. They were kind of cute, actually.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Are you sure they weren't real?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Yeah, pretty sure,\" she says. \"My suit hasn't been compromised, so unless they were magic worms, there hasn't been anything wriggling around inside me for, oh, since a few months before we left Earth.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You can't be sure she hasn't been infected by something, so you have to risk sending her back to the shuttle. Only back on the ship will you be able to tell for sure. It's a calculated risk but one you have to take.")
                msnMgr:addMessage(" ")
            elseif (AislinnChoiceTwo == 2) then
                aislinnStress = aislinnStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Trying, or succeeding?\" she asks.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Trying and failing.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I bet I could irritate you,\" she says. \"Given enough time.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I could literally turn myself off and ignore you until you died of old age and it would be as if no time at all had passed for me,\" you say.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You're no fun,\" she says. \"Fine, I'm bored here anyway. I'll head back to the shuttle.\"")
                msnMgr:addMessage(" ")
            end
        end

        waitUserResponse("Pick me up a souvenir while you're down there...")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % aislinnStress <= charMgr:getCharAttr(CrewAislinn, "physical")) then
            msnMgr:addMessage("You have " .. ComedianName .. " run some extra scans on herself when she gets back to the shuttle, but nothing comes up positive. You're pretty sure that whatever it is in the air down there, it's not infectious, per se. The effects seem temporary. And they don't seem to have affected Aislinn much at all.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Oh by the way,\" she says, \"I found some batteries or something while you were gone. I thought we might use them for fuel. At least, I think they're batteries. I ate one just to be sure. I'll let you know how that goes.\"")
            msnMgr:addMessage(" ")
            ship:adjustFood(0)
            ship:adjustFuel(10)
        else
            msnMgr:addMessage("You have " .. ComedianName .. " run some extra scans on herself when she gets back to the shuttle, but nothing comes up positive. You're pretty sure that whatever it is in the air down there, it's not infectious, per se. The effects seem temporary. And they don't seem to have affected Aislinn much at all.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("She does seem a bit more scattered and flaky than usual, though, so perhaps there was some effect. You'll have to monitor her more closely when she's back in cryo, and maybe do an extra cycle of cell-replacement to be sure. Nothing she needs to know about, though.")
            msnMgr:addMessage(" ")
        end
    end
end

function breckyn()
    CrewBreckyn = charMgr:getCrewByName("Breckyn Haar")
    if (CrewBreckyn ~= -1) then
        CounselorName = charMgr:getCharColoredName(CrewBreckyn)

        waitUserResponse("Come in, Breckyn")

        msnMgr:addMessage(" ")
        msnMgr:addMessage(CounselorName .. " doesn't respond, although you do hear breathing, and can see her camera shift as she moves slightly. The angle is a bit off, as if her helmet wasn't quite on straight. Perhaps she's injured? It does appear that she's sitting, at least, and her vitals look solid. But it's hard to say.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Breckyn, if you can hear me, at least... do something. Make a noise, or move, or something.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Finally, she groans. There's a bit of rustling, and her camera angle corrects itself. Available evidence would suggest that she had purposely loosened her helmet, and has now re-latched it.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Why did you remove your helmet?")
        msnMgr:buildChoice("What's wrong with you?")
        msnMgr:buildChoice("Are you hurt?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        BreckynChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1

        if (BreckynChoiceOne == 0) then
            breckynStress = breckynStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Oh, there you are,\" she says. \"Missed you. Missed.\" Her words are slow and slurred.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Breckyn, why did you remove your helmet?\" you repeat.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("She giggles. \"Air feels good,\" she says. \"Helmet was too tight. Needed to breathe. Cleared my head.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You know from her records that Breckyn has grappled with addiction. It seems likely that something in the air down there is... tapping into that. Some sort of mood-altering substance. It's imperative that you get her off the surface before it's too late.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Breckyn, listen to me,\" you say. \"I need you to get back to the shuttle. Can you walk? Can you find it?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yep, I can do that, boss,\" she says. She stands, the camera lurching wildly for a moment, but she seems stable enough, not drunk or physically impaired. You wonder how much of that is the cybernetic modifications keeping her vertical.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"And keep the helmet on, please,\" you say. \"I'm detecting some... dangerous toxins in the air.\" This latter is a lie--you detect nothing at all--but she doesn't need to know that.")
            msnMgr:addMessage(" ")
        elseif (BreckynChoiceOne == 1) then
            breckynStress = breckynStress + 10;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Wrong with me?\" she says. \"Why does there have to be something wrong with me? I'm fine.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You're acting weird,\" you say.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage(CounselorName .. " lurches to her feet.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I've never felt better,\" she says. \"Ever since we left Earth I've been cooped up, trapped. This place, though... it's made everything clearer somehow. Everything is more colorful. Friendly. I feel good. GOOD.\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("It's not clearer--you're hallucinating")
            msnMgr:buildChoice("It's not good, Breckyn, it's disappointing")
            msnMgr:buildChoice("If I was in your position what would you tell me?")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            BreckynChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (BreckynChoiceTwo == 0) then
                breckynStress = breckynStress + 10;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No, you're hallucinating,\" she says.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"That's not possible,\" you say. \"I'm not biological and not subject to chemical imbalances like a human is. I only see what is.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"How do you know though? You have different cameras, right? Infra, ultra, gamma. There's things you can't see until you make the right adjustments.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"That's different, though. Those things are always there. You're seeing and feeling things that aren't there. I can prove to you that there's a radio wave that you can't see. You can't prove to me that what you're seeing or feeling is anything but electrical activity in your brain.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"It's all electrical brain activity,\" she argues. \"Vision is just interpretation of photon signals or whatever. Reality is subjective. Maybe my reality is real.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You can sense though, now that you've got her talking, that she seems to be regaining some semblance of her actual self. Whatever is in the air down there, the fact that you've got her attention seems to be staving off the full effects.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'd love nothing more than to argue this with you further, Breckyn, but I need you back on the shuttle,\" you say.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Why should I?\"")
                msnMgr:addMessage(" ")

                CrewRemaining = charMgr:depCrewLeft()
                if (CrewRemaining >= 2) then
                    waitUserResponse("The crew needs you")
                else
                    waitUserResponse("Because you're all I've got")
                end

                msnMgr:addMessage(" ")
                msnMgr:addMessage(CounselorName .. " pauses for a moment, then sighs. \"Fine,\" she says. \"I'll be right there.\"")
                msnMgr:addMessage(" ")

            elseif (BreckynChoiceTwo == 1) then
                breckynStress = breckynStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Is that what you think of me? I'm a disappointment?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Yes,\" you say, trying honesty. \"This is disappointing. You're one of the last vestiges of humanity, and you can't afford to be behaving like this.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'm a poor example of humanity, right? I should have just died on Earth?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"That's not what I meant,\" you try, but she's no longer listening. " .. CounselorName .. " removes her helmet, and you are cut off from further contact. The last thing you see is her setting the helmet down, the camera facing a doorway. And then she wanders out the door.")
                msnMgr:addMessage(" ")

                msnMgr:killCrew(CrewBreckyn, "<charName> committed suicide by removing their helmet in a toxic atmosphere.")
                crewTraits()

                -- Any crew alive?
                if (charMgr:depCrewLeft() == 0) then
                    if (charMgr:crewOnShipLeft() == false) then
                        msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("mv ~ /dev/null")

                        msnMgr:endGame(false)
                    else
                        msnMgr:addMessage("The away team has been lost, but the overall mission is still salvageable. As long as there is at least one human crew member alive, you still have a job to do. The odds are not in their favor, but it's not over yet.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("Remote pilot the shuttle back to the ship")

                        msnMgr:endMission(true)
                    end
                else
                    msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                    msnMgr:addMessage(" ")
                end

            elseif (BreckynChoiceTwo == 2) then
                breckynStress = breckynStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage(CounselorName .. " thinks for a moment. \"I'd tell you that ultimately you make your own choices, and there's only two choices. Forward or backward. Advance or retreat. Giving it your all, or giving up.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"And if I chose to end the mission and let you die here?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"That would be giving up.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"And what's wrong with giving up?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"If you wanted to give up, really, you wouldn't have asked. The asking makes it clear you don't want to give up. So don't.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Right. So don't.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Through this brief conversation you sensed Breckyn's hands around her neck, wondering perhaps if she should just take off her helmet and suck down whatever hallucinatory gas fills the atmosphere. And go out with a bang. But she seems at last to get a hold of her senses, and instead she stands.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'm going back to the shuttle now,\" she says. \"Breckyn out.\"")
                msnMgr:addMessage(" ")
            end

        elseif (BreckynChoiceOne == 2) then
            breckynStress = breckynStress + 5;
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"No, I'm not hurt,\" she says, slowly, through a mouth full of cotton. \"Feel fine,\" she says. \"Better than fine.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Even after just a few words, she already seems to be a bit more coherent, so you try to keep her talking and moving. Once she's back on the shuttle you can do some more scans to see what might be wrong with her.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Tell me what happened,\" you say. \"You had your helmet off?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yeah... yes,\" she says. \"Air smelled funny, but good. Made me a little dizzy, felt good. My head felt stuffy, like there was something inside, fuzzy. Loosened the helmet to get some fresh air in. Didn't help, still fuzzy, but felt better.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Please, I really need you to keep that helmet on,\" you say. \"The air might be toxic.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yeah, no worries,\" she says. \"Since you asked nice and all. Want me to come back up?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes, please. Come back to the shuttle. Can you find the way?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yep, on my way boss,\" she says, stumbling a bit as she makes for the door. She appears well enough to walk, however.")
            msnMgr:addMessage(" ")
        end

        waitUserResponse("Be careful down there...")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % breckynStress <= charMgr:getCharAttr(CrewBreckyn, "physical")) then
            msnMgr:addMessage("On her way back to the shuttle, " .. CounselorName .. " regains enough of her senses to remember the mission, and she explores a few empty buildings and gathers a small quantity of what look like foodstuffs. Certainly expired, if there's such a thing as expiration dates in this dead society, but good enough for the food replicator.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I'm sorry,\" she says as she settles into the shuttle and begins to decontaminate herself.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You don't have to apologize to me,\" you say.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"It wasn't for you,\" she replies.")
            msnMgr:addMessage(" ")
            ship:adjustFood(10)
            ship:adjustFuel(0)
        else
            msnMgr:addMessage("On her way back to the shuttle, " .. CounselorName .. " regains enough of her senses to remember the mission, and she explores a few empty buildings and gathers a small quantity of what look like foodstuffs. However it all turns out to be empty boxes, and whatever material the containers are made out of is unsuitable for the food replicator, and useless as fuel.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Sorry,\" she says, settling down in the back of the shuttle. She doesn't respond to any further inquiries.")
            msnMgr:addMessage(" ")
        end
    end
end

function fallyn()
    CrewFallyn = charMgr:getCrewByName("Fallyn Stabler")
    XenophobicName = charMgr:getCharColoredName(CrewFallyn)
    waitUserResponse("Stabler, get me a sit rep, now")

    if ((msnMgr:random() % msnMgr:getDiffScale(2,2,2)) == 0 and cygenDeaths < 1) then
        msnMgr:addMessage(" ")
        msnMgr:addMessage("There is no response from " .. XenophobicName .. ", nor any vital signs. It would appear something has happened to them, but there's unfortunately no way to know what.")
        msnMgr:addMessage(" ")
        msnMgr:killCrew(CrewFallyn, "Contact with <charName> was lost on a planet with hallucinatory properties.")
        crewTraits()

        -- Any crew alive?
        if (charMgr:depCrewLeft() == 0) then
            if (charMgr:crewOnShipLeft() == false) then
                msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                msnMgr:addMessage(" ")

                waitUserResponse("mv ~ /dev/null")

                msnMgr:endGame(false)
            else
                msnMgr:addMessage("The away team has been lost, but the overall mission is still salvageable. As long as there is at least one human crew member alive, you still have a job to do. The odds are not in their favor, but it's not over yet.")
                msnMgr:addMessage(" ")

                waitUserResponse("Remote pilot the shuttle back to the ship")

                msnMgr:endMission(true)
            end
        else
            msnMgr:addMessage("The loss is tragic, but the mission must continue.")
            msnMgr:addMessage(" ")
        end
    else
        if (CrewFallyn ~= -1) then

            msnMgr:addMessage(" ")
            msnMgr:addMessage(XenophobicName .. " doesn't respond right away, although you can see her camera is on, bobbing up and down as she runs across open terrain like some wild beast.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("Despite her exertion, her breathing is slow and steady, her heart rate elevated but stable. Like all military cygens--which is to say, most cygens--she's in peak physical condition, and to her this sort of thing is literally like a walk in the park.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("She appears intent on whatever it is she's doing, however, and does not respond.")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Increase the volume")
            msnMgr:buildChoice("Shout her name over and over")
            msnMgr:buildChoice("Broadcast a message to her helmet's HUD")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end

            FallynChoiceOne = msnMgr:getChoiceResponse(choices)
            choices = choices + 1

            if (FallynChoiceOne == 0) then
                fallynStress = fallynStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You know she can hear you--the feedback confirms that her radio is both sending and receiving. You steadily increase the feedback loop from her own breathing until it creates a terrible noise she can't ignore, and after a moment she stops and adjust the levels, at which point you say her name again. This seems to snap her out of whatever zone she was in.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"What is it?\" she asks.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You tell me,\" you say. \"I left for an hour, I get back and it's chaos down there apparently.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'm not sure,\" she says. \"It's been a bit hazy. Hard to think straight. I think maybe some terrible things have happened down here. Whoever lived here once, they screwed up majorly. Goes to show you can't trust nonhumans.\"")
                msnMgr:addMessage(" ")

                msnMgr:buildChoice("Why were you running?")
                msnMgr:buildChoice("What makes you think they were nonhuman?")
                msnMgr:buildChoice("What sort of terrible things?")
                msnMgr:finalizeChoice()

                if(not waitUserInput(choices)) then
                    return
                end

                FallynChoiceTwo = msnMgr:getChoiceResponse(choices)
                choices = choices + 1

                if (FallynChoiceTwo == 0) then
                    fallynStress = fallynStress + 5;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"There's something in the air,\" says Fallyn. \"This red haze. It tastes like rust, like stale blood. Some chemical agent. It makes it hard to think, hard to breathe. For a while I was completely out of it, didn't know what was going on. Running helped. I don't know why. Not a doctor.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Something that binds with something in your blood stream, maybe\" you say. \"If you were circulating it out of your system fast enough... well, no, that doesn't make sense. Curious...\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"No idea,\" she says. \"Don't care. It wasn't pleasant. And if you don't mind I'd like to get the hell out of here. There's nothing down here but ghosts. No, not literally.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Good idea,\" you say. \"Get back to the shuttle. You need directions?\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"No,\" she says. \"I'm good now. Have been okay for a while. I'll head back.\"")
                    msnMgr:addMessage(" ")

                    CrewRemaining = charMgr:depCrewLeft()
                    if (CrewRemaining >= 3) then
                        msnMgr:addMessage(" ")
                        msnMgr:addMessage("\"Have you heard from anyone else?\" you ask.")
                        msnMgr:addMessage(" ")
                        msnMgr:addMessage("\"Negative,\" she says. \"You left, everyone got fuzzy and separated, nobody's communicated since. Heading back to the shuttle. Stabler out.\"")
                        msnMgr:addMessage(" ")
                    end
                elseif (FallynChoiceTwo == 1) then
                    fallynStress = fallynStress + 5;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Nothing,\" she says. \"Human, nonhuman, inhumane, whatever. This stuff, it's got to be some sort of chemical weapon. Nasty stuff. Clouds your thinnking, makes you hallucinate.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"What sort of hallucinations?\" you ask.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"All sorts,\" she says. \"Visual, auditory, sensory. Extrasensory, I'd go so far as to say. The full virtual reality experience. To be honest I'm not even sure you're real. I could be talking to myself.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"I don't know how I could convince you otherwise.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage(XenophobicName .. " sighs. \"Probably no way,\" she says, \"so don't bother. I'll take it on faith. Have to pick a reality to stick with and this current one seems like it's the real one.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"How can you tell?\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Because the hallucinations were full of people shooting each other and dying violently and things exploding. It was kind of what I thought we were in for on this trip. Instead we've just spent a lot of time eating, sleeping and wandering around in clouds of dust.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"You sound like you'd rather there be more killing,\" you say.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("She doesn't respond.")
                    msnMgr:addMessage(" ")
                elseif (FallynChoiceTwo == 2) then
                    fallynStress = fallynStress + 5;
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Name it,\" she says. \"I think that whatever this garbage in the air is, this rusty stuff, it's capable of making people pretty much lose their minds, if they're exposed to it long enough. Violence, panic, murder. Your worst fears, your id unleashed. Scary, exhilarating. The ultimate chemical weapon.\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("You don't have nearly enough data to support anything she's saying, but you believe she believes it, having been exposed to the stuff. You wonder what it would be like if an entire civilization were exposed to a chemical agent that would turn someone like her loose on everyone else. Except, everyone else would be exactly like her, too. Violent, xenophobic, cruel, merciless.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("It becomes much easier to see how a civilization could vanish so suddenly. Especially if they had no way out.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"I'm going to head back to the shuttle,\" she says. \"I don't think this stuff will affect me any more, not if I keep moving around, but I'd rather not take any chances.\"")
                    msnMgr:addMessage(" ")
                end

            elseif (FallynChoiceOne == 1) then
                fallynStress = fallynStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Fallyn,\" you say, hoping she listens. \"Fallyn, Fallyn, Fallyn. Fallyn Fallyn Bo Ballyn, Fanana Fana Fo Fallyn.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("You know for sure she's heard you when she lets out a small laugh.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Oh, so you can hear me,\" you say. \"What's going on?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Bad things,\" says " .. XenophobicName .. " at last. \"Something in the air. Hard to breathe, hard to think. Made me hallucinate for a while. And my throat hurts something terrible. But I think the worst is past. Sorry for ignoring you. Running helped clear my head.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"No idea what caused it?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"The air? Who knows? Just get me out of here.\"")
                msnMgr:addMessage(" ")
            elseif (FallynChoiceOne == 2) then
                fallynStress = fallynStress + 5;
                msnMgr:addMessage(" ")
                msnMgr:addMessage("Since she is ignoring radio messages, you override her helmet's HUD and transmit a visual message in giant flashing block letters ordering her to return to the shuttle.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Please don't do that,\" she says finally. \"Unless you want me to run into a wall.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"What's going on down there?\" you ask.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("She shakes her head. \"I'm not sure. Something in the air. Kicked in about ten minutes on the ground, gets right through the helmet filters. Some sort of toxin, affects the brain, muscles. Hallucinations, spasms. Sore throat, of all things.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You're okay though?\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I think so,\" she says. \"Murderous rage subsiding. Although if I ever see anyone responsible for releasing whatever this was, that rage is going to come back tenfold.\"")
                msnMgr:addMessage(" ")
            end

            if (FallynDead ~= 1) then
                waitUserResponse("Let's get you back to the shuttle...")
                msnMgr:addMessage(" ")

                -- check here vs stat, based on the choices you made above
                if (msnMgr:random() % fallynStress <= charMgr:getCharAttr(CrewFallyn, "physical")) then
                    msnMgr:addMessage("Fallyn seems pretty much back to her normal homicidally violent self by the time she's back on the shuttle, and you order an immediate decontamination. There's no sense risking re-exposure by trying to take a sample of whatever the stuff was.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Rabies,\" says " .. XenophobicName .. ", suddenly. \"What do you know about that?\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("It sort of fits, but then if you run a list of arbitrary symptoms through a database, anyone will end up dying of a fatal illness. Still... paranoia, anxiety, violent behavior, hallucinations, confusion... and even the sore throat. Maybe these people, whoever they were, tried to weaponize some variant of the rabies virus? Whatever it was, it backfired. Badly. Tragically.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("\"Whatever,\" she says. \"I know you don't want to risk bringing any of this garbage on the ship, but I did recover some fuel cells while roaming around out there. Trying to be useful, while you were gone. I'll run them through decontamination. Way I figure it, this stuff will be harmless once it's burned into antimatter, right?\"")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("That's not quite how it works, but you don't correct her.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("Thanks, Fallyn.")

                    msnMgr:addMessage(" ")
                    ship:adjustFood(0)
                    ship:adjustFuel(15)
                else
                    msnMgr:addMessage("Fallyn seems pretty much back to her normal homicidally violent self by the time she's back on the shuttle, and you order an immediate decontamination. There's no sense risking re-exposure by trying to take a sample of whatever the stuff was.")
                    msnMgr:addMessage(" ")
                    msnMgr:addMessage("She seems a bit shaken up from the whole experience, and now that she's got a chance to calm down, she seems to withdraw into herself a bit more. You leave her be.")
                    msnMgr:addMessage(" ")
                end
            end
        end
    end
end

function cepha()
    CrewCepha = charMgr:getCrewByName("Cepha Lopoda")
    if (CrewCepha ~= -1) then
        CephalopodName = charMgr:getCharColoredName(CrewCepha)

        waitUserResponse("Can you read me? Miss cephalopod person? Cepha?")

        msnMgr:addMessage(" ")
        msnMgr:addMessage(CephalopodName .. " doesn't respond, although you can tell from monitoring their atmospheric suit readings that they are alive, well, and moving about. They can hear you just fine, they just don't feel like talking. They don't seem to be doing anything interesting, just walking around near the shuttle, but they don't seem to be in any trouble either.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"I'm fine,\" they say at last. \"The air is weird but it doesn't seem to be affecting me. I can almost feel it trying, but it can't quite work out how to get at my brain. So I'm safe. Enough, at least.\"")
        msnMgr:addMessage(" ")

        waitUserResponse("Well, I guess maybe, like, head for the shuttle? To be sure?")
        msnMgr:addMessage(" ")

        -- check here vs stat, based on the choices you made above
        if (msnMgr:random() % 10 <= 8) then
            msnMgr:addMessage("Initially it seems as if " .. CephalopodName .. " is ignoring you, because they seem to wander off in the exact opposite direction as the one you want them to head. However, after monitoring them for a minute, you see that in fact they're simply making a circuit and collecting items from nearby buildings. Their random meandering was perhaps not so random.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("In short order, they've gathered up everything they apparently intended to, and then make a quick return to the shuttle, where they load everything on board and settle in quietly. If only all of your crew were so well-behaved.")
            msnMgr:addMessage(" ")
            ship:adjustFood(10)
            ship:adjustFuel(10)
        else
            msnMgr:addMessage(" ")
            msnMgr:addMessage(CephalopodName .. " immediately heads for the shuttle and climbs on board, settling in quietly. If only all of your crew were so well-behaved.")
            msnMgr:addMessage(" ")
        end
    end
end

function savio()
    CrewSavio = charMgr:getCrewByName("Savio Krach")
    if (CrewSavio ~= -1) then
        SavioName = charMgr:getCharColoredName(CrewSavio)
        waitUserResponse("Savio, can you hear me?")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Nearly done,\" calls out " .. SavioName .. " happily, far too loudly to be directed at his helmet mic. \"I'll be up in a sec!\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"What's nearly done?\" you ask.")
        msnMgr:addMessage("\"Oh,\" says " .. SavioName .. ", as he wanders through the barren rooms of an abandoned building. \"I just need to put the kids to bed.\"")
        msnMgr:addMessage(" ")
        msnMgr:buildChoice("There's nobody here")
        msnMgr:buildChoice("Kids?")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end

        SavioChoiceOne = msnMgr:getChoiceResponse(choices)
        choices = choices + 1
        msnMgr:addMessage(" ")

        if (SavioChoiceOne == 0) then
            savioStress = savioStress + 5
            msnMgr:addMessage(SavioName .. " stops walking and begins looking around anxiously. \"You're right,\" he says. \"They're gone!\"")
            msnMgr:addMessage(" ")
            msnMgr:buildChoice("They were never here")
            msnMgr:buildChoice("Maybe they went back to the shuttle")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end
            SavioChoiceTwo = msnMgr:getChoiceResponse(choices)
            choices = choices + 1
            msnMgr:addMessage(" ")

            if (SavioChoiceTwo == 0) then
                savioStress = savioStress + 5
                msnMgr:addMessage("\"Never here...\" repeats " .. SavioName .. " before becoming indignant. \"Are you trying to say that my kids--the children I helped birth and raise never existed? I didn't go through all this,\" he gestures broadly at something unseen. \"Just so that a piece of code can invalidate my life.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I didn't say they never existed,\" you say.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I didn't go through the teething, the puberties, the teenage years,\" he continues, seething. \"Just so that they could leave.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Savio...\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I didn't...\" " .. SavioName .. "'s voice cracks and he crumples to the floor. \"I didn't go through everything just to lose them.\"")
                msnMgr:addMessage(" ")
                waitUserResponse("They loved you, and they felt loved by you")
                msnMgr:addMessage(" ")
                msnMgr:addMessage(SavioName .. " pulls out the photo of his family that he carries and holds it in his lap.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"You enriched their lives as much as they enriched yours,\" you say. \"That's something you'll always have.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I knew there were risks,\" says " .. SavioName .. ". \"We signed forms that listed all the possible ways that the mission could go wrong. For some reason I just let myself believe that whether we lived or died, we'd all face whatever happened together.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Savio, it's okay to be sad,\" you say. \"I just need you to come back to the shuttle.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I know,\" says " .. SavioName .. ", sighing deeply. \"I know. I just need a moment, alright?\"")
                msnMgr:addMessage(" ")
                waitUserResponse("Alright")
                msnMgr:addMessage(" ")
            else--if (SavioChoiceTwo == 1) then
                msnMgr:addMessage("\"The shuttle...\" " .. SavioName .. " repeats to himself. \"The shuttle...\"")
                msnMgr:addMessage(" ")
                waitUserResponse("\"Yes, the shuttle.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Da--my youngest, Mela. We call her, 'Da.'\" says " .. SavioName .. " sadly, retrieving the photo of his family from a pouch on his suit. \"She was terrified of the shuttle we boarded the Omega Epsilon via. She was convinced it would fall into the atmosphere and burn up. We made a deal that if she went on the shuttle, I'd build us a pool and teach her to swim when we landed. When it came time to board, she couldn't handle it and we had to give her something to make her sleep.\"")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"I'm sure she tried her best,\" you say.")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"She did. It didn't help her though. Didn't help any of us.\" " .. SavioName .. " sighs. \"Every day...\"")
                msnMgr:addMessage(" ")
                waitUserResponse("Every day?")
                msnMgr:addMessage(" ")
                msnMgr:addMessage("\"Every day they get a little farther away. Every day is a day closer to when I'll forget their faces. Closer to when I'll forget the sound of their voices. Their laughs.\" " .. SavioName .. " goes quiet for a moment. \"For a moment though... for a moment, it felt like they were here. I could see and smell our home. I would have stayed here. I probably would have been happy.\"")
                msnMgr:addMessage(" ")
                if (charMgr:depCrewLeft() > 1) then
                    waitUserResponse("It'd be hard for us without you")
                    msnMgr:addMessage(" ")
                else
                    waitUserResponse("It'd be hard for me without you")
                    msnMgr:addMessage(" ")
                end
                msnMgr:addMessage("\"Thanks. I guess. I'm grateful that you saved me, and I'm glad I'm a part of this crew... my family was just bigger than that, you know?\" " .. SavioName .. " takes a deep breath and puts the photo away. \"I'll be back at the shuttle soon.\"")
                msnMgr:addMessage(" ")
                if (charMgr:depCrewLeft() > 1) then
                    waitUserResponse("We'll be there for you")
                    msnMgr:addMessage(" ")
                else
                    waitUserResponse("I'll be there for you")
                    msnMgr:addMessage(" ")
                end
            end
        else--if (SavioChoiceOne == 2) then
            savioStress = savioStress + 2
            msnMgr:addMessage(SavioName .. " stops walking and looks around. \"... my kids...\"")
            msnMgr:addMessage(" ")
            waitUserResponse("Tell me about them")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Well,\" says " .. SavioName .. ", with no trace of the happiness that was in his voice moments ago. \"Ilah is my eldest. She studied to become a botanist and was specifically invited to be on the Epsilon Omega's crew.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"You must've been proud,\" you say.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"She was the reason we all signed up in the first place.\" says " .. SavioName .. ". \"Eyoel, my son, is so excited. He was about to start college before we left. He always wanted to travel and explore. He didn't care what kind of job he ended up with so long as he could keep a garden at home and go on long hikes on weekends. I guess that in the Earth's twilight, with industries and societies collapsing, those were probably good life goals to have. When he heard about Ilah getting a position on the colony ship, he begged us to all go with her as a group.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"It sounds like a close family.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Only little Mela didn't want to go. She was terrified. Misa, my wife, and I tried everything we could think of, but we couldn't do anything to make her less afraid.\" " .. SavioName .. " slumps into a corner. \"I guess she \"lived\" in cryo for millennia afterward, but her last days of consciousness were filled with dread.\"")
            msnMgr:addMessage(" ")
            waitUserResponse("You tried your best to support them and give them opportunities")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Maybe you're right,\" says " .. SavioName .. ". \"But either way, I'm here and they're not.\" Savio puts away the photo, \"I guess you want me to head back to the shuttle now and stop wallowing in whatever memories this place is bringing up.\"")
            msnMgr:addMessage(" ")
            waitUserResponse("Take whatever time you need")
            msnMgr:addMessage(" ")
        end
        
        if (msnMgr:random() % savioStress <= charMgr:getCharAttr(CrewSavio, "mental")) then
            msnMgr:addMessage("After a few minutes to collect himself, " .. SavioName .. " makes his way back to the shuttle, finding a small handful of what look like sealed foodstuffs along the way.")
            msnMgr:addMessage(" ")
            
            ship:adjustFood(6)
        else
            msnMgr:addMessage("After a few minutes to collect himself, " .. SavioName .. " makes his way back to the shuttle.")
            msnMgr:addMessage(" ")
        end
    end
end

function customCrew(crewID)
    fullName = charMgr:getCharColoredName(crewID)
    fullNameUncoloured = charMgr:getCharName(crewID)
    lastName = fullNameUncoloured:match("%s*(%S+)$")
    firstName = fullNameUncoloured:match("(%S+)%s*")
    if (msnMgr:random() % 2 == 0) then
        waitUserResponse(firstName .. callList[msnMgr:random() % callCount + 1])
    else
        waitUserResponse(lastName .. callList[msnMgr:random() % callCount + 1])
    end
    msnMgr:addMessage(" ")

    lostCrewType = customCrewOutcomes[handledCustomCrew]
    if (msnMgr:random() % msnMgr:getDiffScale(10,12,15) > 9 or (charMgr:getCharTrait(crewID, "Cygen") and msnMgr:random() % msnMgr:getDiffScale(2,2,2) == 0 and cygenDeaths < 1)) then
        lostCrewType = 0
    end

    if (lostCrewType == 0) then
        --Nowhere to be found
        msnMgr:addMessage("There is no response from " .. fullName .. ", nor any vital signs. It would appear something has happened to them, but there's unfortunately no way to know what.")
        msnMgr:addMessage(" ")
        msnMgr:killCrew(crewID, "Contact with <charName> was lost on a planet with hallucinatory properties.")
        crewTraits()

        cygenDeaths = cygenDeaths + 1

        -- Any crew alive?
        if (charMgr:depCrewLeft() == 0) then
            if (charMgr:crewOnShipLeft() == false) then
                msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                msnMgr:addMessage(" ")

                waitUserResponse("mv ~ /dev/null")

                msnMgr:endGame(false)
            else
                msnMgr:addMessage("The away team has been lost, but the overall mission is still salvageable. As long as there is at least one human crew member alive, you still have a job to do. The odds are not in their favor, but it's not over yet.")
                msnMgr:addMessage(" ")

                waitUserResponse("Remote pilot the shuttle back to the ship")

                msnMgr:endMission(true)
            end
        else
            msnMgr:addMessage("The loss is tragic, but the mission must continue.")
            msnMgr:addMessage(" ")
        end
    elseif (lostCrewType == 1) then
        --Huddled in a basement
        msnMgr:addMessage(fullName .. " lets out a whimper, but doesn't respond. From their suit cam, they seem to be huddled in the corner of a dark room.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"" .. firstName .. ". I need you to talk to me.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Why?\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("I can't help you unless you tell me what's happening")
        msnMgr:buildChoice("Because sitting in here crying isn't helping either of us")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end
        customCharChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1
        msnMgr:addMessage(" ")

        if (customCharChoice == 0) then
            msnMgr:addMessage("\"Do you even want to help?\" they ask forlornly.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yes,\" you respond. \"You are an important part of the mission and a valued member of the crew.\"")
            msnMgr:addMessage(" ")
        else --if (customCharChoice == 1) then
            msnMgr:addMessage(firstName .. " seems to struggle to absorb your words. \"What?\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I need you to help me,\" you say. \"And you need me to help you. At almost every step of the mission, I couldn't continue without you, and without me to operate the ship, the crew wouldn't survive.")
            msnMgr:addMessage(" ")
        end

        msnMgr:addMessage("\"Mission...\" they say, standing up. \"Crew...\"")
        msnMgr:addMessage(" ")

        if (charMgr:depCrewLeft() == 1) then
            waitUserResponse("That's right. I need you")
            msnMgr:addMessage(" ")
        else
            waitUserResponse("That's right. We need you")
            msnMgr:addMessage(" ")
        end

        msnMgr:addMessage(fullName .. " seems far more focused now. You do what you can to stabilize their mood using suit hookups to control endorphin levels and ask if they know the way back to the shuttle.")
        msnMgr:addMessage(" ")

        msnMgr:addMessage("\"I'm not sure...\" says " .. fullName .. ". \"I don't even know how I got here.\"")
        msnMgr:addMessage(" ")

        msnMgr:addMessage("You provide them with a route to the shuttle via their HUD and pay close attention to their readings until they're aboard and decontaminating.")
        msnMgr:addMessage(" ")

    elseif (lostCrewType == 2) then
        --Digging at the ground in an empty park
        msnMgr:addMessage("\"I'm here,\" says " .. fullName .. ", panting. Their suit cam shows them digging at the ground with their hands.")
        msnMgr:addMessage(" ")
        waitUserResponse("Are you okay?")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"I don't know,\" they say, continuing to dig. \"I just need to keep digging.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage(firstName .."'s readings indicate high blood pressure, but more importantly, leakage close to the limit of what their atmospheric suit can compensate for. Judging from the size of the hole in front of them, they have likely begun to wear through their suit gloves' fingertips.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Can you tell me why?")
        msnMgr:buildChoice(firstName .. ", I think you need to stop")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end
        customCharChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1
        msnMgr:addMessage(" ")

        if (customCharChoice == 0) then
            msnMgr:addMessage("\"No,\" they say, slowing down.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Then maybe you should stop until you can.\"")
            msnMgr:addMessage(" ")
        else --if (customCharChoice == 1) then
            msnMgr:addMessage("\"No!\" they shout, digging faster.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"" .. firstName .. ", please. My scans show that there is nothing below the surface, and your suit will rupture soon.\" Both of these statements are untrue. Scans from the ship are inconclusive and so far as you can tell, the suit has already been breached.")
            msnMgr:addMessage(" ")
        end
        msnMgr:addMessage(firstName .. " stops to catch their breath. Their suit pressure and oxygen levels are low, but enough to sustain them for a walk back to the shuttle.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"I really don't know what that was all about,\" they say with a wavering voice. \"Am I okay? I want to go back to the shuttle now.\"")
        msnMgr:addMessage(" ")
        waitUserResponse("Your readings say that you'll be fine")
        msnMgr:addMessage(" ")
        msnMgr:addMessage(fullName .. " seems reassured, and you guide them back to the shuttle via their HUD.")
        msnMgr:addMessage(" ")

    elseif (lostCrewType == 3) then
        --Picking up shattered glass
        msnMgr:addMessage("\"Leave me alone, I'm busy,\" says " .. fullName .. ". You can see from their head-mounted camera that they are scanning the ground as they walk along, carrying an armfull of glass shards. Their suit readings don't indicate any punctures, but clearly, something isn't quite right.")
        msnMgr:addMessage(" ")
        waitUserResponse(firstName .. ", tell me what's going on")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"None of your business,\" they say, irritation clear in their voice. \"Go away.\"")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("You don't really want that do you?")
        msnMgr:buildChoice("Okay, if that's what you need")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end
        customCharChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1
        msnMgr:addMessage(" ")

        if (customCharChoice == 0) then
            msnMgr:addMessage("\"Fine. You can stay, just don't get in my way.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"What are we looking for?\" you ask.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"How am I going to get anything done with your incessant yammering?\" they ask. \"It's bad enough on the ship. \"Go into cryo, " .. firstName .. ".\" \"Come out of cryo, " .. firstName .. ".\" \"Get suited up, " .. firstName .. ".\" \"Collect that fuel, " .. firstName .. ".\" \"Look at that space thing, " .. firstName .. ".\" Do you have any idea what that's like?\"")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Say something")
            msnMgr:buildChoice("Say nothing")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end
            customCharChoice2 = msnMgr:getChoiceResponse(choices)
            choices = choices + 1
            msnMgr:addMessage(" ")

            if (customCharChoice2 == 0) then
                msnMgr:addMessage("\"The mission needs you,\" you say. While technically, this is true--without humans to find a home for, your mission would be over--, you don't really need assistance with the day to day operation on the ship. As " .. fullName .. " should be aware, the primary reason that the crew are assigned duties on board is to keep them physically and mentally active. You decide that now is probably not the best time to mention that, though.")
                msnMgr:addMessage(" ")
            else
                msnMgr:addMessage("You remain silent and observe as they break a window and proceed to pick up the pieces.")
                msnMgr:addMessage(" ")
            end

            msnMgr:addMessage(firstName .. " walks a little further before throwing their armload of glass onto the ground. \"You know what makes it worse?\" they ask in disgust.")
            msnMgr:addMessage(" ")

            msnMgr:buildChoice("Say nothing")
            msnMgr:buildChoice("What makes it worse?")
            msnMgr:finalizeChoice()

            if(not waitUserInput(choices)) then
                return
            end
            customCharChoice2 = msnMgr:getChoiceResponse(choices)
            choices = choices + 1
            msnMgr:addMessage(" ")

            msnMgr:addMessage("\"I have no idea what I'm doing or why I'm angry,\" they say, throwing their hand in their air.")
            msnMgr:addMessage(" ")

            msnMgr:addMessage("\"It's okay,\" you say. \"Something on this planet is affecting you. Let's get you back to the shuttle.\"")
            msnMgr:addMessage(" ")

            msnMgr:addMessage("After arriving at the shuttle, " .. fullName .. " gets your attention. \"Hey,\" they say before beginning decontamination procedures. \"Thanks for not leaving me back there.\"")
            msnMgr:addMessage(" ")

        else --if (customCharChoice == 1) then
            if (msnMgr:random() % msnMgr:getDiffScale(8,10,15) > 5) then
                --they're dead \o/

                msnMgr:addMessage("Shortly after you break off comms, " .. fullName .. "'s suit readings become unstable as they wander into or under something that blocks their signal. You repeatedly try to contact them, but are unable to get any kind of response.")
                msnMgr:addMessage(" ")

                msnMgr:killCrew(crewID, "Contact with <charName> was lost on a planet with hallucinatory properties.")
                crewTraits()

                -- Any crew alive?
                if (charMgr:depCrewLeft() == 0) then
                    if (charMgr:crewOnShipLeft() == false) then
                        msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("mv ~ /dev/null")

                        msnMgr:endGame(false)
                    else
                        msnMgr:addMessage("The away team has been lost, but the overall mission is still salvageable. As long as there is at least one human crew member alive, you still have a job to do. The odds are not in their favor, but it's not over yet.")
                        msnMgr:addMessage(" ")

                        waitUserResponse("Remote pilot the shuttle back to the ship")

                        msnMgr:endMission(true)
                    end
                else
                    msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                    msnMgr:addMessage(" ")
                end
            else
                msnMgr:addMessage(fullName .. " eventually finds their way back to the shuddle without incident. A little sheepishly, they apologise for their behaviour.")
                msnMgr:addMessage(" ")
            end
        end

    elseif (lostCrewType == 4) then
        --Lying on a street
        msnMgr:addMessage(fullName .. " does not respond, but their vital signs are within acceptable limits. Their suit cam rocks slightly up and down in time with their breathing, but you can't quite work out what they're looking at.")
        msnMgr:addMessage(" ")
        waitUserResponse(firstName .. ", talk to me")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"They went out,\" they say. \"They all went out. No more lights. No more stars.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("You realise that the dull redness filling the camera view is the sky. " .. fullName .. " is lying on their back.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("The stars are still burning up here")
        msnMgr:buildChoice("It's time to go")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end
        customCharChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1
        msnMgr:addMessage(" ")

        if (customCharChoice == 0) then
            msnMgr:addMessage("\"How do I know you're not just saying that?\" they ask, dubiously.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"There's really only one way to find out,\" you say. \"Plus, there are lights on in the shuttle.\"")
            msnMgr:addMessage(" ")
        else
            msnMgr:addMessage("\"Go where? What's the point?\" They gesture toward the sky in exasperation. \"Everything's dark and dead and dumb.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"This planet might be dead,\" you say. \"But there's still life out there in the universe. If you can make your way back to the shuttle, there'll be life there too.\"")
            msnMgr:addMessage(" ")
        end
        msnMgr:addMessage(fullName .. " is silent for a moment and then reluctantly climbs to their feet.")
        msnMgr:addMessage(" ")
        waitUserResponse("Do you remember where the shuttle is?")
        msnMgr:addMessage(" ")
        msnMgr:addMessage(firstName .. " looks around. \"I... I don't know where I am.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("You provide " .. fullName .. " with a direct route back to the shuttle via their HUD and make sure they get there safely.")
        msnMgr:addMessage(" ")

    elseif (lostCrewType == 5) then
        --Climbed a statue
        msnMgr:addMessage("\"It's over,\" says " .. fullName .. ". \"Everything is gone.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("Their head-mounted camera shows them looking down at the city from a height of about 20 meters.")
        msnMgr:addMessage(" ")
        waitUserResponse(firstName .. ", I need you to tell me where you are")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"I'm at the end, can't you see?\" says " .. firstName .. ", looking around. As they turn, you catch sight of the tall statue they are standing on.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("Nothing needs to end here")
        msnMgr:buildChoice("Get down from there before you hurt yourself")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end
        customCharChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1
        msnMgr:addMessage(" ")

        if (customCharChoice == 0) then
            msnMgr:addMessage("\"This place might have ended,\" you say. \"But we still have a long way to go. It's going to be okay.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I... But...\" they stammer before eventually nodding.")
            msnMgr:addMessage(" ")
            waitUserResponse("Can you climb down?")
            msnMgr:addMessage(" ")
        end
        msnMgr:addMessage("\"Down...\" Their voice trails off as they look downward.")
        msnMgr:addMessage(" ")

        if (customCharChoice == 1 and msnMgr:random() % msnMgr:getDiffScale(8,10,15) > 5) then
            msnMgr:addMessage("Without another word, " .. fullName .. " lets go of the statue and plummets to the ground.")
            msnMgr:addMessage(" ")

            msnMgr:killCrew(crewID, "<charName> fell to their death from a statue on a planet with hallucinatory properties.")
            crewTraits()

            -- Any crew alive?
            if (charMgr:depCrewLeft() == 0) then
                if (charMgr:crewOnShipLeft() == false) then
                    msnMgr:addMessage("Under the circumstances, all seems lost. Even if everything were in order--the crew, the shuttle, the ship--it seems like the mission is not destined to be completed.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("mv ~ /dev/null")

                    msnMgr:endGame(false)
                else
                    msnMgr:addMessage("The away team has been lost, but the overall mission is still salvageable. As long as there is at least one human crew member alive, you still have a job to do. The odds are not in their favor, but it's not over yet.")
                    msnMgr:addMessage(" ")

                    waitUserResponse("Remote pilot the shuttle back to the ship")

                    msnMgr:endMission(true)
                end
            else
                msnMgr:addMessage("The loss is tragic, but the mission must continue.")
                msnMgr:addMessage(" ")
            end
        else
            msnMgr:addMessage("It's pretty clear that you're going to need to walk " .. fullName .. " through descending. By reviewing the suit cam video feed and analysing shadows, reflection, and ambient occlusion, you are able to get a fairly accurate impression of the shape of the statue--a humanoid figure so far as you can tell.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("You provide a series of hand and foot markers to their HUD and slowly guide them to the bottom of the statue.")
            msnMgr:addMessage(" ")
            waitUserResponse("Think you can make it back to the shuttle?")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"I just need a moment,\" pants " .. fullName .. ". \"I'll be there soon.\"")
            msnMgr:addMessage(" ")
        end
    else
        --Trying to avoid people
        msnMgr:addMessage(fullName .. " doesn't respond right away. Their suit camera shows them, ducking behind buildings and rubble, bobing and weaving as they go.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"" .. firstName .. ", I need you to listen to me,\" you say.")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("\"Shhh!\" they hiss, looking around. \"They'll hear us.\"")
        msnMgr:addMessage(" ")
        msnMgr:addMessage("You can see no sign of anybody or anything living in the immediate vicinity--or the planet at all for that matter.")
        msnMgr:addMessage(" ")

        msnMgr:buildChoice("There's nobody here")
        msnMgr:buildChoice("Here's a safe path that avoids them")
        msnMgr:finalizeChoice()

        if(not waitUserInput(choices)) then
            return
        end
        customCharChoice = msnMgr:getChoiceResponse(choices)
        choices = choices + 1
        msnMgr:addMessage(" ")

        if (customCharChoice == 0) then
            msnMgr:addMessage("\"That sounds like something *they* would say. Maybe you're not on our side after all.\"")
            msnMgr:addMessage(" ")
            waitUserResponse("We are on a mission together, remember?")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"A mission...\" they mumble.")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"That's right,\" you say. \"We're going to find you a new home. This isn't it though, and I need you to come back.\"")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("They shake their head and look around. \"This place... Something happened here. It gets into your mind.\"")
            msnMgr:addMessage(" ")
            waitUserResponse("Can you make it back to the shuttle?")
            msnMgr:addMessage(" ")
            msnMgr:addMessage("\"Yeah. I think so, \" says " .. fullName .. ".")
            msnMgr:addMessage(" ")

        else --if (customCharChoice == 1) then
            msnMgr:addMessage("You transmit a circuitous route back to the shuttle onto " .. fullName .. "'s HUD. After a few moments hesitation and a lot of glancing around, they follow it.")
            msnMgr:addMessage(" ")
        end
    end
end

function anybodyElse()
    msnMgr:addMessage("You find the rest of the crew scattered nearby, disoriented but uninjured. You direct them back to the shuttle without incident.")
    msnMgr:addMessage(" ")
end

function escape()
    waitUserResponse("That's everybody accounted for")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("With the crew located, and the shuttle prepped, you give the order to push off and return to the ship. There's no sense in lingering, and clearly this place is unsuitable for permanent habitation. It's unclear whether the inhabitants were human or not--there's no sign of a predecessor ship, or an AI, and the crew found no evidence pointing one way or the other.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("And in the end it doesn't matter. Whoever lived here before ruined the place forever after with whatever garbage they pumped into the atmosphere. You just wonder if it was murder, or suicide.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("The crew says its goodbyes, and is glad to be gone.")
    msnMgr:addMessage(" ")
end

function wrapup()
    msnMgr:addMessage("Before you push out of the system, you consider setting up some sort of warning beacon to warn off theoretical future travelers. But the odds of another ship stumbling across this place seem slim. You were the last to leave Earth. Anyone else who was out here roaming around has presumably already found a place to call home. You're probably the last one still looking.")
    msnMgr:addMessage(" ")
    msnMgr:addMessage("You just hope that whatever you eventually find, it doesn't turn out to be another ruin like this place.")
    msnMgr:addMessage(" ")

    ship:adjustFuel(0)
    ship:adjustFood(0)
end

-- Set Hidden Flags and other items
choices = 0;
choicesCount = 2;
count = 1;
rechoicePosition = -1;
crewDead = 0;
aarikStress = 0;
osminStress = 0;
kealanStress = 0;
xzavianStress = 0;
mychalStress = 0;
corraStress = 0;
corraAlliteration = 0;
emerieStress = 0;
aislinnStress = 0;
breckynStress = 0;
savioStress = 0;
fallynStress = 0;
cygenDeaths = 0;
xzavianDead = 0;
fallynDead = 0;
callList = {", can you read me?", ", are you receiving me?", ", can you hear me?", ", report in", ", status report?", ", do you copy?", ", if you can hear this please respond", ", come in", "? Are you there?"}
customCrewOutcomes = {1, 2, 3, 4, 5, 6}
customCrewOutcomes = shuffleList(customCrewOutcomes)

callCount = 0
for key, value in pairs(callList) do
    callCount = callCount + 1
end

crewTraits()

missionStart()

introduction()
surface()

customCrewCount = 0
handledCustomCrew = 0

crewAlive = luaMgr:aliveCrewLeft()
for key, index in pairs(crewAlive) do
    tempName = charMgr:getCharDetail(index,"name")
    if (tempName == "Aarik Pritts") then
        aarik()
    elseif (tempName == "Osmin Keenum") then
        osmin()
    elseif (tempName == "Kealan Reeser") then
        kealan()
    elseif (tempName == "Xzavian Merz") then
        xzavian()
    elseif (tempName == "Mychal Rennick") then
        mychal()
    elseif (tempName == "Corra Emmer") then
        corra()
    elseif (tempName == "Emerie Borja") then
        emerie()
    elseif (tempName == "Aislinn Fyffe") then
        aislinn()
    elseif (tempName == "Breckyn Haar") then
        breckyn()
    elseif (tempName == "Fallyn Stabler") then
        fallyn()
    elseif (tempName == "Cepha Lopoda") then
        cepha()
    elseif (tempName == "Savio Krach") then
        savio()
    else
        customCrewCount = customCrewCount + 1
        if (msnMgr:random() % 3 > 0 or handledCustomCrew < 1) then
            handledCustomCrew = handledCustomCrew + 1
            customCrew(index)
        end
    end
end

if (handledCustomCrew < customCrewCount) then
    anybodyElse()
end

escape()
wrapup()

missionOverview()

msnMgr:endMission(true)
