IndeedPete 1038 Posted August 15, 2014 Appreciated as always, thanks Foxhound! Share this post Link to post Share on other sites
killshot 5 Posted August 16, 2014 I tested it with a second guy on a dedicated server today and it worked perfectly just like in the editor. Awesome! :) I've taken a look at the Splendid Camera too and will try to make some avatars later, thanks for the info. And for everyone, who wants the conversation partners to have specific names (faces,speakers,pitch), I just read, that it's not necessary anymore to use the setIdentity command (AI's init) + class cfgIdentities (description.ext), but instead just use setFace - setName - setSpeaker etc. in the AI's init. kylania posted a list ( click ) with every possible value. Unfortunately the list is quite limited. Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 16, 2014 Glad to hear it's working! With name I meant a name in the editor so you can reference the unit. Apart from that every unit has some default name. Share this post Link to post Share on other sites
killshot 5 Posted August 16, 2014 Yes, I was refering to the name that is shown in the conversation window itself of course :cheers: Share this post Link to post Share on other sites
Xabialonso 10 Posted August 18, 2014 Thanks IndeedPete! Really appreciate your help. Having tons of fun with this. Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 18, 2014 Glad to hear you guys enjoy it! Share this post Link to post Share on other sites
Purzel 35 Posted August 21, 2014 (edited) Hi, it seems to be a nicer look for conversations. So I tried to bind it into my mission. I need a little conversation between a REDFOR ai-unit and a BLUFOR human-unit. But I don´t understand how and where to put the texts. and how to trigger them ingame. I just need it for the identification of a secret agent. There has not to be a bigger conversation, just a little "Are you looking for birds?" "Yes, the birds are more fluffy in springtime." "Ok, target identified, let´s go!" The player should walk around and talk to that one person, all others will tell him useless stuff (or nothing) I already copied the folder and the description.ext-stuff into my mission. Unfortunatly I´m not the big scripting guru... So please give me a hint, what to write where. But even I read the examples, I don´t know, where to write all those code-snippets. What next? Thx Greetings Purzel Edited August 21, 2014 by Purzel Share this post Link to post Share on other sites
Xabialonso 10 Posted August 21, 2014 Hey Purzel, I’m also new to this. Here’s what I got. Name player one IP_Main. You will bring up the convo once you near the ai unit (named dude) in the action scroll menu. Make sure you have this in your description.ext #include "conv\cfg\defines.hpp" #include "conv\cfg\dialogs.hpp" #include "missionConversations.hpp" This in your init.sqf, just change dude to whatever you name the AI unit dude setVariable ["IP_LiveFeed", true]; dude setVariable ["IP_ConvSpecial", "The Silver Sheep Guard"]; [dude, "dudeOpener", dude] call IP_fnc_addConversation; Open missionConversations.hpp (just change dude to whatever you name the AI unit) and after class conversations { //dude class dudeOpener { responses[] = {"where", "dudeExit"}; sentences[] = { "I am looking for James Bond.", "What are you doing? Stop it now!", "They said I could find him here." }; }; class where { responses[] = {"dudeExit"}; sentences[] = { "Where did he go?", "Down to Mexico." }; }; class dudeExit { expression = "call IP_fnc_closeConversation; nul = [dude, 'No Mercy!', 'DIRECT', 3] spawn IP_fnc_simpleSentence;"; sentences[] = {"Got it, bye." }; }; ---------- Post added at 05:23 ---------- Previous post was at 05:15 ---------- Thanks to Indeedpete I was able to make the NPCs give tasks. How can I have the conversation not be accessed once they give tasks. Reason I ask is that I am able to converse again and complete the task (if failed), or keep getting the mission (once succeeded). Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 21, 2014 @Purzel: You can pretty much orientate yourself in what Xabialonso posted. One or two minor things though to prevent confusions. The variable "IP_ConvSpecial" is optional and doesn't need to be set; it just gives you an option to store some little background info about the character at hand. IP_fnc_addConversation requires only two parameters, the third one is optional and meant to add a conversation to an object like a cellphone or laptop. If you want to setup simple face-to-face convos, just use: [dude, "dudeOpener"] call IP_fnc_addConversation; @Xabialonso: Extend your task giving conversation class with condition = "!('tTaskName' call BIS_fnc_taskExists)"; Share this post Link to post Share on other sites
Xabialonso 10 Posted August 25, 2014 Thanks IndeedPete it worked!:D 1.I'm trying to have a subtask created, where tStore is the subtask and tNorms is the current main task. I've tried BIS_fnc_taskChildren and BIS_fnc_taskCreate but nothing happens. class party3 { expression = "['tStore', 'tNorms' ['Hey can you get some drinks at <marker name='mStore''> Gyros</marker>?', 'Go to the store', 'Store], 'mStore', true, 1] call BIS_fnc_taskChildren; call IP_fnc_closeConversation;nul = [dude, 'Thank-you brother.', 'DIRECT', 1] spawn IP_fnc_simpleSentence;"; sentences[] = { "Yeah, sure I can pick some drinks up." }; }; 2. How can I have a task state change to succeeded once a unit approaches a certain marker? Does an AI unit have to be there or can it just be triggered by the player's distance to the marker? I've tried it as a discussion: class chapel { condition = "!('tCheckpoint' call BIS_fnc_taskExists);(IP_Main distance (getMarkerPos ''mChapel'') < 10);"; expression = "['tCheckpoint', 'SUCCEEDED'] call BIS_fnc_taskSetState;" }; Once again thanks IndeedPete for all your help! Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 25, 2014 1. Check this example of how to create child tasks: [player, "tCamps", ["Search the enemy camps for information!", "Search the Camps", ""], nil, false, 1] call BIS_fnc_taskCreate; [player, ["tCampCharkia", "tCamps"], ["Search the <marker name=""mCampCharkia"">camp near Charkia</marker> for information!", "Camp near Charkia", "Camp"], "mCampCharkia", false, 1] call BIS_fnc_taskCreate; [player, ["tCampAgios", "tCamps"], ["Search the <marker name=""mCampAgios"">camp near Agios Georgios</marker> for information!", "Camp near Agios Georgios", "Camp"], "mCampAgios", false, 1] call BIS_fnc_taskCreate; [player, ["tCampMountains", "tCamps"], ["Search the <marker name=""mCampMountains"">camp in the mountains</marker> for information!", "Camp in the Mountains", "Camp"], "mCampMountains", false, 1] call BIS_fnc_taskCreate; 2. You don't have to do the further task handling via the conv system; you might as well do that "traditionally" with triggers or modules. Apart from that your condition is a bit off. Try (untested): condition = "('tCheckpoint' call BIS_fnc_taskExists) && {('tCheckpoint' call BIS_fnc_taskState) != 'SUCCEEDED'} && {IP_Main distance (getMarkerPos ''mChapel'') < 10}"; It will work from a trigger as well. Share this post Link to post Share on other sites
hogthar 295 Posted August 27, 2014 Hi I created an RPG mission with your Simple Conversation System. I Wrote a shop menu with this and it's working fine, also work missions and cash reward as well. So thanks i could make what i want to long time. Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 29, 2014 Hm, interesting idea to do a shop system with this... Anyway, I'm glad you've managed to do so! Share this post Link to post Share on other sites
hogthar 295 Posted August 30, 2014 better than if i use action menu, i could categorize all stuff, weapons, gear, ammo etc,etc. Example: conversation begin - buy - weapons, ammo, gear - ////in weapons/// M4, M4A1, M16A4 the config: class M4 // Name of the conversation. { expression = "execVM 'shop\m4.sqf'"; responses[] = {"weapons"}; sentences[] = {"buy an M4 (250$"}; The M4.sqf: if (cash < 250) then { Hint "You don't have enough money"; } else { cash = cash -250; gunbox addWeaponCargo ["DM_M4", 1]; Hint "You bought an M4, you find on the weapon box"; }; Of course you need ammobox. name the ammobox. Name : gunbox ammobox Init line: clearweaponcargo this; clearmagazinecargo this; And you need cash to the game. Open init.sqf and write next: cash = 0; If you want to give some money to player add this line a trigger example: cash = cash + 500; Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 30, 2014 Looks good! But you might want to create small functions from your M4.sqf or other weapon adding scripts to avoid execVM all the time. Or you could make just one purchase function as the custom code execution passes [(first speaker), (second speaker), (conversation class)] to the script you execute (accessible by _this). So you could just have one purchase script and identify the purchased weapon by the passed conversation class. Plus you could use the "condition" field to evaluate if the user has enough money in the first place; saves you the extra money check but of course the user won't be able to see weapons he doesn't have enough money for. Well, just some ideas. ;) Share this post Link to post Share on other sites
Xabialonso 10 Posted September 1, 2014 @IndeedPete 1. Thanks it worked. 2. I tried it (it was supposed to go as a condition in the conversation right?) but nothing happened. I tried your other suggestion of putting it in as a trigger with this in condition (IP_Main in thisList) && ('tCheckpoint' call BIS_fnc_taskExists); and this on act ["tCheckpoint","SUCCEEDED"] call BIS_fnc_taskSetState; and it worked. Thanks boss. I'm adding some voiceovers into the mission but am currently only able to make it by using triggers. The voiceovers are only limited where the NPC is telling a story. Is there any way of making a conversation choice play a sound file? Share this post Link to post Share on other sites
IndeedPete 1038 Posted September 1, 2014 Sure, provided you have defined them correctly in your description / CfgSounds you should be able to use playSound or say or whatever command you need as custom code. Just paste the same code you use in your triggers into the expression field and keep the "" in mind. Share this post Link to post Share on other sites
Xabialonso 10 Posted September 3, 2014 @IndeedPete Thanks boss it worked. If I have a chunk of text and its corresponding sound file playing, and I click another conversation choice, the sound files overlap. Is it possible to have the first sound stop playing once I select another choice? Here is what I have in the class expression = "matt2 say 'sam4'; Thanks as always IndeedPete! Share this post Link to post Share on other sites
IndeedPete 1038 Posted September 3, 2014 Hm, doing a quick google search it doesn't seem possible to end a playSound / say / say3D sound while it's still playing. But you might be able to do a better search. What you need to do is finding a piece of code that ends the current sound and put it into the expression before calling the next one. Simple stuff like matt say "" doesn't work to end a sound? Share this post Link to post Share on other sites
rakowozz 14 Posted September 3, 2014 @IndeedPete Thanks boss it worked.If I have a chunk of text and its corresponding sound file playing, and I click another conversation choice, the sound files overlap. Is it possible to have the first sound stop playing once I select another choice? Here is what I have in the class expression = "matt2 say 'sam4'; Thanks as always IndeedPete! You can't stop a sound from playing with playSound, etc., but you could set up a very simple function to prevent the sounds from overlapping - so it'd wait for the previous sound to play. You'd just insert the duration of the sound playback as a parameter. FNC_Dialogue = { private ["_audio","_duration"]; _audio = _this select 0; _duration = _this select 1; waitUntil {!dialogue_saying}; dialogue_saying = true; playsound _audio; sleep _duration + 3; dialogue_saying = false; }; dialogue_saying = false; ["MySound",15] spawn FNC_Dialogue; ["MyOtherSound",5] spawn FNC_Dialogue; Either that, or you use kbTell. Share this post Link to post Share on other sites
IndeedPete 1038 Posted September 4, 2014 That's true but he plays the sounds within the conv system, meaning he doesn't know when the player selects the next dialogue form the multiple choice box. Of course he could wait until the sound is played (i.e. use it as condition) and then reload the GUI so it doesn't show the responses until the sound is played. But that's a bit clunky and confusing in my opinion. The system was made to fancy up text-based communication. But with some work it should be possible to adapt it towards the sound playing ability. Share this post Link to post Share on other sites
anrio 11 Posted September 10, 2014 IndeedPete, i like your conv_system! And how i can use it with sounds replics? waitUntil {player distance IP_Commander < 5}; [ [iP_Commander, player], [ "Hey, I just met you!", "And this is crazy!", "So here's my number!", "Call me maybe!" ], "DIRECT", true ] call IP_fnc_simpleConversation; i have sound files corresponding to concrete sentence and i want to hear a sound with this text ("Hey, I just met you!" - text with sound, after that (with pause for this sound) another replic ......) Share this post Link to post Share on other sites
IndeedPete 1038 Posted September 10, 2014 Hey, glad you like it. I'm afraid what you're after is only possible with a bit of scripting and a good timing. Do you have your sounds already defined in CfgSounds? If so it should work like this: waitUntil {player distance IP_Commander < 5}; [ [iP_Commander, player], [ "Hey, I just met you!", "And this is crazy!", "So here's my number!", "Call me maybe!" ], "DIRECT", true ] spawn IP_fnc_simpleConversation; // use spawn to make it run parallel IP_Commander say "Sentence1"; // say sound - say3D might be working as well sleep 3; // wait until the first sound is played - this needs timing! player say "Sentence2"; sleep 2; // And so on... Share this post Link to post Share on other sites
anrio 11 Posted September 11, 2014 Hey IndeedPete Yes, it works in a parallel script, but pauses between phrases aren't observed But it also was expected. Besides, these pauses will be different duration it would be quite good to unite this IP_fnc_simpleConversation with "kbtell"-system (if it is possible):) or to add pauses to each remark as parameter [iP_Commander, player], [ ["Hey, I just met you!",5], ["And this is crazy!",3], ...... ], Unfortunately, I'm not familiar with some functions and commands like BIS_fnc_param, getvariable.... (and english isn't my native) I want to make a telephone conversation, and this system is very nice for it (with cinemaBorder, camera and avatars) Share this post Link to post Share on other sites
IndeedPete 1038 Posted September 11, 2014 Well, since IP_fnc_simpleConversation is just a wrapper function for IP_fnc_simpleSentence (it just loops through the latter and adds some fancy cinema borders as well as skipping mechanics if the cutscene parameter is true), it's fairly easy to adapt. IP_fnc_simpleSentence already supports the parameters add and length as 4th and 5th parameter. add adds an amount of seconds to the calculated or given length value (can be negative to shorten convos) and length is a total value (can't be negative). An adapted version of IP_fnc_simpleConversation could look like this (untested): /* Name: simpleConversation Author: IndeedPete Purpose: Wrapper function to create a simple conversation from several simple sentences (IP_fnc_simpleSentence). ---------- Parameters: _speakers - ARRAY OF OBJECTS: Units that alternately say the _sentences. - [player, SomeGuy] _sentences - ARAAY OF STRINGS: Sentences the _speakers should say. Every Xth sentence will be spoken by the Xth speaker. - ["Hello world!", "Fuck off!"] _wichChat - STRING (OPTIONAL): Which way of communication should be used. Available chats: "SIDE", "GROUP", "VEHICLE", "CUT" or "DIRECT" - "DIRECT" - DEFAULT: "SIDE" _isCutscene - BOOL (OPTIONAL): Cutscene mode: If set to true cinema borders will show up and the conversation can be skipped by the player pressing space. - true - DEFAULT: false ---------- Requires: IP_fnc_simpleSentence */ if (count _this < 2) exitWith {false}; private ["_speakers", "_sentences", "_whichChat", "_isCutscene", "_count", "_ehSkip"]; _speakers = [_this, 0, [], [[]]] call BIS_fnc_param; _sentences = [_this, 1, [], [[]]] call BIS_fnc_param; _whichChat = [_this, 2, "SIDE", [""]] call BIS_fnc_param; _isCutscene = [_this, 3, false, [true]] call BIS_fnc_param; _count = count _speakers; _x = 0.09; if (_isCutscene) then { disableSerialization; IP_Cutscene_Skip = false; _ehSkip = ([] call BIS_fnc_displayMission) displayAddEventHandler [ "KeyDown", " if (_this select 1 == 57) then { if (IP_Cutscene_Skip) exitWith {}; playSound ['click',true]; IP_Cutscene_Skip = true; }; if !((_this select 1) in (actionKeys 'PersonView' + [1])) then {true}; " ]; uiNamespace setVariable ["IP_Cutscene_ehSkip", _ehSkip]; [0] call BIS_fnc_cinemaBorder; }; for "_i" from 0 to ((count _sentences) - 1) do { _speaker = _speakers select (_i mod _count); _sentenceArr = _sentences select _i; _sentence = _sentenceArr select 0; _add = [_sentenceArr, 1, 0, [0]] call BIS_fnc_param; _len = [_sentenceArr, 2, ((count(toArray _sentence)) * _x), [0]] call BIS_fnc_param; [_speaker, _sentence, _whichChat, _add, _len] call IP_fnc_simpleSentence; if ((!isNil "IP_Cutscene_Skip") && {IP_Cutscene_Skip}) exitWith {}; }; if (_isCutscene) then { [1] call BIS_fnc_cinemaBorder; ([] call BIS_fnc_displayMission) displayRemoveEventHandler ['KeyDown', (uiNamespace getVariable "IP_Cutscene_ehSkip")]; uiNamespace setVariable ["IP_Cutscene_ehSkip", nil]; IP_Cutscene_Skip = nil; }; And it could be executed like this: [[iP_Buddy, player], [ ["Hey, I just met you!"], // No additional parameters. ["And this is crazy!", 1] // Plus one second length. ["So, here's my number!", 0, 3] // Total length of three seconds. ], "DIRECT", true ] call IP_fnc_simpleConversation; ---------- Post added at 12:15 PM ---------- Previous post was at 12:11 PM ---------- Oh, and of course with a bit of work you could adapt the functions to use kbTell. Problem is that kbTell already puts text into sidechat, means the player sees the text popping up two times. This system was never really meant to play sounds as it is kind of a counter-kbTell text-based solution for people who can't or don't want to do voice acting. Looking at the sidechat presentation that hasn't changed since OFP(?) I can see that people are looking for a better / prettier solution. Share this post Link to post Share on other sites