Jump to content

Recommended Posts

What is the best way to have the following 

 

- dialogue when nearing a character who speaks to you

 

 

- dialogue that can give a mission on certain options

 

 

 

would I have to use two different scripts ? Ie. One with scrupts for dialogue choice and one for subtitles ?

Share this post


Link to post
Share on other sites

I don't know about the "best way", but for dialogue with no forking options, I script it like example below.  I'm using CustomRadio, because it shows the name of who is speaking and shows text from radio sounds defined in description.ext.   You could also use Say3D combined with TitleText or globalChat to show the text.  Note that this example waits until player (valdez) is near the NPC (paramedic1) before starting conversation.  And I use " [0] call BIS_fnc_cinemaBorder;" to prevent player from walking away until conversation is finished.  JBOY_Lip is a function I wrote to encapsulate the few lines of code to start and stop lip movement for a # of seconds.  In this example you also see globalChat lines commented out.  When first making mission I use globalChats (text only, no sound), until I get the conversation working the way I want, then I add the voices in later, and comment out the globalChats.

Spoiler

// **************************************************************
// Talk to Paramedic when near and not in truck
// **************************************************************
waitUntil {valdez distance paramedic1 < 4 and vehicle valdez == valdez};
paramedic1 dowatch valdez;
//[0, 200, false, false ] call BIS_fnc_cinemaBorder;
[0] call BIS_fnc_cinemaBorder;
// **************************************************************
[paramedic1, 2] call JBOY_Lip;
paramedic1 customRadio [JBOY_Channel,"hParaGoodDayBob"]; 
//paramedic1 globalchat "Good day officer Bob.";
paramedic1 playActionNow "gestureHi";
sleep 2;
// **************************************************************
[valdez, 5] call JBOY_Lip;
valdez customRadio [JBOY_Channel,"hvTempHospital"];   // 4.1
//valdez globalchat "Hey Zeke.  When are they going to build the new hospital?  This temporary one is a dump.";
sleep 5;
// **************************************************************
[paramedic1, 2.6] call JBOY_Lip;
paramedic1 customRadio [JBOY_Channel,"hParaCutOffFunding"];  //
//paramedic1 globalchat "Maybe never.  Madagascar has cut off the funding.";
sleep 3;
// **************************************************************
[valdez, 4.5] call JBOY_Lip;
valdez customRadio [JBOY_Channel,"hvAfterTexit"];   // 6.2
//valdez globalchat "Goddamn Madagascar. After TEXIT that's all going to change.";
sleep 4.5;
// **************************************************************
[paramedic1, 2] call JBOY_Lip;
paramedic1 customRadio [JBOY_Channel,"hParaAmen"];
paramedic1 lockwp false;
//paramedic1 globalchat "Amen brother. Go TEXIT!";
[1] call BIS_fnc_cinemaBorder;

 

Here's a snippet from description.ext for some of the voice sounds used in above example:

Spoiler

class CfgRadio
{	
    class hParaGoodDayBob
	{
		name = "hParaGoodDayBob";
		sound[] = {"Sounds\hParaGoodDayBob.ogg", db+0, 1.0};
		title = "Good day officer Bob.";
	}; 
    class hParaCutOffFunding
	{
		name = "hParaCutOffFunding";
		sound[] = {"Sounds\hParaCutOffFunding.ogg", db+0, 1.0};
		title = "Maybe never.  Madagascar has cut off the funding.";
	}; 
    class hParaAmen
	{
		name = "hParaAmen";
		sound[] = {"Sounds\hParaAmen.ogg", db+0, 1.0};
		title = "Amen brother. Go TEXIT!";
	}; 

 

And here is my JBOY_Lip function:

Spoiler

// ***********************************************************************************
// JBOY_Lip.sqf
// Do random lip for X seconds
// Compile in init.sqf:    JBOY_Lip =  compile preprocessFileLineNumbers "Scripts\JBOY_Lip.sqf";
// Call:                   _n = [dude, 3] call JBOY_Lip;
// ***********************************************************************************
params["_speaker","_seconds"];

_n = [_speaker,_seconds] spawn
{
    params["_speaker","_seconds"];
    _speaker setRandomLip true;
    sleep _seconds;
    _speaker setRandomLip false;
};

 

And here's another example, where I wanted the conversation to be in the final scene (movie), rather than an NPC conversation that occurs during the mission.  In this case I use say3D and cutText to show the text at bottom of screen (similar to TitleText).

Spoiler

// **************************************************************
[valdez, 3.8] call JBOY_Lip;
valdez say3d "hvSoManyMen";
//valdez sidechat "Why so many armed men to take an ATM?  It doesn't seem worth it.";
cutText ["<br/><br/><br/><br/><t size='2'>Why so many armed men to take an ATM?  It doesn't seem worth it.</t><br/>", "PLAIN", -1, true, true];
sleep 4;
cutText ["", "PLAIN", -1, true, true];

// **************************************************************
[heistHostage, 6.5] call JBOY_Lip;
heistHostage say3d "cousinGoalToKill";
//heistHostage globalchat "When you were chasing us they were laughing.  They didn't care about the money.  I knew then they just wanted to kill you and your men.";
cutText ["<br/><br/><br/><br/><t size='2'>When you were chasing us they were laughing.  They didn't care about the money.  I knew then they just wanted to kill you and your men.</t><br/>", "PLAIN", -1, true, true];
sleep 6.5;
cutText ["", "PLAIN", -1, true, true];

 

 

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

If using the Conversations system, you don't have to use separate files but it helps with organizing.  You can pack everything for different conversations into single files, i.e. one .bikb for topic, one .fsm for AI., one handler .sqf for players, etc.  Then you only have to add one kbtopic to all speakers at mission start.  But as the mission expands with more and more conversations, the files become larger and difficult to search through.

 

So I would say, small missions with maybe a few conversations, you could pack all into single files, but with larger missions having various conversations, you will want to consider breaking the conversations out into files named for their topics.

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×