PDA

View Full Version : Conversation System



hawk66de
Jun 7 2009, 15:29
Has anybody already played with the conversation system (eg. kbAddTopic script commands) or is there already any documentation, which I've missed?

Jezuro
Jun 8 2009, 09:45
You might want to check the comref (http://forums.bistudio.com/showthread.php?t=73456).

The summary is:

kbAddTopic adds a topic (duh!) to a person with the .bikb (list of sentences), .fsm (conversation flow script for the AI) and/or .sqf (conversation flow script for a player) files as its parameters
kbTell makes the person actually say a specific sentence (defined in the .bikb file)

Conversation flow scripts are executed every time a sentence was said to the person with passed parameters being:

_sentenceId: the sentence as defined in the .bikb file
_topic: topic name registered via kbAddTopic
_this: the person that was talked to (receiver)
_from: the person that talked to the receiver and triggered the script

hawk66de
Jun 8 2009, 17:00
Thanks Jezuro, I had a look at the wiki/comref but without examples it's a little tough to understand it ;).

Will try it out.

Serclaes
Jun 8 2009, 17:38
Just unpack the campaign in yourarmafolder\Addons\missions:)
There are a lot of "examples". Sure you have to figure out how they work together but thats easy :p

hawk66de
Jun 9 2009, 18:22
works well for NPC conversations, but what do I have to do if I wanna add a topic for the player?

Example:


c1 kbAddtopic["myTest", "myTest.bikb", "", "myTest.sqf"]; // works
sleep 2;
c1 kbTell [m1, "myTest", "myTest_A_0"]; // works fine

player kbAddtopic["myTest", "myTest.bikb", "", "myTest.sqf"]; // and now??



My thought was that I (as the player) could use the sentence(s) somehow to communicate to NPCs (similar to the standard 'Greetings' conversation'), now.

What's the flow here? Thx

Jezuro
Jun 10 2009, 07:27
For the player you need to use call for the script.


player kbAddtopic["myTest", "myTest.bikb", "", {call compile preprocessFileLineNumbers "myTest.sqf"}];

hawk66de
Jun 12 2009, 12:15
@<hidden>

I need your help again:

I did some further tests, here the code:

init.sqf


hint "KbTopic";
c1 kbAddtopic["myTest", "myTest.bikb", "", {call compile preprocessFileLineNumbers "myTest.sqf"}];
player kbAddtopic["myTest", "myTest.bikb", "", {call compile preprocessFileLineNumbers "myTest.sqf"}];

c1 doMove (position receiver);
sleep 10;
c1 lookAt receiver;
sleep 3;
c1 kbTell [receiver, "myTest", "myTest_A_0"];


event handler mytest.sqf:



hint format ["From:%1, Topic:%2, Sentence:%3", _from, _topic, _sentenceId];


When I run the testmission I get immediately the 'kbTell' event handled if I -as the player- approach any unit (_sentenceid is initial).
And I do not see my Topic in any menu...do I have to add it manually somehow?

And what is also strange is that the event handler for
<<<c1 kbTell [m1, "myTest", "myTest_A_0"]; >>>
is not triggered although c1 speaks to receiver

Probably I missed sth completely here :confused:

hawk66de
Jun 22 2009, 18:29
any update on this issue? thx.

Rommel
Jul 6 2009, 06:25
Nevermind I think I found my solution, which when finished I will post for others. :)

Ghost
Jul 6 2009, 11:45
in Ofpec found this topic that might be of use http://www.ofpec.com/forum/index.php?topic=29905.0

ST_Dux
Jul 9 2009, 02:34
I've had a look through some of the missions that come with the game to try and figure this conversation stuff out, and I keep finding a lot of lines like this:


_nic = [objNull, m1, rKBTELL, m4, "global", "s012"] call RE;

Can someone explain to me what "call RE" does? Is kbAddTopic even necessary? I never see it used in official missions. I just see a ton of these calls to the mysterious "RE."

Redfield-77
Jul 9 2009, 21:07
This stuff is way over my head. I did however come up with an easy way to get around using these scripts.

Its probly not the best way to do things and its not applicable to every conversation you may want to create but it does offer a way to ask single questions with single answers. In this example you can ask the AI 3 different questions.

in the AI units init.

this addaction ["Hows it hanging?", "answer1.sqf"]; this addaction ["Do you like Hockey?", "Answer2.sqf"]; this addaction ["Did you see the size of that chicken?", "Answer3.sqf"];

Make 3 sqf. files named Answer1.sqf Answer2.sqf Answer3.sqf

example:
Answer1.sqf

hint "A little to the left";

As you can tell this wouldnt work for full conversations but works well enough to ask simple questions to AI.

ST_Dux
Jul 9 2009, 23:10
I've actually figured out how to use the conversation system. I've even figured out how to use it with the conversation menu (that menu where you can choose your response). But I still have no idea what "call RE" means. Is that some sort of hard-coded function? How does it work? I AM SO CURIOUS.

Redfield-77
Jul 10 2009, 02:48
I've actually figured out how to use the conversation system. I've even figured out how to use it with the conversation menu (that menu where you can choose your response). But I still have no idea what "call RE" means. Is that some sort of hard-coded function? How does it work? I AM SO CURIOUS.

Please post an example conversation for dummies like me :D

Redfield-77
Jul 12 2009, 01:50
Still looking for an example of how conversations work.

zippers
Jul 12 2009, 16:46
Most large conversations are in the fsm files, but i haven't been able to work out work yet. Things like this:


item0[] = {"React",0,250,-148.442688,-132.013092,-48.442719,-82.013107,0.000000,"React"};
item1[] = {"",7,210,-102.438477,48.426529,-94.438538,56.426514,0.000000,""};
item2[] = {"__",8,218,-245.799591,27.887707,-155.799591,77.887695,0.000000,"-"};
item3[] = {"END",1,250,-249.361267,105.329407,-149.361450,155.329422,0.000000,"END"};
item4[] = {"Is_that_right_",4,218,0.000000,225.000000,300.000000,275.000000,1.000000,"Is that right?"};
item5[] = {"So_I_hear__Only",1,250,350.000000,262.000000,650.000000,312.000000,0.000000,"So I hear. Only a few hours now huh? You nervous? I'm shitting it. Hey, you hang here and shoot the breeze some? Your team be cool with that?"};
item6[] = {"Sure__they_won_t",4,218,0.000000,300.000000,300.000000,350.000000,1.000000,"Sure, they won't mind. So, tell me about that new house of yours man!"};
item7[] = {"Oh_yeah__Man_you",1,4346,350.000000,337.000000,650.000000,387.000000,0.000000,"Oh yeah! Man you should see it! Eighteen acres of sweet, sweet..." \n "ADD ACTION, SET TALKER AS WAITING"};
item8[] = {"Na__I_got_stuff",4,218,-2.365997,374.528778,297.633972,424.528778,1.000000,"Na, I got stuff to do."};

ST_Dux
Jul 12 2009, 17:55
Before doing anything with conversations, you need to get yourself an FSM editor. The AI-side of any conversation in ArmA 2 must be controlled by an FSM, so if you are unfamiliar with FSM editing, familiarize yourself with that first.

Basically, the whole system works by automatically running scripts (for the player) or FSMs (for the AI) whenever kbTell is used. These scripts/FSMs can then be used to initiate more kbTells, creating a whole converstation. The kbAddTopic command is what ties everything together.

In order to give the player choices, you need to use an apparently reserved variable, BIS_convMenu. A typical player conversation script will look like this (taken from the official mission "Dogs of War"):


// collect reactions to BIS_convMenu _this _from _topic _sentenceid
BIS_convMenu = [];

//debug
if (!isNil "BIS_DEBUG_DIALOG") then
{
if (_sentenceId!="") then
{
debugLog format["DIALOG- SQF of %1 initiated by %2 _sentenceId %3 sentence %4",_this, _from, _sentenceId, localize ("STR_"+"_sentenceId")];
};
};

switch (_sentenceId) do
{



case "beginning_cdf_briefing_S_2":
{//USEUCOM say we're close to convincing Moscow that NAPA had nothing to do with the bombing. Without that the Russians've got no reason to be here.

if (BIS_evidenceGathered >= BIS_evidenceNeeded) then {
_this kbtell [_from, "beginning_cdf_briefing","beginning_cdf_briefing_C_1"]; //We may even be able to redeploy the MEU. It seems we got enough evidence to convince the rest of the Security Council.
} else {
_this kbtell [_from, "beginning_cdf_briefing","beginning_cdf_briefing_C_2"]; //I think there's no chance of the MEU returning any time soon. The weight of evidence just wasn't enough to convince the Security Council to reinstate US control.
};
_this kbtell [BIS_CDFBegunov, "beginning_cdf_briefing","beginning_cdf_briefing_C_3"]; //Anyway, what do we do?
};


case "beginning_cdf_briefing_B_4":
{//You keep to your brief. Support the Chernarussian forces on the ground. However, due to your heroic efforts in the Sobor region, I am ready to offer you command over the operation.

BIS_convMenu = BIS_convMenu + [[ localize "str_command_yes", _topic, "beginning_cdf_briefing_C_4", []]];
BIS_convMenu = BIS_convMenu + [[ localize "str_command_no", _topic, "beginning_cdf_briefing_C_5", []]];
};


case "beginning_cdf_briefing_B_7":
{//You can still report to Marny and Stavovich here in the base for orders and intel but other than that you've got free reign to retake the north as you see fit.

_this kbtell [_from, "beginning_cdf_briefing","beginning_cdf_briefing_C_6"]; //Thank you Sir. With your permission, we'll get started.
};


};

// return the result
BIS_convMenu
BIS_convMenu is an array of arrays, each of which takes four arguments:
1. Text to show up in the menu (string)
2. Conversation topic as established using kbAddTopic (string)
3. Sentence ID of sentence to be said if option is chose, as defined by the bikb file tied to the conversation topic (string)
4. I suppose this is for optional arguments, but I've only seen it used as empty array (array).

Redfield-77
Jul 12 2009, 19:36
Great! thanks alot ST Dux.

zippers
Jul 13 2009, 15:50
So if thats how to make a conversation what are all the items for and what do the numbers mean. For example:


item8[] = {"Na__I_got_stuff",4,218,-2.365997,374.528778,297.633972,424.528778,1.000000,"Na, I got stuff to do."};

Redfield-77
Jul 13 2009, 23:09
So if thats how to make a conversation what are all the items for and what do the numbers mean. For example:


item8[] = {"Na__I_got_stuff",4,218,-2.365997,374.528778,297.633972,424.528778,1.000000,"Na, I got stuff to do."};

Those are mouse pointer coords so you can click what you want to say.

Rommel
Aug 30 2009, 03:19
If you open up the FSM files and remove all the comments, you will notice those numbers are nothing but references to the design in BIS's FSM editor, and have no functionality what so ever.

Could BIS give us some easy insight to how make something simple out of this...

Doolittle
Aug 30 2009, 21:28
I don't know if this is related to the Conversation system, but where is BIS_noCoreConversations used??? I can't find it in any .fsm anywhere..! Just the setting of it...

E.g. what module does the conv. between people in the game?

Edit: nevermind: found in characters

disobey
Sep 5 2009, 11:48
Has anyone got a sample mission or some sample script for a an example of a simple conversation?

I've been trying to get it to work, with a .bikb file but no luck so far. Is there any documentation relating to how FSMs are related to the conversation logic (are they even required?).

All I want is 2 additional questions to ask a civilian on top of Weather/Targets/Location and a single response. For some reason, kbAddTopic and kbTell do not do anything when I have tried them!

Wolffy.au
Sep 15 2009, 11:22
But I still have no idea what "call RE" means. Is that some sort of hard-coded function? How does it work? I AM SO CURIOUS.

Well, I've been having heaps of trouble with JIP and started looking into the Multiplayer Framework Editor Module (http://community.bistudio.com/wiki/Multiplayer_framework)- that's what RE references.

For example,
[nil,nil,rHINT, "Hello world"] call RE; would broadcast hint "Hello world" to all players.

I am yet to test, but thats what I'm see atm. Would love to see some official BIS help on the multiplayer module - try to resolve JIP weather, time, markers, objectives, etc.

Zagolski
Sep 25 2009, 22:56
In what folder sweets their custom sounds and how they prescribe to .bikb? I do not, there is no sound ...

IndeedPete
Oct 14 2009, 11:18
Has someone got a simple example mission yet? I found out how to use kbTell but the multiple choice thing still doesn't work. I opened a few BIS missions to see how it works but it's far too complicated. I would really appreciate a simple example with only two guys and a small multiple choice dialogue. :)

King Nothing
Nov 16 2009, 22:16
Hi, After looking through quite a few links and official campaign files I'm also interested to have some small and simple tutorial on how a conversation works seen in the campaign. Some where you can choose "yes" or "no". That would be much appreciated. :)