1.55 use new selectRandom command

This commit is contained in:
commy2 2015-11-29 16:33:25 +01:00
parent 3be60a2f6e
commit e5c4d35969
11 changed files with 15 additions and 15 deletions

View File

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

View File

@ -299,7 +299,7 @@ class CfgVehicles {
class ACE_Gesture_Go { class ACE_Gesture_Go {
displayName = CSTRING(Gestures_Go); displayName = CSTRING(Gestures_Go);
condition = QUOTE(canStand _target); 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; showDisabled = 1;
priority = 1.8; priority = 1.8;
hotkey = "2"; hotkey = "2";
@ -354,7 +354,7 @@ class CfgVehicles {
class ACE_Gesture_Yes { class ACE_Gesture_Yes {
displayName = ECSTRING(common,Yes); displayName = ECSTRING(common,Yes);
condition = QUOTE(canStand _target); 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; showDisabled = 1;
priority = 1.1; priority = 1.1;
hotkey = "8"; hotkey = "8";
@ -370,7 +370,7 @@ class CfgVehicles {
class ACE_Gesture_Hi { class ACE_Gesture_Hi {
displayName = CSTRING(Gestures_Hi); displayName = CSTRING(Gestures_Hi);
condition = QUOTE(canStand _target); 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; showDisabled = 1;
priority = 0.9; priority = 0.9;
hotkey = "0"; hotkey = "0";

View File

@ -78,7 +78,7 @@ _createdLitter = [];
// Loop through through the litter options and place the litter // Loop through through the litter options and place the litter
{ {
if (typeName _x == "ARRAY" && {(count _x > 0)}) then { 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 { if (typeName _x == "STRING") then {
[_target, _x] call _createLitter; [_target, _x] call _createLitter;

View File

@ -77,7 +77,7 @@ _minLethalDamage = if (_typeIndex >= 0) then {
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then { if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then {
if (GVAR(enableVehicleCrashes)) then { if (GVAR(enableVehicleCrashes)) then {
_selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); _selection = selectRandom GVAR(SELECTIONS);
}; };
}; };

View File

@ -35,7 +35,7 @@ if (_selectionName in _hitSelections) then {
// Check for vehicle crash // Check for vehicle crash
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then { if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then {
if (GVAR(enableVehicleCrashes)) then { if (GVAR(enableVehicleCrashes)) then {
_selectionName = _hitSelections select (floor(random(count _hitSelections))); _selectionName = selectRandom _hitSelections;
_projectile = "vehiclecrash"; _projectile = "vehiclecrash";
_this set [1, _selectionName]; _this set [1, _selectionName];
_this set [4, _projectile]; _this set [4, _projectile];
@ -57,7 +57,7 @@ if (_unit getVariable [QGVAR(isFalling), false]) then {
}; };
} else { } else {
if (_selectionName == "") then { if (_selectionName == "") then {
_selectionName = ["leg_l", "leg_r"] select (floor(random 2)); _selectionName = selectRandom ["leg_l", "leg_r"];
_this set [1, _selectionName]; _this set [1, _selectionName];
}; };
_newDamage = _newDamage * 0.7; _newDamage = _newDamage * 0.7;

View File

@ -83,7 +83,7 @@ _woundsCreated = [];
for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do { 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] // 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; _toAddClassID = _toAddInjury select 0;
_foundIndex = -1; _foundIndex = -1;

View File

@ -59,9 +59,9 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitwith {
// Select the to be played sound based upon damage amount. // Select the to be played sound based upon damage amount.
if (_pain > 0.5) then { if (_pain > 0.5) then {
if (random(1) > 0.5) then { if (random(1) > 0.5) then {
_sound = _availableSounds_A select (round(random((count _availableSounds_A) - 1))); _sound = selectRandom _availableSounds_A;
} else { } else {
_sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1))); _sound = selectRandom _availableSounds_B;
}; };
} else { } else {
_sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1))); _sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1)));

View File

@ -36,7 +36,7 @@ _adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation
_adjustment set [_weaponIndex, [_elevation, _windage, _zero]]; _adjustment set [_weaponIndex, [_elevation, _windage, _zero]];
[_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); [_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 // slightly rotate the player if looking through optic
if (cameraView == "GUNNER") then { if (cameraView == "GUNNER") then {

View File

@ -46,4 +46,4 @@ _animations = [
]; ];
// Select random animation // Select random animation
(_animations select (floor (random (count _animations)))) selectRandom _animations

View File

@ -67,7 +67,7 @@ if (_newMode == 0) then { // Free
// When null unit is given choose random // When null unit is given choose random
if (isNull _newUnit) then { 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) // Switch camera view to internal unit view (external uses the camera)

View File

@ -66,7 +66,7 @@ if (_activated) then {
_velocity = [0,0,-100]; _velocity = [0,0,-100];
_radio = "SentGenIncoming"; _radio = "SentGenIncoming";
_sounds = if (getnumber (_cfgAmmo >> "hit") < 200) then {["mortar1","mortar2"]} else {["shell1","shell2","shell3","shell4"]}; _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"]; _hint = ["Curator","PlaceOrdnance"];
_shakeStrength = 0.01; _shakeStrength = 0.01;
_shakeRadius = 300; _shakeRadius = 300;