How can I make a quest system?

This question is still not fully answered


Please tell me how to make a simple script that allows certain text to appear and dissapear after some time. I would also need a checkpoint script. This is an example:


  • Add following text: "Private what are you doing? Come back to the ship this instant... Ahh! Stay away, no!"
  • Wait 2.5
  • Remove the text
  • Wait 0.5
  • Add following text: "Private, you're on your own from now on. I've hidden in the ship's cargo storage and will try to start contact with you again once I will found a safer place."
  • Wait 3.5
  • Remove the text
  • Wait 0.5
  • Add a text that says "Missions: find a secured area on apparently abandoned planet"
  • Place a preset mark on the map and give the player a set amount of time to reach it
  • Delete the timer when player reached mark and add more text

I know this is possible but please, give me something to work on, I'm rather new to scripting but if I have a template I could work on it. Please?

A simple solution might be to use co-routines.

private var text : String = String.Empty;

function Narrative()
{
    text = "Private what are you doing? ... (cut out)";
    yield WaitForSeconds(2.5f);
    text = String.Empty;
    yield WaitForSeconds(0.5f);

    text = "Private, you're on your own ... (cut out)";
    yield WaitForSeconds(3.5f);
    text = String.Empty;
    yield WaitForSeconds(0.5f);
}

function OnGUI()
{
    if (GUILayout.Button("Start Narrative"))
    {
        StartCoroutine("Narrative");
    }
    GUILayout.Label(text);
}

Hmm

I See

That's actually quite nice

What confuses me is "Narrative", as Narrator, as voice or is it just a silly name for a text command?

Anyways, what I need is to be able to actually put the text onto the screen as soon as you start the game, and then continue changing it. I've already added music and built most of the terrain etc., but I still need the conversations to actually work, can you help me a bit more plz?

Ohh ya, GUILayout, how does that function? I've always used GUItext and 3dtext for now never quite used a Layour, i'm quite new to Unity

The string.Empty, that means that the script should be located in an empty object, right? Coz I already made that and copy pasted this script inside, but I still need what I've written above