Jump to content
IndeedPete

Spin-Off Release: Simple Conversation System

Recommended Posts

Hey,

yes, I can confirm the error, I have no idea what it might be though. It's taken from Iceman77's tutorial. The control itself (the dark-transparent box behind every dialog) seems to work fine. It's an error that's in the .rpt but other than that it seems to have no effect whatsoever. I assume it doesn't cause any script errors for you.

Did you #include missionConversations.hpp into your description.ext?

---------- Post added at 01:09 AM ---------- Previous post was at 01:08 AM ----------

It's step four on the setup in my prior post. Flagged as optional because you don't need to do it if you only want to use the simple functions.

---------- Post added at 01:10 AM ---------- Previous post was at 01:09 AM ----------

Oh, and missionConversations.hpp can be in your config folder but you'd have to change the include to: #include conv\missionConversations.hpp

Share this post


Link to post
Share on other sites

Fixed that bit, the conversations was mistakenly included inside the RscTitles class.

Now what occurs is I get the action, but I get an error stating that IP_DLG_CONVERSATION cannot be found when I try to use it.

Currently here's where I have includes at, most other combinations result in a CTD when I start a local server:

class RscTitles {
#include "ais_injury\dialogs\rscTitlesAIS.hpp"
#include "conv\cfg\defines.hpp"
#include "conv\cfg\dialogs.hpp"
};

#include "conv\missionConversations.hpp"

class CfgFunctions
{
#include "VAS\cfgfunctions.hpp"
#include "conv\cfg\functions.hpp"
#include "ais_injury\cfgFunctionsAIS.hpp"

};

And how they're being called in script, executed locally to the player:

nul = [_target, "Hey, what can I help you with?", "Direct"] spawn IP_fnc_simpleSentence;

nul = [_target, "opener"] spawn IP_fnc_addConversation;

Where _target is the civilian.

Sorry for all the poking, I'm not used to working with .hpp files.

Share this post


Link to post
Share on other sites

Ah, I see. The problem is that the small dialog for simpleSentence must be defined within RscTitles because otherwise a mouse cursor would show up and you wouldn't be able to more for the duration. However, the full conversation (big dialog) must not be a RscTitles, it must be a plain old dialog. If you take a look at the sources you will see that only the IP_DLG_SIMPLESENTENCE is placed within the RscTitles brackets. So, to do what you're after you need to create a second .hpp containing the IP_DLG_CONVERSATION only and #include it separately.

Share this post


Link to post
Share on other sites

Did that, but unfortunately now if I #include it anywhere except RscTitles it'll CTD on server start saying that IP_BOX is undefined. I tried removing that section just for kicks and the next item down also reported as undefined.

Share this post


Link to post
Share on other sites

Hm, works for me. Maybe you've made a msitake somewhere else? I've modified the example mission to have separated RscTitles and Dialogs, hope it helps:

Download

Share this post


Link to post
Share on other sites

Hello,

First of all i just wanna say thank you and what a great job you are doing, Keep up the good work.

I have managed to setup a series of tasks given to the player from a commanding officer, dialogs become available and unavailable based on there:

Ranks of the players.

Conditions of other tasks or if you had a negative impact on another task giver during your conversation with them.

Consequences based on the decisions you make.

And lots of other cool stuff.

The only problem i am having and its been driving me mad is the "Live-Cam" I just cant seem to get it working, It will only ever show the default display picture for every conversation, Unless i give the path to my own images, But its not a image i want, I want it Live-Cam "except for in vehicles" any idea how i get it working?

Thanks.

Share this post


Link to post
Share on other sites

Hi, glad you like it so far!

The live cam is only available in IP_fnc_simpleSentence, not in the full conversation if that's your problem. If not, the speaking unit should have this var set:

unit setVariable ["IP_LiveFeed", true];

I guess it would be possible to change the system to show a live feed in the "big dialog" too. However, you can't have more than one picture-in-picture effect running at a time (game limitation), so one conversation partner would have a static image while the other would have the live feed. I found this inconsistent and thus decided to use static images in the big dialog. This pip limitation is a problem in camscripts too, so if you intent to use the system during camscripted cutscenes you have to rely on static images.

Share this post


Link to post
Share on other sites

Thank you for the reply,

Yes it is full conversations, I intended to use a static image for the player, But for the AI i am talking to i wanted it to be live-cam, Just find it a bit tedious to set images for every Ai that you can talk to even more so if its allot of AI's if you get my drift lol

Share this post


Link to post
Share on other sites

Well, you could achieve that with a little bit of adapting. Provided that your AI is always the second conversation partner (means player is first) you could try the following (untested):

conv\cfg\dialogs.hpp

Change this:

class IP_PIC_SECOND: IP_RscPicture
{
idc = 1201;
[b][color="#FF0000"]text = "#(argb,8,8,3)color(1,1,1,1)";[/color][/b]
x = 33 * GUI_GRID_W + GUI_GRID_X;
y = 1 * GUI_GRID_H + GUI_GRID_Y;
w = 6 * GUI_GRID_W;
h = 4 * GUI_GRID_H;
};

To this:

class IP_PIC_SECOND: IP_RscPicture
{
idc = 1201;
[b][color="#FF0000"]text = "#(argb,256,256,1)r2t(camrender0,1.0)";[/color][/b]
x = 33 * GUI_GRID_W + GUI_GRID_X;
y = 1 * GUI_GRID_H + GUI_GRID_Y;
w = 6 * GUI_GRID_W;
h = 4 * GUI_GRID_H;
};

conv\fnc\openConversation.sqf

Change this (lines 44-45):

_picture = _second getVariable ["IP_Avatar", "conv\img\defaultAvatar.jpg"];
ctrlSetText [1201, _picture];

To this:

_animState = animationState _second;
_animStateChars = toArray _animState;
_animP = toUpper (toString [_animStateChars select 5, _animStateChars select 6, _aniMStateChars select 7]);		
_attachToValues = switch (_animP) do {
case "ERC": {[0, 1, 1.7]};
case "KNL": {[0, 1.25, 1]};
case "PNE": {[0, 1.5, 0.25]};
default {[0, 1, 1.7]};
};

IP_Camera = "camera" camCreate (getPos _second);
IP_Camera camPrepareTarget _second;
IP_Camera camPrepareFOV 0.2;
IP_Camera attachTo [_second, _attachToValues];		
IP_Camera camCommitPrepared 0.03;
IP_Camera cameraEffect ["INTERNAL", "BACK", "camrender0"];

conv\fnc\closeConversation.sqf

Change this:

closeDialog 0;

To this:

player cameraEffect ["terminate", "back"];
camDestroy IP_Camera;
closeDialog 0;

As said it's untested and might be a bit clunky or need some tweaking. Let me know if that works for you!

Share this post


Link to post
Share on other sites

At the moment with them tweaks, The box where the picture used to be for the AI is now gone,

cHNQY8.png

Thanks for taking the time to help me out.

EDIT:

I also noticed that even the simple chat before i made the changes didnt show the live cam, I am doing these tests on your example mission, Am i missing a graphic setting or equipment?

Edited by British89

Share this post


Link to post
Share on other sites

Hm, maybe it doesn't work with "real" dialogs and just with RscTitles. Any scripterrors so far?

Share this post


Link to post
Share on other sites

There are no script errors, You replied as i edited my other post to say that even before i made the changes, The live cam didnt show on the simple chat "RscTitles" and i am using your example mission to do the tests.

Share this post


Link to post
Share on other sites

Do you have PiP enabled in your graphic settings? I recall another user having problems because he disabled this option in his settings.

Share this post


Link to post
Share on other sites

Silly me yes i did have it disabled, Turns out you aced it with your tweaks lol, All is working as intended.

Thanks allot for your help :yay:

Share this post


Link to post
Share on other sites

Glad to hear! I should write that down somewhere, not that anyone actually reads the readMe.txts but... :D

Share this post


Link to post
Share on other sites

I have managed to setup a series of tasks given to the player from a commanding officer, dialogs become available and unavailable based on there:

Thanks.

Hello guys,

To British, I want to set up a conversation with tasks just as you explained, but I am really not that great at scripting.

1. Are you going to release your mission to the public? Any simple pointers?

To Indeed Pete

Thanks man. Loving this.

1. I set up two multiple IP_Commander sequences, but the second one doesn't play unless the first one fires first. Any way to have it at random, or does it just play in descending order?

2. If I kill the unit I can still talk with him. Any possible fix aside from having them despawn with a cleanup script?

Share this post


Link to post
Share on other sites

Hi there!

1. Can you post your code?

2. That's a bug. I've messed up the action's condition (silly me). For a quick fix open up conv\fnc\addConversation.sqf, locate line 42 and change the red marked _this:

