OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: junius on 15 May 2010, 14:28:53

Title: How to make a conversation
Post by: junius on 15 May 2010, 14:28:53
Hi All.

Basicly I need enter a waypoint and have a long conversation with the person standing at it.

Either through radio, plan text anything.

In the waypoints onactiviation screen:
I have tried making the waypoint turn on triggers but obviously the codes havn't work.
I have tried global chat but that dosn't work.

If anyone knows how to do this, it would be appreciated.

Thanks

junius

Title: Re: How to make a conversation
Post by: Wolfrug on 17 May 2010, 15:13:50
Well, there's the hard way (BIS' conversation system) and the easier way (game logic convo), and the regularly difficult way (script). Also, are you going to make it fully voiced and use the "say" command, or is it enough to use e.g. groupradio or titletext? The examples below will be based on just text.

Easiest, in-editor, but a bit clunky:

Add a global variable in the waypoint which starts the conversation (e.g. StartConv1 = true). Now, create a Game Logic and give it an AND waypoint. Make its Condition the same as your global variable (so, StartConv1). Now, in the On Activation field, write the first line of dialogue:

titleText ["Hey Joe, what's up", "plain"]; (or, Talker1 sidechat "Hey Joe, I like my radio")

Then, give the GL another AND waypoint, and fill in the Min, Max, Med boxes with as many seconds as you want there to be between the first and the second line of dialogue (so, say, 3 seconds for the above). That means 3 seconds pass, and then the On Activation field of the second waypoint runs - just put the next line of dialogue there. And so on ad infinitum. If you want the conversation to stop if the player moves away, you can get creative - for instance adding a condition: Player distance Talker1 < 10 which will pause the conversation until the player is within 10 meters of Talker1. And so on and so forth.

The script way will look better, and might be easier. Just do the same thing as above, but run the script instead of making the global variable true when reaching the WP. So:

nul=[player, talker1] execvm "talk1.sqf";

and then you just create a script like below:

Code: [Select]
//talk1.sqf
_t1 = _this select 0;
_t2 = _this select 1;

_t1 sidechat "Hey Joe";
sleep 3;
_t2 sidechat "Hey Moe."
sleep 3;
_t1 sidechat "Well, fun talking to you. Bye!";
sleep 5;
_t2 sidechat "Bye!";

If there's anything here you don't really understand, you will want to first peruse our wonderful Beginner's Tutorial (http://www.ofpec.com/tutorials/index.php?action=show&id=14) which will explain basic concepts such as waypoints, condition fields, on activation, script placement and so on.

Good luck!

Wolfrug out.