Jump to content
Sign in to follow this  
Woodpeckersam

Conversation System... confusing and cant get it to work

Recommended Posts

Hi there all (again) lol!

I thought to try the Conversation system in Arma 2, following a certain tutorial which i find very difficult to understand and slightly unclear. I just cant seem to get the system to work.

Can someone please review my script and see why it wont work?

Many thanks for your time :D

3RD TIME UPDATED SCRIPTS FOR THE QUESTION I ASKED REGARDING WHY THE AI IS NOT MAKING CONVERSATION

UPDATE: Welcome_boss.sqf, start.sqf, welcome.bikb, FSM Image and Welcome_boss.fsm (FILE)

****

The player (
mainguy
) starts in a helicopter (
HeliStart
) with his group.

HeliStart
is going to land at
helipad1
to drop of my group.

When
mainguy
walks out of the helicopter compound, the CO (
boss
) is standing in front of him.

When
mainguy
reaches a certain distance between
boss
the conversation starts. The animation has already been set up.

While chatting with
boss
the player is given a choice of missions he would like to do.

When the player chooses a mission it executes another script (i havent made any yet, i just want to get the conversation working).

****

Also as you may probably notice in the scripts i havent fully completed it the way i want it to be complete, i just cant seem to work out how to make it work. Once i understand how to do it, then i can probably do it all myself. I would REALLY appreciate it so much if someone can help me out here. Its for a practice mission but i want to learn much about scripting before i go on to do stuff for the community.

Start.sqf

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: WoodyUK
//***************************************************************/
// A very big thanks to: Muzzleflash, Cobra4v320 and IndeedPete!
//***************************************************************/
//////////////////////////////////////////////////////////////////
private ["_megrp","_player","_del"];

{_x setVariable ["BIS_noCoreConversations", TRUE]} forEach [player, boss];

_this select 0;
_megrp = group mainguy;
_player = mainguy;
_del = deletevehtrig;
_boss = boss;

boss setBehaviour "safe";

{_x moveincargo HeliStart} foreach units _megrp;

while {HeliStart distance helipad1 >= 100} do
{
HeliStart Move getpos helipad1;

HeliStart flyinHeight 50;
};

HeliStart land "LAND";

{doGetOut _x} foreach units _megrp;

waituntil {{ !( _x in HeliStart)} foreach (units _megrp) };

HeliStart land "NONE";

boss doWatch leader _megrp;
boss setSpeedMode "LIMITED";

waituntil {_player distance boss <= 4};

player kbAddTopic ["GoodMorning", "Conversations\Boss\Welcome.bikb", "", {call compile preprocessFileLineNumbers "Conversations\Boss\Welcome_Boss.sqf"}];
_boss kbAddTopic ["GoodMorning", "Conversations\Boss\Welcome.bikb", "Conversations\Boss\Welcome_boss.fsm"];

_boss kbTell [player,"GoodMorning","GoodMorning"];

waitUntil {boss kbWasSaid [_player,"finishconvo", "bossfin", 999999]};

HeliStart move getpos _del;

Welcome_Boss.sqf

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: WoodyUK
//////////////////////////////////////////////////////////////////
BIS_convMenu = [];

if (_from == boss && _sentenceId == "" && !(boss kbWasSaid [_from, _topic, "GoodMorning", 999999])) then {
BIS_convMenu = BIS_convMenu + [["Commander Sunny?", _topic, "GoodMorning", []]];
};

switch (_sentenceId) do
{	
case "GoodMorning":
{
	boss playMove "AmovPercMstpSlowWrflDnon_Salute";
	player playMove "AmovPercMstpSlowWrflDnon_Salute";
	BIS_convMenu = BIS_convMenu + [["Good Morning and thank you Sir!",  _topic, "GMorningSir", []]];
};

case "ChooseMission":
{
	boss playMove "";
	player playMove "";
	BIS_convMenu = BIS_convMenu + [["Protect Convoy",  _topic, "p_convoy", []]];
	BIS_convMenu = BIS_convMenu + [["Help Defend Town", _topic, "d_town", []]];
	BIS_convMenu = BIS_convMenu + [["Sneak into Village and Steal Documents",  _topic, "s_docs", []]];

};

case "p_convoy":
{
	BIS_convMenu = BIS_convMenu + [["Yes Sir.",  _topic, "p_convoy_agree", []]];
	BIS_convMenu = BIS_convMenu + [["No Sir", _topic, "disagree", []]];
};

case "p_convoy_explain":
{
	BIS_convMenu = BIS_convMenu + [["I understand",  _topic, "p_convoy_understand", []]];
	BIS_convMenu = BIS_convMenu + [["Please Explain Again", _topic, "p_convoy_again", []]];
	BIS_convMenu = BIS_convMenu + [["I want a different mission", _topic, "disagree", []]];
};

case "p_convoy_understand":
{

};

case "d_town":
{
	BIS_convMenu = BIS_convMenu + [["Yes Sir.",  _topic, "d_town_agree", []]];
	BIS_convMenu = BIS_convMenu + [["No Sir", _topic, "disagree", []]];
};

case "s_docs":
{
	BIS_convMenu = BIS_convMenu + [["Yes Sir.",  _topic, "s_docs_agree", []]];
	BIS_convMenu = BIS_convMenu + [["No Sir", _topic, "s_docs_disagree", []]];
};

};

BIS_convMenu;

Welcome.bikb

class Sentences
{
// BOSS CONVO
class GoodMorning
{
	text = "Good Morning! I am Commander Sunny indeed! Welcome to Firefly base Sergeant.";
	speech[] = {};
	class Arguments {};

};

class ChooseMission
{
	text = "Well look on the bright side! Now that you are here, the action can start. You will have a choice to choose one of three missions. What would you like to do?";
	speech[] = {};
	class Arguments {};

};

class p_convoy
{
	text = "You will need to protect the convoy that will be heading from --- to ---. Are you sure you want to do this mission?";
	speech[] = {};
	class Arguments {};

};

class p_convoy_agree
{
	text = "Good! This mission should be a total piece of cake.";
	speech[] = {};
	class Arguments {};

};

class p_convoy_explain
{
	text = "The mission details are as followed. A convoy will be dispatched from the weapons factory in Chernogorsk. Your task will be to protect it at all cost, until it reaches its destination. Do you understand?";
	speech[] = {};
	class Arguments {};

};

class p_convoy_understand
{
	text = "Good! Go to your tent that we have set up for you, and stay the night. The convoy will be leaving at 0600 tomorrow.";
	speech[] = {};
	class Arguments {};

};

class d_town
{
	text = "You will need to defend ---. Are you sure you want to do this mission?";
	speech[] = {};
	class Arguments {};

};
class s_docs
{
	text = "You will need to steal the docs from ---. Are you sure you want to do this mission?";
	speech[] = {};
	class Arguments {};

};


class Bossfin
{
	text = "Carry On Sergeant! Good luck!";
	speech[] = {};
	class Arguments {};

};

// PLAYER CONVO

class GMorningSir
{
	text = "Good Morning and thank you Sir!";
	speech[] = {};
	class Arguments {};		
};

class agree
{
	text = "Yes Sir.";
	speech[] = {};
	class Arguments {};

};

class disagree
{
	text = "No Sir";
	speech[] = {};
	class Arguments {};

};

};
class Arguments{};
class Special{};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};

Welcome_boss.fsm

I have uploaded my latest fsm file, please download it to see what it's doing in conjunction with these scripts above.

FSM - http://www.mediafire.com/file/ctsh7a4n3ujxwst/Welcome_Boss.fsm

http://www.mediafire.com/file/g4oht9694wjom1q/Welcome_Boss.rar

code-1.jpg

Edited by WoodyUK

Share this post


Link to post
Share on other sites

It's been a while since I've worked with the conversation system, but you'll need to use an FSM file for all AI speech. Scripts only work with players.

Share this post


Link to post
Share on other sites

