
Wiec tak,
sciagnalem skrypt Dynamic Conversation System, dzieki ktoremu mozna prowadzic dialog z innymi jednostkami w grze. Dostosowalem sobie opcje rozmowy i to jak maja brzmiec do wlasnych potrzeb. Wstawilem na mape Oficera, wpisalem co trzeba do inicjacji, wszystko ladnie chodzi. Ale za Chiny nie wiem jak zrobic zebym mogl rozmawiac potem z druga jednostka (w moim przypadku Policjant). Dodam ze autor opisal w readme jak dodac mozliwosc prowadzenia dialogu, ale tylko z jedna jednostka. A ja nie wiem jak zrobic zebym mogl pogadac najpierw z np. Oficerem, pozniej z np. Policjantem a jeszcze pozniej z jakas inna jednostka. Pol nocy nad tym siedzialem. Bardzo prosze o pomoc, poniewaz potrzebuje ten skrypt w mojej misji.
Link do tego skryptu: http://www.ofpec.com/includes/download2.php?id=718
Teraz co sie znajduje w poszczegolnych plikach:
init.sqs:
SOW_FillListBox = preprocessfile "SOW_DynamicDlg\FillListBox.sqf";
mySpeechArray= call loadfile "BrakTalk.sqf";
-----------------------------------------------------------------------------
BrakTalk.sqf:
private ["_structure"];
_structure = [];
comment "Array consists of [ AI unit text response, [Array of user responses] ] for each dialog 'page' or 'set' ";
comment "Array for user responses consists of [text, which page to go to next (or -1 to end), {scripted action} ]";
comment "Speech Set 0";
_structure = _structure +
[[
"Witam poruczniku Novak! Odebralismy godzine temu meldunek wolania o pomoc z pobliskiej fabryki chemicznej. Obowiazek zareagowania spoczywa na nas. Pojedzie pan sprawdzic co sie tam stalo. Pana ludzie czekaja przy ciezarowce. Jakies pytania?","Talk1",
[
["Czego mozemy sie tam spodziewac?",1,{}],
["A co ze wsparciem?",2,{}],
["Nie mam pytan",-1,{}]
]
]];
comment "Speech Set 1";
_structure = _structure +
[[
"W najgorszym wypadku terrorystow.","Talk1",
[
["A co ze wsparciem?",2,{}],
["Nie mam pytan",-1,{}]
]
]];
comment "Speech Set 2";
_structure = _structure +
[[
"W razie klopotow nie dostaniecie wsparcia, duzo zolnierzy zostalo zwolnionych do domow z powodu choroby, zarazili sie jakims wirusem. To co pan tu widzi w bazie, to wszystko co mamy.","Talk1",
[
["Czego mozemy sie tam spodziewac?",1,{}],
["Nie mam pytan",-1,{}]
]
]];
_structure
----------------------------------------------------------------
startTalking.sqs
[_this select 0, mySpeechArray] exec "SOW_DynamicDlg\talk.sqs"
exit
----------------------------------------------------------------
Description.ext
//---------------------------------------DIALOG SECTION---------------------------------------
// Control types
#define SOW_DD_CT_STATIC 0
#define SOW_DD_CT_BUTTON 1
#define SOW_DD_CT_LISTBOX 5
// Static styles
#define SOW_DD_ST_HPOS 0x0F
#define SOW_DD_ST_LEFT 0
#define SOW_DD_ST_RIGHT 1
#define SOW_DD_ST_CENTER 2
#define SOW_DD_ST_UP 3
#define SOW_DD_ST_DOWN 4
#define SOW_DD_ST_VCENTER 5
#define SOW_DD_ST_SINGLE 0
#define SOW_DD_ST_MULTI 16
#define SOW_DD_ST_BACKGROUND 80
#define SOW_DD_ST_GROUP_BOX2 112
// Colors
#define SOW_DD_Background {0,0,0,1}
#define SOW_DD_Background2 {0.05,0.05,0.05,.9}
#define SOW_DD_TransBackground {0,0,0,0}
#define SOW_DD_MenuText {1,1,1,1}
#define SOW_DD_LBTextG {0.1,0.5,0.1,1}
#define SOW_DD_LBTextB {0.1,0.1,0.5,1}
#define SOW_DD_Text {0.8,0.8,0.8,1}
#define SOW_DD_ButtonText {0,0,0,1}
//Fonts
#define SOW_DD_Font "courierNewB64"
#define SOW_DD_FontTitle "SteelfishB64"
#define SOW_DD_FontLB "tahomaB48"
#define SOW_DD_FontButton "tahomaB24"
class SOW_DD_RscDialogBack
{
type = SOW_DD_CT_STATIC;
idc = -1;
style = SOW_DD_ST_GROUP_BOX2;
colorBackground[] = SOW_DD_Background2;
colorText[] = SOW_DD_Text;
font = SOW_DD_FontTitle;
sizeEx = 0.04;
text = ;
};
class SOW_DD_RscGroupBox2
{
type = SOW_DD_CT_STATIC;
idc = -1;
style = SOW_DD_ST_GROUP_BOX2;
colorBackground[] = SOW_DD_Background;
colorText[] = SOW_DD_Text;
font = SOW_DD_FontTitle;
sizeEx = 0.04;
text = ;
};
class SOW_DD_RscButton
{
type = SOW_DD_CT_BUTTON;
idc = -1;
style = SOW_DD_ST_CENTER;
colorText[] = SOW_DD_ButtonText;
font = SOW_DD_FontButton;
sizeEx = 0.02;
soundPush[] = {};
soundClick[] = {};
soundEscape[] = {};
default = false;
};
class SOW_DD_RscListBox
{
type = SOW_DD_CT_LISTBOX;
idc = -1;
style = SOW_DD_ST_GROUP_BOX2;
colorBackground[] = SOW_DD_Background;
colorText[] = SOW_DD_LBTextB;
colorSelect[] = SOW_DD_ButtonText;
font = SOW_DD_Font;
sizeEx = 0.025;
rowHeight = 0.025
text = ;
};
class SOW_DD_RscText
{
type = SOW_DD_CT_STATIC;
idc = -1;
style = SOW_DD_ST_MULTI;
colorBackground[] = SOW_DD_TransBackground;
colorText[] = SOW_DD_LBTextG;
font = SOW_DD_Font;
sizeEx = 0.025;
linespacing = 1.0;
text = ;
};
//-------------DIALOG DISPLAYED-------------
class SOW_DynamicDialog
{
idd = -1;
movingEnable = false;
controlsBackground[] = {DialogFrame,TextArea1,TextArea2};
class DialogFrame : SOW_DD_RscDialogBack
{
x = 0.05; y = 0.05; w = 0.35; h = 0.6;
text = "";
};
class TextArea1 : SOW_DD_RscGroupBox2
{
x = 0.0625; y = 0.0625; w = 0.325; h = 0.25;
text = "";
};
class TextArea2 : SOW_DD_RscGroupBox2
{
x = 0.0625; y = 0.325; w = 0.325; h = 0.25;
text = "";
};
objects[] = {};
controls[] = {SpeechArea,ResponseArea,ButtonOK,ButtonCancel};
class SpeechArea : SOW_DD_RscText
{
idc = 100;
text = "";
x = 0.0625; y = 0.0625; w = 0.325; h = 0.25;
};
class ResponseArea : SOW_DD_RscListBox
{
idc = 101;
text = "";
x = 0.0625; y = 0.325; w = 0.325; h = 0.25;
};
class ButtonOK : SOW_DD_RscButton
{
idc = 102;
text = "OK"
x = 0.0625; y = 0.6; w = 0.1; h = 0.035;
action = "SOW_DialogButtonOK = true;";
};
class ButtonCancel : SOW_DD_RscButton
{
idc = 103;
text = "Cancel"
x = 0.2875; y = 0.6; w = 0.1; h = 0.035;
action = "closeDialog 1;";
};
};
-----------------------------------------------------------------
Folder SOW_DynamicDlg:
FillListBox.sqf:
private ["_lbtext","_lbnewindex","_lbaction","_curlbindex"];
_lbText = _this select 0;
_lbNewIndex = _this select 1;
_lbAction = _this select 2;
_curLBIndex = 0;
_curLBIndex = lbAdd [101,_lbText];
lbSetValue [101, _curLBIndex, _lbNewIndex];
lbSetData [101, _curLBIndex, _lbAction];
-----------------------------------------------------------------
talk.sqs:
private ["_speechunit","_speechfile","_speechindex","_speecharray","_speechaction","_dlgok"]
_speechUnit = _this select 0
SOW_DialogButtonOK = false
_speechFile = _this select 1
_speechIndex = 0
#InitDialog
_dlgOK = createDialog "SOW_DynamicDialog"
? !(_dlgOK):call {closeDialog 2; exit;}
#SetText
_speechArray =_speechFile select _speechIndex
lbClear 101
ctrlSetText [100, _speechArray select 0]
_speechUnit say (_speechArray select 1)
_lbArray = _speechArray select 2
{_x call SOW_FillListBox} forEach _lbArray
#Wait
@ ((SOW_DialogButtonOK) or !(ctrlVisible 100))
SOW_DialogButtonOK = false
_speechIndex = lbValue [101,lbcursel 101]
_speechAction = lbData [101,lbcursel 101]
? (_speechAction != ""):call _speechAction
? ((_speechIndex == -1) or !(ctrlVisible 100)):goto "EndDialog"
goto "SetText"
#EndDialog
closedialog 1
exit
-----------------------------------------------------------------------------
Oto Readme:
User Agreement:
By using this script within your mission, you agree to the following -
1. You will give credit to author of included source material where appropriate.
2. You will not submit a modified version of the source material anywhere without also crediting original author.
3. You will not attempt to sell, trade, or distribute for financial gain the source material within.
****************************************************************************************
To implement this into your mission takes 5 simple steps:
1. Copy the SOW_DynamicDlg folder into your mission.
2. Copy the contents of the DynamicDialog.h file into your existing or new 'description.ext" file.
3. Preprocess the "FillListBox.sqf" file by adding the following to your init.sqs file (must use this variable name!): SOW_FillListBox = preprocessfile "SOW_DynamicDlg\FillListBox.sqf"
4. You must then create a conversation array using the following syntax:
Array of Conversation Elements= [ [conversation set element 0], [conversation set element 1], [conversation set element 2], etc...]
Conversation Set Element = [ "Text for AI to display", "<sound file>", [Array of User Responses] ] <Note: for no sound file use "">
Array of User Responses = [ [User Response Element 0], [User Response Element 1], [User Response Element 2], etc...]
User Response Element = [ "Text of response", <integer of next conversation set to go to or -1 to end dialog>, {scripted action to perform}]
I have used a loadfile function to keep the conversation array clear to the designer. Open the BrakTalk.sqf file to see how I laid it out. Note I do not use any scripted actions in this dialog, however. A good example of a scripted action might be: {[player] exec "action.sqs";}
You can use the array on as many units as you want, but I recommend not since it will make your units appear to be robots!
5. To initiate the array I use the action command on the AI unit, but you can use whatever you wish. The proper execution requires two parameters,
the unit talking, and the conversation array. An example execution is:
[SomeGuy, MySpeechArray] exec "SOW_DynamicDlg\talk.sqs"
sciagnalem skrypt Dynamic Conversation System, dzieki ktoremu mozna prowadzic dialog z innymi jednostkami w grze. Dostosowalem sobie opcje rozmowy i to jak maja brzmiec do wlasnych potrzeb. Wstawilem na mape Oficera, wpisalem co trzeba do inicjacji, wszystko ladnie chodzi. Ale za Chiny nie wiem jak zrobic zebym mogl rozmawiac potem z druga jednostka (w moim przypadku Policjant). Dodam ze autor opisal w readme jak dodac mozliwosc prowadzenia dialogu, ale tylko z jedna jednostka. A ja nie wiem jak zrobic zebym mogl pogadac najpierw z np. Oficerem, pozniej z np. Policjantem a jeszcze pozniej z jakas inna jednostka. Pol nocy nad tym siedzialem. Bardzo prosze o pomoc, poniewaz potrzebuje ten skrypt w mojej misji.
Link do tego skryptu: http://www.ofpec.com/includes/download2.php?id=718
Teraz co sie znajduje w poszczegolnych plikach:
init.sqs:
SOW_FillListBox = preprocessfile "SOW_DynamicDlg\FillListBox.sqf";
mySpeechArray= call loadfile "BrakTalk.sqf";
-----------------------------------------------------------------------------
BrakTalk.sqf:
private ["_structure"];
_structure = [];
comment "Array consists of [ AI unit text response, [Array of user responses] ] for each dialog 'page' or 'set' ";
comment "Array for user responses consists of [text, which page to go to next (or -1 to end), {scripted action} ]";
comment "Speech Set 0";
_structure = _structure +
[[
"Witam poruczniku Novak! Odebralismy godzine temu meldunek wolania o pomoc z pobliskiej fabryki chemicznej. Obowiazek zareagowania spoczywa na nas. Pojedzie pan sprawdzic co sie tam stalo. Pana ludzie czekaja przy ciezarowce. Jakies pytania?","Talk1",
[
["Czego mozemy sie tam spodziewac?",1,{}],
["A co ze wsparciem?",2,{}],
["Nie mam pytan",-1,{}]
]
]];
comment "Speech Set 1";
_structure = _structure +
[[
"W najgorszym wypadku terrorystow.","Talk1",
[
["A co ze wsparciem?",2,{}],
["Nie mam pytan",-1,{}]
]
]];
comment "Speech Set 2";
_structure = _structure +
[[
"W razie klopotow nie dostaniecie wsparcia, duzo zolnierzy zostalo zwolnionych do domow z powodu choroby, zarazili sie jakims wirusem. To co pan tu widzi w bazie, to wszystko co mamy.","Talk1",
[
["Czego mozemy sie tam spodziewac?",1,{}],
["Nie mam pytan",-1,{}]
]
]];
_structure
----------------------------------------------------------------
startTalking.sqs
[_this select 0, mySpeechArray] exec "SOW_DynamicDlg\talk.sqs"
exit
----------------------------------------------------------------
Description.ext
//---------------------------------------DIALOG SECTION---------------------------------------
// Control types
#define SOW_DD_CT_STATIC 0
#define SOW_DD_CT_BUTTON 1
#define SOW_DD_CT_LISTBOX 5
// Static styles
#define SOW_DD_ST_HPOS 0x0F
#define SOW_DD_ST_LEFT 0
#define SOW_DD_ST_RIGHT 1
#define SOW_DD_ST_CENTER 2
#define SOW_DD_ST_UP 3
#define SOW_DD_ST_DOWN 4
#define SOW_DD_ST_VCENTER 5
#define SOW_DD_ST_SINGLE 0
#define SOW_DD_ST_MULTI 16
#define SOW_DD_ST_BACKGROUND 80
#define SOW_DD_ST_GROUP_BOX2 112
// Colors
#define SOW_DD_Background {0,0,0,1}
#define SOW_DD_Background2 {0.05,0.05,0.05,.9}
#define SOW_DD_TransBackground {0,0,0,0}
#define SOW_DD_MenuText {1,1,1,1}
#define SOW_DD_LBTextG {0.1,0.5,0.1,1}
#define SOW_DD_LBTextB {0.1,0.1,0.5,1}
#define SOW_DD_Text {0.8,0.8,0.8,1}
#define SOW_DD_ButtonText {0,0,0,1}
//Fonts
#define SOW_DD_Font "courierNewB64"
#define SOW_DD_FontTitle "SteelfishB64"
#define SOW_DD_FontLB "tahomaB48"
#define SOW_DD_FontButton "tahomaB24"
class SOW_DD_RscDialogBack
{
type = SOW_DD_CT_STATIC;
idc = -1;
style = SOW_DD_ST_GROUP_BOX2;
colorBackground[] = SOW_DD_Background2;
colorText[] = SOW_DD_Text;
font = SOW_DD_FontTitle;
sizeEx = 0.04;
text = ;
};
class SOW_DD_RscGroupBox2
{
type = SOW_DD_CT_STATIC;
idc = -1;
style = SOW_DD_ST_GROUP_BOX2;
colorBackground[] = SOW_DD_Background;
colorText[] = SOW_DD_Text;
font = SOW_DD_FontTitle;
sizeEx = 0.04;
text = ;
};
class SOW_DD_RscButton
{
type = SOW_DD_CT_BUTTON;
idc = -1;
style = SOW_DD_ST_CENTER;
colorText[] = SOW_DD_ButtonText;
font = SOW_DD_FontButton;
sizeEx = 0.02;
soundPush[] = {};
soundClick[] = {};
soundEscape[] = {};
default = false;
};
class SOW_DD_RscListBox
{
type = SOW_DD_CT_LISTBOX;
idc = -1;
style = SOW_DD_ST_GROUP_BOX2;
colorBackground[] = SOW_DD_Background;
colorText[] = SOW_DD_LBTextB;
colorSelect[] = SOW_DD_ButtonText;
font = SOW_DD_Font;
sizeEx = 0.025;
rowHeight = 0.025
text = ;
};
class SOW_DD_RscText
{
type = SOW_DD_CT_STATIC;
idc = -1;
style = SOW_DD_ST_MULTI;
colorBackground[] = SOW_DD_TransBackground;
colorText[] = SOW_DD_LBTextG;
font = SOW_DD_Font;
sizeEx = 0.025;
linespacing = 1.0;
text = ;
};
//-------------DIALOG DISPLAYED-------------
class SOW_DynamicDialog
{
idd = -1;
movingEnable = false;
controlsBackground[] = {DialogFrame,TextArea1,TextArea2};
class DialogFrame : SOW_DD_RscDialogBack
{
x = 0.05; y = 0.05; w = 0.35; h = 0.6;
text = "";
};
class TextArea1 : SOW_DD_RscGroupBox2
{
x = 0.0625; y = 0.0625; w = 0.325; h = 0.25;
text = "";
};
class TextArea2 : SOW_DD_RscGroupBox2
{
x = 0.0625; y = 0.325; w = 0.325; h = 0.25;
text = "";
};
objects[] = {};
controls[] = {SpeechArea,ResponseArea,ButtonOK,ButtonCancel};
class SpeechArea : SOW_DD_RscText
{
idc = 100;
text = "";
x = 0.0625; y = 0.0625; w = 0.325; h = 0.25;
};
class ResponseArea : SOW_DD_RscListBox
{
idc = 101;
text = "";
x = 0.0625; y = 0.325; w = 0.325; h = 0.25;
};
class ButtonOK : SOW_DD_RscButton
{
idc = 102;
text = "OK"
x = 0.0625; y = 0.6; w = 0.1; h = 0.035;
action = "SOW_DialogButtonOK = true;";
};
class ButtonCancel : SOW_DD_RscButton
{
idc = 103;
text = "Cancel"
x = 0.2875; y = 0.6; w = 0.1; h = 0.035;
action = "closeDialog 1;";
};
};
-----------------------------------------------------------------
Folder SOW_DynamicDlg:
FillListBox.sqf:
private ["_lbtext","_lbnewindex","_lbaction","_curlbindex"];
_lbText = _this select 0;
_lbNewIndex = _this select 1;
_lbAction = _this select 2;
_curLBIndex = 0;
_curLBIndex = lbAdd [101,_lbText];
lbSetValue [101, _curLBIndex, _lbNewIndex];
lbSetData [101, _curLBIndex, _lbAction];
-----------------------------------------------------------------
talk.sqs:
private ["_speechunit","_speechfile","_speechindex","_speecharray","_speechaction","_dlgok"]
_speechUnit = _this select 0
SOW_DialogButtonOK = false
_speechFile = _this select 1
_speechIndex = 0
#InitDialog
_dlgOK = createDialog "SOW_DynamicDialog"
? !(_dlgOK):call {closeDialog 2; exit;}
#SetText
_speechArray =_speechFile select _speechIndex
lbClear 101
ctrlSetText [100, _speechArray select 0]
_speechUnit say (_speechArray select 1)
_lbArray = _speechArray select 2
{_x call SOW_FillListBox} forEach _lbArray
#Wait
@ ((SOW_DialogButtonOK) or !(ctrlVisible 100))
SOW_DialogButtonOK = false
_speechIndex = lbValue [101,lbcursel 101]
_speechAction = lbData [101,lbcursel 101]
? (_speechAction != ""):call _speechAction
? ((_speechIndex == -1) or !(ctrlVisible 100)):goto "EndDialog"
goto "SetText"
#EndDialog
closedialog 1
exit
-----------------------------------------------------------------------------
Oto Readme:
User Agreement:
By using this script within your mission, you agree to the following -
1. You will give credit to author of included source material where appropriate.
2. You will not submit a modified version of the source material anywhere without also crediting original author.
3. You will not attempt to sell, trade, or distribute for financial gain the source material within.
****************************************************************************************
To implement this into your mission takes 5 simple steps:
1. Copy the SOW_DynamicDlg folder into your mission.
2. Copy the contents of the DynamicDialog.h file into your existing or new 'description.ext" file.
3. Preprocess the "FillListBox.sqf" file by adding the following to your init.sqs file (must use this variable name!): SOW_FillListBox = preprocessfile "SOW_DynamicDlg\FillListBox.sqf"
4. You must then create a conversation array using the following syntax:
Array of Conversation Elements= [ [conversation set element 0], [conversation set element 1], [conversation set element 2], etc...]
Conversation Set Element = [ "Text for AI to display", "<sound file>", [Array of User Responses] ] <Note: for no sound file use "">
Array of User Responses = [ [User Response Element 0], [User Response Element 1], [User Response Element 2], etc...]
User Response Element = [ "Text of response", <integer of next conversation set to go to or -1 to end dialog>, {scripted action to perform}]
I have used a loadfile function to keep the conversation array clear to the designer. Open the BrakTalk.sqf file to see how I laid it out. Note I do not use any scripted actions in this dialog, however. A good example of a scripted action might be: {[player] exec "action.sqs";}
You can use the array on as many units as you want, but I recommend not since it will make your units appear to be robots!
5. To initiate the array I use the action command on the AI unit, but you can use whatever you wish. The proper execution requires two parameters,
the unit talking, and the conversation array. An example execution is:
[SomeGuy, MySpeechArray] exec "SOW_DynamicDlg\talk.sqs"