Dynamic Dialogs

MCC got dynamic dialog function which mission maker can call in order to enhance their game-play.

The dynamic dialog purpose is to give mission makers the ability to spawn dialog menus without the hassle of learning how to create and implement UI elements in ArmA 3.

Calling Dynamic Dialog Function
The dynamic dialog function is local to the player who call it so it is best to use the AddAction command to add the dialog to an item.

The method of calling the function on local environment is this

Example: undefined The first argument in the array must be from a string type and it will be the new dialog header. In the example we called our new dialog "My Dialog".

The rest should be an array of arrays where each array will be a new dialog element where the first variable of each array must be a string containing the dialog element text.

Each dialog can have as many elements as you want.

Combo-box Element
A combo-box element will give the player the option to choose between a fixed list of options.

In the example above the first array of arrays is a combo-box type.

Syntax: ["question1",["Option1","option2"]]|undefined The first variable "question1" is the header for the element and it must be from a STRING type.

The next variable ["Option1","option2"] is the combo-box options that will be shown to the player.

The output will be an INTEGER containing the player selected option index.

Pictured Combo-box Element
The pictured combo-box element is much like the combo-box element, the only difference is that in the last there will be little pictures next to each option.

In the example above the second array of arrays is a combo-box type.

Syntax: ["question2","Option1","option1pic.paa"],["Option2","option2pic.paa"] The first variable "question2" is the header for the element and it must be from a STRING type.

The next variable"Option1","option1pic.paa"],["Option2","option2pic.paa" is an ARRAY of ARRAYS where each variable is an ARRAY containing the combo-box option text and the picture paa path.

Check-box Element
A check-box element will give the player the option to answer yes or no - BOOLEAN. The player can either check the box or not.

In the example above the third array of arrays is a check-box type.

Syntax: ["question3",false] The first variable "question3" is the header for the element and it must be from a STRING type.

The next variable false is from a BOOLEAN type that will determine the default check-box state: false - check-box will be empty. True - check-box will be checked by default.

Slider Element
A slider element will give the player the option to set the scale on a slider to provide an INTEGER output.

In the example above the fourth array of arrays is a slider type.

Syntax: ["question4",10] The first variable "question4" is the header for the element and it must be from a STRING type.

The next variable 10 is from an INTEGER type that will determine the max slider output where the minimum slider output will always be 0. By default the slider will be set on the average between 0 and the max value.

Reading The Output
You should always call the function and not spawn it as the function need to hang and wait for the player responce.

The function will return the values according to the element sent and the order they have been sent.

In the example above we have sent 4 elements: combo-box, pictured combo-box, check-box and a slider.

The function output will be: [INTEGER index of the option selected ,INTEGER index of the option selected,BOOLEAN state if the check-box,INTEGER state of the slider]; For example if the player have choosed: Option1, Option2, checked the box, and put the slider on 2. The returned output will be: [0,1,true,2]

Simple implementation
Lets say that I as the mission maker want to add a dialog to vehicle where the player call it he will be prompt with a dialog that asks him what gear he want, how many magazine he want, and do he want to be healed.

I'll add an addAction command that calls "rearmScript.sqf" script that will handle the dialog.

In the rearmScript.sqf i'll put this: private ["_result"];

undefined //If the dialog has been canceled undefined {{sup|switch (_result select 0) do {}} case 0 : //rifleman code case 1: //AR code case 2: //AT code {{sup|};}} if (_result select 1) then {player setdamae 0}; //heal the player {{sup|for "_i" from 0 to (_result select 2) do {}} ///add magazine code {{sup|};}}