From e5c4d3596999a5b1ca60969e528e049efc8bf496 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 29 Nov 2015 16:33:25 +0100 Subject: [PATCH] 1.55 use new selectRandom command --- addons/backpacks/functions/fnc_backpackOpened.sqf | 2 +- addons/interaction/CfgVehicles.hpp | 6 +++--- addons/medical/functions/fnc_createLitter.sqf | 2 +- addons/medical/functions/fnc_handleDamage.sqf | 2 +- addons/medical/functions/fnc_handleDamage_caching.sqf | 4 ++-- addons/medical/functions/fnc_handleDamage_woundsOld.sqf | 2 +- addons/medical/functions/fnc_playInjuredSound.sqf | 4 ++-- addons/scopes/functions/fnc_applyScopeAdjustment.sqf | 2 +- addons/sitting/functions/fnc_getRandomAnimation.sqf | 2 +- addons/spectator/functions/fnc_transitionCamera.sqf | 2 +- addons/zeus/functions/fnc_bi_moduleProjectile.sqf | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/backpacks/functions/fnc_backpackOpened.sqf b/addons/backpacks/functions/fnc_backpackOpened.sqf index 4e61e8fbcc..c2f2721bc7 100644 --- a/addons/backpacks/functions/fnc_backpackOpened.sqf +++ b/addons/backpacks/functions/fnc_backpackOpened.sqf @@ -37,7 +37,7 @@ _sounds = [ _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3")); playSound3D [ - _sounds select floor random count _sounds, + selectRandom _sounds, objNull, false, _position, diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index dfe4f2025e..e9ad20c1b1 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -299,7 +299,7 @@ class CfgVehicles { class ACE_Gesture_Go { displayName = CSTRING(Gestures_Go); condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow ([ARR_2('gestureGo','gestureGoB')] select floor random 2);); + statement = QUOTE(_target playActionNow selectRandom [ARR_2('gestureGo','gestureGoB')];); showDisabled = 1; priority = 1.8; hotkey = "2"; @@ -354,7 +354,7 @@ class CfgVehicles { class ACE_Gesture_Yes { displayName = ECSTRING(common,Yes); condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow ([ARR_2('gestureYes','gestureNod')] select floor random 2);); + statement = QUOTE(_target playActionNow selectRandom [ARR_2('gestureYes','gestureNod')];); showDisabled = 1; priority = 1.1; hotkey = "8"; @@ -370,7 +370,7 @@ class CfgVehicles { class ACE_Gesture_Hi { displayName = CSTRING(Gestures_Hi); condition = QUOTE(canStand _target); - statement = QUOTE(_target playActionNow ([ARR_3('gestureHi','gestureHiB','gestureHiC')] select floor random 3);); + statement = QUOTE(_target playActionNow selectRandom [ARR_3('gestureHi','gestureHiB','gestureHiC')];); showDisabled = 1; priority = 0.9; hotkey = "0"; diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index 54fd6694dd..29c62d1442 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -78,7 +78,7 @@ _createdLitter = []; // Loop through through the litter options and place the litter { if (typeName _x == "ARRAY" && {(count _x > 0)}) then { - [_target, _x select (floor(random(count _x)))] call _createLitter; + [_target, selectRandom _x] call _createLitter; }; if (typeName _x == "STRING") then { [_target, _x] call _createLitter; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 6d955e72fd..faf7d3273c 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -77,7 +77,7 @@ _minLethalDamage = if (_typeIndex >= 0) then { if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then { if (GVAR(enableVehicleCrashes)) then { - _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); + _selection = selectRandom GVAR(SELECTIONS); }; }; diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 910221a850..c97a1725a3 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -35,7 +35,7 @@ if (_selectionName in _hitSelections) then { // Check for vehicle crash if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then { if (GVAR(enableVehicleCrashes)) then { - _selectionName = _hitSelections select (floor(random(count _hitSelections))); + _selectionName = selectRandom _hitSelections; _projectile = "vehiclecrash"; _this set [1, _selectionName]; _this set [4, _projectile]; @@ -57,7 +57,7 @@ if (_unit getVariable [QGVAR(isFalling), false]) then { }; } else { if (_selectionName == "") then { - _selectionName = ["leg_l", "leg_r"] select (floor(random 2)); + _selectionName = selectRandom ["leg_l", "leg_r"]; _this set [1, _selectionName]; }; _newDamage = _newDamage * 0.7; diff --git a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf index dc21012dd6..016cb7982d 100644 --- a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf +++ b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf @@ -83,7 +83,7 @@ _woundsCreated = []; for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do { // Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage] - _toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));}; + _toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {selectRandom _allPossibleInjuries}; _toAddClassID = _toAddInjury select 0; _foundIndex = -1; diff --git a/addons/medical/functions/fnc_playInjuredSound.sqf b/addons/medical/functions/fnc_playInjuredSound.sqf index 4792f879ec..3dcb7c270b 100644 --- a/addons/medical/functions/fnc_playInjuredSound.sqf +++ b/addons/medical/functions/fnc_playInjuredSound.sqf @@ -59,9 +59,9 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitwith { // Select the to be played sound based upon damage amount. if (_pain > 0.5) then { if (random(1) > 0.5) then { - _sound = _availableSounds_A select (round(random((count _availableSounds_A) - 1))); + _sound = selectRandom _availableSounds_A; } else { - _sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1))); + _sound = selectRandom _availableSounds_B; }; } else { _sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1))); diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf index fbd3e1b636..15f0e8f981 100644 --- a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -36,7 +36,7 @@ _adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation _adjustment set [_weaponIndex, [_elevation, _windage, _zero]]; [_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); -playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3); +playSound selectRandom ["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"]; // slightly rotate the player if looking through optic if (cameraView == "GUNNER") then { diff --git a/addons/sitting/functions/fnc_getRandomAnimation.sqf b/addons/sitting/functions/fnc_getRandomAnimation.sqf index ca9a9ccfb1..ce95819575 100644 --- a/addons/sitting/functions/fnc_getRandomAnimation.sqf +++ b/addons/sitting/functions/fnc_getRandomAnimation.sqf @@ -46,4 +46,4 @@ _animations = [ ]; // Select random animation -(_animations select (floor (random (count _animations)))) +selectRandom _animations diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index 0f6eb3ffc7..d5e28cc355 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -67,7 +67,7 @@ if (_newMode == 0) then { // Free // When null unit is given choose random if (isNull _newUnit) then { - _newUnit = GVAR(unitList) select floor(random(count GVAR(unitList))); + _newUnit = selectRandom GVAR(unitList); }; // Switch camera view to internal unit view (external uses the camera) diff --git a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf index 7150856154..e429c0b531 100644 --- a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf +++ b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf @@ -66,7 +66,7 @@ if (_activated) then { _velocity = [0,0,-100]; _radio = "SentGenIncoming"; _sounds = if (getnumber (_cfgAmmo >> "hit") < 200) then {["mortar1","mortar2"]} else {["shell1","shell2","shell3","shell4"]}; - _sound = _sounds call bis_fnc_selectrandom; + _sound = selectRandom _sounds; _hint = ["Curator","PlaceOrdnance"]; _shakeStrength = 0.01; _shakeRadius = 300;