ACE3/addons/backpacks/functions/fnc_backpackOpened.sqf
Ozan Eğitmen 2a7eb07803
Use modelToWorldVisualWorld (#8489)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2021-10-10 15:37:05 +02:00

44 lines
885 B
Plaintext

#include "script_component.hpp"
/*
* Author: commy2
* Someone opened your backpack. Play sound and camshake. Execute locally.
*
* Arguments:
* 0: Who accessed your inventory? <Object>
* 1: Unit that wields the backpack <Object>
* 2: The backpack object <Object>
*
* Return Value:
* None
*
* Example:
* [bob, kevin, backpack] call ace_backpacks_fnc_backpackOpened
*
* Public: No
*/
params ["_target", "_backpack"];
// do cam shake if the target is the player
if (_target call EFUNC(common,isPlayer)) then {
addCamShake [4, 0.5, 5];
};
// play a zipper sound effect
private _sounds = [
QUOTE(PATHTO_R(sounds\zip_in.wav)),
QUOTE(PATHTO_R(sounds\zip_out.wav))
];
private _position = _target modelToWorldVisualWorld (_target selectionPosition "Spine3");
playSound3D [
selectRandom _sounds,
objNull,
false,
_position,
1,
1,
50
];