Jump to content
zagor64bz

[SOLVED]Choosing AI language at mission start:is it possible?

Recommended Posts

Hii, I was wondering...would be possible to somehow choose at mission start, what language your AI teammates would speak? Let me explain the scenario:

It's a SP mission where you play as the new Contact DLC Spetsnaz with AI teammates. Now, we all know they interact in Russian, but not everyone feels comfortable or understand it enough for a smooth playing. I would like to have an option, maybe right after the loading screen, where you can choose (using the SetIdentity I guess) what language the player group would speak.

is it doable?

Share this post


Link to post
Share on other sites
4 minutes ago, zagor64bz said:

Hii, I was wondering...would be possible to somehow choose at mission start, what language your AI teammates would speak? Let me explain the scenario:

It's a SP mission where you play as the new Contact DLC Spetsnaz with AI teammates. Now, we all know they interact in Russian, but not everyone feels comfortable or understand it enough for a smooth playing. I would like to have an option, maybe right after the loading screen, where you can choose (using the SetIdentity I guess) what language the player group would speak.

is it doable?

 

I'd like to think that in the init.sqf, you could try using this setspeaker with a simple dialog created by ctrlCreate with two buttons that the player can choose from?

Share this post


Link to post
Share on other sites
 
 
 
 
 
3
4 minutes ago, genesis92x said:

 

I'd like to think that in the init.sqf, you could try using this setspeaker with a simple dialog created by ctrlCreate with two buttons that the player can choose from?

Yeah, I was thinking about a GUI of some sort, but never consider ctrlCreate. How that works? I read the wiki page, but could not understand where and how to use it....

Share this post


Link to post
Share on other sites
15 minutes ago, zagor64bz said:

Yeah, I was thinking about a GUI of some sort, but never consider ctrlCreate. How that works? I read the wiki page, but could not understand where and how to use it....

 

Here's an example that I just created, so it might not be perfect

 

This could go at the end of your init.sqf, for example.

		[] spawn
		{
			waituntil {time > 1};
			private _display = findDisplay 46 createDisplay "RscDisplayEmpty";
			
			GEN_ChangeVoices =
			{
				params ["_control","_Style"];
				
				if (_Style isEqualTo "Russian") then
				{
					Bobby1 setspeaker "SomethingRussianHere1";
					Bobby2 setspeaker "SomethingRussianHere2";
					Bobby3 setspeaker "SomethingRussianHere3";
				}
				else
				{
					Bobby1 setspeaker "SomethingHere1";
					Bobby2 setspeaker "SomethingHere2";
					Bobby3 setspeaker "SomethingHere3";			
				};
				_display = ctrlParent _control;
				_display closedisplay 2;
			};

			private _ButtonLeft = _display ctrlCreate ["RscButton", 7803];
			_ButtonLeft ctrlSetPosition [(0.2 * safezoneW + safezoneX),(0.5 * safezoneH + safezoneY),(0.05 * safezoneW),(0.025* safezoneH)];
			_ButtonLeft ctrlSetBackgroundColor [1,1,1,1];
			_ButtonLeft ctrlCommit 0;
			_ButtonLeft ctrlSetText "Russian Voices";
			_ButtonLeft ctrlAddEventHandler ["ButtonClick","[_this,'Russian'] call GEN_ChangeVoices"];
			
			private _ButtonRight = _display ctrlCreate ["RscButton", 7803];
			_ButtonRight ctrlSetPosition [(0.4 * safezoneW + safezoneX),(0.5 * safezoneH + safezoneY),(0.05 * safezoneW),(0.025* safezoneH)];
			_ButtonRight ctrlSetBackgroundColor [1,1,1,1];
			_ButtonRight ctrlCommit 0;
			_ButtonRight ctrlSetText "American Voices";
			_ButtonRight ctrlAddEventHandler ["ButtonClick","[_this,'American'] call GEN_ChangeVoices"];	
		
			
		};

EDIT: Fixed an obvious bug

  • Thanks 2

Share this post


Link to post
Share on other sites

I'm gonna test this asap and report back...in the meantime, THANK YOU!!

Share this post


Link to post
Share on other sites

Ok..I got this error:

17:09:40 Error in expression <etspeaker "male03gre";			
};
_display = ctrlParent _control;
_display closedispl>
17:09:40   Error position: <ctrlParent _control;
_display closedispl>
17:09:40   Error ctrlparent: Type Array, expected Control
17:09:40 File C:\Users\claudio\Documents\Arma 3 - Other Profiles\ZAGOR64BZ\mis..., line 495

..and this is the code I put into the INIT.sqf.

[] spawn
		{
			waituntil {time > 1};
			private _display = findDisplay 46 createDisplay "RscDisplayEmpty";
			
			GEN_ChangeVoices =
			{
				params ["_control","_Style"];
				
				if (_Style isEqualTo "Russian") then
				{
					s01 setspeaker "male01rus";
					s02 setspeaker "male02rus";
					s03 setspeaker "male03rus";
				}
				else
				{
					s01 setspeaker "male01gre";
					s02 setspeaker "male02gre";
					s03 setspeaker "male03gre";			
				};
				_display = ctrlParent _control;
				_display closedisplay 2;
			};

			private _ButtonLeft = _display ctrlCreate ["RscButton", 7803];
			_ButtonLeft ctrlSetPosition [(0.2 * safezoneW + safezoneX),(0.5 * safezoneH + safezoneY),(0.05 * safezoneW),(0.025* safezoneH)];
			_ButtonLeft ctrlSetBackgroundColor [1,1,1,1];
			_ButtonLeft ctrlCommit 0;
			_ButtonLeft ctrlSetText "Russian Voices";
			_ButtonLeft ctrlAddEventHandler ["ButtonClick","[_this,'Russian'] call GEN_ChangeVoices"];
			
			private _ButtonRight = _display ctrlCreate ["RscButton", 7803];
			_ButtonRight ctrlSetPosition [(0.4 * safezoneW + safezoneX),(0.5 * safezoneH + safezoneY),(0.05 * safezoneW),(0.025* safezoneH)];
			_ButtonRight ctrlSetBackgroundColor [1,1,1,1];
			_ButtonRight ctrlCommit 0;
			_ButtonRight ctrlSetText "American Voices";
			_ButtonRight ctrlAddEventHandler ["ButtonClick","[_this,'American'] call GEN_ChangeVoices"];	
		
			
		};

:headscratch:

Share this post


Link to post
Share on other sites

Looking at it today, there is an error with the GEN_ChangeVoices function,

replace GEN_ChangeVoices with this

 

			GEN_ChangeVoices =
			{
				params ["_passedparam","_Style"];
				_passedparam params ["_control"];

				if (_Style isEqualTo "Russian") then
				{
					s01 setspeaker "male01rus";
					s02 setspeaker "male02rus";
					s03 setspeaker "male03rus";
				}
				else
				{
					s01 setspeaker "male01gre";
					s02 setspeaker "male02gre";
					s03 setspeaker "male03gre";			
				};
				_display = ctrlParent _control;
				_display closedisplay 2;
			};

I believe that should work.

 

Currently _control is returning [_control], it needs to just be _control.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×