What's up Arma community! Throwing this out there because I am terrible at this and stuck with getting a conversation scripted. Below all the posted scripts I describe how I am currently experimenting with it
What I am trying to do is get an interactive conversation flow between the player and an NPC with the scroll menu and different response options, like in Arma 2. BI has a pretty decent conversations page for this exact subject, with lip synch and all, I have copied it and made only minor tweaks to make it more readable for myself, and for my sound files to play. The example mission is here if someone who knows this stuff wants to take a look or if someone wants a good starting point for conversations in their scenario ----> Google drive example mission
What works - I have kbTell working fine, so I know the code and folder set ups are ok, and my sound files play just fine.
What is the problem? - when using kbAddTopic nothing! No errors!, no RPT log suspects, no stuttering... but also no functionality 😔. It must be something I am doing wrong but I cannot for the life of me debug it or figure out why. So here we are. It would be super cool to have AI conversations with player choices, especially for the SP crowd
My directory -
kb --------------- folder with bikb and sqf
sounds ----------- folder with a few test samples in .ogg that are confirmed 100% to work in game
description.ext
mission.sqm
Scripts -
Description.ext
class CfgSentences
{
class event1
{
class talk
{
file = "kb\talk.bikb";
#include "kb\talk.bikb" // avoids a double declaration
};
};
};
kb\talk.bikb
class Sentences
{
class sentence1
{
text = "";
textPlain = "Shuuuush";
speech[] = { "\sounds\officer_intro_1.ogg" };
class Arguments {};
actor = "officer"
};
class sentence2
{
text = "";
textPlain = "Go Away";
speech[] = { "\sounds\officer_intro_2.ogg" };
class Arguments {};
actor = "officer"
};
// these sentences are EH options for later
class response{ text = "response"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; };
class option1 { text = "op1"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; };
class option2 { text = "op2"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; };
class option3 { text = "op3"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; };
// the Interrupted sentence triggered when the conversation menu is closed without answering (e.g using backspace)
class Interrupted
{
text = "SideChat text";
speech[] = { "\sounds\officer_intro_3" };
class Arguments {};
actor = "officer";
};
};
// Needed parameters.
class Arguments {};
class Special {};
startWithVocal[] = { hour };
startWithConsonant[] = { europe, university };
kb\talk.sqf
I am also not entirely sure how this one works, I am somewhat scripting literate (after so many hours trial and error) but I don't know if I should replace all the private _variables with the planned interlocuters or...??? that cant be right can it?, idk!? 😟
/*
-------BI notes I kept--------
here we will be storing all the sentences from which the player will choose (left side menu)
if there is only one option in the array, the sentence will replace the "Talk to" action name
we want the player to be able to approach his buddy and talk to him via the action menu.
we need to check:
if the player is pointing at his buddy
if the player is not answering any of his buddy's sentences
if the player has not told him hello already
then we add that array to _convMenu - the parameters are mostly self-explanatory:
------BI Params--------------- (do these have to be replaced?)
_this: Object - the player receiving the sentence. Must have had this particular script assigned via kbAddTopic Player, AI player talking with or both??
_from: Object - the unit that told the sentence
_sentenceId: String - the sentence the player is reacting to. Defined in .bikb in class Sentences
_topic: String - topic name used in kbAddTopic
*/
private _convMenu = [];
if (_from == officer && _sentenceId == "" && !(_this kbWasSaid [_from, _topic, "sentence1", 999999])) then
{
_convMenu pushBack ["menu text", _topic, "sentence1", []];
};
// here we make the unit say the proper sentence based on the one he just received
// switch-case-do is used here but it is only one solution to manage sentences (if-then etc could do)
switch (_sentenceId) do
{
case "sentence1":
{
_this kbTell [_from, _topic, "a player response?"];
};
case "sentence2":
{
_this kbTell [_from, _topic, "????"];
};
case "responses":
{
// the player will have 3 answers to choose from:
_convMenu pushBack ["op1", _topic, "option1", []];
_convMenu pushBack ["op2", _topic, "option2", []];
_convMenu pushBack ["op3", _topic, "option3", []];
};
};
// return the sentence list pool
_convMenu;
the above is kind of hard for me to make sense of honestly with all the scopes and the switch-case-do wizardry.
I have the player named nomad and a BLUFOR AI named officer. I have two triggers one for kbTell and one for BIS_fnc_kbAddTopic
When I trigger kbTell all is good, would be great if you only needed to fire off some sentences and be done.
["the topic", "Cfg of topic"] spawn BIS_fnc_kbTell - no issues all is good
But with kbAddTopic no such luck here using the following on player only, officer only, both, as objects or as strings, and for any of the methods below:
X kbAddTopic ["myTest", "kb\talk.bikb", "kb\talk.sqf"];
X kbAddTopic ["myTest", "kb\talk.bikb"];
X kbAddTopic ["myTest", "kb\talk.bikb", "compile preprocessFileLineNumbers "kb\talk.sqf"];
what I mean by X --> (player, nomad, officer, with and without"") from trigger, from unit init, from a script. Nothing
Again no errors or anything to start chipping away at like usual.
Here are the resources I have already tried and poured many hours over:
Conversations official Biki, 99% of what I have is from the source already, read many times over
kbAddTopic
Jezuro's old posting
HateDead's old posting
IndeedPete's pretty cool conversation system that I may just have to adopt if I cant figure this out. Also where I got the sample sound files.
Youtube, but kind of like the BI fourm threads a lot of the stuff is outdated
Google of course
Prayer and hope
Anything you guys have would be MUCH appreciated. Thank you so much!