Thats going to take me a long time to get the hang of, i tried it out today, constant failure. There just dont seem to be any clear documentation that i can find on the net... :(

When you mean speech, do you mean the AI is using a sound file i provide for the speech? I just want to make it with no speech, just text for now and thats just it.

I saw in the tutorial i mentioned (its very hard to understand that tutorial) that you dont need an fsm file. It said it was optional.

So i wonder if i have just typed a line of a code wrong...

Share this post


Link to post
Share on other sites

The FSM is optional for playable units. AI controlled units always need a FSM to respond. I know it's very hard to understand and it took me a lot of time to get a simple conversation working. I think you should use Jezuro's example and try to expand it more. That's how i got started.;)

Share this post


Link to post
Share on other sites

Yes that's the tutorial I was using. Great tut, just very hard to understand some parts of it. So I see what you are saying, so basically a unit will require fsm to respond to what the player is saying (via choices for example)?

Thats where I dropped into a deadzone, there's very little mention of how to use fsm in conjunction with the conversation.

I'll look more into this later. Thanks for your reply :D

Edit*****

quick question, let's say I use the manual conversation flow as shown in jezuro tutorial, how would I go about adding choices? (I was thinking of using this as my backup)

Edited by WoodyUK

Share this post


Link to post
Share on other sites
quick question, let's say I use the manual conversation flow as shown in jezuro tutorial, how would I go about adding choices? (I was thinking of using this as my backup)

You can't add choices this way, but you could just add actions that correspond to various conversation branches. If you want to use the built-in conversation menu, though, you're going to have to learn how to create FSM files. Thankfully, FSM files actually aren't that hard to make if you have a decent FSM editor. They use the same scripting language, and they're presented in a graphical way that's really quite intuitive.

Share this post


Link to post
Share on other sites

Thanks for replying :D

I have now sort of understood the logic of .fsm, and have made a very basic one. But for some reason the AI dont seem to be saying anything to the player at all :(. Can someone help me with this script please? and identify whats wrong?

Many thanks.

ps - check the first post for the scripts and the fsm =) or click here http://forums.bistudio.com/showpost.php?p=1723077&postcount=1

Edited by WoodyUK

Share this post


Link to post
Share on other sites

If i ignore the fact that i'm a little drunk right now i'd recommend to replace the local "_player" variable with "player" in your welcome_boss.sqf. Maybe that solves the problem. If not i'll take a closer look tommorrow...^^

Share this post


Link to post
Share on other sites

updated first post heavily... changed it to make it easier to read :)

_________________________________________________________________

Haha at least you got drunk! i have done that in ages! You had a good time? :P

Thanks for the suggestion matey, that did work a little indeed(pete) only for the first sentence of the conversation. At one point i managed to get the conversation to go through with the action boxes and stuff, and when the game crashed at the end of the bikb script i change some setting and now i cant work out what i did.

But from listening to your advice i managed to get boss1 to say his first sentence to me! *gets a video camera to record this special moment*

So i have been having problems since that moment i changed a part of ONE of the scripts (this was about 3 hours ago :( ) Is it ok if you can take a gander at me script?

Thanks a lot for all the help you have given me so far :D

Share this post


Link to post
Share on other sites

Oh, great time...^^

Well, the problem is that the Boss does not receive the first sentence. I guess you could do a workaround by putting the first two sentences "GoodMorning" and "boss1" into one sentence.

Share this post


Link to post
Share on other sites

Updated first post heavily again...

  1. Replaced scripts to latest version
  2. Changed the FSM picture
  3. Uploaded my FSM file

____________________________________________

Hello there again :D

First thing first check at the top of the start.sqf script :D http://forums.bistudio.com/showpost.php?p=1723077&postcount=1

I sort of did what you said and with tweaking and using examples from the script for Jezuro's post i actually made the conversation go further, and it allowed me to use the menu woohoo!!

However... when i get to the point where i want to choose the mission i want to do... i get a few problems. Remember i am only testing the mission selection for the protect_convoy missions, none of the others.

  1. When the conversation gets to the part where Boss i supposed to say "Well look on the bright side!.....", Boss isnt saying it, the player is :S
  2. When i click on the "Protect Convoy Mission" in the menu it doesnt start the next lot of dialogue.
  3. I set a description.ext so i could give the Boss a real name, which is "Commander Sunny", in his dialogue it doesn't come up with his name...

Because of these problems, i uploaded the FSM file so you can see it right on your machine :D

edit::: Changed the download link to my FSM file. 2Shared is a rubbish website. Thank god for MediaFire

Edited by WoodyUK

Share this post


Link to post
Share on other sites

Ok, first thing: Why do you use "_player" and "player" in your start.sqf? Use "player" OR "mainguy". Same thing for "boss" and "_boss". ;)

Oh and you don't need the "_this select 0;" unless you want to pass something into the script. If you wish that it would look like this:

_var = _this select 0;

"start.sqf"

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: WoodyUK
//***************************************************************/
// A very big thanks to: Muzzleflash, Cobra4v320 and IndeedPete!
//***************************************************************/
//////////////////////////////////////////////////////////////////

{_x setVariable ["BIS_noCoreConversations", TRUE]} forEach [player, boss];

_megrp = group player;

boss setBehaviour "safe";

{_x moveincargo HeliStart} foreach units _megrp;

while {HeliStart distance helipad1 >= 100} do
{
HeliStart Move getpos helipad1;

HeliStart flyinHeight 50;
};

HeliStart land "LAND";

{doGetOut _x} foreach units _megrp;

waituntil {{ !( _x in HeliStart)} foreach (units _megrp) };

HeliStart land "NONE";

