Talk to Characters

Non-platform specific questions.

Talk to Characters

Postby Super Pieman » Sat Dec 08, 2007 6:35 pm

I am making a zelda game, it is pretty much a remake of the minish cap, and i can't get the textboxes to work. I have tried several codes but nothing is working. Can someone start me off. I will give you 2 points if you can help. Ps. When talking most people say multiple boxes of words, for example they say "Hello Link, how are you today" you press enter "have you visited the BAKERY yet?" you press enter again, then the text box closes.
Current Projects:
*Lonely (2%)
**LinkSys (1%)

*To be made in GE, then ported to DS.
**To be made for the DS.
User avatar
Super Pieman
 
Posts: 57
Joined: Sat Nov 03, 2007 3:27 pm
Location: Manotick (Ontario, Canada)
Score: 2 Give a positive score

Re: Talk to Characters

Postby Azou » Sat Dec 08, 2007 6:58 pm

We'vegot the same problem! :( Maybe a noble gentleman will help us! :D
User avatar
Azou
 
Posts: 514
Joined: Thu Sep 13, 2007 1:12 pm
Score: 35 Give a positive score

Re: Talk to Characters

Postby pyrometal » Sun Dec 09, 2007 5:44 am

Well here's a structure you may want to try using to code NPCs on a KeyDown Event located in the text actor:

Code: Select all
if (distance(player.x, player.y, NPC.x, NPC.y) <= 20)  //Event only occurs when player is close enough to NPC (Defines a 20 px radius).
{

    EventDisable("player", EVENTALL);  //Disable player controls
    transp = 0;  //Set the Messages to be visible

    switch(Dialogue_Position)  //Keeps the position in the dialogue
    {
        case 1: sprintf(text,"Hello Link, how are you today?",text); //Change the message
                Dialogue_Position++;  //Increment Dialogue's position by 1
                break;  //Ignore the rest of "case" labels

        case 2: sprintf(text,"Have you visited the BAKERY yet?",text);  //Same as Case 1 (You can have as many as you wish)
                Dialogue_Position++;
                break;

        case 3: sprintf(text," ",text);
                transp = 1;  //Make the messages invisible.
                EventEnable("player", EVENTALL);  //Enable player controls
                Dialogue_Position = 0;  //Reset Dialogue Position to 0 in order to be able to go through the dialogue another time
                break;
    }
}


Note that it would be in your best interest to set your NPCs in a manner to avoid convergence of the proximity radii in order to avoid unexpected (and funky) behavior when initiating the preset conversations. Also try keeping the scripts as organized as possible so you can easily modify your text.

You will probably need to use the "\n" control character in your text formatting in order to split your text onto other lines (Like using ENTER).

Example:

Code: Select all
sprintf(text,"This example text string\nis spread over two lines!!!",text);


Hopefully this helps you in your game's conception. If you have any other questions about this, ask!

Well, that's all for now!

-- Pyrometal --
SPRITE WARRIOR:
Free, open-source & crossplatform pixel art editor (currently under construction).
User avatar
pyrometal
 
Posts: 706
Joined: Wed Nov 28, 2007 4:07 am
Location: Kingston, ON, Canada
Score: 86 Give a positive score

Re: Talk to Characters

Postby Super Pieman » Sun Dec 09, 2007 1:55 pm

When i enter the script there are no error messages but for some reason the cases arent working
Current Projects:
*Lonely (2%)
**LinkSys (1%)

*To be made in GE, then ported to DS.
**To be made for the DS.
User avatar
Super Pieman
 
Posts: 57
Joined: Sat Nov 03, 2007 3:27 pm
Location: Manotick (Ontario, Canada)
Score: 2 Give a positive score

Re: Talk to Characters

Postby pyrometal » Sun Dec 09, 2007 3:29 pm

Sorry, I made a stupid mistake. The cases are supposed to be numbered 0,1,2... instead of 1,2,3...

Here's a working example:

Dialogue Script.zip
(206.67 KiB) Downloaded 167 times


Sorry about that, I should have noticed before sending. The code should work now.

-- Pyrometal --
SPRITE WARRIOR:
Free, open-source & crossplatform pixel art editor (currently under construction).
User avatar
pyrometal
 
Posts: 706
Joined: Wed Nov 28, 2007 4:07 am
Location: Kingston, ON, Canada
Score: 86 Give a positive score

Re: Talk to Characters

Postby Spidy » Sun Dec 09, 2007 4:47 pm

Image
VOTE FOR MY SIGNATURE PLEASE.......THANK YOU
User avatar
Spidy
 
Posts: 935
Joined: Tue Aug 14, 2007 1:28 pm
Location: http://www.inatonibai.com
Score: 38 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron