Page 1 of 1

How to make Text dialogue

PostPosted: Sat Aug 14, 2010 7:37 pm
by Setokyo
Hi i was wondering how to make the text dialogues for the talking for the ppl in the game?
Any ideas or code for it?

Re: How to make Text dialogue

PostPosted: Sat Aug 14, 2010 8:25 pm
by savvy
you could make it so that the text is part of an animation, and when the player presses Z for example, it does
Code: Select all
animindex+=1;
meaning that the animation will change to the next one.
the text has to be seperate, or actually part of the textbox's animation

Re: How to make Text dialogue

PostPosted: Sat Aug 14, 2010 9:51 pm
by Setokyo
any other ideas

Re: How to make Text dialogue

PostPosted: Sun Aug 15, 2010 12:24 pm
by Scorpion50o1

Re: How to make Text dialogue

PostPosted: Sun Aug 15, 2010 1:31 pm
by Setokyo
Hey
THanks it does
any more ideas

Re: How to make Text dialogue

PostPosted: Sun Aug 15, 2010 3:34 pm
by lcl
I usually do it this way:

I have actors TalkBg, Text and Talk1.
And I have two global variables, speaking and talk.

TalkBg - create actor- script editor:
Code: Select all
VisibilityState("Event Actor", DISABLE);

Draw actor - script editor:
Code: Select all
if (speech == 1)
{
    VisibilityState("Event Actor", ENABLE);
    if (transp > 0)
    {
        transp -= .05;
    }
}
if (speech == 0)
{
    if (transp < 1)
    {
        transp += .05;
    }
    if (transp == 1)
    {
        VisibilityState("Event Actor", DISABLE);
    }
}


Text - create actor - script editor:
Code: Select all
speaking = 0;
talk = 0;
sprintf(text, " ");
VisibilityState("Event Actor", DISABLE);


key down - key that you want to change text - repeat: disable - script editor:
Code: Select all
if (speaking == 1)
{
    talk += 1;
}


Talk1 - create actor - script editor:
Code: Select all
EventDisable("Event Actor", EVENTANIMATION);


collision - any side of main actor - script editor:
Code: Select all
if(can_speak == 1)
{
    speaking = 1;
    talk = 1;
    VisibilityState("Text", ENABLE);
    EventDisable("Main Actor", EVENTKEYDOWN);
    EventEnable("Event Actor", EVENTANIMATION);
}
if(can_speak == 0)
{
    DestroyActor("Event Actor");
}



Draw actor - script editor:
Code: Select all
switch (talk)
{
    case 1:
    speech = 1;
    sprintf(Text.text, "Here comes what you want your actor say first."); //first words
    break;

    case 2:
    speech = 1;
    sprintf(Text.text, "Here comes what you want your actor say second."); //second words
    break;

    case 3:
    //This is for hiding the text
    sprintf(Text.text, " ");
    talk = 0;
    speaking = 0;
    speech = 0;
    DestroyActor("Event Actor");
    VisibilityState("Text", DISABLE);
    EventEnable("Main actor", EVENTKEYDOWN);
    break;
}


And then i create actors like Talk2, Talk3, and this way for other talkings...
This is my way of doing it, not best but works. :D