boss doWatch leader _megrp;
boss setSpeedMode "LIMITED";

waituntil {player distance boss <= 4};

player kbAddTopic ["GoodMorning", "Conversations\Boss\Welcome.bikb", "", {call compile preprocessFileLineNumbers "Conversations\Boss\Welcome_Boss.sqf"}];
boss kbAddTopic ["GoodMorning", "Conversations\Boss\Welcome.bikb", "Conversations\Boss\Welcome_boss.fsm"];

boss kbTell [player,"GoodMorning","GoodMorning"];

waitUntil {boss kbWasSaid [player,"finishconvo", "bossfin", 999999]};

HeliStart move getpos deletevehtrig;

Now to your questions:

1. I think there's a problem in your FSM. I'd take a look but i can't open it, always get an error. Did you compile it with the right compile config?

2. Same thing here, i need the FSM and all the other files to look at.

3.Well, let's see your description.ext then. Or did you forget to give the boss an identity by:

boss setIdentity "sunny";

It would be the best if you upload the whole mission including the UNCOMPILED FSM! :)

Share this post


Link to post
Share on other sites

Hi there mate again :D

Thanks for your help. I did what you told me to do :D

I figured out the problem for the FSM. I had a corrupted fsm file and everything i did (that you see in the pic from the first post) is from the .BIFSM file. Thats all been fixed now.

I sorted out the identity, turns out I didnt name the boss in description.ext properly, now thats sort.

And per your request here is the actual mission file.

http://www.mediafire.com/file/cizbbd056k9cip8/Firefly_Base.Chernarus.rar

Some words... base looks ugly (because its tottalllyyy unfinished) the convoy behind the base doesnt seem to start off properly. Damn AI and Roads!. Originally the helicopter is meant to start far out to sea. I have done anything with the two characters acting and making expression, except saluting. And there are no missions, i just want to get the dialogue done. Also dont worry about mission2.sqm it doesnt work in the editor (i keep forgetting to delete it)

See if you can open the mission file. I dunno what mods are really loaded onto it, even with checking the sqm file... so heres a screenshot of the game folder with all my loaded mods. (from other people of course and thanks to them :D)

mods.jpg

I know i am not using all the mods, just some.

*******EDIT

After re-checking this post for replies i realised that the mod folder image hasnt been put on here.... weird i swear i did. Well its here now.

Edited by WoodyUK

Share this post


Link to post
Share on other sites

Ah, i see the problem. You let the wrong persons say the wrong sentences.^^

I fixed it an did a little workaround, now the conversation is working to the point where the player can say "I understand", "Explain again" and "I want another mission". Anyway, here are the changed scripts, i marked the things i added/edited.

"welcome.bikb"

class Sentences
{
// BOSS CONVO
class GoodMorning
{
	text = "Good Morning! I am Commander Sunny. Welcome to Firefly base Sergeant.";
	speech[] = {};
	class Arguments {};

};

class ChooseMission
{
	text = "Well look on the bright side! Now that you are here, the action can start. You will have a choice to choose one of three missions. What would you like to do?";
	speech[] = {};
	class Arguments {};

};

class p_convoy
{
	text = "You will need to protect the convoy that will be heading from --- to ---. Are you sure you want to do this mission?";
	speech[] = {};
	class Arguments {};

};

class p_convoy_agree
{
	text = "Good! This mission should be a total piece of cake.";
	speech[] = {};
	class Arguments {};

};

class p_convoy_explain
{
	text = "The mission details are as followed. A convoy will be dispatched from the weapons factory in Chernogorsk. Your task will be to protect it at all cost, until it reaches its destination. Do you understand?";
	speech[] = {};
	class Arguments {};

};

class p_convoy_understand
{
	text = "Good! Go to your tent that we have set up for you, and stay the night. The convoy will be leaving at 0600 tomorrow.";
	speech[] = {};
	class Arguments {};
};

class d_town
{
	text = "You will need to defend ---. Are you sure you want to do this mission?";
	speech[] = {};
	class Arguments {};

};
class s_docs
{
	text = "You will need to steal the docs from ---. Are you sure you want to do this mission?";
	speech[] = {};
	class Arguments {};

};


class Bossfin
{
	text = "Carry On Sergeant! Good luck!";
	speech[] = {};
	class Arguments {};

};

// PLAYER CONVO

[b][color="Red"]class p_convoy_understand_select
{
	text = "Got it!";
	speech[] = {};
	class Arguments {};
};

class p_convoy_select
{
	text = "What about the convoy?";
	speech[] = {};
	class Arguments {};
};[/color][/b]

class GMorningSir
{
	text = "Good Morning and thank you Sir!";
	speech[] = {};
	class Arguments {};		
};

class agree
{
	text = "Yes Sir.";
	speech[] = {};
	class Arguments {};

};

class disagree
{
	text = "No Sir";
	speech[] = {};
	class Arguments {};

};

};
class Arguments{};
class Special{};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};

"welcome_boss.sqf"

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: WoodyUK
//////////////////////////////////////////////////////////////////
BIS_convMenu = [];

if (_from == boss && _sentenceId == "" && !(boss kbWasSaid [_from, _topic, "GoodMorning", 999999])) then {
BIS_convMenu = BIS_convMenu + [["Commander Sunny?", _topic, "GoodMorning", []]];
};

switch (_sentenceId) do
{	
case "GoodMorning":
{
	boss playMove "AmovPercMstpSlowWrflDnon_Salute";
	player playMove "AmovPercMstpSlowWrflDnon_Salute";
	BIS_convMenu = BIS_convMenu + [["Good Morning and thank you Sir!",  _topic, "GMorningSir", []]];
};

[b][color="Red"]case "ChooseMission":
{
	boss playMove "";
	player playMove "";
	BIS_convMenu = BIS_convMenu + [["Protect Convoy",  _topic, "p_convoy_select", []]];
	BIS_convMenu = BIS_convMenu + [["Help Defend Town", _topic, "d_town", []]];
	BIS_convMenu = BIS_convMenu + [["Sneak into Village and Steal Documents",  _topic, "s_docs", []]];

};[/color][/b]

case "p_convoy":
{
	BIS_convMenu = BIS_convMenu + [["Yes Sir.",  _topic, "p_convoy_agree", []]];
	BIS_convMenu = BIS_convMenu + [["No Sir", _topic, "disagree", []]];
};

[b][color="Red"]case "p_convoy_explain":
{
	BIS_convMenu = BIS_convMenu + [["I understand",  _topic, "p_convoy_understand_select", []]];
	BIS_convMenu = BIS_convMenu + [["Please Explain Again", _topic, "p_convoy_again", []]];
	BIS_convMenu = BIS_convMenu + [["I want a different mission", _topic, "disagree", []]];
};[/color][/b]

case "d_town":
{
	BIS_convMenu = BIS_convMenu + [["Yes Sir.",  _topic, "d_town_agree", []]];
	BIS_convMenu = BIS_convMenu + [["No Sir", _topic, "disagree", []]];
};

case "s_docs":
{
	BIS_convMenu = BIS_convMenu + [["Yes Sir.",  _topic, "s_docs_agree", []]];
	BIS_convMenu = BIS_convMenu + [["No Sir", _topic, "s_docs_disagree", []]];
};

};

BIS_convMenu;

And i changed the FSM a bit. Here i've uploaded the changed files and an old mission from myself where i used the conversation system right at the beginning. To play it you need to have the Mercenaries Mod installed. But you could just look at the scripts of course! If you play it please note that it was part of a campaign i never finished so it might be a bit confusing...

http://www.mediafire.com/?qy8qx16p1f628lb

Share this post


Link to post
Share on other sites

I want to thank you so much for all the time you put in to helping me out with this mate! Thank you sooo much!! Woohoo! Now the conversations are all working i can carry the script on :D

You are a great community member and helper, you are indeed pete. :D

Have you ever thought about expanding the conversation system tutorial from Jezuro? Maybe creating a tutorial that will help explain things to beginners? Im still relatively new to this system, although if i ever get experienced enough at it, i wouldnt mind trying to make a tutorial. I'll put it my "think about it" book :P

I'll check out your short campaign when im free. Going to be busy for the next 4 - 5 weeks (moving)

Again thanks so much! *Beer for Indeed Pete*

Share this post


Link to post
Share on other sites

Thanks mate, it's always a pleasure to help. :) I thought about doing a tutorial since there's so little information out there but i don't know if i can cover everything that the conversation system has to offer. Well, i see if i can get something useful together.^^

Share this post


Link to post
Share on other sites

I see here are myn guys who know the conversation system very well.

So i too have a quick question...

Is it possible to change the color of the text ?

The White text is sometimes hard to read...

Share this post


Link to post
Share on other sites

Not that i know. You could increase the distance between the two talking persons to force them to use the radio though... :D

Share this post


Link to post
Share on other sites
Not that i know. You could increase the distance between the two talking persons to force them to use the radio though... :D

Mhhh, but the you would have give the unit a group identity and will always see a 1 behind the name...

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
Sign in to follow this  

×