Advertisement
FT_

deployShellscrape.sqf

FT_
Nov 8th, 2015
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. //Written by beta
  2. //Ideas from GeneralCarver
  3. //Deploys shellscrape
  4.  
  5.  
  6. private["_pos", "_confAct", "_cancAct", "_dir", "_obj"];
  7.  
  8. _obj = "Fort_EnvelopeSmall" createVehicleLocal [0, 0, 0];
  9.  
  10. _pos = player modelToWorld [0, 2, 0];
  11. _dir = getDir player;
  12. [_pos, _obj, _dir] spawn
  13. {
  14. private["_pos", "_dir", "_cancAct", "_confAct", "_obj"];
  15.  
  16. _pos = _this select 0;
  17. _obj = _this select 1;
  18. _dir = _this select 2;
  19.  
  20. _confAct = player addAction ["Confirm Deployment", "bScripts\deploy\placeShellscrape.sqf", ["fort_EnvelopeSmall", _obj], 99, true, false, "", ""];
  21. _cancAct = player addAction ["Cancel Deployment", "bScripts\deploy\cancelShellscrape.sqf", [_obj], 99, true, false, "", ""];
  22.  
  23. while {!(player getVariable "objDeployed") && !(player getVariable "objCancelled") && alive player} do
  24. {
  25. _pos = player modelToWorld [0, 2, 0];
  26. _dir = getDir player;
  27.  
  28. _obj setDir _dir;
  29.  
  30. _pos = [_pos select 0, _pos select 1, 0.05];
  31. _obj setPosATL _pos;
  32.  
  33. _x = _pos select 0;
  34. _y = _pos select 1;
  35. _z = _pos select 2;
  36. _top = getTerrainHeightASL [_x, _y +1];
  37. _bottom = getTerrainHeightASL [_x, _y -1];
  38. _left = getTerrainHeightASL [_x -1, _y];
  39. _right = getTerrainHeightASL [_x +1, _y];
  40. _obj setVectorUp [_left - _right, _bottom - _top, 2];
  41.  
  42. sleep 0.1;
  43. };
  44.  
  45. player removeAction _confAct;
  46. player removeAction _cancAct;
  47.  
  48. player setVariable ["objDeployed", false, false];
  49. player setVariable ["objCancelled", false, false];
  50.  
  51. if (!alive player) then
  52. {
  53. deleteVehicle _obj;
  54. };
  55. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement