Skip to content

Commit 67847b5

Browse files
authored
Merge pull request #1813 from OverlordZorn/globalsay3d-distrance
globalSay3D - handle edgecase
2 parents d8e102d + 22685f9 commit 67847b5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

addons/network/fnc_globalSay3D.sqf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Description:
88
Parameters:
99
_objects - Object or array of objects that perform Say <OBJECT, ARRAY>
1010
_params - classname or parameter array - see biki: say3d <STRING, ARRAY>
11-
_range - Maximum distance from camera to execute command - will be ignored if _params is an array (optional, default: nil) <NUMBER>
11+
_range - Maximum distance from camera to execute command - will be ignored if _params is an array (optional, default: nil) <NUMBER, NIL>
1212
_attach - Attach created sound to _object (optional, default: false) <BOOL>
1313
_instant - Deletes all previously attached sounds to play the current sound immediately (optional, default: false) <BOOL>
1414
_rndPitch - Randomizes Pitch. True for a Dynamic Range of 10% - Alternative Number of Dynamic Range in Pecentage. Example: 0.15 -> +- 7.5% (optional, default: false) <BOOL, NUMBER>
@@ -26,13 +26,15 @@ Author:
2626
Sickboy, commy2, DartRuffian, OverlordZorn
2727
---------------------------------------------------------------------------- */
2828

29-
params [["_objects", [], [[], objNull]], ["_params", "", ["", []]], ["_distance", nil, [0]], ["_attach", false, [false]], ["_instant", false, [false]], ["_rndPitch", false, [false, 0]]];
29+
params [["_objects", [], [[], objNull]], ["_params", "", ["", []]], ["_distance", nil, [nil, 0]], ["_attach", false, [false]], ["_instant", false, [false]], ["_rndPitch", false, [false, 0]]];
3030

3131
if (_objects isEqualType objNull) then {
3232
_objects = [_objects];
3333
};
3434

35-
if (!isNil "_distance" && { _params isEqualType "" } ) then { _params = [_params, _distance]; };
35+
if ( !isNil "_distance" ) then {
36+
if (_params isEqualType "") then { _params = [_params, _distance]; } else { _params set [1, _distance]; };
37+
};
3638

3739
if (_rndPitch isNotEqualTo false) then {
3840
private _defaultPitch = 1;

0 commit comments

Comments
 (0)