_id = _addTo addAction [_firstSentence, {nul = [(_this select 1), (_this select 3 select 0), (_this select 3 select 1)] spawn IP_fnc_openConversation}, [_unit, _conversation], 1.5, false, true, "", ("(_this distance _target < 3) && (alive [b][color="#FF0000"]_this[/color][/b]) && " + _condition)];

to _target

_id = _addTo addAction [_firstSentence, {nul = [(_this select 1), (_this select 3 select 0), (_this select 3 select 1)] spawn IP_fnc_openConversation}, [_unit, _conversation], 1.5, false, true, "", ("(_this distance _target < 3) && (alive [b][color="#FF0000"]_target[/color][/b]) && " + _condition)];

Meanwhile I'll coble together a small update.

Share this post


Link to post
Share on other sites

I'm just about to learn about your script and wrote a little conversation myself to test it out on a dedicated server, hopefully later this day :)

It's just a great piece of work and really useful! Thanks a lot for sharing!

I go all the way with the "Full multiple choice conversations with multiple layers" it's just awesome.

A nice addition to me is to use the setIdentity command to give the conversation partner a specific name, that shows up when your dialogue window opens (above the IP_ConvSpecial variable).

The "conversation log" is a really nice gimmick too ;) And I'm definetely looking forward to play a little bit around with the custom code execution. It does give the possibility to set a variable's status e.g. to success a task after the conversation, doesn't it?

I would also like to see, what British89 accomplished or the guy you mentioned, who made it clan/mp-compatible.

And I have a question too: How to add another possible conversation partner to the script?

my init.sqf

contact1 setVariable ["IP_Avatar", "conv\img\buddyAvatar.jpg"];
contact1 setVariable ["IP_ConvSpecial", "contact1"];
[contact1, "opener"] call IP_fnc_addConversation;

contact2 setVariable ["IP_Avatar", "conv\img\buddyAvatar.jpg"];
contact2 setVariable ["IP_ConvSpecial", "contact2"];
[contact2, "opener"] call IP_fnc_addConversation;

But that of course would make them share the same "opener" etc. How to integrate a different conversation for contact2 into the missionConversations.hpp?

Thanks and I'm looking forward for your updates on this :wiggle:

Share this post


Link to post
Share on other sites

Hey, glad you like it!

The "conversation log" is a really nice gimmick too ;) And I'm definetely looking forward to play a little bit around with the custom code execution. It does give the possibility to set a variable's status e.g. to success a task after the conversation, doesn't it?

Yes, sure, you can just put anything in the custom code field. Just make sure you get those little " and ' right. Might be a bit tricky at the beginning. "['MyTask', 'SUCCEEDED'] call BIS_fnc_taskSetState;" in the custom code field does its job perfectly. But of course you can also set vars or call another script ("IP_MyVar = true; [] call IP_MyScript;").

And I have a question too: How to add another possible conversation partner to the script?

Do you mean a third guy in the same dialog? That's one of the limitations at the moment as I didn't need it so far. I recall somebody getting it done. I think it was the same guy who adapted it for his clan. I'll search through my messages some time and post his username, then you could ask him yourself.

But that of course would make them share the same "opener" etc. How to integrate a different conversation for contact2 into the missionConversations.hpp?

Quite easy. You need to setup a different conversation in your missionConversations.hpp and call it with:

[contact2, "openerContact2"] call IP_fnc_addConversation;

If you check the example mission you'll see that there's another conversation with opener and exit for the pizza guy. Basically, you can add any class from the missionConversations.hpp to a unit with IP_fnc_addConversation. The given classname just defines where the conversation starts, the relations given in responses[] in the missionConversations.hpp handle the rest from that point.

Share this post


Link to post
Share on other sites

Do you mean a third guy in the same dialog?

No, I meant exactly what you explained below, if I had thought twice before asking, I wouldn't have to bother you with it, because I read the "class pizzaopener"-line before (but deleted it) haha sorry. But thanks for the detailed explanation, also with the custom code execution! This script is promising a lot of fun, breathing a little bit more life in some AIs :)

Could you give a little hint on how to make a good avatar, and did you just cut the size (809*599) visceral or on purpose? I think I will have to use FRAPS, since it's the only software I own for screenshots, which one did you use?

But first it's business before pleasure again :( already late ^^

Share this post


Link to post
Share on other sites

Uhm, the avatars in the example mission are a bit old and I'm ashamed to confess that the size of those pictures mostly relied on guessing. Anyway, nowadays I recommend a rough 4:3 image. I usually use the ingame Splendid Camera (Editor Preview > Esc > Camera Button). It's perfect for screenshots: Time stop, free camera movement, focus control, fading out the HUD etc. Then I take a screenshot with steam (F12 key - I guess it's default), open the .jpg with GIMP or any other image editor, use the selection tool to get a 4:3 box (it's like 1,33:1, GIMP shows that relation) and export the selection as .jpg.

Good luck and have fun with your business! ;)

Share this post


Link to post
Share on other sites

Quickly set up the update fixing the talking-to-dead-people-problem!

Changelog

v1.05 - Talking to dead guys is not possible anymore.

Download v1.05

Share this post


Link to post
Share on other sites
Hi there!

1. Can you post your code?

2. That's a bug.

Thanks IndeedPete it worked! Appreciate your help!

1. Here's what I have. The cutscenes won't start unless the IP_Buddy goes first.

[] spawn {

waitUntil {time > 5};

[iP_Buddy, "Over here man. I'm inside the Gyro's Kiosk!", "SIDE"] call IP_fnc_simpleSentence;

waitUntil {player distance IP_Dude < 2};

[

[iP_Dude, player],

[

"Hey!",

"What?",

"What's the password?",

"Wallah wallah"

],

"DIRECT",

true

] call IP_fnc_simpleConversation;

waitUntil {player distance IP_Commander < 2};

[

[iP_Commander, player],

[

"Hey, I've been looking for you!",

"What? I don't know you.",

"What are you doing here anyways?",

"Biding my time, that's all."

],

"DIRECT",

true

] call IP_fnc_simpleConversation;

};

3. I was looking at the other conversation addon in armaholic and saw this which closes the conversation and makes a unit kill you based on a dialogue selection. Any way of implementing that in your addon?

_rsp = "Bring it on Buster!";

sarge RESP("AE",1,_rsp)

sarge setVariable["dialogActAE1", ["AF",

"player addrating -10000;

closeDialog 0;"

]];

4. How can I make a unit give a task (or do other cool stuff like how British explained) after selecting a certain dialogue option?

Once again thanks for all your help and sorry for all these questions. :o

Share this post


Link to post
Share on other sites

1. I see, you're doign everything in the same thread, means the second waits for the first to finish. Either do it in separate threads:

[] spawn {
waitUntil {time > 5};

[iP_Buddy, "Over here man. I'm inside the Gyro's Kiosk!", "SIDE"] call IP_fnc_simpleSentence;

waitUntil {player distance IP_Dude < 2};

[
	[iP_Dude, player],
	[
		"Hey!",
		"What?",
		"What's the password?",
		"Wallah wallah"
	],
	"DIRECT",
	true
] call IP_fnc_simpleConversation;
};

[] spawn {
waitUntil {player distance IP_Commander < 2};

[
	[iP_Commander, player],
	[
	"Hey, I've been looking for you!",
	"What? I don't know you.",
	"What are you doing here anyways?",
	"Biding my time, that's all."
	],
	"DIRECT",
	true
] call IP_fnc_simpleConversation;
};

Or put just the code between the [] spawn {} into separate scriptfiles and execVM/call them from different triggers. It's actually easier, I just praticed the lazy way by putting all into the test mission's init.

3. Of course, the custom code execution is just what you need. Take a look at this modified class from the example missionConversations.hpp:

class exit
{
expression = "call IP_fnc_closeConversation; player addRating -10000;";
sentences[] = {"Good bye!"};
};

It will do exactly the same as the code you've posted.

4. Same as above, the "expression" field allows you to execute any code on certain events. If it's more than one line I'd recommend to put custom code into an extra scriptfile or function and call it like this:

class exit
{
expression = "_this execVM 'myScript.sqf'; _this call myEventFunction;";
sentences[] = {"Good bye!"};
};

Just giving a simple task is also possible, but might get tricky when it comes to fiddeling around with " and '. Here's an example class from one of my missions:

class phoneHangUp
{
expression = "[player, 'tCheckpoint', ['Engage and clear the <marker name=''mCheckpoint''>AAF Checkpoint at Edessa</marker>!', 'Clear AAF Checkpoint', 'AAF Checkpoint'], 'mCheckpoint', true, 1] call BIS_fnc_taskCreate;";
sentences[] = {
	"(Hang up.)"
};
};

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

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

×