Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. /*
  2. LRF script
  3.  
  4. a: reyhard
  5. */
  6. _k=format["RHS_%1_ctrl",_this select 2];
  7.  
  8.  
  9. if(isNull (uiNamespace getVariable [_k,displayNull]))then
  10. {
  11.  
  12. uiNameSpace setVariable [_k,_this select 0];
  13.  
  14. [_this select 1,_k] spawn
  15. {
  16. waitUntil {isNil "rhs_acog_cam"};
  17. private["_v","_t"];
  18. disableSerialization;
  19. _c = uiNamespace getVariable (_this select 1);
  20. _z = (_c displayCtrl 168);
  21.  
  22.  
  23.  
  24. _id = addMissionEventHandler ["Draw3D",
  25. {
  26. //attach to cause to double camera rotation
  27. _p=(call rhsusf_fnc_findPlayer);
  28. //should be right hand as it glued to weapon most of the time
  29. if (rhs_acog_cam != nil) {
  30. rhs_acog_cam setPosATL (_p modelToWorld ((player selectionPosition "leftHand") vectorAdd [-0.03,0.14,0.1]));
  31.  
  32. _w = _p weaponDirection (primaryWeapon _p);
  33. _r = vectorNormalized(_w vectorCrossProduct [0,0,1]);
  34. _u = _r vectorCrossProduct _w;
  35.  
  36. rhs_acog_cam setVectorDirAndUp [_w ,_u];
  37. };
  38. }];
  39. _k=true;
  40. while{not(isnull _z)}do
  41. {
  42. sleep 0.1;
  43. if(cameraView == "gunner")then{
  44. if(_k)then{
  45. if (rhs_acog_cam == nil) {
  46. rhs_acog_cam = "camera" camCreate [0,0,0];
  47. rhs_acog_cam cameraEffect ["internal", "Back", "furlong_pip"];
  48. rhs_acog_cam camSetFov 0.35/(_this select 0);
  49. };
  50. rhs_acog_cam cameraEffect ["internal", "Back", "furlong_pip"];
  51.  
  52. _k=false;
  53. };
  54. }else{
  55. if (rhs_acog_cam != nil) {
  56. rhs_acog_cam cameraeffect ["terminate","back"];
  57. camDestroy rhs_acog_cam;
  58. rhs_acog_cam =nil;
  59. };
  60. _k=true;
  61. };
  62. };
  63.  
  64. uiNameSpace setVariable [(_this select 1),displayNull];
  65. removeMissionEventHandler ["draw3d",_id];
  66.  
  67. };
  68.  
  69. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement