Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Thumb_Sucker on Sun 02/12/2012 20:07:07

Title: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Sun 02/12/2012 20:07:07
Hello fellow Adventures.

I'm in a real hurry here! I got this college project due to tomorrow (yep, I screwed up) and it is basically and Adventure Game. I'm quite familiar with AGS, had my runs, but never made a complex project or completed anything. So I'm not a real expert (beggner's help uh?).

The case is I need a Sierra, Gabriel Knight, dialogue style system, the one with only the floating portraits and subtitles as opposed to the LucasArts system where you are kept in the common view of the game.

I searched around the forum and only found people discussing steps further for it, people that already knew how to implement the system.
I recurred to the video tutorials, the ones about Sammy's Quest. They do delve into this matter, but their tutorial depends upon a script download (given in the video description) that is broken!
Does anyone happen to know other link for it? The original is in this video: http://www.youtube.com/watch?v=zZpRKs4rZQY&list=PL21DB402CB4DAEAEF&index=34&feature=plpp_video

Searching a little further into google, for AGS resources sites, I stumbled upon this page: http://americangirlscouts.org/agsresources/Templates.html
That happens to have what I'm searching for but for an outdated AGS version! (I still tried to adapt the code but had no luck).

I'm desperate people! Anyone please help this noob!
Title: Re: Gabriel Knight dialogue style
Post by: Crimson Wizard on Sun 02/12/2012 20:26:48
Quote from: Thumb_Sucker on Sun 02/12/2012 20:07:07
The case is I need a Sierra, Gabriel Knight, dialogue style system, the one with only the floating portraits and subtitles as opposed to the LucasArts system where you are kept in the common view of the game.
Have you tried setting Sierra-style dialogs in project General Settings?

General Settings -> Dialog -> Speech Style; set to "Sierra transparent" or "Sierra with background".
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Sun 02/12/2012 20:39:06
Quote from: Crimson Wizard on Sun 02/12/2012 20:26:48
Quote from: Thumb_Sucker on Sun 02/12/2012 20:07:07
The case is I need a Sierra, Gabriel Knight, dialogue style system, the one with only the floating portraits and subtitles as opposed to the LucasArts system where you are kept in the common view of the game.
Have you tried setting Sierra-style dialogs in project General Settings?

General Settings -> Dialog -> Speech Style; set to "Sierra transparent" or "Sierra with background".

Yeah I did. On it's core it worked, I had the talk views (that I made into portraits) to appear and have their subtitles. But they are arranged poorly and the subtitles have colors and boxes that I don't want. And my BG can still be seen. But besides the looks (wich I'm certain there is a way to manipulate), the portrits only apear after I chose a dialogue line to say to this character. Want that upon clicking him I already end up on the Gabriel Knight screen.
Title: Re: Gabriel Knight dialogue style
Post by: Crimson Wizard on Sun 02/12/2012 20:46:40
Hmm, what about "Whole Screen"? AFAIK That should display black screen and portraits visible all the time.
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Sun 02/12/2012 21:10:53
So, i tested the Whole Screen mode, but it shows me each portrait at time and the portraits continues only apear after I chose a dialogue line to say to this character...

What i need:

http://www.mobygames.com/images/shots/l/9893-gabriel-knight-sins-of-the-fathers-dos-screenshot-gabriel-talking.gif
Title: Re: Gabriel Knight dialogue style
Post by: Khris on Sun 02/12/2012 21:46:42
This is really simple to emulate using only stuff you already know:
Create a new room with a black background, put two characters in there (as in, the portraits) and let them talk using Character.SayAt().

The new dialog scripting allows you to put SayAt calls directly into the dialog script.

While this type of dialog isn't available as a built-in option, there's nothing inherently special about its setup that would require some plugin or the like, or am I missing something?

Putting the dialog option GUI in the middle of the screen is just a matter of creating a custom text window GUI and setting it as dialog GUI.
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Sun 02/12/2012 22:05:08
But  I'll have to create a room for each dialog?


I start try this way. I creat a room  and set 2 chars, after I creat the  DialogGui and set in in the general setting, but when i try

Code (AGS) Select
function room_AfterFadeIn()
{
  if (dialogo == 1) {
  Dialog.Start(0);
  }
}


the follow error appears: Failed to save room room100.crm; details below
room100.asc(6): Error (line 6): must have an instance of the struct to access a non-static member.

This stuck me...
Title: Re: Gabriel Knight dialogue style
Post by: Khris on Mon 03/12/2012 00:55:49
You don't need a separate room, you can reuse the same for all dialogs.
In the room's before fadein, set up the characters, according to the dialog's ID.

Code (ags) Select
// add this to GlobalScript.ash
import Dialog* gk_dialog;

// add this to the top of GlobalScript.asc
Dialog* gk_dialog;
export gk_dialog;

// to start a dialog:
  gk_dialog = dMyDialog1;
  player.ChangeRoom(ROOM_NUMBER_OF_DIALOG_ROOM);


In the room's before fadein event:
Code (ags) Select
function room_Load() {
  player.ChangeView(PORTRAIT);
  player.SpeechView = PORTRAIT_TALK;
  player.x = 70;
  player.y = 70;
  // other character
  if (gk_dialog == dMyDialog1 || gk_dialog == dMyDialog2 ...) {
    cDialogPartner.ChangeView(GRACE_PORTRAIT);
    cDialogPartner.SpeechView = GRACE_PORTRAIT_TALK;
  }
  ...
  gk_dialog.Start();


The error you're getting is due to calling Dialog.Start(0);, you're supposed to Start() the actual dialog.
Either use the ID like this: dialog[0].Start();
or the dialog's script name: dMerchant.Start();
(Needless to say, this is mentioned in the manual entry.)
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Mon 03/12/2012 02:17:34
I do this codes, but stil having problems. The code pass in debug, but nothing appears in the dialog room, just the black background...

Code (AGS) Select

function cClarice_Interact()
{
  gk_dialog = dMyDialog1;
  player.ChangeRoom(100);
}


Code (AGS) Select

@S  // Dialog startup entry point
return
@1
  cClarice.SayAt(151, 58, 100, "Olá!");
return

@2
  cClarice.SayAt(151, 58, 100, "Olá!");
stop


Code (AGS) Select

function room_Load()
{
  player.ChangeView(SVMIGUEL);
  player.SpeechView = 2;
  player.x= 70;
  player.y= 70;
//other
  if (gk_dialog == dMyDialog1) {
    cClarice.ChangeView(5);
    cClarice.SpeechView = 5;
  }
  gk_dialog.Start();
}



I dont see the error, soon I will start feels stupid...lol

Title: Re: Gabriel Knight dialogue style
Post by: Khris on Mon 03/12/2012 02:33:56
There are two ways to make the NPC appear:
a) use a dummy character which remains inside the dialog room and assign the correct views to it in room_Load (which is what I suggested using cDialogPartner, which was meant to be read as actual script name, not as place holder)
or
b) change the NPC's normal and talk views (they can't be the same view since walking and talking both use the first 4/8 loops) and move them to the room, which is probably what you forgot to do.

I'd go with option a) since in that case you don't have to change the NPC's views / store their original position and room
1. create two views for Clarice, one with the standard portrait sprite in the first frame of the first loop, and one with the talking sprites in the first loop
2. add a dummy character called cDialogPartner and place it in the dialog room
3. use the code I had in room_Load
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Mon 03/12/2012 03:02:43
I follow this  3 steps, but the result as the same. The speechstyle for this is the default(Lucas arts)?  Or may be something wrong with my Gui...

Code (AGS) Select
function room_Load()
{
  player.ChangeView(SVMIGUEL);
  player.SpeechView = 2;
  player.x= 70;
  player.y= 70;
//other
  if (gk_dialog == dMyDialog1) {
    cDialogPartner.ChangeView(6);
    cDialogPartner.SpeechView =VCLARICESPEECH;
  }
gk_dialog.Start();
}


Sorry for this great bother, but this work is very important to continue my college...


Title: Re: Gabriel Knight dialogue style
Post by: Khris on Mon 03/12/2012 06:10:13
So the problem is you can't see anything besides the black background?
What about the player character? My code puts the player at 70, 70; this should be the top left corner of the screen, do you see anything at all? At least the spoken text should appear.

I'm not sure how to help you fix this; I'd have to check all your views and sprites.

One thing though: did you link this function to the room event properly? You didn't just paste my code, right?
Is the dialog started at all?
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Mon 03/12/2012 06:14:59
When the rooms change is only black, the dialog dont start and the characters don't appears too...

I copy your code, but change the necessary.
Title: Re: Gabriel Knight dialogue style
Post by: Gilbert on Mon 03/12/2012 06:57:11
I didn't have time to read all the discussions, but:
Quote from: Khris on Mon 03/12/2012 06:10:13
One thing though: did you link this function to the room event properly?

Did you do that? I ask this because you never answered this and this is a pretty common mistakes that people could make. If you just paste the codes in without setting up the interactions properly in the editor the codes wouldn't be called.
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Tue 04/12/2012 16:45:59
Yes, I copy te code but i set the editor things properly. Btw, how i can check this?

I create a new project to test this isolated and the result was the same...

working here, i noted the problem:  if i don't write the line gk_dialog.Start(); the  views of characters appears but not the dialogue...

SOLVED: i put gk_dialog.Start() in room_afterFadeIn and works fine.

but... how I do to change the room to the previously room when the dialog  ends? I try, add   character.Changeroom in the dialog script, but  the character back to the room as his speec view...
Title: Re: Gabriel Knight dialogue style
Post by: Khris on Wed 05/12/2012 00:29:03
player.ChangeRoom(player.PreviousRoom);

You'll also want to restore the player's previous position though. You could store the coordinates in two global variabkles, however a simpler solution is to not use the player character in the gk_dialog room but a dummy character.

In the talkto interaction, instead of
Code (ags) Select
  player.ChangeRoom(ROOM_NUMBER_OF_DIALOG_ROOM);
you'd simply change the current player character to the dummy one:
Code (ags) Select
  cDialogPlayer.SetAsPlayer();

The character cDialogPlayer starts out in the dialog room, and upon setting them as active player character, AGS will switch the room, just like with player.ChangeRoom().

After the dialog is finished, you simply call cGabriel.SetAsPlayer(); to return to the actual character and the current room.
Title: Re: Gabriel Knight dialogue style
Post by: Thumb_Sucker on Wed 05/12/2012 01:57:38
Great thanks Khris, i was a doing it  by a hard way...