Change Voice on AI

This script ensures that any unit with the specified classname that spawns during the mission will automatically have its voice changed to the one defined in the script.

1

Creating a sqf file

Start of by created a init.sqf then copy & paste this code in there:

[] execVM "SetVoiceOnSpawn.sqf";
2

Creating the script

So now create a new file called SetVoiceOnSpawn.sqf open it and paste this code in there:

[ "CAManBase", "InitPost", {
	params ["_unit"];
	if (typeOf _unit == "CLASSNAME") then {
		_unit setSpeaker "VOICE"
	};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
3

Choose unit and voice

Open SetVoiceOnSpawn.sqf and find the section labeled "CLASSNAME". Replace "CLASSNAME" with the classname of the unit whose voice you want to change.

Next, locate the section labeled "VOICE". Replace "VOICE" with the desired voice for the unit. You can refer to the list of available voices under Speakers Available to choose a suitable voice.

Last updated