Merge pull request #2893 from acemod/155selectRandom

1.55 use new selectRandom command
This commit is contained in:
commy2 2016-02-18 14:22:52 +01:00
commit 9851ed6d3d
12 changed files with 19 additions and 21 deletions

View File

@ -30,7 +30,7 @@ private _sounds = [
private _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
playSound3D [
_sounds select floor random count _sounds,
selectRandom _sounds,
objNull,
false,
_position,

View File

@ -289,6 +289,7 @@ class CfgVehicles {
icon = PATHTOF(UI\team\team_management_ca.paa);
};
};
class ACE_Equipment {
displayName = CSTRING(Equipment);
condition = QUOTE(true);

View File

@ -81,7 +81,7 @@ _createdLitter = [];
// Loop through through the litter options and place the litter
{
if (_x isEqualType [] && {(count _x > 0)}) then {
[_target, _x select (floor(random(count _x)))] call _createLitter;
[_target, selectRandom _x] call _createLitter;
};
if (_x isEqualType "") then {
[_target, _x] call _createLitter;

View File

@ -32,7 +32,7 @@ TRACE_7("ACE_DEBUG: HandleDamage_Caching Called",_unit, _selectionName, _damage,
private _vehicle = vehicle _unit;
if ((_vehicle != _unit) && {!(_vehicle isKindOf "StaticWeapon")} && {_source in [objNull, driver _vehicle, _vehicle]} && {_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];
@ -60,7 +60,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;

View File

@ -83,7 +83,7 @@ _woundsCreated = [];
for "_i" from 0 to ((_x select 1)-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;

View File

@ -59,12 +59,12 @@ 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)));
_sound = selectRandom _availableSounds_B;
};
// Play the sound
playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters.

View File

@ -108,7 +108,7 @@ if (_activated && local _logic) then {
// If no unit is to close to this position, we will play the sound.
if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then {
playSound3D [_ambianceSounds call BIS_fnc_selectRandom, objNull, false, _newPos, _volume, 1, 1000];
playSound3D [selectRandom _ambianceSounds, objNull, false, _newPos, _volume, 1, 1000];
_args set [8, ACE_time];
};
};

View File

@ -37,7 +37,7 @@ if (_adjustmentDifference isEqualTo [0,0,0]) exitWith {false}; // Don't coninue
_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 {

View File

@ -15,8 +15,8 @@
*/
#include "script_component.hpp"
// Animations Pool
private _animations = [
// Select random animation from Animations Pool
selectRandom [
QGVAR(HubSittingChairA_idle1),
QGVAR(HubSittingChairA_idle2),
QGVAR(HubSittingChairA_idle3),
@ -41,7 +41,4 @@ private _animations = [
QGVAR(HubSittingChairUC_idle2),
QGVAR(HubSittingChairUC_idle3),
QGVAR(HubSittingChairUC_move1)
];
// Select random animation
(_animations select (floor (random (count _animations))))
]

View File

@ -66,7 +66,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)

View File

@ -57,8 +57,8 @@ if (_activated) then {
if (_isAdmin) then {
_letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
_adminVar = "admin_";
for "_i" from 0 to 9 do {_adminVar = _adminVar + (_letters call bis_fnc_selectrandom);};
_logic setVariable ["adminVar",_adminVar,true];
for "_i" from 0 to 9 do {_adminVar = _adminVar + selectRandom _letters};
_logic setvariable ["adminVar",_adminVar,true];
};
//--- Get allowed addons

View File

@ -65,8 +65,8 @@ if (_activated) then {
_altitude = 1000;
_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;
_sounds = if (getnumber (_cfgAmmo >> "hit") < 200) then {["mortar1","mortar2"]} else {["shell1","shell2","shell3","shell4"]};
_sound = selectRandom _sounds;
_hint = ["Curator","PlaceOrdnance"];
_shakeStrength = 0.01;
_shakeRadius = 300;