Jump to content
R3vo

RELEASE: Simple Conversation Script (APEX Edition)

Recommended Posts

Simple Conversation Script (APEX Edition)

 

A simple conversation script for Arma 3. For the documentation as well as the download visit GitHub.

 

Demo Video

 

  • Like 13
  • Thanks 1

Share this post


Link to post
Share on other sites

this is cool, i might use this with some of my own voice acting to create a little liveliness to shops in my mission.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the credit  :D.

 

And good job about the script!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the mention and nice script :) Might give it a go if I ever get around to making a mission

Share this post


Link to post
Share on other sites

With this script: Are the character lip movements just randomized?

Share this post


Link to post
Share on other sites

With this script: Are the character lip movements just randomized?

Yes, they are.

Share this post


Link to post
Share on other sites

With this script: Are the character lip movements just randomized?

 

It looks like it. It's disabled again when the line finishes. This only happens when _speakerObj is defined.

 

if !(isNull _speakerObj) then {_speakerObj setRandomLip true};
 
//Actual convo code
 
if !(isNull _speakerObj) then {_speakerObj setRandomLip false};
  • Like 1

Share this post


Link to post
Share on other sites

Would implementing voice overs be as simple as dropping a playSound3D before the first line of your conversation script (not the function but the actual conversation .sqf).

If this is the best way to do it, is say3D or playSound a better option?

Thanks in advance.

Share this post


Link to post
Share on other sites

Thanks for this amazing script!  I have only a question: if I try to execute it via trigger, it took at least 10 seconds before actual appear. there's a way to make it appear immediately or I'm the one that missed to change something in the script code? :huh:

Share this post


Link to post
Share on other sites

Thanks for this amazing script!  I have only a question: if I try to execute it via trigger, it took at least 10 seconds before actual appear. there's a way to make it appear immediately or I'm the one that missed to change something in the script code? :huh:

 

Hmm no clue, there's nothing in the script which would delay the execution, especially not by 10 seconds. However, make sure that Revo_fnc_simpleConversation_running is nil before calling the script. Otherwise the function will wait until it's nil (To prevent an overlap between conversations)

Share this post


Link to post
Share on other sites

Hmm no clue, there's nothing in the script which would delay the execution, especially not by 10 seconds. However, make sure that Revo_fnc_simpleConversation_running is nil before calling the script. Otherwise the function will wait until it's nil (To prevent an overlap between conversations)

 

Checked and everything seems ok but I still have this delay in the execution. :wacko:  Any  way thanks for the answer.  :(

Share this post


Link to post
Share on other sites

Really loving this script.

 

It's what I was hoping bis_fnc_showsubtitle was going to be.

 

Can I make a couple of suggestions?

 

Can we have a dedicated blufor-indfor-opfor-civ channels in blue,green, red and purple?  So we don't have to change the script colours too much. "Side" is in blue no matter if it's an opfor speaking.

 

And would it be possible to add a time at the end of each sentence? Instead of just one length between each sentence.

 

"line1 = ["Sgt. Anderson", "Papa Bear, this is Alpha 1-1, we are under heavy fire, I repeat, we are under heavy fire, how copy?",5];
    line2 = ["PAPA BEAR", "Solid copy Alpha 1-1, we are sending air support, mark the enemy's position with red smoke, Papa Bear out.",6];
    [[line1,line2],"BLUFOR"] execVM "simpleConv.sqf";"

 

Thanks for the script

I'll defo mention you in the credits ;)

 

e2a

Ahh I see it doesn't need the time thing, Very cool :D

 

 

Share this post


Link to post
Share on other sites

Really loving this script.

 

It's what I was hoping bis_fnc_showsubtitle was going to be.

 

Can I make a couple of suggestions?

 

Can we have a dedicated blufor-indfor-opfor-civ channels in blue,green, red and purple?  So we don't have to change the script colours too much. "Side" is in blue no matter if it's an opfor speaking.

 

And would it be possible to add a time at the end of each sentence? Instead of just one length between each sentence.

 

"line1 = ["Sgt. Anderson", "Papa Bear, this is Alpha 1-1, we are under heavy fire, I repeat, we are under heavy fire, how copy?",5];

    line2 = ["PAPA BEAR", "Solid copy Alpha 1-1, we are sending air support, mark the enemy's position with red smoke, Papa Bear out.",6];

    [[line1,line2],"BLUFOR"] execVM "simpleConv.sqf";"

 

Thanks for the script

I'll defo mention you in the credits ;)

 

e2a

Ahh I see it doesn't need the time thing, Very cool :D

 

Done ;) You can view the new version in the first post, a download link should also be available on Armaholic soon

  • Like 1

Share this post


Link to post
Share on other sites

You sir are a scholar and a gentlemen :)

 

This and 3den enhanced are staples of my mission building these days.

 

Thank you :)

  • Like 1

Share this post


Link to post
Share on other sites

I still find it occasionally hard to read the text on a non-night mission. Is there any way to add a half transparent background color to the text or something? I've checked the wiki in hopes of finding a "backgroundcolor =" attribute, but there doesn't seem to be any?

Share this post


Link to post
Share on other sites

I still find it occasionally hard to read the text on a non-night mission. Is there any way to add a half transparent background color to the text or something? I've checked the wiki in hopes of finding a "backgroundcolor =" attribute, but there doesn't seem to be any?

 

/*
    Author: Revo, _fnc_showTubtitles from Thomas Ryan, edited by Revo
    Last update:  08/19/2016
    - added more colour options

    Description:
    Displays a subtitle at the bottom of the screen. Name of the speaker can be defined and it's colour

    Parameters:
    _this select 0: _array
        _array select 0: STRING - Name of the person speaking - Default: Speaker
        _array select 1: STRING - Subtitle - Default: Subtitle
        _array select 2: OBJECT - Character which speaks the subtitle, used to enable lip movement - Default: objNull
    _this select 1: STRING - Chat type - Default: SIDE
                           - SIDE
                           - GLOBAL
                           - VEHICLE
                           - COMMAND
                           - GROUP
                           - DIRECT
                           - CUSTOM
                           - SYSTEM
    _this select 2: NUMBER - Break multiplier - Is used to calculate the display length of every line - Default: 0.1
    _this select 3: BOOL   - Show background

    Returns:
    true

    Example:

    line1 = ["Sgt. Anderson", "Papa Bear, this is Alpha 1-1, we are under heavy fire, I repeat, we are under heavy fire, how copy?"];
    line2 = ["PAPA BEAR", "Solid copy Alpha 1-1, we are sending air support, mark the enemy's position with red smoke, Papa Bear out."];
    [[line1,line2],"SIDE",0.15,true] execVM "fn_simpleConv.sqf";

*/

#define FADE_DURATION 0.5
#define BACKGROUND_COLOUR [0,0,0,0.4]
#define BACKGROUND_H_COEF 0.0008

waitUntil {isNil "Revo_fnc_simpleConversation_running"};
Revo_fnc_simpleConversation_running = true;

private _lines = param [0,[["Speaker","Subtitle"]],[[]]];
private _colour = param [1,"SIDE",[""]];
private _breakMultiplier = param [2,0.1,[0]];
private _showBackground = param [3,false,[false]];


//Select HEX colour from given string
private _colourHTML = switch (toUpper _colour) do
{
    case "SIDE":     {"#00ccff"};
    case "GLOBAL":     {"#d7d7d9"};
    case "VEHICLE": {"#fbd40b"};
    case "COMMAND": {"#e5e760"};
    case "GROUP":     {"#beee7e"};
    case "DIRECT":     {"#fffffb"};
    case "CUSTOM":    {"#ec5a29"};
    case "SYSTEM":    {"#8a8a88"};
    case "BLUFOR":     {([WEST,false] call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML};
    case "OPFOR":     {([EAST,false] call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML};
    case "GUER":     {([INDEPENDENT,false] call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML};
    case "CIV":     {([CIVILIAN,false] call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML};
};

private _fnc_showSubtitles =
{
    params ["_from", "_text","_colourHTML","_break","_showBackground"];

    // Create display and control
    disableSerialization;
    titleRsc ["RscDynamicText", "PLAIN"];
    private "_display";
    waitUntil {_display = uiNamespace getVariable "BIS_dynamicText"; !(isNull _display)};
    private _ctrl = _display displayCtrl 9999;
    uiNamespace setVariable ["BIS_dynamicText", displayNull];
    private _ctrlBackground = _display ctrlCreate ["RscText",99999];

    // Position control
    private _w = 0.4 * safeZoneW;
    private _x = safeZoneX + (0.5 * safeZoneW - (_w / 2));
    private _y = safeZoneY + (0.73 * safeZoneH);
    private _h = safeZoneH;

    _ctrl ctrlSetPosition [_x, _y, _w, _h];

    // Hide control
    _ctrl ctrlSetFade 1;
    _ctrl ctrlCommit 0;
    if (_showBackground) then
    {
        _ctrlBackground ctrlSetPosition [_x,_y,_w,((count _text) * BACKGROUND_H_COEF) max 0.035];
        _ctrlBackground ctrlSetBackgroundColor BACKGROUND_COLOUR;
        _ctrlBackground ctrlSetFade 1;
        _ctrlBackground ctrlCommit 0;
    };
    // Show subtitle
    _text = parseText format ["<t align = 'center' shadow = '2' size = '0.52'><t color = '%1'>" + _from + ":</t> <t color = '#d0d0d0'>" + _text + "</t></t>",_colourHTML];
    _ctrl ctrlSetStructuredText _text;
    _ctrl ctrlSetFade 0;
    _ctrl ctrlCommit FADE_DURATION;
    if (_showBackground) then
    {
        _ctrlBackground ctrlSetFade 0;
        _ctrlBackground ctrlCommit FADE_DURATION;
    };
    sleep _break;

    // Hide subtitle
    _ctrl ctrlSetFade 1;
    _ctrl ctrlCommit FADE_DURATION;

    if (_showBackground) then
    {
        _ctrlBackground ctrlSetFade 1;
        _ctrlBackground ctrlCommit FADE_DURATION;
    };
};

//Loop through all given lines
for "_i" from 0 to (count _lines) - 1 do
{
    private _nameSpeaker = (_lines select _i) select 0;
    private _currentLine = (_lines select _i) select 1;
    private _speaker = (_lines select _i) param [2,objNull,[objNull]];
    private _break = count _currentLine * _breakMultiplier;

    if !(isNull _speaker) then {_speaker setRandomLip true};
    private _handle = [_nameSpeaker,_currentLine,_colourHTML,_break,_showBackground] spawn _fnc_showSubtitles;
    waitUntil {scriptDone _handle};

    if !(isNull _speaker) then {_speaker setRandomLip false};

    sleep FADE_DURATION + 0.5;
};

Revo_fnc_simpleConversation_running = nil;

true

 

 

Here's a test version where one can enable a background. Feedback would be appreciated!

  • Like 1

Share this post


Link to post
Share on other sites

Works. Had to change the transparency to 0.5, though, because no matter what, at times I still find it hard to read the text. Maybe it's not much the font color contrast, but moving stuff in the background? ... No idea (please someone tell me I am not the only one). /Edit: Well, at least BI has to agree, as their general chat window is using background colors as well.

 

Also changed the box height to a fixed one, as with your version, it sometimes has weird unsymmetrical proportions.

        if ((count _text) <= 100) then { bgh = 0.045; } else { bgh = 0.085; };
        _ctrlBackground ctrlSetPosition [_x,_y,_w,bgh];

This way, if the text has more than 100 signs, the background height will be (nearly) doubled. No need to check for more lines, as more than two is bad writing anyway.

The 100 is a pure guesstimate value. Best approach would be to directly detect if a text definitely uses up more than one line (is this possible?). Oh, and the 0.045 / 0.085 is based on a font size of 0.5 as the original function has (your version uses 0.52).

Share this post


Link to post
Share on other sites

Works. Had to change the transparency to 0.5, though, because no matter what, at times I still find it hard to read the text. Maybe it's not much the font color contrast, but moving stuff in the background? ... No idea (please someone tell me I am not the only one). /Edit: Well, at least BI has to agree, as their general chat window is using background colors as well.

 

Also changed the box height to a fixed one, as with your version, it sometimes has weird unsymmetrical proportions.

        if ((count _text) <= 100) then { bgh = 0.045; } else { bgh = 0.085; };
        _ctrlBackground ctrlSetPosition [_x,_y,_w,bgh];

This way, if the text has more than 100 signs, the background height will be (nearly) doubled. No need to check for more lines, as more than two is bad writing anyway.

The 100 is a pure guesstimate value. Best approach would be to directly detect if a text definitely uses up more than one line (is this possible?). Oh, and the 0.045 / 0.085 is based on a font size of 0.5 as the original function has (your version uses 0.52).

 

Looks great! I tried to get the actual text height with ctrlTextHeight, but it seems that this command only works for certain control types.

Share this post


Link to post
Share on other sites

If we can't get to know when the text breaks into the next line, maybe we can force a line break at a certain position and then also increase the background height?

Share this post


Link to post
Share on other sites

Great Script. Can you tell how the chances for including voice files are standing right now?

Share this post


Link to post
Share on other sites

Great Script. Can you tell how the chances for including voice files are standing right now?

Not good. I don't have much time and I haven't worked with voice files yet.

  • Like 1

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

×