Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_doorAnimate.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Animates a door?
  8. */
  9.  
  10. private ["_b","_doors","_door"];
  11. _b = _this select 0;
  12. _doors = 1;
  13. _doors = FETCH_CONFIG2(getNumber,"CfgVehicles",typeOf _b,"NumberOfDoors");
  14. _door = 0;
  15.  
  16. for "_i" from 1 to _doors do {
  17. private _selPos = _b selectionPosition format ["Door_%1_trigger",_i];
  18. private _worldSpace = _b modelToWorld _selPos;
  19. if (player distance _worldSpace < 5) exitWith {_door = _i;};
  20. };
  21.  
  22. if (_door isEqualTo 0) exitWith {hint localize "STR_Cop_NotaDoor"};
  23.  
  24. if ((typeof _b) == "Land_Dome_Big_F") then {
  25. switch (_door) do {
  26. case 1 : {
  27. if (_b animationPhase "door_1a_move" isEqualto 0) then {
  28. _b animate ["door_1a_move",1];
  29. _b animate ["door_1b_move",1];
  30. } else {
  31. _b animate ["door_1a_move",0];
  32. _b animate ["door_1b_move",0];
  33. };
  34. };
  35. default {
  36. _doorAnimation = format ["door_%1_rot",_door];
  37. if ((_b animationPhase _doorAnimation) isEqualto 0) then {
  38. _b animate [_doorAnimation,1];
  39. } else {
  40. _b animate [_doorAnimation,0];
  41. };
  42. };
  43. };
  44. } else {
  45. _doorAnimation = format ["door_%1_rot",_door];
  46. if ((_b animationPhase _doorAnimation) isEqualto 0) then {
  47. _b animate [_doorAnimation,1];
  48. } else {
  49. _b animate [_doorAnimation,0];
  50. };
  51. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement