1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Dialogs : head, sounds, camera

Discussion in 'Tutorials' started by zorglub, Jan 30, 2010.

  1. zorglub

    zorglub Privateer Storm Modder

    Joined:
    Sep 7, 2006
    Messages:
    774
    Gender:
    Male
    Ahoy.
    Here is a brand new tutorial, hopefully less confusing and more up-to date than the original one, which appear to have lost the most important post in a past forum crash.

    Like its predecessor, it will deal with the talking head that is loaded during dialogs on the upper left edge of the screen. A small detail that can enhance the general game ambient. But I added extra chapters about other things as well.
    I don't think experienced modders will learn anything from this tutorial, but as new comers keep showing for time to time, they might find it useful.


    :keith Sections : (todo : add shortcuts)

    I. Head expression

    Introduction
    How to give the proper head expression while loading the dialog
    How to change head expression during dialog
    Bonus : dream for the day the source code will be ours
    Non functional stuff

    II. Dialog sounds

    Greeting system
    Playing another sound during dialog in stock PotC
    Build mod (not finished)
    Non functional stuff

    III. Camera

    PotC crappy system
    Enabling looking in 1st view
    Seadogs camera mod attempts
    Moving the camera
    Non functional stuff

    ________________________

    Comments - add your comments here.

    Don't think ASVS is back yet.
     
  2. zorglub

    zorglub Privateer Storm Modder

    Joined:
    Sep 7, 2006
    Messages:
    774
    Gender:
    Male
    I. Head expression


    :mm Introduction

    In stock PotC, all heads had the same neutral expression. All others were left unused, but in fact the system was still partly operational as I found out while looking at the dll file, with a bit of guessing & luck.

    We have four different head expressions : 'Normal', 'Smile', 'Angry', 'Afraid', as shown in the picture below.

    Files :
    Code:
    \MODULES\DIALOG.dll
    \MODULES\CameraDialog.dll
    \PROGRAM\dialog.c
    \PROGRAM\Dialog_func.c
    \PROGRAM\DIALOGS\ //is where the .c files are
    \PROGRAM\DIALOGS\[language] //is where the .h files are
    \RESOURCE\INI\dialog.ini
    \RESOURCE\MODELS\Heads		//model files
    \RESOURCE\animation\Heads\ 	//.ani files
    \RESOURCE\animation\Heads\AN 	//.an files

    :mm How to give proper head expression while loading the dialog

    The .dll file expects some Dialog.mood attribute.

    You have to give it one of the following sentences, in the first node of your character dialog .c file :
    Code:
    Dialog.mood = "afraid";
    Dialog.mood = "angry";
    Dialog.mood = "smile";
    Dialog.mood = "normal"; 
    Of course, the "normal" mood is not useful as the head will have the same look if you don't give it anything. So forget about that one!

    For example, if you want a happy Malcolm Hatcher in stock PotC :
    Code:
    		case "start":
    dialog.mood = "smile";
    dialog.text = DLG_TEXT[0] + NPchar.name + DLG_TEXT[1];
    link.l1 = DLG_TEXT[2];
    link.l1.go = "start1";
    break;

    :mm How to change head expression during the dialog

    Included in Build 14 is a very simple function of my that allow you to do that.
    In your dialog node, use Change_Mood([whatever]), whatever being "normal", "smile", "angry" or "afraid".

    For those who'd like to change head expression the same way in stock PotC, you might just want to write a normal Dialog.Mood = [whatever]; followed by a Dialog.headModel = NPChar.headModel; or a new greeting sound.


    :onya Bonus : dream for the day the source code will be ours

    I personally hope that when we'll have the source code we will add the animated heads directly on the beheaded characters via locators (like sabre, pistol ; or armours in AoP).
    This could allow us to save space, by having only one type of body for several different people (I'm sure Thomas the Terror agree with me!)
    Then we would remove the talking heads from the separated window in the upper left edge, and makes the people themselves talk. Additionally, we'd make so you can see those people in 1st person view even in dialog mode, which is currently *partly* impossible.


    :shrug Other things apparently not functional

    Yes/No
    Looking in DIALOG.dll or dialog.ini, it seems that apart from talking and staying idle, the heads could be asked to play 'yes' or 'no' animation.
    Unfortunately I have no idea if this is really functional or not, and what could trigger that.


    Ani
    In some dialog .c files you can find the following Dialog attributes left. They seem to be useless. It looks like it was part of an original more complex system.
    Code:
    Ani
    defAni
    defLinkAni
    'ani' do appear in DIALOG.dll, and might be used by CameraDialog.dll (don't know what this one is doing)
    However most of the animation names given for 'ani' don't exist. In all case, these refer to the character and not the talking head.


    ___________________________________________________________________
     

    Attached Files:

  3. zorglub

    zorglub Privateer Storm Modder

    Joined:
    Sep 7, 2006
    Messages:
    774
    Gender:
    Male
    II. Dialog sounds

    :mm Greeting system

    In stock PotC a sound is played when the dialog is launched, while the animated head takes the 'talk' animation. When the sound stops, so does the head.

    \RESOURCE\Sounds\VOICE\[language]
    \RESOURCE\INI\ALIASES\Greetings_[language].lng or Greetings_alias.ini (before Build 14)

    The greeting sounds are stored as a character 'greeting' attribute.


    :mm Playing another sound during dialog in stock PotC

    In stock Potc you can make the head talk again at any time by adding a Dialog.greeting = [something] in the dialog file.
    Something can be either a sound file or a greeting entry. Playing the new sound, if you've just given a new .mood attribute it will be taken into account.

    Example : Malcolm Hatcher in stock PotC
    Code:
    	case "start":
    dialog.mood = "smile";
    dialog.text = DLG_TEXT[0] + NPchar.name + DLG_TEXT[1];
    link.l1 = DLG_TEXT[2];
    link.l1.go = "start1";
    break;
    
    case "start1":
    dialog.mood = "afraid";
    dialog.greeting = LanguageGetLanguage() + " Gr_Balltesar Figueiredo";
    dialog.text = DLG_TEXT[3];
    link.l1 = DLG_TEXT[4];
    link.l1.go = "start2";
    link.l2 = DLG_TEXT[5];
    link.l2.go = "Skip_tutorial";
    break;
    
    case "start2":
    dialog.mood = "angry";
    dialog.greeting = "VOICE\FRENCH\Fre_m_b_055.wav";
    dialog.text = DLG_TEXT[6];
    link.l1 = DLG_TEXT[7];
    link.l1.go = "start3";
    break;
    ...However, please note that the game will start playing your new sound even if it hasn't finish playing the old one.


    :mm Build mod

    In Build 14 synchronisation between sound and talking head was lost. But you can now stop the former sound.
    Note that the Dialog.greeting trick still work, but you shouldn't use it.

    I'll edit this tutorial later to tell you what you shall do, as I don't remember.


    :shrug Non functional stuff

    It seems that originally another system existed, in which all dialog lines would have been recorded & played during dialogs.
    You can still find remains with those three attributes scattered in some dialog files :
    snd
    defSnd
    defLinkSnd

    None of them are functional and of course the sounds files they call don't exist.
    ___________________________________________________________________
     
  4. zorglub

    zorglub Privateer Storm Modder

    Joined:
    Sep 7, 2006
    Messages:
    774
    Gender:
    Male
    III. Camera


    :mm PotC crappy system

    Please excuse my harsh words. In stock PotC, camera stays below your main char while you load a dialog, and cannot move. If you are in 1st person view, it will goes in 3rd person view the time of the dialog.


    :mm Enabling looking in 1st view while in Dialog

    In Build 13 this was enabled, thought only when you talk to CCC buildings owners - because otherwise you wouldn't be able to see them as the camera would go behind the wall...
    If you want to enable them completely, uncomment the following line. However, I suspect this might be related to some crashes in populated area so be careful with that.
    Code:
    SendMessage(mainChr, "lsl", MSG_CHARACTER_EX_MSG, "InDialog", 1);

    :mm Seadogs camera mode attempts

    In Seadogs, if you were in 3rd view, when a dialog was launched the camera was moving nicely to the side in order to see both characters. Attempts have been made to recreate this behaviour.

    The first one by myself, that's why you can still find locCameraRight() and locCameraLeft() functions in PROGRAM\Locations\locations_camera.c. On a side note, I never released my latest version of that mod.

    The second attempt was made (independently?) by Maximus. It is off by default, you can enable it in the advanced option in the Camera's behaviour section.
    Both shared the same big inconvenient : camera doesn't care about walls, patch or anything. Thus you can have silly views (behind the wall, etc).


    :mm For quest scenes

    In some quests you might want the camera to show a different view than the main character back. For those, you could consider several possibilities.
    - using the
    Code:
    locCameraToPos(locx, locy, locz, false);
    function. 'false' allow nice smooth moving. Find the best coordinate for the camera. Don't forget to use locCameraFollow(); at the end of your dialog!
    - use this kind of line if you want the camera to focus on another character :
    Code:
    SendMessage(&locCamera, "li", MSG_CAMERA_SETTARGET, CharacterFromID("Nigel Blythe"));
    Combining camera moves and head model changes can allow you to avoid the annoying exit dialog / enter dialog again issue when you want some discussion with more than two characters.


    :shrug Non functional stuff

    Once again, we have some remains : useless attributes.
    Code:
    cam
    defCam  
    defLinkCam
    Please note that 'cam' is still present in DIALOG.DLL, so it might not be completely useless. You can find '.cam' in CameraDialog.dll' as well, but again I don't know what that's about.
    No matter what, 'cam' is always given "1" whereas Defcam is sometimes given "2", and Deflinkcam "9" only once.
     
  5. zorglub

    zorglub Privateer Storm Modder

    Joined:
    Sep 7, 2006
    Messages:
    774
    Gender:
    Male
    ______________________________________________________

    *end of the tutorial - you can add your comments*

    for moderators : the old, confusing tutorial can be move out of the tutorials subforum.
     
  6. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,575
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Thanks a lot, ASVS! This is a great tutorial with some interesting stuff!
    In fact, since most storyline writers don't actually use the moods code,
    maybe this might encourage them to make use of that small, but fun addition. :yes

    That sounds weird and I don't remember this being intentional. Could you fix it properly and upload the file?

    New version? WHAT new version? :shock
    Actually, those functions ARE used in some spots where for quest purposes,
    we want to show relevant things to the side of the talking characters.
    Examples are the HMS Interceptor moored when talking to the harbour master upon the Jack Sparrow Grand Entrance.
    The other is the burning of the Wicked Wench, which happens DURING the dialog.
    However, I seem to have noticed that these instances don't actually work anymore.
    Would there be any chance you could check this?

    That sounds like it's worth trying to do something with.
    I know there's some of those weird multi-character dialog scenes in the Jack Sparrow and Hornblower quests.
     
  7. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,575
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Old thread is moved to Build Alpha and Brainstorming:
    http://forum.piratesahoy.net//tutorial-how-to-get-the-talking-heads-look-better-t11234.html
     
  8. zorglub

    zorglub Privateer Storm Modder

    Joined:
    Sep 7, 2006
    Messages:
    774
    Gender:
    Male
    Thanks Pieter, yes, that was the whole idea. I bumped recently into my old tutorial about head expression alone and find it so bad that I thought a rewrite was necessary!

    Forgot to remove that from the tutorial script. Nope, everything is fine, that was my mistake!

    I know the functions are used, but all this code is outdated, I changed it a lot from my side - trying to acheive something better than Maximus. I'm quite happy with what I've acheive so far but it's not finish yet. If I remember well, I wanted to work on keeping 1st person view in dialog, and better angle for the barmans, things like that. And for the scenes you're talking, I think we could acheive the same effect with a single locCameraToPos(locx, locy, locz, false); with the appropriate coordinates.

    I haven't played those, but yes indeed. The only issue might be the character name, which appears on top of the screen if I remember well. But avoiding camera sickness and having some better clarty in the dialog is much more important.
     
  9. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,575
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I don't like locCameraToPos because it requires me to come up with coordinate values.
    As far as I'm concerned, your original functions worked quite nicely for it.
    Only I think they now actually refuse to work, which I don't understand.
    So if you have time, could you please use the cheatmode shortcut and try:
    - The burning of the Wicked Wench
    - The Grand Entrance in Port Royale?
    Please check if the camera changes in the dialog work and, if not,
    would it be at all possible for you to have a quick look into what's wrong?
    I know it USED to work. :facepalm
     
  10. zorglub

    zorglub Privateer Storm Modder

    Joined:
    Sep 7, 2006
    Messages:
    774
    Gender:
    Male
    Okay, I'll try to look at it Friday. :onya
     
  11. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,575
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Thanks a lot. There's no rush since I'm at sea for four months anyway,
    so Friday would be perfect. :bow
     

Share This Page